[vala/staging] tests: Add expected generated C sources



commit 366590a71672106d8f8a820e79431df7f0c39337
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Sun May 23 17:50:12 2021 +0200

    tests: Add expected generated C sources

 .../deprecated-delegate-minimal.c-expected         |   22 +
 .../annotations/deprecated-enum-minimal.c-expected |   24 +
 .../deprecated-method-minimal.c-expected           |   36 +
 .../deprecated-property-minimal.c-expected         |   56 +
 .../deprecated-struct-minimal.c-expected           |   26 +
 tests/annotations/deprecated.c-expected            |  563 ++++
 tests/annotations/description.c-expected           |  303 ++
 .../cast-struct-boxed-element-access.c-expected    |  824 ++++++
 tests/arrays/class-field-initializer.c-expected    |  949 ++++++
 tests/arrays/class-field-length-cname.c-expected   |  320 +++
 tests/arrays/constant-element-access.c-expected    |  179 ++
 tests/arrays/empty-length-0.c-expected             |  420 +++
 tests/arrays/field-global-length-cname.c-expected  |   54 +
 tests/arrays/fixed-length-enum-value.c-expected    |  123 +
 .../fixed-length-init0-not-allowed.c-expected      |  133 +
 .../in-operator-with-boxed-needle.c-expected       |   96 +
 tests/arrays/inline-struct.c-expected              |  135 +
 tests/arrays/length-inline-assignment.c-expected   |   99 +
 tests/arrays/length-type-include.c-expected        |   26 +
 tests/arrays/resize-local-size-captured.c-expected |  132 +
 tests/arrays/resize-local-size.c-expected          |   73 +
 tests/arrays/resize.c-expected                     |  166 ++
 tests/arrays/slice-fixed-length.c-expected         |  406 +++
 tests/arrays/struct-field-initializer.c-expected   |  120 +
 tests/arrays/struct-field-length-cname.c-expected  |  161 ++
 tests/arrays/struct-initializer-null.c-expected    |  114 +
 .../struct-namespaced-initializer.c-expected       |  481 ++++
 tests/asynchronous/bug595735.c-expected            |  466 +++
 tests/asynchronous/bug595755.c-expected            |  210 ++
 tests/asynchronous/bug596177.c-expected            |  400 +++
 tests/asynchronous/bug596861.c-expected            |  218 ++
 tests/asynchronous/bug597294.c-expected            |  117 +
 tests/asynchronous/bug598677.c-expected            |  371 +++
 tests/asynchronous/bug598697.c-expected            |  394 +++
 tests/asynchronous/bug598698.c-expected            |  398 +++
 tests/asynchronous/bug599568.c-expected            |  120 +
 tests/asynchronous/bug600827.c-expected            |  404 +++
 tests/asynchronous/bug601558.c-expected            |  563 ++++
 tests/asynchronous/bug612641.c-expected            |  409 +++
 tests/asynchronous/bug613484.c-expected            |  172 ++
 tests/asynchronous/bug614294.c-expected            | 1132 ++++++++
 tests/asynchronous/bug620740.c-expected            |  145 +
 tests/asynchronous/bug626053.c-expected            |  425 +++
 tests/asynchronous/bug639591.c-expected            |  184 ++
 tests/asynchronous/bug640721.c-expected            |  161 ++
 tests/asynchronous/bug641182.c-expected            |  470 +++
 tests/asynchronous/bug646945.c-expected            |  587 ++++
 tests/asynchronous/bug652252.c-expected            |  337 +++
 tests/asynchronous/bug653861.c-expected            |  406 +++
 tests/asynchronous/bug654336.c-expected            |  185 ++
 tests/asynchronous/bug654337.c-expected            |  181 ++
 tests/asynchronous/bug659886.c-expected            |  268 ++
 tests/asynchronous/bug661961.c-expected            |  196 ++
 tests/asynchronous/bug710103.c-expected            |  595 ++++
 tests/asynchronous/bug741929.c-expected            |  587 ++++
 tests/asynchronous/bug742621.c-expected            |  298 ++
 tests/asynchronous/bug762819.c-expected            |  438 +++
 tests/asynchronous/bug777242.c-expected            |  170 ++
 tests/asynchronous/bug783543.c-expected            |  265 ++
 tests/asynchronous/bug792660.c-expected            |  537 ++++
 tests/asynchronous/bug792942.c-expected            |  476 ++++
 tests/asynchronous/bug793158.c-expected            |  250 ++
 tests/asynchronous/captured-fixed-array.c-expected |  121 +
 tests/asynchronous/catch-error-scope.c-expected    |  222 ++
 tests/asynchronous/catch-in-finally.c-expected     |  714 +++++
 tests/asynchronous/closures.c-expected             |  213 ++
 .../constructor-argument-check.c-expected          |  470 +++
 tests/asynchronous/finish-name.c-expected          |  974 +++++++
 tests/asynchronous/generator.c-expected            |  837 ++++++
 tests/asynchronous/nowrapper.c-expected            |  426 +++
 .../out-parameter-free-on-error.c-expected         |  364 +++
 tests/asynchronous/result-pos.c-expected           |  385 +++
 tests/asynchronous/yield.c-expected                |   98 +
 .../array-uint8-uchar-compat.c-expected            |  186 ++
 .../basic-types/arrays-fixed-assignment.c-expected |  146 +
 tests/basic-types/arrays-generics.c-expected       |  489 ++++
 tests/basic-types/arrays.c-expected                | 1699 +++++++++++
 tests/basic-types/boolean.c-expected               |   53 +
 tests/basic-types/bug571486.c-expected             |  440 +++
 tests/basic-types/bug591552.c-expected             |  231 ++
 tests/basic-types/bug595751.c-expected             |   21 +
 tests/basic-types/bug596637.c-expected             |   44 +
 tests/basic-types/bug596785.c-expected             |   28 +
 tests/basic-types/bug604371.c-expected             |  192 ++
 tests/basic-types/bug610660.c-expected             |   51 +
 tests/basic-types/bug622178.c-expected             |  441 +++
 tests/basic-types/bug632322.c-expected             |   39 +
 tests/basic-types/bug643612.c-expected             |   31 +
 tests/basic-types/bug644046.c-expected             |   52 +
 tests/basic-types/bug647222.c-expected             |   30 +
 tests/basic-types/bug648364.c-expected             |   47 +
 tests/basic-types/bug650993.c-expected             |   47 +
 tests/basic-types/bug652380.c-expected             |   61 +
 tests/basic-types/bug655908.c-expected             |   50 +
 tests/basic-types/bug659975.c-expected             |   55 +
 tests/basic-types/bug678791.c-expected             |  114 +
 tests/basic-types/bug686336.c-expected             |  408 +++
 tests/basic-types/bug729907.c-expected             |   28 +
 tests/basic-types/bug731017.c-expected             |  160 ++
 tests/basic-types/bug756376.c-expected             |   41 +
 tests/basic-types/bug761307.c-expected             |   68 +
 tests/basic-types/bug761736.c-expected             |  385 +++
 tests/basic-types/bug772426.c-expected             |  110 +
 tests/basic-types/bug787152.c-expected             |   46 +
 tests/basic-types/bug788775.c-expected             |  108 +
 tests/basic-types/custom-types.c-expected          |   59 +
 tests/basic-types/default-gtype.c-expected         |  252 ++
 tests/basic-types/escape-chars.c-expected          |   99 +
 tests/basic-types/floats-boxed-cast.c-expected     |  129 +
 tests/basic-types/floats.c-expected                |  380 +++
 tests/basic-types/garray.c-expected                |  608 ++++
 tests/basic-types/gassert.c-expected               |  147 +
 tests/basic-types/glists.c-expected                |  294 ++
 tests/basic-types/gptrarray.c-expected             |  871 ++++++
 .../basic-types/gvariants-unboxing-safe.c-expected |  734 +++++
 tests/basic-types/gvariants.c-expected             |  860 ++++++
 tests/basic-types/integers-boxed-cast.c-expected   |  227 ++
 tests/basic-types/integers.c-expected              |  618 ++++
 tests/basic-types/null.c-expected                  |   22 +
 tests/basic-types/pointers-arithmetic.c-expected   |   83 +
 tests/basic-types/pointers.c-expected              |  139 +
 tests/basic-types/sizeof.c-expected                |   29 +
 tests/basic-types/strings.c-expected               |  895 ++++++
 tests/chainup/bug791785.c-expected                 |  432 +++
 tests/chainup/class-base-foo.c-expected            |  408 +++
 tests/chainup/class-base.c-expected                |  392 +++
 tests/chainup/class-compact-base.c-expected        |  126 +
 tests/chainup/class-compact-this.c-expected        |  118 +
 tests/chainup/class-object.c-expected              |  134 +
 tests/chainup/class-this-foo.c-expected            |  324 +++
 tests/chainup/class-this.c-expected                |  324 +++
 tests/chainup/method-lambda-base.c-expected        |  438 +++
 tests/chainup/no-chainup.c-expected                |  406 +++
 tests/chainup/signal-default-handler.c-expected    |  237 ++
 tests/chainup/struct-base-foo.c-expected           |  146 +
 tests/chainup/struct-base.c-expected               |  148 +
 tests/chainup/struct-no-gtype-base.c-expected      |  112 +
 .../chainup/struct-simple-no-gtype-base.c-expected |   76 +
 tests/chainup/struct-this-foo.c-expected           |  105 +
 tests/chainup/struct-this.c-expected               |  107 +
 tests/constants/glog.c-expected                    |   30 +
 tests/constants/strings.c-expected                 |   25 +
 .../assigned-local-variable.c-expected             |  249 ++
 tests/control-flow/break.c-expected                |  141 +
 tests/control-flow/bug628336.c-expected            |  163 ++
 tests/control-flow/bug639482.c-expected            |  124 +
 tests/control-flow/bug652549.c-expected            |   46 +
 tests/control-flow/bug661985.c-expected            |   51 +
 tests/control-flow/bug665904.c-expected            |  143 +
 tests/control-flow/bug691514.c-expected            |  227 ++
 tests/control-flow/bug736774-1.c-expected          |  173 ++
 tests/control-flow/bug736774-2.c-expected          |  103 +
 tests/control-flow/bug764440.c-expected            |   93 +
 tests/control-flow/coalesce-as-argument.c-expected |   74 +
 .../coalesce-execution-order.c-expected            |  102 +
 .../coalesce-reference-transfer.c-expected         |  143 +
 tests/control-flow/coalesce-right-value.c-expected |  173 ++
 .../control-flow/coalesce-short-circuit.c-expected |   99 +
 .../conditional-as-argument.c-expected             |   76 +
 .../expressions-conditional.c-expected             |  160 ++
 tests/control-flow/for-switch-continue.c-expected  |  173 ++
 tests/control-flow/for.c-expected                  |   90 +
 tests/control-flow/foreach.c-expected              |  470 +++
 .../local-clash-with-implicit-this.c-expected      |  320 +++
 tests/control-flow/nested-conditional.c-expected   |   57 +
 .../pre-post-increment-field.c-expected            |  166 ++
 .../pre-post-increment-local.c-expected            |  165 ++
 .../pre-post-increment-parameter.c-expected        |  170 ++
 .../pre-post-increment-property.c-expected         |  740 +++++
 tests/control-flow/pre-post-increment.c-expected   |   95 +
 tests/control-flow/sideeffects.c-expected          |  161 ++
 tests/control-flow/switch-enum.c-expected          |   86 +
 tests/control-flow/switch-string.c-expected        |  145 +
 tests/control-flow/switch.c-expected               |  367 +++
 tests/control-flow/while-false.c-expected          |   23 +
 tests/dbus/arrays_client.c-expected                | 1153 ++++++++
 tests/dbus/arrays_server.c-expected                |  909 ++++++
 tests/dbus/async-bus_client.c-expected             |  404 +++
 tests/dbus/async-bus_server.c-expected             |  434 +++
 tests/dbus/async-connection_client.c-expected      |  414 +++
 tests/dbus/async-connection_server.c-expected      |  434 +++
 tests/dbus/async-errors_client.c-expected          | 1143 ++++++++
 tests/dbus/async-errors_server.c-expected          | 1071 +++++++
 tests/dbus/async-no-reply_client.c-expected        | 1012 +++++++
 tests/dbus/async-no-reply_server.c-expected        |  765 +++++
 tests/dbus/async_client.c-expected                 |  947 ++++++
 tests/dbus/async_server.c-expected                 |  885 ++++++
 tests/dbus/basic-types_client.c-expected           |  872 ++++++
 tests/dbus/basic-types_server.c-expected           |  755 +++++
 tests/dbus/bug596862.c-expected                    |  277 ++
 tests/dbus/bug602003_client.c-expected             |  443 +++
 tests/dbus/bug602003_server.c-expected             |  466 +++
 tests/dbus/bug735437_client.c-expected             | 1017 +++++++
 tests/dbus/bug735437_server.c-expected             |  651 +++++
 tests/dbus/bug782719_client.c-expected             |  527 ++++
 tests/dbus/bug782719_server.c-expected             |  535 ++++
 tests/dbus/bug783002_client.c-expected             |  633 ++++
 tests/dbus/bug783002_server.c-expected             |  680 +++++
 tests/dbus/bug792277.c-expected                    |  712 +++++
 tests/dbus/connection_client.c-expected            |  366 +++
 tests/dbus/connection_server.c-expected            |  434 +++
 tests/dbus/dicts_client.c-expected                 |  487 ++++
 tests/dbus/dicts_server.c-expected                 |  917 ++++++
 tests/dbus/dynamic-method_client.c-expected        |  250 ++
 tests/dbus/dynamic-method_server.c-expected        |  460 +++
 tests/dbus/enum-string-marshalling.c-expected      |  901 ++++++
 tests/dbus/errors_client.c-expected                |  890 ++++++
 tests/dbus/errors_server.c-expected                |  692 +++++
 tests/dbus/filedescriptor-async_client.c-expected  |  740 +++++
 tests/dbus/filedescriptor-async_server.c-expected  |  712 +++++
 tests/dbus/filedescriptor-errors_client.c-expected |  479 ++++
 tests/dbus/filedescriptor-errors_server.c-expected |  493 ++++
 tests/dbus/filedescriptor_client.c-expected        |  555 ++++
 tests/dbus/filedescriptor_server.c-expected        |  585 ++++
 tests/dbus/generics_client.c-expected              |  397 +++
 tests/dbus/generics_server.c-expected              |  478 ++++
 tests/dbus/interface-info_client.c-expected        |  403 +++
 tests/dbus/interface-info_server.c-expected        |  414 +++
 tests/dbus/no-reply_client.c-expected              |  933 ++++++
 tests/dbus/no-reply_server.c-expected              |  632 ++++
 tests/dbus/rawvariants_client.c-expected           | 1277 +++++++++
 tests/dbus/rawvariants_server.c-expected           | 1095 +++++++
 tests/dbus/signals_client.c-expected               |  780 +++++
 tests/dbus/signals_server.c-expected               |  620 ++++
 tests/dbus/structs_client.c-expected               |  718 +++++
 tests/dbus/structs_server.c-expected               |  758 +++++
 tests/delegates/bug539166.c-expected               |  163 ++
 tests/delegates/bug595610.c-expected               |  109 +
 tests/delegates/bug595639.c-expected               |   65 +
 tests/delegates/bug638415.c-expected               |  108 +
 tests/delegates/bug639751.c-expected               |  142 +
 tests/delegates/bug659778.c-expected               |  521 ++++
 tests/delegates/bug683925.c-expected               |  187 ++
 tests/delegates/bug703804.c-expected               |  105 +
 tests/delegates/bug761360.c-expected               |   79 +
 tests/delegates/bug792077.c-expected               |  114 +
 tests/delegates/casting.c-expected                 |  285 ++
 tests/delegates/compatible.c-expected              |  196 ++
 tests/delegates/delegate-recusive.c-expected       |   23 +
 tests/delegates/delegate_only.c-expected           |   22 +
 tests/delegates/delegates.c-expected               |  593 ++++
 tests/delegates/error-pos.c-expected               |  482 ++++
 tests/delegates/fields-no-target.c-expected        |  400 +++
 tests/delegates/fields.c-expected                  |   76 +
 tests/delegates/gclosure-conversion.c-expected     |  462 +++
 .../lambda-mixed-instance-static.c-expected        |  123 +
 tests/delegates/lambda-shared-closure.c-expected   |  875 ++++++
 tests/delegates/member-target-destroy.c-expected   |   84 +
 .../delegates/params-array-with-throws.c-expected  |  202 ++
 tests/delegates/params-array.c-expected            |  444 +++
 tests/delegates/reference_transfer.c-expected      |  368 +++
 .../return-array-null-terminated.c-expected        |  126 +
 tests/delegates/variadic.c-expected                |  202 ++
 tests/delegates/wrapper.c-expected                 |  177 ++
 tests/enums/bug666035.c-expected                   |  231 ++
 tests/enums/bug673879.c-expected                   |   93 +
 tests/enums/bug763831.c-expected                   |   89 +
 tests/enums/bug780050.c-expected                   |   61 +
 tests/enums/default-gtype.c-expected               |   36 +
 tests/enums/enum-no-gtype.c-expected               |   23 +
 tests/enums/enum_only.c-expected                   |   59 +
 tests/enums/enums.c-expected                       |  238 ++
 tests/enums/flags.c-expected                       |   81 +
 tests/enums/from-0-literal.c-expected              |   95 +
 tests/enums/in-inference.c-expected                |   71 +
 tests/enums/no_gtype_to_string.c-expected          |   80 +
 tests/enums/switch.c-expected                      |   77 +
 tests/errors/bug567181.c-expected                  |  214 ++
 tests/errors/bug579101.c-expected                  |  199 ++
 tests/errors/bug596228.c-expected                  |  116 +
 tests/errors/bug623049.c-expected                  |  243 ++
 tests/errors/bug627090.c-expected                  |  202 ++
 tests/errors/bug639589.c-expected                  |   97 +
 tests/errors/bug651145.c-expected                  |   49 +
 tests/errors/bug762377.c-expected                  |  233 ++
 tests/errors/bug778224.c-expected                  |   95 +
 tests/errors/catch-error-code.c-expected           |   91 +
 tests/errors/catch-in-finally.c-expected           |  283 ++
 tests/errors/default-gtype.c-expected              |   49 +
 tests/errors/errorcode.c-expected                  |   90 +
 tests/errors/errordomain-static-method.c-expected  |   69 +
 tests/errors/errordomain.c-expected                |   42 +
 tests/errors/errors.c-expected                     |  353 +++
 tests/errors/loops.c-expected                      |  493 ++++
 tests/errors/method-throws.c-expected              |   36 +
 tests/errors/unhandled.c-expected                  |  294 ++
 tests/generics/arrays.c-expected                   |  540 ++++
 tests/generics/bug694765-1.c-expected              |  111 +
 tests/generics/bug694765-2.c-expected              |  601 ++++
 tests/generics/bug694765-3.c-expected              |   56 +
 tests/generics/constructor-chain-up.c-expected     |  241 ++
 tests/generics/floating-type-cast.c-expected       |  164 ++
 .../inference-argument-may-fail.c-expected         |  395 +++
 .../generics/inference-static-function.c-expected  |  377 +++
 tests/generics/integer-member-access.c-expected    |  378 +++
 tests/generics/integer-type-cast-return.c-expected |  176 ++
 tests/generics/integer-type-cast.c-expected        |  288 ++
 tests/generics/member-dup-destroy.c-expected       |  565 ++++
 .../parameter-sizeof-initializer.c-expected        |  112 +
 tests/generics/property-int-cast.c-expected        |  368 +++
 tests/generics/reference-transfer.c-expected       |  414 +++
 .../generics/string-literal-comparison.c-expected  |  344 +++
 .../generics/type-parameter-properties.c-expected  |  418 +++
 .../generics/value-pointer-type-access.c-expected  |  417 +++
 tests/genie/class.c-expected                       |  315 ++
 tests/genie/control-flow-if-do.c-expected          |   33 +
 tests/genie/control-flow-if-else-if.c-expected     |   38 +
 tests/genie/control-flow-if-else.c-expected        |   36 +
 .../genie/control-flow-if-greater-than.c-expected  |   36 +
 tests/genie/control-flow-if-identity.c-expected    |   40 +
 tests/genie/control-flow-if-less-than.c-expected   |   36 +
 tests/genie/control-flow-if.c-expected             |   34 +
 tests/genie/enum-with-keyword-values.c-expected    |   82 +
 tests/genie/enum.c-expected                        |   70 +
 tests/genie/function-returns-closure.c-expected    |   92 +
 tests/genie/function-with-argument.c-expected      |   47 +
 tests/genie/function-with-return-value.c-expected  |   57 +
 tests/genie/function.c-expected                    |   51 +
 tests/genie/indentation-with-spaces.c-expected     |   30 +
 tests/genie/init-int.c-expected                    |   26 +
 tests/genie/init.c-expected                        |   30 +
 tests/genie/literal-boolean-assignment.c-expected  |   32 +
 tests/genie/literal-boolean.c-expected             |   35 +
 tests/genie/literal-character.c-expected           |   32 +
 tests/genie/literal-hexadecimal.c-expected         |   32 +
 .../literal-integer-long-long-suffix.c-expected    |   32 +
 tests/genie/literal-integer.c-expected             |   32 +
 tests/genie/literal-null.c-expected                |   34 +
 tests/genie/literal-octal.c-expected               |   32 +
 tests/genie/literal-real.c-expected                |   36 +
 tests/genie/literal-regex.c-expected               |   62 +
 tests/genie/literal-template-string.c-expected     |   61 +
 tests/genie/literal-verbatim-string.c-expected     |   36 +
 tests/genie/operator-addition.c-expected           |   32 +
 .../genie/operator-assignment-combined.c-expected  |   59 +
 tests/genie/operator-assignment.c-expected         |   32 +
 tests/genie/operator-bitwise-and.c-expected        |   34 +
 tests/genie/operator-bitwise-left-shift.c-expected |   34 +
 tests/genie/operator-bitwise-not.c-expected        |   34 +
 tests/genie/operator-bitwise-or.c-expected         |   34 +
 .../genie/operator-bitwise-right-shift.c-expected  |   34 +
 tests/genie/operator-bitwise-xor.c-expected        |   34 +
 tests/genie/operator-division.c-expected           |   32 +
 tests/genie/operator-equal.c-expected              |   40 +
 tests/genie/operator-greater-than-equal.c-expected |   36 +
 tests/genie/operator-less-than-equal.c-expected    |   36 +
 tests/genie/operator-less-than.c-expected          |   36 +
 tests/genie/operator-logical-and.c-expected        |   47 +
 tests/genie/operator-logical-not.c-expected        |   36 +
 tests/genie/operator-logical-or.c-expected         |   47 +
 tests/genie/operator-modulo.c-expected             |   32 +
 tests/genie/operator-multiply.c-expected           |   32 +
 tests/genie/operator-not-equal.c-expected          |   40 +
 tests/genie/operator-post-decrement.c-expected     |   38 +
 tests/genie/operator-post-increment.c-expected     |   38 +
 tests/genie/operator-pre-decrement.c-expected      |   38 +
 tests/genie/operator-pre-increment.c-expected      |   38 +
 tests/genie/operator-subtraction.c-expected        |   32 +
 tests/genie/operator-ternary.c-expected            |   44 +
 tests/genie/operators-greater-than.c-expected      |   36 +
 tests/genie/preparser-and-expression.c-expected    |   30 +
 tests/genie/preparser-elif.c-expected              |   30 +
 .../genie/preparser-equality-expression.c-expected |   30 +
 tests/genie/preparser-not.c-expected               |   30 +
 tests/genie/preparser-or-expression.c-expected     |   30 +
 tests/genie/preparser.c-expected                   |   45 +
 tests/genie/struct-after-class.c-expected          |  400 +++
 tests/genie/struct.c-expected                      |  126 +
 tests/glib/conditional-glib-api.c-expected         |  757 +++++
 tests/linux/bug793444.c-expected                   |   25 +
 tests/linux/file-commandpipe.c-expected            |   47 +
 tests/methods/argument-array-initilizer.c-expected |  187 ++
 tests/methods/argument-named.c-expected            |  348 +++
 tests/methods/array-length-type.c-expected         | 1463 ++++++++++
 tests/methods/bug540483.c-expected                 |  858 ++++++
 tests/methods/bug595538.c-expected                 |  102 +
 tests/methods/bug596726.c-expected                 |  117 +
 tests/methods/bug597426.c-expected                 |  127 +
 tests/methods/bug598738.c-expected                 |   89 +
 tests/methods/bug599892.c-expected                 |  336 +++
 tests/methods/bug613483.c-expected                 |  361 +++
 tests/methods/bug622570.c-expected                 |  116 +
 tests/methods/bug626783.c-expected                 |  401 +++
 tests/methods/bug634753.c-expected                 |   57 +
 tests/methods/bug639054.c-expected                 |  349 +++
 tests/methods/bug642350.c-expected                 |  413 +++
 tests/methods/bug642885.c-expected                 |  277 ++
 tests/methods/bug642899.c-expected                 |  394 +++
 tests/methods/bug646345.c-expected                 |  184 ++
 tests/methods/bug648320.c-expected                 |  180 ++
 tests/methods/bug649562.c-expected                 |   52 +
 tests/methods/bug652098.c-expected                 |  682 +++++
 tests/methods/bug653391.c-expected                 |  136 +
 tests/methods/bug653908.c-expected                 |   99 +
 tests/methods/bug663210.c-expected                 |  393 +++
 tests/methods/bug699956.c-expected                 |  381 +++
 tests/methods/bug710862.c-expected                 |  309 ++
 tests/methods/bug723009.c-expected                 |   75 +
 tests/methods/bug723195.c-expected                 |  283 ++
 tests/methods/bug726347.c-expected                 |  358 +++
 tests/methods/bug736235.c-expected                 |  217 ++
 tests/methods/bug737222.c-expected                 |  133 +
 tests/methods/bug743877.c-expected                 |   56 +
 tests/methods/bug771964.c-expected                 |  253 ++
 tests/methods/bug774060.c-expected                 |  204 ++
 tests/methods/bug781061.c-expected                 |  149 +
 tests/methods/bug784691.c-expected                 |   50 +
 tests/methods/bug791215.c-expected                 |   47 +
 tests/methods/bug791283.c-expected                 |  366 +++
 tests/methods/closures.c-expected                  |  541 ++++
 tests/methods/contains.c-expected                  |  315 ++
 tests/methods/delegate-target.c-expected           |  829 ++++++
 tests/methods/extern.c-expected                    |  321 +++
 tests/methods/generics.c-expected                  |  505 ++++
 tests/methods/iterator.c-expected                  | 3014 ++++++++++++++++++++
 tests/methods/lambda.c-expected                    |  227 ++
 tests/methods/nowrapper-interface.c-expected       |  187 ++
 .../parameter-fixed-array-initializer.c-expected   |  126 +
 .../methods/parameter-out-free-on-error.c-expected |  264 ++
 .../parameter-ref-array-resize-captured.c-expected |  150 +
 .../methods/parameter-ref-array-resize.c-expected  |   91 +
 tests/methods/parameter-ref-delegate.c-expected    |  187 ++
 .../parameter-ref-element-access.c-expected        |   99 +
 tests/methods/params-array-with-throws.c-expected  |  622 ++++
 tests/methods/params-array.c-expected              | 1155 ++++++++
 .../postconditions-temp-variables.c-expected       |  107 +
 tests/methods/postconditions.c-expected            |  370 +++
 .../preconditions-temp-variables.c-expected        |   74 +
 .../methods/prepostconditions-captured.c-expected  |  302 ++
 tests/methods/prepostconditions.c-expected         |  633 ++++
 tests/methods/print-attribute.c-expected           |  461 +++
 tests/methods/printf-constructor.c-expected        |   27 +
 tests/methods/return-unowned-delegate.c-expected   |  134 +
 tests/methods/same-name.c-expected                 |  391 +++
 tests/methods/symbolresolution.c-expected          |  462 +++
 .../varargs-delegate-without-target.c-expected     |  105 +
 tests/methods/varargs-delegate.c-expected          |  125 +
 tests/methods/varargs-gvalue.c-expected            |   99 +
 tests/methods/varargs-out.c-expected               |  337 +++
 tests/methods/varargs-ref.c-expected               |   71 +
 tests/methods/varargs-struct.c-expected            |  138 +
 tests/namespace/unique.c-expected                  |  309 ++
 tests/nullability/bug611223.c-expected             |   77 +
 .../member-access-narrowed-instance.c-expected     |  309 ++
 tests/nullability/var-type.c-expected              |   92 +
 tests/objects/bug566909.c-expected                 |  268 ++
 tests/objects/bug588203.c-expected                 |  306 ++
 tests/objects/bug589928.c-expected                 |  375 +++
 tests/objects/bug593137.c-expected                 |  298 ++
 tests/objects/bug593260.c-expected                 |  317 ++
 tests/objects/bug596621.c-expected                 |  199 ++
 tests/objects/bug597155.c-expected                 |  196 ++
 tests/objects/bug597161.c-expected                 |  123 +
 tests/objects/bug613486.c-expected                 |  411 +++
 tests/objects/bug613840.c-expected                 |   95 +
 tests/objects/bug620675.c-expected                 |  693 +++++
 tests/objects/bug620706.c-expected                 |  307 ++
 tests/objects/bug624594.c-expected                 |  208 ++
 tests/objects/bug626038-2.c-expected               |  744 +++++
 tests/objects/bug626038.c-expected                 |  306 ++
 tests/objects/bug628639.c-expected                 |  371 +++
 tests/objects/bug629593.c-expected                 |  626 ++++
 tests/objects/bug631267.c-expected                 |  813 ++++++
 tests/objects/bug634782.c-expected                 |  366 +++
 tests/objects/bug641828.c-expected                 |  242 ++
 tests/objects/bug642809.c-expected                 |  183 ++
 tests/objects/bug643711.c-expected                 |  404 +++
 tests/objects/bug644938.c-expected                 |  315 ++
 tests/objects/bug646362.c-expected                 |  200 ++
 tests/objects/bug646792.c-expected                 |  349 +++
 tests/objects/bug647018.c-expected                 |   35 +
 tests/objects/bug653138.c-expected                 |  359 +++
 tests/objects/bug654702.c-expected                 |  291 ++
 tests/objects/bug663134.c-expected                 |  440 +++
 tests/objects/bug664529.c-expected                 |   65 +
 tests/objects/bug667668.c-expected                 |  426 +++
 tests/objects/bug681356.c-expected                 |  204 ++
 tests/objects/bug683646.c-expected                 |  134 +
 tests/objects/bug695671.c-expected                 |  211 ++
 tests/objects/bug702736.c-expected                 |  475 +++
 tests/objects/bug702846.c-expected                 |   65 +
 tests/objects/bug731547.c-expected                 |  183 ++
 tests/objects/bug741465.c-expected                 |  441 +++
 tests/objects/bug751338.c-expected                 |  416 +++
 tests/objects/bug758816.c-expected                 |  541 ++++
 tests/objects/bug764481.c-expected                 |  880 ++++++
 tests/objects/bug766739.c-expected                 | 1085 +++++++
 tests/objects/bug778632.c-expected                 |  236 ++
 tests/objects/bug779219.c-expected                 |  338 +++
 tests/objects/bug779955.c-expected                 |  223 ++
 tests/objects/bug783897.c-expected                 |  653 +++++
 tests/objects/bug788964.c-expected                 |  342 +++
 tests/objects/bug795521.c-expected                 |  466 +++
 tests/objects/chainup.c-expected                   |  564 ++++
 tests/objects/class-ccode-cprefix.c-expected       |  398 +++
 tests/objects/class-destroysinstance.c-expected    |  142 +
 tests/objects/class-inner-types.c-expected         |  627 ++++
 tests/objects/class-new-no-override.c-expected     |  220 ++
 tests/objects/class-vfunc-base-access.c-expected   |  459 +++
 tests/objects/class_only.c-expected                |  291 ++
 .../classes-implicit-implementation.c-expected     |  527 ++++
 .../objects/classes-interfaces-virtuals.c-expected |  407 +++
 tests/objects/classes-interfaces.c-expected        |  375 +++
 tests/objects/classes.c-expected                   | 2020 +++++++++++++
 tests/objects/compact-class-custom-ref.c-expected  |  107 +
 tests/objects/compact-class-destructor.c-expected  |  545 ++++
 tests/objects/compact-class-refcount.c-expected    |   83 +
 tests/objects/compact-class.c-expected             |   60 +
 tests/objects/constructor-inner-error.c-expected   |  179 ++
 tests/objects/constructor-variadic.c-expected      |  411 +++
 tests/objects/constructors.c-expected              |  472 +++
 tests/objects/destructors.c-expected               |  421 +++
 tests/objects/dynamic.c-expected                   |  347 +++
 tests/objects/fields.c-expected                    | 1389 +++++++++
 tests/objects/generics.c-expected                  |   35 +
 tests/objects/gobject-class-lifetime.c-expected    |  198 ++
 tests/objects/gsource.c-expected                   |  234 ++
 tests/objects/gtype-class-lifetime.c-expected      |  318 +++
 tests/objects/initially-unowned.c-expected         |  235 ++
 tests/objects/instance-comparison.c-expected       |  451 +++
 .../interface-abstract-async-override.c-expected   |  322 +++
 .../objects/interface-async-base-access.c-expected |  631 ++++
 .../interface-async-captured-generic.c-expected    |  299 ++
 tests/objects/interface-base-access.c-expected     |  463 +++
 tests/objects/interface-generics.c-expected        |  282 ++
 tests/objects/interface-inner-types.c-expected     |  677 +++++
 .../interface-property-base-access.c-expected      |  680 +++++
 .../interface-property-base-impl.c-expected        |  396 +++
 .../objects/interface-property-delegate.c-expected |  727 +++++
 .../objects/interface-property-override.c-expected |  682 +++++
 .../objects/interface-virtual-override.c-expected  |  208 ++
 tests/objects/interface_only.c-expected            |   71 +
 tests/objects/interfaces.c-expected                |  392 +++
 .../member-initializer-base-properties.c-expected  |  612 ++++
 .../member-initializer-chained-2.c-expected        |  467 +++
 .../objects/member-initializer-chained.c-expected  |  511 ++++
 ...er-initializer-property-owned-setter.c-expected |  482 ++++
 .../objects/member-initializer-property.c-expected |  682 +++++
 tests/objects/methods.c-expected                   | 1744 +++++++++++
 tests/objects/paramspec.c-expected                 | 2096 ++++++++++++++
 tests/objects/plugin-module-init.c-expected        |  141 +
 tests/objects/properties.c-expected                | 2212 ++++++++++++++
 tests/objects/property-array-length.c-expected     |  236 ++
 tests/objects/property-array.c-expected            | 1562 ++++++++++
 tests/objects/property-base-access.c-expected      |  485 ++++
 tests/objects/property-construct-only.c-expected   |  648 +++++
 tests/objects/property-delegate-owned.c-expected   |  918 ++++++
 tests/objects/property-delegate.c-expected         |  947 ++++++
 tests/objects/property-enum.c-expected             |  817 ++++++
 tests/objects/property-gboxed-nullable.c-expected  |  651 +++++
 .../property-notify-owned-getter.c-expected        |  873 ++++++
 tests/objects/property-notify.c-expected           |  356 +++
 tests/objects/property-ownership.c-expected        |  946 ++++++
 tests/objects/property-read-only-auto.c-expected   |  699 +++++
 .../property-real-struct-assignment.c-expected     |  666 +++++
 ...property-simple-type-struct-nullable.c-expected |  221 ++
 tests/objects/property-static.c-expected           |  420 +++
 tests/objects/property-struct-no-gtype.c-expected  |  242 ++
 tests/objects/regex.c-expected                     |  616 ++++
 .../signals-default-class-handler.c-expected       |  341 +++
 .../objects/signals-delegate-parameter.c-expected  |  473 +++
 tests/objects/signals-delegate.c-expected          |  578 ++++
 tests/objects/signals-enum-marshal.c-expected      |  288 ++
 tests/objects/signals-error-marshal.c-expected     |  285 ++
 .../objects/signals-fundamental-return.c-expected  |  824 ++++++
 tests/objects/signals-gobject-return.c-expected    |  274 ++
 tests/objects/signals-lambda-delegate.c-expected   |  229 ++
 tests/objects/signals-prototype-access.c-expected  |  452 +++
 tests/objects/signals-struct-return.c-expected     |  497 ++++
 tests/objects/signals.c-expected                   |  932 ++++++
 tests/objects/simple-generics-chainup.c-expected   |  146 +
 tests/objects/singleton.c-expected                 |  374 +++
 tests/objects/test-025.c-expected                  |  255 ++
 tests/objects/test-026.c-expected                  |  240 ++
 tests/objects/test-029.c-expected                  |  278 ++
 tests/objects/test-034.c-expected                  |  554 ++++
 .../type-narrowing-by-precondition.c-expected      |  408 +++
 tests/objects/type-narrowing-fallback.c-expected   |  307 ++
 tests/objects/type-narrowing.c-expected            |  582 ++++
 tests/objects/with-expression.c-expected           |  417 +++
 tests/objects/with-instance.c-expected             | 1027 +++++++
 tests/objects/with-nested-in-lambda.c-expected     |  369 +++
 tests/objects/with-nested-method.c-expected        |  593 ++++
 tests/objects/with-nested-signal.c-expected        |  492 ++++
 .../with-nested-unambigous-signal.c-expected       |  367 +++
 tests/objects/with-nested.c-expected               |  867 ++++++
 tests/ordering/delegate-class.c-expected           |  305 ++
 tests/ordering/delegate-enum.c-expected            |   59 +
 tests/ordering/delegate-interface.c-expected       |   89 +
 tests/ordering/delegate-struct.c-expected          |   78 +
 tests/ordering/struct-delegate.c-expected          |   78 +
 .../member-initializer.c-expected                  |  372 +++
 tests/parser/assignment.c-expected                 |   33 +
 tests/parser/bug728574.c-expected                  |   47 +
 tests/parser/bug749576.c-expected                  |  144 +
 tests/parser/continue-statement.c-expected         |   35 +
 tests/parser/do-statement.c-expected               |   48 +
 tests/parser/foreach.c-expected                    |  150 +
 tests/parser/local-variable.c-expected             |   39 +
 tests/parser/lock-statement.c-expected             |  340 +++
 tests/parser/main-block.c-expected                 |   28 +
 tests/parser/member-access-pointer.c-expected      |  119 +
 tests/parser/member-initializer-empty.c-expected   |  299 ++
 .../member-initializer-trailing-comma.c-expected   |  300 ++
 tests/parser/member-initializer.c-expected         |  300 ++
 tests/parser/namespaces.c-expected                 |  662 +++++
 tests/parser/preprocessor-glib.c-expected          |   26 +
 tests/parser/preprocessor-vala.c-expected          |   26 +
 tests/parser/preprocessor.c-expected               |   26 +
 tests/parser/qualified-member-access.c-expected    |   51 +
 tests/parser/qualified-symbol-access.c-expected    |  565 ++++
 .../statement-keyword-as-identifier.c-expected     |   96 +
 tests/parser/switch-statement.c-expected           |   51 +
 tests/parser/template.c-expected                   |   80 +
 tests/parser/tuple.c-expected                      |  192 ++
 tests/parser/using-directive.c-expected            |   42 +
 tests/parser/var-type-nullable.c-expected          |  118 +
 tests/parser/with-embedded.c-expected              |   56 +
 tests/parser/with-empty.c-expected                 |   24 +
 tests/pointers/bug590641.c-expected                |   79 +
 tests/pointers/delete.c-expected                   |  390 +++
 tests/posix/arrays.c-expected                      | 1663 +++++++++++
 tests/posix/delegate_only.c-expected               |   20 +
 tests/posix/empty-length-0.c-expected              |  389 +++
 tests/posix/enum-to-string.c-expected              |   56 +
 tests/posix/enum_only.c-expected                   |   23 +
 tests/posix/string-concat.c-expected               |   72 +
 tests/posix/string-printf.c-expected               |   65 +
 tests/posix/struct_only.c-expected                 |   54 +
 tests/resolver/peek-inner-types.c-expected         | 1088 +++++++
 tests/scanner/regex-escape-x.c-expected            |   47 +
 tests/scanner/string-escape-x.c-expected           |   29 +
 tests/semantic/assignment-same-variable.c-expected |  313 ++
 .../class-opaque-automatic-property.c-expected     |   96 +
 tests/semantic/class-opaque.c-expected             |   85 +
 .../floating-reference-base-method.c-expected      |  631 ++++
 tests/semantic/floating-reference-error.c-expected |  107 +
 tests/semantic/floating-reference.c-expected       |  330 +++
 ...ocalvariable-var-pointer-initializer.c-expected |  135 +
 ...-access-static-transformed-qualified.c-expected |  563 ++++
 .../member-access-static-with-instance.c-expected  |   87 +
 .../member-access-transformed-qualified.c-expected |  308 ++
 tests/semantic/with-buildin.c-expected             |   33 +
 tests/semantic/with-compact.c-expected             |   74 +
 .../semantic/with-declaration-cast-type.c-expected |  373 +++
 tests/semantic/with-declaration.c-expected         |  356 +++
 .../semantic/with-dereferenced-pointer.c-expected  |  311 ++
 tests/semantic/with-enum-member.c-expected         |   62 +
 tests/semantic/with-null.c-expected                |  300 ++
 tests/semantic/with-string.c-expected              |   52 +
 tests/semantic/with-value.c-expected               |   39 +
 tests/structs/bug530605.c-expected                 |  197 ++
 tests/structs/bug572091.c-expected                 |  100 +
 tests/structs/bug583603.c-expected                 |   90 +
 tests/structs/bug595587.c-expected                 |  349 +++
 tests/structs/bug596144.c-expected                 |  140 +
 tests/structs/bug603056.c-expected                 |   97 +
 tests/structs/bug606202.c-expected                 |  446 +++
 tests/structs/bug609642.c-expected                 |   63 +
 tests/structs/bug613513.c-expected                 |  101 +
 tests/structs/bug613825.c-expected                 |   89 +
 tests/structs/bug621176.c-expected                 |   90 +
 tests/structs/bug622422.c-expected                 |  174 ++
 tests/structs/bug623092.c-expected                 |  131 +
 tests/structs/bug651441.c-expected                 |   89 +
 tests/structs/bug654646.c-expected                 |   49 +
 tests/structs/bug654753.c-expected                 |  110 +
 tests/structs/bug656693.c-expected                 |  107 +
 tests/structs/bug657378.c-expected                 |   64 +
 tests/structs/bug658048.c-expected                 |   51 +
 tests/structs/bug660426.c-expected                 |  155 +
 tests/structs/bug661945.c-expected                 |  133 +
 tests/structs/bug667890.c-expected                 |   93 +
 tests/structs/bug669580.c-expected                 |  122 +
 tests/structs/bug685177.c-expected                 |  230 ++
 tests/structs/bug686190.c-expected                 |   96 +
 tests/structs/bug688732.c-expected                 |  155 +
 tests/structs/bug690380.c-expected                 |  173 ++
 tests/structs/bug694140.c-expected                 |  137 +
 tests/structs/bug749952.c-expected                 |  159 ++
 tests/structs/bug775761.c-expected                 |  182 ++
 tests/structs/bug777194-2.c-expected               |   44 +
 tests/structs/bug777194.c-expected                 |  369 +++
 tests/structs/cast-struct-boxed.c-expected         |  446 +++
 tests/structs/constructor-params-array.c-expected  |  255 ++
 tests/structs/constructor-variadic.c-expected      |  144 +
 tests/structs/default-gtype.c-expected             |  100 +
 tests/structs/gmutex.c-expected                    |   87 +
 tests/structs/gtype-base-struct.c-expected         |  623 ++++
 .../structs/gvalue-implicit-comparison.c-expected  |  308 ++
 tests/structs/gvalue.c-expected                    | 1208 ++++++++
 tests/structs/properties.c-expected                |  292 ++
 tests/structs/simple-type-constructor.c-expected   |   57 +
 tests/structs/struct-base-types.c-expected         |  260 ++
 tests/structs/struct-boxed-cast.c-expected         |  168 ++
 .../struct-initializer-list-in-array.c-expected    |  401 +++
 .../struct-initializer-list-nested.c-expected      |  457 +++
 tests/structs/struct-no-gtype-inherit.c-expected   |   23 +
 tests/structs/struct-no-gtype.c-expected           |   54 +
 tests/structs/struct_only.c-expected               |   77 +
 tests/structs/structs.c-expected                   |  508 ++++
 tests/threads/threadpool.c-expected                |  109 +
 702 files changed, 215648 insertions(+)
---
diff --git a/tests/annotations/deprecated-delegate-minimal.c-expected 
b/tests/annotations/deprecated-delegate-minimal.c-expected
new file mode 100644
index 000000000..5f70e82fd
--- /dev/null
+++ b/tests/annotations/deprecated-delegate-minimal.c-expected
@@ -0,0 +1,22 @@
+/* annotations_deprecated_delegate_minimal.c generated by valac, the Vala compiler
+ * generated from annotations_deprecated_delegate_minimal.vala, do not modify */
+
+#include <glib.h>
+
+typedef void (*Foo) (void) G_GNUC_DEPRECATED ;
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/annotations/deprecated-enum-minimal.c-expected 
b/tests/annotations/deprecated-enum-minimal.c-expected
new file mode 100644
index 000000000..c809a7aef
--- /dev/null
+++ b/tests/annotations/deprecated-enum-minimal.c-expected
@@ -0,0 +1,24 @@
+/* annotations_deprecated_enum_minimal.c generated by valac, the Vala compiler
+ * generated from annotations_deprecated_enum_minimal.vala, do not modify */
+
+#include <glib.h>
+
+typedef enum  {
+       FOO_BAR
+} Foo G_GNUC_DEPRECATED ;
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/annotations/deprecated-method-minimal.c-expected 
b/tests/annotations/deprecated-method-minimal.c-expected
new file mode 100644
index 000000000..02168bc6c
--- /dev/null
+++ b/tests/annotations/deprecated-method-minimal.c-expected
@@ -0,0 +1,36 @@
+/* annotations_deprecated_method_minimal.c generated by valac, the Vala compiler
+ * generated from annotations_deprecated_method_minimal.vala, do not modify */
+
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+VALA_EXTERN void foo (void) G_GNUC_DEPRECATED ;
+static void _vala_main (void);
+
+void
+foo (void)
+{
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/annotations/deprecated-property-minimal.c-expected 
b/tests/annotations/deprecated-property-minimal.c-expected
new file mode 100644
index 000000000..cebd8f46d
--- /dev/null
+++ b/tests/annotations/deprecated-property-minimal.c-expected
@@ -0,0 +1,56 @@
+/* annotations_deprecated_property_minimal.c generated by valac, the Vala compiler
+ * generated from annotations_deprecated_property_minimal.vala, do not modify */
+
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef struct _Foo Foo;
+
+struct _Foo {
+       void* _bar;
+};
+
+VALA_EXTERN void* foo_get_bar (Foo self) G_GNUC_DEPRECATED ;
+VALA_EXTERN void foo_set_bar (Foo self,
+                  void* value) G_GNUC_DEPRECATED ;
+static void _vala_main (void);
+
+void*
+foo_get_bar (Foo self)
+{
+       void* result;
+       void* _tmp0_;
+       _tmp0_ = self._bar;
+       result = _tmp0_;
+       return result;
+}
+
+void
+foo_set_bar (Foo self,
+             void* value)
+{
+       self._bar = value;
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/annotations/deprecated-struct-minimal.c-expected 
b/tests/annotations/deprecated-struct-minimal.c-expected
new file mode 100644
index 000000000..cbc9b5d9d
--- /dev/null
+++ b/tests/annotations/deprecated-struct-minimal.c-expected
@@ -0,0 +1,26 @@
+/* annotations_deprecated_struct_minimal.c generated by valac, the Vala compiler
+ * generated from annotations_deprecated_struct_minimal.vala, do not modify */
+
+#include <glib.h>
+
+typedef struct _Foo Foo;
+
+struct _Foo {
+       void* bar;
+} G_GNUC_DEPRECATED ;
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/annotations/deprecated.c-expected b/tests/annotations/deprecated.c-expected
new file mode 100644
index 000000000..729cd82e4
--- /dev/null
+++ b/tests/annotations/deprecated.c-expected
@@ -0,0 +1,563 @@
+/* annotations_deprecated.c generated by valac, the Vala compiler
+ * generated from annotations_deprecated.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef void (*FooDelegate) (gpointer user_data) G_GNUC_DEPRECATED ;
+
+#define TYPE_FOO_STRUCT (foo_struct_get_type ())
+typedef struct _FooStruct FooStruct;
+
+#define TYPE_FOOCLASS (fooclass_get_type ())
+#define FOOCLASS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOOCLASS, FooClass))
+#define FOOCLASS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOOCLASS, FooClassClass))
+#define IS_FOOCLASS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOOCLASS))
+#define IS_FOOCLASS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOOCLASS))
+#define FOOCLASS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOOCLASS, FooClassClass))
+
+typedef struct _FooClass FooClass;
+typedef struct _FooClassClass FooClassClass;
+typedef struct _FooClassPrivate FooClassPrivate;
+enum  {
+       FOOCLASS_0_PROPERTY,
+       FOOCLASS_BAR_PROPERTY,
+       FOOCLASS_NUM_PROPERTIES
+};
+static GParamSpec* fooclass_properties[FOOCLASS_NUM_PROPERTIES];
+
+#define TYPE_AFOO (afoo_get_type ())
+#define AFOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_AFOO, AFoo))
+#define AFOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_AFOO, AFooClass))
+#define IS_AFOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_AFOO))
+#define IS_AFOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_AFOO))
+#define AFOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_AFOO, AFooClass))
+
+typedef struct _AFoo AFoo;
+typedef struct _AFooClass AFooClass;
+typedef struct _AFooPrivate AFooPrivate;
+enum  {
+       AFOO_0_PROPERTY,
+       AFOO_NUM_PROPERTIES
+};
+static GParamSpec* afoo_properties[AFOO_NUM_PROPERTIES];
+
+#define TYPE_IFOO (ifoo_get_type ())
+#define IFOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IFOO, IFoo))
+#define IS_IFOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IFOO))
+#define IFOO_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_IFOO, IFooIface))
+
+typedef struct _IFoo IFoo;
+typedef struct _IFooIface IFooIface;
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+typedef enum  {
+       FOO_ENUM_BAR = 0,
+       FOO_ENUM_FOO,
+       FOO_ENUM_BAZ
+} FooEnum G_GNUC_DEPRECATED ;
+
+#define TYPE_FOO_ENUM (foo_enum_get_type ())
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _FooStruct {
+       gint bar G_GNUC_DEPRECATED ;
+} G_GNUC_DEPRECATED ;
+
+struct _FooClass {
+       GObject parent_instance;
+       FooClassPrivate * priv;
+       gint baz G_GNUC_DEPRECATED ;
+};
+
+struct _FooClassClass {
+       GObjectClass parent_class;
+       gint (*foov) (FooClass* self) G_GNUC_DEPRECATED ;
+};
+
+struct _FooClassPrivate {
+       gint _bar;
+};
+
+struct _AFoo {
+       GObject parent_instance;
+       AFooPrivate * priv;
+};
+
+struct _AFooClass {
+       GObjectClass parent_class;
+       gint (*fooa) (AFoo* self) G_GNUC_DEPRECATED ;
+};
+
+struct _IFooIface {
+       GTypeInterface parent_iface;
+       void (*fooa) (IFoo* self) G_GNUC_DEPRECATED ;
+};
+
+VALA_EXTERN gint bar;
+gint bar = 42;
+static gint FooClass_private_offset;
+static gpointer fooclass_parent_class = NULL;
+VALA_EXTERN gint fooclass_manam;
+gint fooclass_manam = 42;
+static gpointer afoo_parent_class = NULL;
+
+VALA_EXTERN void baz (void) G_GNUC_DEPRECATED ;
+VALA_EXTERN GType foo_struct_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN FooStruct* foo_struct_dup (const FooStruct* self);
+VALA_EXTERN void foo_struct_free (FooStruct* self);
+VALA_EXTERN void test_struct_field (void);
+VALA_EXTERN GType fooclass_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (FooClass, g_object_unref)
+VALA_EXTERN gint fooclass_foov (FooClass* self) G_GNUC_DEPRECATED ;
+VALA_EXTERN gint fooclass_foo (FooClass* self) G_GNUC_DEPRECATED ;
+static gint fooclass_real_foov (FooClass* self) G_GNUC_DEPRECATED ;
+VALA_EXTERN FooClass* fooclass_new (void);
+VALA_EXTERN FooClass* fooclass_construct (GType object_type);
+VALA_EXTERN gint fooclass_get_bar (FooClass* self) G_GNUC_DEPRECATED ;
+VALA_EXTERN void fooclass_set_bar (FooClass* self,
+                       gint value) G_GNUC_DEPRECATED ;
+static void fooclass_finalize (GObject * obj);
+static GType fooclass_get_type_once (void);
+static void _vala_fooclass_get_property (GObject * object,
+                                  guint property_id,
+                                  GValue * value,
+                                  GParamSpec * pspec);
+static void _vala_fooclass_set_property (GObject * object,
+                                  guint property_id,
+                                  const GValue * value,
+                                  GParamSpec * pspec);
+VALA_EXTERN GType afoo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (AFoo, g_object_unref)
+VALA_EXTERN gint afoo_fooa (AFoo* self) G_GNUC_DEPRECATED ;
+VALA_EXTERN gint afoo_foo (AFoo* self) G_GNUC_DEPRECATED ;
+static gint afoo_real_fooa (AFoo* self) G_GNUC_DEPRECATED ;
+VALA_EXTERN AFoo* afoo_construct (GType object_type);
+static GType afoo_get_type_once (void);
+VALA_EXTERN GType ifoo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN gint ifoo_foo (IFoo* self) G_GNUC_DEPRECATED ;
+VALA_EXTERN void ifoo_fooa (IFoo* self) G_GNUC_DEPRECATED ;
+static GType ifoo_get_type_once (void);
+VALA_EXTERN void test_class_property (void);
+VALA_EXTERN GType foo_enum_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN void test_enum (void);
+static void _vala_main (void);
+
+void
+baz (void)
+{
+}
+
+FooStruct*
+foo_struct_dup (const FooStruct* self)
+{
+       FooStruct* dup;
+       dup = g_new0 (FooStruct, 1);
+       memcpy (dup, self, sizeof (FooStruct));
+       return dup;
+}
+
+void
+foo_struct_free (FooStruct* self)
+{
+       g_free (self);
+}
+
+static GType
+foo_struct_get_type_once (void)
+{
+       GType foo_struct_type_id;
+       foo_struct_type_id = g_boxed_type_register_static ("FooStruct", (GBoxedCopyFunc) foo_struct_dup, 
(GBoxedFreeFunc) foo_struct_free);
+       return foo_struct_type_id;
+}
+
+GType
+foo_struct_get_type (void)
+{
+       static volatile gsize foo_struct_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_struct_type_id__volatile)) {
+               GType foo_struct_type_id;
+               foo_struct_type_id = foo_struct_get_type_once ();
+               g_once_init_leave (&foo_struct_type_id__volatile, foo_struct_type_id);
+       }
+       return foo_struct_type_id__volatile;
+}
+
+void
+test_struct_field (void)
+{
+       FooStruct foo = {0};
+       FooStruct _tmp0_ = {0};
+       gint i = 0;
+       FooStruct _tmp1_;
+       FooStruct _tmp2_;
+       _tmp0_.bar = 42;
+       foo = _tmp0_;
+       _tmp1_ = foo;
+       i = _tmp1_.bar;
+       foo.bar = i;
+       _tmp2_ = foo;
+       _vala_assert (_tmp2_.bar == 42, "foo.bar == 42");
+}
+
+static inline gpointer
+fooclass_get_instance_private (FooClass* self)
+{
+       return G_STRUCT_MEMBER_P (self, FooClass_private_offset);
+}
+
+gint
+fooclass_foo (FooClass* self)
+{
+       gint result = 0;
+       g_return_val_if_fail (IS_FOOCLASS (self), 0);
+       result = 42;
+       return result;
+}
+
+static gint
+fooclass_real_foov (FooClass* self)
+{
+       gint result = 0;
+       result = 42;
+       return result;
+}
+
+gint
+fooclass_foov (FooClass* self)
+{
+       FooClassClass* _klass_;
+       g_return_val_if_fail (IS_FOOCLASS (self), 0);
+       _klass_ = FOOCLASS_GET_CLASS (self);
+       if (_klass_->foov) {
+               return _klass_->foov (self);
+       }
+       return -1;
+}
+
+FooClass*
+fooclass_construct (GType object_type)
+{
+       FooClass * self = NULL;
+       self = (FooClass*) g_object_new (object_type, NULL);
+       return self;
+}
+
+FooClass*
+fooclass_new (void)
+{
+       return fooclass_construct (TYPE_FOOCLASS);
+}
+
+gint
+fooclass_get_bar (FooClass* self)
+{
+       gint result;
+       g_return_val_if_fail (IS_FOOCLASS (self), 0);
+       result = self->priv->_bar;
+       return result;
+}
+
+void
+fooclass_set_bar (FooClass* self,
+                  gint value)
+{
+       gint old_value;
+       g_return_if_fail (IS_FOOCLASS (self));
+       old_value = fooclass_get_bar (self);
+       if (old_value != value) {
+               self->priv->_bar = value;
+               g_object_notify_by_pspec ((GObject *) self, fooclass_properties[FOOCLASS_BAR_PROPERTY]);
+       }
+}
+
+static void
+fooclass_class_init (FooClassClass * klass,
+                     gpointer klass_data)
+{
+       fooclass_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &FooClass_private_offset);
+       ((FooClassClass *) klass)->foov = (gint (*) (FooClass*)) fooclass_real_foov;
+       G_OBJECT_CLASS (klass)->get_property = _vala_fooclass_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_fooclass_set_property;
+       G_OBJECT_CLASS (klass)->finalize = fooclass_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOOCLASS_BAR_PROPERTY, 
fooclass_properties[FOOCLASS_BAR_PROPERTY] = g_param_spec_int ("bar", "bar", "bar", G_MININT, G_MAXINT, 42, 
G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_DEPRECATED));
+}
+
+static void
+fooclass_instance_init (FooClass * self,
+                        gpointer klass)
+{
+       self->priv = fooclass_get_instance_private (self);
+       self->priv->_bar = 42;
+}
+
+static void
+fooclass_finalize (GObject * obj)
+{
+       FooClass * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOOCLASS, FooClass);
+       G_OBJECT_CLASS (fooclass_parent_class)->finalize (obj);
+}
+
+static GType
+fooclass_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClassClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) fooclass_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(FooClass), 0, (GInstanceInitFunc) fooclass_instance_init, NULL };
+       GType fooclass_type_id;
+       fooclass_type_id = g_type_register_static (G_TYPE_OBJECT, "FooClass", &g_define_type_info, 0);
+       FooClass_private_offset = g_type_add_instance_private (fooclass_type_id, sizeof (FooClassPrivate));
+       return fooclass_type_id;
+}
+
+GType
+fooclass_get_type (void)
+{
+       static volatile gsize fooclass_type_id__volatile = 0;
+       if (g_once_init_enter (&fooclass_type_id__volatile)) {
+               GType fooclass_type_id;
+               fooclass_type_id = fooclass_get_type_once ();
+               g_once_init_leave (&fooclass_type_id__volatile, fooclass_type_id);
+       }
+       return fooclass_type_id__volatile;
+}
+
+static void
+_vala_fooclass_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec)
+{
+       FooClass * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOOCLASS, FooClass);
+       switch (property_id) {
+               case FOOCLASS_BAR_PROPERTY:
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+               g_value_set_int (value, fooclass_get_bar (self));
+G_GNUC_END_IGNORE_DEPRECATIONS
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_fooclass_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec)
+{
+       FooClass * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOOCLASS, FooClass);
+       switch (property_id) {
+               case FOOCLASS_BAR_PROPERTY:
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+               fooclass_set_bar (self, g_value_get_int (value));
+G_GNUC_END_IGNORE_DEPRECATIONS
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+gint
+afoo_foo (AFoo* self)
+{
+       gint result = 0;
+       g_return_val_if_fail (IS_AFOO (self), 0);
+       result = 42;
+       return result;
+}
+
+static gint
+afoo_real_fooa (AFoo* self)
+{
+       gint _tmp0_ = 0;
+       g_critical ("Type `%s' does not implement abstract method `afoo_fooa'", g_type_name 
(G_TYPE_FROM_INSTANCE (self)));
+       return _tmp0_;
+}
+
+gint
+afoo_fooa (AFoo* self)
+{
+       AFooClass* _klass_;
+       g_return_val_if_fail (IS_AFOO (self), 0);
+       _klass_ = AFOO_GET_CLASS (self);
+       if (_klass_->fooa) {
+               return _klass_->fooa (self);
+       }
+       return -1;
+}
+
+AFoo*
+afoo_construct (GType object_type)
+{
+       AFoo * self = NULL;
+       self = (AFoo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+static void
+afoo_class_init (AFooClass * klass,
+                 gpointer klass_data)
+{
+       afoo_parent_class = g_type_class_peek_parent (klass);
+       ((AFooClass *) klass)->fooa = (gint (*) (AFoo*)) afoo_real_fooa;
+}
+
+static void
+afoo_instance_init (AFoo * self,
+                    gpointer klass)
+{
+}
+
+static GType
+afoo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (AFooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) afoo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (AFoo), 
0, (GInstanceInitFunc) afoo_instance_init, NULL };
+       GType afoo_type_id;
+       afoo_type_id = g_type_register_static (G_TYPE_OBJECT, "AFoo", &g_define_type_info, 
G_TYPE_FLAG_ABSTRACT);
+       return afoo_type_id;
+}
+
+GType
+afoo_get_type (void)
+{
+       static volatile gsize afoo_type_id__volatile = 0;
+       if (g_once_init_enter (&afoo_type_id__volatile)) {
+               GType afoo_type_id;
+               afoo_type_id = afoo_get_type_once ();
+               g_once_init_leave (&afoo_type_id__volatile, afoo_type_id);
+       }
+       return afoo_type_id__volatile;
+}
+
+gint
+ifoo_foo (IFoo* self)
+{
+       gint result = 0;
+       result = 42;
+       return result;
+}
+
+void
+ifoo_fooa (IFoo* self)
+{
+       IFooIface* _iface_;
+       g_return_if_fail (IS_IFOO (self));
+       _iface_ = IFOO_GET_INTERFACE (self);
+       if (_iface_->fooa) {
+               _iface_->fooa (self);
+       }
+}
+
+static void
+ifoo_default_init (IFooIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+ifoo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (IFooIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) ifoo_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType ifoo_type_id;
+       ifoo_type_id = g_type_register_static (G_TYPE_INTERFACE, "IFoo", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (ifoo_type_id, G_TYPE_OBJECT);
+       return ifoo_type_id;
+}
+
+GType
+ifoo_get_type (void)
+{
+       static volatile gsize ifoo_type_id__volatile = 0;
+       if (g_once_init_enter (&ifoo_type_id__volatile)) {
+               GType ifoo_type_id;
+               ifoo_type_id = ifoo_get_type_once ();
+               g_once_init_leave (&ifoo_type_id__volatile, ifoo_type_id);
+       }
+       return ifoo_type_id__volatile;
+}
+
+void
+test_class_property (void)
+{
+       FooClass* foo = NULL;
+       FooClass* _tmp0_;
+       gint i = 0;
+       gint _tmp1_;
+       gint _tmp2_;
+       gint _tmp3_;
+       gint _tmp4_;
+       _tmp0_ = fooclass_new ();
+       foo = _tmp0_;
+       _tmp1_ = fooclass_get_bar (foo);
+       _tmp2_ = _tmp1_;
+       i = _tmp2_;
+       fooclass_set_bar (foo, i);
+       _tmp3_ = fooclass_get_bar (foo);
+       _tmp4_ = _tmp3_;
+       _vala_assert (_tmp4_ == 42, "foo.bar == 42");
+       _g_object_unref0 (foo);
+}
+
+static GType
+foo_enum_get_type_once (void)
+{
+       static const GEnumValue values[] = {{FOO_ENUM_BAR, "FOO_ENUM_BAR", "bar"}, {FOO_ENUM_FOO, 
"FOO_ENUM_FOO", "foo"}, {FOO_ENUM_BAZ, "FOO_ENUM_BAZ", "baz"}, {0, NULL, NULL}};
+       GType foo_enum_type_id;
+       foo_enum_type_id = g_enum_register_static ("FooEnum", values);
+       return foo_enum_type_id;
+}
+
+GType
+foo_enum_get_type (void)
+{
+       static volatile gsize foo_enum_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_enum_type_id__volatile)) {
+               GType foo_enum_type_id;
+               foo_enum_type_id = foo_enum_get_type_once ();
+               g_once_init_leave (&foo_enum_type_id__volatile, foo_enum_type_id);
+       }
+       return foo_enum_type_id__volatile;
+}
+
+void
+test_enum (void)
+{
+       FooEnum foo = 0;
+       foo = FOO_ENUM_BAR;
+       _vala_assert (foo == 0, "foo == 0");
+}
+
+static void
+_vala_main (void)
+{
+       test_class_property ();
+       test_struct_field ();
+       test_enum ();
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/annotations/description.c-expected b/tests/annotations/description.c-expected
new file mode 100644
index 000000000..4dbb7e569
--- /dev/null
+++ b/tests/annotations/description.c-expected
@@ -0,0 +1,303 @@
+/* annotations_description.c generated by valac, the Vala compiler
+ * generated from annotations_description.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_FOO_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+typedef enum  {
+       BAR_FOO
+} Bar;
+
+#define TYPE_BAR (bar_get_type ())
+#define _g_type_class_unref0(var) ((var == NULL) ? NULL : (var = (g_type_class_unref (var), NULL)))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _FooPrivate {
+       gint _foo;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+VALA_EXTERN gint foo_get_foo (Foo* self);
+VALA_EXTERN void foo_set_foo (Foo* self,
+                  gint value);
+static void foo_finalize (GObject * obj);
+static GType foo_get_type_once (void);
+static void _vala_foo_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_foo_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+static void _vala_main (void);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+gint
+foo_get_foo (Foo* self)
+{
+       gint result;
+       g_return_val_if_fail (IS_FOO (self), 0);
+       result = self->priv->_foo;
+       return result;
+}
+
+void
+foo_set_foo (Foo* self,
+             gint value)
+{
+       gint old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_foo (self);
+       if (old_value != value) {
+               self->priv->_foo = value;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_FOO_PROPERTY]);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_foo_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_foo_set_property;
+       G_OBJECT_CLASS (klass)->finalize = foo_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_FOO_PROPERTY, 
foo_properties[FOO_FOO_PROPERTY] = g_param_spec_int ("foo", "foo's nick", "foo's blurb", G_MININT, G_MAXINT, 
0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+}
+
+static void
+foo_finalize (GObject * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       G_OBJECT_CLASS (foo_parent_class)->finalize (obj);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_foo_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_FOO_PROPERTY:
+               g_value_set_int (value, foo_get_foo (self));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_foo_set_property (GObject * object,
+                        guint property_id,
+                        const GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_FOO_PROPERTY:
+               foo_set_foo (self, g_value_get_int (value));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GEnumValue values[] = {{BAR_FOO, "BAR_FOO", "foo's nick"}, {0, NULL, NULL}};
+       GType bar_type_id;
+       bar_type_id = g_enum_register_static ("Bar", values);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       GParamSpec** properties = NULL;
+       Foo* _tmp1_;
+       GObjectClass* _tmp2_;
+       guint _tmp3_ = 0;
+       GParamSpec** _tmp4_;
+       gint properties_length1;
+       gint _properties_size_;
+       GParamSpec** _tmp5_;
+       gint _tmp5__length1;
+       GTypeClass* _tmp12_;
+       GEnumClass* _tmp13_;
+       GEnumValue* _tmp14_;
+       const gchar* _tmp15_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       _tmp1_ = foo;
+       _tmp2_ = G_OBJECT_GET_CLASS (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, G_TYPE_OBJECT, GObject));
+       _tmp4_ = g_object_class_list_properties (_tmp2_, &_tmp3_);
+       properties = _tmp4_;
+       properties_length1 = _tmp3_;
+       _properties_size_ = properties_length1;
+       _tmp5_ = properties;
+       _tmp5__length1 = properties_length1;
+       {
+               GParamSpec** p_collection = NULL;
+               gint p_collection_length1 = 0;
+               gint _p_collection_size_ = 0;
+               gint p_it = 0;
+               p_collection = _tmp5_;
+               p_collection_length1 = _tmp5__length1;
+               for (p_it = 0; p_it < p_collection_length1; p_it = p_it + 1) {
+                       GParamSpec* p = NULL;
+                       p = p_collection[p_it];
+                       {
+                               GParamSpec* _tmp6_;
+                               const gchar* _tmp7_;
+                               GParamSpec* _tmp8_;
+                               const gchar* _tmp9_;
+                               GParamSpec* _tmp10_;
+                               const gchar* _tmp11_;
+                               _tmp6_ = p;
+                               _tmp7_ = g_param_spec_get_name (_tmp6_);
+                               _vala_assert (g_strcmp0 (_tmp7_, "foo") == 0, "p.get_name () == \"foo\"");
+                               _tmp8_ = p;
+                               _tmp9_ = g_param_spec_get_nick (_tmp8_);
+                               _vala_assert (g_strcmp0 (_tmp9_, "foo's nick") == 0, "p.get_nick () == 
\"foo's nick\"");
+                               _tmp10_ = p;
+                               _tmp11_ = g_param_spec_get_blurb (_tmp10_);
+                               _vala_assert (g_strcmp0 (_tmp11_, "foo's blurb") == 0, "p.get_blurb () == 
\"foo's blurb\"");
+                       }
+               }
+       }
+       _tmp12_ = g_type_class_ref (TYPE_BAR);
+       _tmp13_ = (GEnumClass*) _tmp12_;
+       _tmp14_ = g_enum_get_value (g_type_class_ref (TYPE_BAR), BAR_FOO);
+       _tmp15_ = (*g_enum_get_value_by_name (_tmp13_, (_tmp14_ != NULL) ? _tmp14_->value_name : 
NULL)).value_nick;
+       _vala_assert (g_strcmp0 (_tmp15_, "foo's nick") == 0, "((EnumClass) typeof (Bar).class_ref 
()).get_value_by_name (Bar.FOO.to_string ()).value_nick == \"foo's nick\"");
+       _g_type_class_unref0 (_tmp13_);
+       properties = (g_free (properties), NULL);
+       _g_object_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/arrays/cast-struct-boxed-element-access.c-expected 
b/tests/arrays/cast-struct-boxed-element-access.c-expected
new file mode 100644
index 000000000..c9ab958f1
--- /dev/null
+++ b/tests/arrays/cast-struct-boxed-element-access.c-expected
@@ -0,0 +1,824 @@
+/* arrays_cast_struct_boxed_element_access.c generated by valac, the Vala compiler
+ * generated from arrays_cast_struct_boxed_element_access.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+#include <stdlib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+
+#define TYPE_BAR (bar_get_type ())
+typedef struct _Bar Bar;
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       gint i;
+};
+
+struct _Bar {
+       gchar* s;
+};
+
+VALA_EXTERN Foo** foo_array;
+VALA_EXTERN gint foo_array_length1;
+Foo** foo_array = NULL;
+gint foo_array_length1 = 0;
+static gint _foo_array_size_ = 0;
+VALA_EXTERN Bar** bar_array;
+VALA_EXTERN gint bar_array_length1;
+Bar** bar_array = NULL;
+gint bar_array_length1 = 0;
+static gint _bar_array_size_ = 0;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN Foo** foo_array_owned (gint* result_length1);
+VALA_EXTERN Foo** foo_array_unowned (gint* result_length1);
+VALA_EXTERN void test_without_destroy (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Bar* bar_dup (const Bar* self);
+VALA_EXTERN void bar_free (Bar* self);
+VALA_EXTERN void bar_copy (const Bar* self,
+               Bar* dest);
+VALA_EXTERN void bar_destroy (Bar* self);
+VALA_EXTERN Bar** bar_array_owned (gint* result_length1);
+VALA_EXTERN Bar** bar_array_unowned (gint* result_length1);
+VALA_EXTERN void test_with_destroy (void);
+static void _vala_main (void);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       memcpy (dup, self, sizeof (Foo));
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static gpointer
+_foo_dup0 (gpointer self)
+{
+       return self ? foo_dup (self) : NULL;
+}
+
+Foo**
+foo_array_owned (gint* result_length1)
+{
+       Foo _tmp0_ = {0};
+       Foo* _tmp1_;
+       Foo _tmp2_ = {0};
+       Foo* _tmp3_;
+       Foo _tmp4_ = {0};
+       Foo* _tmp5_;
+       Foo** _tmp6_;
+       Foo** _tmp7_;
+       gint _tmp7__length1;
+       Foo** result = NULL;
+       memset (&_tmp0_, 0, sizeof (Foo));
+       _tmp0_.i = 23;
+       _tmp1_ = _foo_dup0 (&_tmp0_);
+       memset (&_tmp2_, 0, sizeof (Foo));
+       _tmp2_.i = 42;
+       _tmp3_ = _foo_dup0 (&_tmp2_);
+       memset (&_tmp4_, 0, sizeof (Foo));
+       _tmp4_.i = 4711;
+       _tmp5_ = _foo_dup0 (&_tmp4_);
+       _tmp6_ = g_new0 (Foo*, 3);
+       _tmp6_[0] = _tmp1_;
+       _tmp6_[1] = _tmp3_;
+       _tmp6_[2] = _tmp5_;
+       _tmp7_ = _tmp6_;
+       _tmp7__length1 = 3;
+       if (result_length1) {
+               *result_length1 = _tmp7__length1;
+       }
+       result = _tmp7_;
+       return result;
+}
+
+Foo**
+foo_array_unowned (gint* result_length1)
+{
+       Foo _tmp0_ = {0};
+       Foo* _tmp1_;
+       Foo _tmp2_ = {0};
+       Foo* _tmp3_;
+       Foo _tmp4_ = {0};
+       Foo* _tmp5_;
+       Foo** _tmp6_;
+       Foo** _tmp7_;
+       gint _tmp7__length1;
+       Foo** _tmp8_;
+       gint _tmp8__length1;
+       Foo** result = NULL;
+       memset (&_tmp0_, 0, sizeof (Foo));
+       _tmp0_.i = 23;
+       _tmp1_ = _foo_dup0 (&_tmp0_);
+       memset (&_tmp2_, 0, sizeof (Foo));
+       _tmp2_.i = 42;
+       _tmp3_ = _foo_dup0 (&_tmp2_);
+       memset (&_tmp4_, 0, sizeof (Foo));
+       _tmp4_.i = 4711;
+       _tmp5_ = _foo_dup0 (&_tmp4_);
+       _tmp6_ = g_new0 (Foo*, 3);
+       _tmp6_[0] = _tmp1_;
+       _tmp6_[1] = _tmp3_;
+       _tmp6_[2] = _tmp5_;
+       foo_array = (_vala_array_free (foo_array, foo_array_length1, (GDestroyNotify) foo_free), NULL);
+       foo_array = _tmp6_;
+       foo_array_length1 = 3;
+       _foo_array_size_ = foo_array_length1;
+       _tmp7_ = foo_array;
+       _tmp7__length1 = foo_array_length1;
+       _tmp8_ = _tmp7_;
+       _tmp8__length1 = _tmp7__length1;
+       if (result_length1) {
+               *result_length1 = _tmp8__length1;
+       }
+       result = _tmp8_;
+       return result;
+}
+
+void
+test_without_destroy (void)
+{
+       {
+               Foo** foo = NULL;
+               Foo _tmp0_ = {0};
+               Foo* _tmp1_;
+               Foo _tmp2_ = {0};
+               Foo* _tmp3_;
+               Foo _tmp4_ = {0};
+               Foo* _tmp5_;
+               Foo** _tmp6_;
+               gint foo_length1;
+               gint _foo_size_;
+               memset (&_tmp0_, 0, sizeof (Foo));
+               _tmp0_.i = 23;
+               _tmp1_ = _foo_dup0 (&_tmp0_);
+               memset (&_tmp2_, 0, sizeof (Foo));
+               _tmp2_.i = 42;
+               _tmp3_ = _foo_dup0 (&_tmp2_);
+               memset (&_tmp4_, 0, sizeof (Foo));
+               _tmp4_.i = 4711;
+               _tmp5_ = _foo_dup0 (&_tmp4_);
+               _tmp6_ = g_new0 (Foo*, 3);
+               _tmp6_[0] = _tmp1_;
+               _tmp6_[1] = _tmp3_;
+               _tmp6_[2] = _tmp5_;
+               foo = _tmp6_;
+               foo_length1 = 3;
+               _foo_size_ = foo_length1;
+               {
+                       Foo f = {0};
+                       Foo* _tmp7_;
+                       Foo _tmp8_;
+                       Foo* _tmp9_;
+                       _tmp7_ = foo[0];
+                       f = *_tmp7_;
+                       _tmp8_ = f;
+                       _vala_assert (_tmp8_.i == 23, "f.i == 23");
+                       _tmp9_ = foo[0];
+                       _vala_assert ((*_tmp9_).i == 23, "foo[0].i == 23");
+               }
+               {
+                       Foo f = {0};
+                       Foo* _tmp10_;
+                       Foo _tmp11_;
+                       Foo* _tmp12_;
+                       _tmp10_ = foo[1];
+                       f = (Foo) (*_tmp10_);
+                       _tmp11_ = f;
+                       _vala_assert (_tmp11_.i == 42, "f.i == 42");
+                       _tmp12_ = foo[1];
+                       _vala_assert ((*_tmp12_).i == 42, "foo[1].i == 42");
+               }
+               {
+                       Foo f = {0};
+                       Foo* _tmp13_;
+                       Foo _tmp14_;
+                       Foo* _tmp15_;
+                       _tmp13_ = foo[2];
+                       f = (Foo) (*_tmp13_);
+                       _tmp14_ = f;
+                       _vala_assert (_tmp14_.i == 4711, "f.i == 4711");
+                       _tmp15_ = foo[2];
+                       _vala_assert ((*_tmp15_).i == 4711, "foo[2].i == 4711");
+               }
+               foo = (_vala_array_free (foo, foo_length1, (GDestroyNotify) foo_free), NULL);
+       }
+       {
+               Foo f = {0};
+               gint _tmp16_ = 0;
+               Foo** _tmp17_;
+               Foo** _tmp18_;
+               gint _tmp18__length1;
+               Foo* _tmp19_;
+               Foo _tmp20_;
+               Foo _tmp21_;
+               _tmp17_ = foo_array_owned (&_tmp16_);
+               _tmp18_ = _tmp17_;
+               _tmp18__length1 = _tmp16_;
+               _tmp19_ = _tmp18_[0];
+               _tmp20_ = *_tmp19_;
+               _tmp18_ = (_vala_array_free (_tmp18_, _tmp18__length1, (GDestroyNotify) foo_free), NULL);
+               f = _tmp20_;
+               _tmp21_ = f;
+               _vala_assert (_tmp21_.i == 23, "f.i == 23");
+       }
+       {
+               Foo f = {0};
+               gint _tmp22_ = 0;
+               Foo** _tmp23_;
+               Foo** _tmp24_;
+               gint _tmp24__length1;
+               Foo* _tmp25_;
+               Foo _tmp26_;
+               Foo _tmp27_;
+               _tmp23_ = foo_array_owned (&_tmp22_);
+               _tmp24_ = _tmp23_;
+               _tmp24__length1 = _tmp22_;
+               _tmp25_ = _tmp24_[1];
+               _tmp26_ = (Foo) (*_tmp25_);
+               _tmp24_ = (_vala_array_free (_tmp24_, _tmp24__length1, (GDestroyNotify) foo_free), NULL);
+               f = _tmp26_;
+               _tmp27_ = f;
+               _vala_assert (_tmp27_.i == 42, "f.i == 42");
+       }
+       {
+               Foo f = {0};
+               gint _tmp28_ = 0;
+               Foo** _tmp29_;
+               Foo** _tmp30_;
+               gint _tmp30__length1;
+               Foo* _tmp31_;
+               Foo _tmp32_;
+               Foo _tmp33_;
+               _tmp29_ = foo_array_owned (&_tmp28_);
+               _tmp30_ = _tmp29_;
+               _tmp30__length1 = _tmp28_;
+               _tmp31_ = _tmp30_[2];
+               _tmp32_ = (Foo) (*_tmp31_);
+               _tmp30_ = (_vala_array_free (_tmp30_, _tmp30__length1, (GDestroyNotify) foo_free), NULL);
+               f = _tmp32_;
+               _tmp33_ = f;
+               _vala_assert (_tmp33_.i == 4711, "f.i == 4711");
+       }
+       {
+               Foo f = {0};
+               gint _tmp34_ = 0;
+               Foo** _tmp35_;
+               Foo* _tmp36_;
+               Foo _tmp37_;
+               _tmp35_ = foo_array_unowned (&_tmp34_);
+               _tmp36_ = _tmp35_[0];
+               f = *_tmp36_;
+               _tmp37_ = f;
+               _vala_assert (_tmp37_.i == 23, "f.i == 23");
+       }
+       {
+               Foo f = {0};
+               gint _tmp38_ = 0;
+               Foo** _tmp39_;
+               Foo* _tmp40_;
+               Foo _tmp41_;
+               _tmp39_ = foo_array_unowned (&_tmp38_);
+               _tmp40_ = _tmp39_[1];
+               f = (Foo) (*_tmp40_);
+               _tmp41_ = f;
+               _vala_assert (_tmp41_.i == 42, "f.i == 42");
+       }
+       {
+               Foo f = {0};
+               gint _tmp42_ = 0;
+               Foo** _tmp43_;
+               Foo* _tmp44_;
+               Foo _tmp45_;
+               _tmp43_ = foo_array_unowned (&_tmp42_);
+               _tmp44_ = _tmp43_[2];
+               f = (Foo) (*_tmp44_);
+               _tmp45_ = f;
+               _vala_assert (_tmp45_.i == 4711, "f.i == 4711");
+       }
+}
+
+void
+bar_copy (const Bar* self,
+          Bar* dest)
+{
+       const gchar* _tmp0_;
+       gchar* _tmp1_;
+       _tmp0_ = (*self).s;
+       _tmp1_ = g_strdup (_tmp0_);
+       _g_free0 ((*dest).s);
+       (*dest).s = _tmp1_;
+}
+
+void
+bar_destroy (Bar* self)
+{
+       _g_free0 ((*self).s);
+}
+
+Bar*
+bar_dup (const Bar* self)
+{
+       Bar* dup;
+       dup = g_new0 (Bar, 1);
+       bar_copy (self, dup);
+       return dup;
+}
+
+void
+bar_free (Bar* self)
+{
+       bar_destroy (self);
+       g_free (self);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       GType bar_type_id;
+       bar_type_id = g_boxed_type_register_static ("Bar", (GBoxedCopyFunc) bar_dup, (GBoxedFreeFunc) 
bar_free);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static gpointer
+_bar_dup0 (gpointer self)
+{
+       return self ? bar_dup (self) : NULL;
+}
+
+Bar**
+bar_array_owned (gint* result_length1)
+{
+       gchar* _tmp0_;
+       Bar _tmp1_ = {0};
+       Bar _tmp2_;
+       Bar* _tmp3_;
+       gchar* _tmp4_;
+       Bar _tmp5_ = {0};
+       Bar _tmp6_;
+       Bar* _tmp7_;
+       gchar* _tmp8_;
+       Bar _tmp9_ = {0};
+       Bar _tmp10_;
+       Bar* _tmp11_;
+       Bar** _tmp12_;
+       Bar** _tmp13_;
+       gint _tmp13__length1;
+       Bar** _tmp14_;
+       gint _tmp14__length1;
+       Bar** result = NULL;
+       _tmp0_ = g_strdup ("foo");
+       memset (&_tmp1_, 0, sizeof (Bar));
+       _g_free0 (_tmp1_.s);
+       _tmp1_.s = _tmp0_;
+       _tmp2_ = _tmp1_;
+       _tmp3_ = _bar_dup0 (&_tmp2_);
+       _tmp4_ = g_strdup ("bar");
+       memset (&_tmp5_, 0, sizeof (Bar));
+       _g_free0 (_tmp5_.s);
+       _tmp5_.s = _tmp4_;
+       _tmp6_ = _tmp5_;
+       _tmp7_ = _bar_dup0 (&_tmp6_);
+       _tmp8_ = g_strdup ("manam");
+       memset (&_tmp9_, 0, sizeof (Bar));
+       _g_free0 (_tmp9_.s);
+       _tmp9_.s = _tmp8_;
+       _tmp10_ = _tmp9_;
+       _tmp11_ = _bar_dup0 (&_tmp10_);
+       _tmp12_ = g_new0 (Bar*, 3);
+       _tmp12_[0] = _tmp3_;
+       _tmp12_[1] = _tmp7_;
+       _tmp12_[2] = _tmp11_;
+       _tmp13_ = _tmp12_;
+       _tmp13__length1 = 3;
+       bar_destroy (&_tmp10_);
+       bar_destroy (&_tmp6_);
+       bar_destroy (&_tmp2_);
+       _tmp14_ = _tmp13_;
+       _tmp14__length1 = _tmp13__length1;
+       if (result_length1) {
+               *result_length1 = _tmp14__length1;
+       }
+       result = _tmp14_;
+       return result;
+}
+
+Bar**
+bar_array_unowned (gint* result_length1)
+{
+       gchar* _tmp0_;
+       Bar _tmp1_ = {0};
+       Bar _tmp2_;
+       Bar* _tmp3_;
+       gchar* _tmp4_;
+       Bar _tmp5_ = {0};
+       Bar _tmp6_;
+       Bar* _tmp7_;
+       gchar* _tmp8_;
+       Bar _tmp9_ = {0};
+       Bar _tmp10_;
+       Bar* _tmp11_;
+       Bar** _tmp12_;
+       Bar** _tmp13_;
+       gint _tmp13__length1;
+       Bar** _tmp14_;
+       gint _tmp14__length1;
+       Bar** result = NULL;
+       _tmp0_ = g_strdup ("foo");
+       memset (&_tmp1_, 0, sizeof (Bar));
+       _g_free0 (_tmp1_.s);
+       _tmp1_.s = _tmp0_;
+       _tmp2_ = _tmp1_;
+       _tmp3_ = _bar_dup0 (&_tmp2_);
+       _tmp4_ = g_strdup ("bar");
+       memset (&_tmp5_, 0, sizeof (Bar));
+       _g_free0 (_tmp5_.s);
+       _tmp5_.s = _tmp4_;
+       _tmp6_ = _tmp5_;
+       _tmp7_ = _bar_dup0 (&_tmp6_);
+       _tmp8_ = g_strdup ("manam");
+       memset (&_tmp9_, 0, sizeof (Bar));
+       _g_free0 (_tmp9_.s);
+       _tmp9_.s = _tmp8_;
+       _tmp10_ = _tmp9_;
+       _tmp11_ = _bar_dup0 (&_tmp10_);
+       _tmp12_ = g_new0 (Bar*, 3);
+       _tmp12_[0] = _tmp3_;
+       _tmp12_[1] = _tmp7_;
+       _tmp12_[2] = _tmp11_;
+       bar_array = (_vala_array_free (bar_array, bar_array_length1, (GDestroyNotify) bar_free), NULL);
+       bar_array = _tmp12_;
+       bar_array_length1 = 3;
+       _bar_array_size_ = bar_array_length1;
+       bar_destroy (&_tmp10_);
+       bar_destroy (&_tmp6_);
+       bar_destroy (&_tmp2_);
+       _tmp13_ = bar_array;
+       _tmp13__length1 = bar_array_length1;
+       _tmp14_ = _tmp13_;
+       _tmp14__length1 = _tmp13__length1;
+       if (result_length1) {
+               *result_length1 = _tmp14__length1;
+       }
+       result = _tmp14_;
+       return result;
+}
+
+void
+test_with_destroy (void)
+{
+       {
+               Bar** bar = NULL;
+               gchar* _tmp0_;
+               Bar _tmp1_ = {0};
+               Bar _tmp2_;
+               Bar* _tmp3_;
+               gchar* _tmp4_;
+               Bar _tmp5_ = {0};
+               Bar _tmp6_;
+               Bar* _tmp7_;
+               gchar* _tmp8_;
+               Bar _tmp9_ = {0};
+               Bar _tmp10_;
+               Bar* _tmp11_;
+               Bar** _tmp12_;
+               Bar** _tmp13_;
+               gint _tmp13__length1;
+               gint bar_length1;
+               gint _bar_size_;
+               _tmp0_ = g_strdup ("foo");
+               memset (&_tmp1_, 0, sizeof (Bar));
+               _g_free0 (_tmp1_.s);
+               _tmp1_.s = _tmp0_;
+               _tmp2_ = _tmp1_;
+               _tmp3_ = _bar_dup0 (&_tmp2_);
+               _tmp4_ = g_strdup ("bar");
+               memset (&_tmp5_, 0, sizeof (Bar));
+               _g_free0 (_tmp5_.s);
+               _tmp5_.s = _tmp4_;
+               _tmp6_ = _tmp5_;
+               _tmp7_ = _bar_dup0 (&_tmp6_);
+               _tmp8_ = g_strdup ("manam");
+               memset (&_tmp9_, 0, sizeof (Bar));
+               _g_free0 (_tmp9_.s);
+               _tmp9_.s = _tmp8_;
+               _tmp10_ = _tmp9_;
+               _tmp11_ = _bar_dup0 (&_tmp10_);
+               _tmp12_ = g_new0 (Bar*, 3);
+               _tmp12_[0] = _tmp3_;
+               _tmp12_[1] = _tmp7_;
+               _tmp12_[2] = _tmp11_;
+               _tmp13_ = _tmp12_;
+               _tmp13__length1 = 3;
+               bar_destroy (&_tmp10_);
+               bar_destroy (&_tmp6_);
+               bar_destroy (&_tmp2_);
+               bar = _tmp13_;
+               bar_length1 = _tmp13__length1;
+               _bar_size_ = bar_length1;
+               {
+                       Bar b = {0};
+                       Bar* _tmp14_;
+                       Bar _tmp15_;
+                       Bar _tmp16_ = {0};
+                       Bar _tmp17_;
+                       const gchar* _tmp18_;
+                       Bar* _tmp19_;
+                       const gchar* _tmp20_;
+                       _tmp14_ = bar[0];
+                       _tmp15_ = *_tmp14_;
+                       bar_copy (&_tmp15_, &_tmp16_);
+                       b = _tmp16_;
+                       _tmp17_ = b;
+                       _tmp18_ = _tmp17_.s;
+                       _vala_assert (g_strcmp0 (_tmp18_, "foo") == 0, "b.s == \"foo\"");
+                       _tmp19_ = bar[0];
+                       _tmp20_ = (*_tmp19_).s;
+                       _vala_assert (g_strcmp0 (_tmp20_, "foo") == 0, "bar[0].s == \"foo\"");
+                       bar_destroy (&b);
+               }
+               {
+                       Bar b = {0};
+                       Bar* _tmp21_;
+                       Bar _tmp22_;
+                       Bar _tmp23_ = {0};
+                       Bar _tmp24_;
+                       const gchar* _tmp25_;
+                       Bar* _tmp26_;
+                       const gchar* _tmp27_;
+                       _tmp21_ = bar[1];
+                       _tmp22_ = (Bar) (*_tmp21_);
+                       bar_copy (&_tmp22_, &_tmp23_);
+                       b = _tmp23_;
+                       _tmp24_ = b;
+                       _tmp25_ = _tmp24_.s;
+                       _vala_assert (g_strcmp0 (_tmp25_, "bar") == 0, "b.s == \"bar\"");
+                       _tmp26_ = bar[1];
+                       _tmp27_ = (*_tmp26_).s;
+                       _vala_assert (g_strcmp0 (_tmp27_, "bar") == 0, "bar[1].s == \"bar\"");
+                       bar_destroy (&b);
+               }
+               {
+                       Bar b = {0};
+                       Bar* _tmp28_;
+                       Bar _tmp29_;
+                       Bar _tmp30_ = {0};
+                       Bar _tmp31_;
+                       const gchar* _tmp32_;
+                       Bar* _tmp33_;
+                       const gchar* _tmp34_;
+                       _tmp28_ = bar[2];
+                       _tmp29_ = (Bar) (*_tmp28_);
+                       bar_copy (&_tmp29_, &_tmp30_);
+                       b = _tmp30_;
+                       _tmp31_ = b;
+                       _tmp32_ = _tmp31_.s;
+                       _vala_assert (g_strcmp0 (_tmp32_, "manam") == 0, "b.s == \"manam\"");
+                       _tmp33_ = bar[2];
+                       _tmp34_ = (*_tmp33_).s;
+                       _vala_assert (g_strcmp0 (_tmp34_, "manam") == 0, "bar[2].s == \"manam\"");
+                       bar_destroy (&b);
+               }
+               bar = (_vala_array_free (bar, bar_length1, (GDestroyNotify) bar_free), NULL);
+       }
+       {
+               Bar b = {0};
+               gint _tmp35_ = 0;
+               Bar** _tmp36_;
+               Bar** _tmp37_;
+               gint _tmp37__length1;
+               Bar* _tmp38_;
+               Bar _tmp39_;
+               Bar _tmp40_ = {0};
+               Bar _tmp41_;
+               Bar _tmp42_;
+               const gchar* _tmp43_;
+               _tmp36_ = bar_array_owned (&_tmp35_);
+               _tmp37_ = _tmp36_;
+               _tmp37__length1 = _tmp35_;
+               _tmp38_ = _tmp37_[0];
+               _tmp39_ = *_tmp38_;
+               bar_copy (&_tmp39_, &_tmp40_);
+               _tmp41_ = _tmp40_;
+               _tmp37_ = (_vala_array_free (_tmp37_, _tmp37__length1, (GDestroyNotify) bar_free), NULL);
+               b = _tmp41_;
+               _tmp42_ = b;
+               _tmp43_ = _tmp42_.s;
+               _vala_assert (g_strcmp0 (_tmp43_, "foo") == 0, "b.s == \"foo\"");
+               bar_destroy (&b);
+       }
+       {
+               Bar b = {0};
+               gint _tmp44_ = 0;
+               Bar** _tmp45_;
+               Bar** _tmp46_;
+               gint _tmp46__length1;
+               Bar* _tmp47_;
+               Bar _tmp48_;
+               Bar _tmp49_ = {0};
+               Bar _tmp50_;
+               Bar _tmp51_;
+               const gchar* _tmp52_;
+               _tmp45_ = bar_array_owned (&_tmp44_);
+               _tmp46_ = _tmp45_;
+               _tmp46__length1 = _tmp44_;
+               _tmp47_ = _tmp46_[1];
+               _tmp48_ = (Bar) (*_tmp47_);
+               bar_copy (&_tmp48_, &_tmp49_);
+               _tmp50_ = _tmp49_;
+               _tmp46_ = (_vala_array_free (_tmp46_, _tmp46__length1, (GDestroyNotify) bar_free), NULL);
+               b = _tmp50_;
+               _tmp51_ = b;
+               _tmp52_ = _tmp51_.s;
+               _vala_assert (g_strcmp0 (_tmp52_, "bar") == 0, "b.s == \"bar\"");
+               bar_destroy (&b);
+       }
+       {
+               Bar b = {0};
+               gint _tmp53_ = 0;
+               Bar** _tmp54_;
+               Bar** _tmp55_;
+               gint _tmp55__length1;
+               Bar* _tmp56_;
+               Bar _tmp57_;
+               Bar _tmp58_ = {0};
+               Bar _tmp59_;
+               Bar _tmp60_;
+               const gchar* _tmp61_;
+               _tmp54_ = bar_array_owned (&_tmp53_);
+               _tmp55_ = _tmp54_;
+               _tmp55__length1 = _tmp53_;
+               _tmp56_ = _tmp55_[2];
+               _tmp57_ = (Bar) (*_tmp56_);
+               bar_copy (&_tmp57_, &_tmp58_);
+               _tmp59_ = _tmp58_;
+               _tmp55_ = (_vala_array_free (_tmp55_, _tmp55__length1, (GDestroyNotify) bar_free), NULL);
+               b = _tmp59_;
+               _tmp60_ = b;
+               _tmp61_ = _tmp60_.s;
+               _vala_assert (g_strcmp0 (_tmp61_, "manam") == 0, "b.s == \"manam\"");
+               bar_destroy (&b);
+       }
+       {
+               Bar b = {0};
+               gint _tmp62_ = 0;
+               Bar** _tmp63_;
+               Bar* _tmp64_;
+               Bar _tmp65_;
+               Bar _tmp66_ = {0};
+               Bar _tmp67_;
+               const gchar* _tmp68_;
+               _tmp63_ = bar_array_unowned (&_tmp62_);
+               _tmp64_ = _tmp63_[0];
+               _tmp65_ = *_tmp64_;
+               bar_copy (&_tmp65_, &_tmp66_);
+               b = _tmp66_;
+               _tmp67_ = b;
+               _tmp68_ = _tmp67_.s;
+               _vala_assert (g_strcmp0 (_tmp68_, "foo") == 0, "b.s == \"foo\"");
+               bar_destroy (&b);
+       }
+       {
+               Bar b = {0};
+               gint _tmp69_ = 0;
+               Bar** _tmp70_;
+               Bar* _tmp71_;
+               Bar _tmp72_;
+               Bar _tmp73_ = {0};
+               Bar _tmp74_;
+               const gchar* _tmp75_;
+               _tmp70_ = bar_array_unowned (&_tmp69_);
+               _tmp71_ = _tmp70_[1];
+               _tmp72_ = (Bar) (*_tmp71_);
+               bar_copy (&_tmp72_, &_tmp73_);
+               b = _tmp73_;
+               _tmp74_ = b;
+               _tmp75_ = _tmp74_.s;
+               _vala_assert (g_strcmp0 (_tmp75_, "bar") == 0, "b.s == \"bar\"");
+               bar_destroy (&b);
+       }
+       {
+               Bar b = {0};
+               gint _tmp76_ = 0;
+               Bar** _tmp77_;
+               Bar* _tmp78_;
+               Bar _tmp79_;
+               Bar _tmp80_ = {0};
+               Bar _tmp81_;
+               const gchar* _tmp82_;
+               _tmp77_ = bar_array_unowned (&_tmp76_);
+               _tmp78_ = _tmp77_[2];
+               _tmp79_ = (Bar) (*_tmp78_);
+               bar_copy (&_tmp79_, &_tmp80_);
+               b = _tmp80_;
+               _tmp81_ = b;
+               _tmp82_ = _tmp81_.s;
+               _vala_assert (g_strcmp0 (_tmp82_, "manam") == 0, "b.s == \"manam\"");
+               bar_destroy (&b);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       test_without_destroy ();
+       test_with_destroy ();
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/arrays/class-field-initializer.c-expected b/tests/arrays/class-field-initializer.c-expected
new file mode 100644
index 000000000..dff1fb667
--- /dev/null
+++ b/tests/arrays/class-field-initializer.c-expected
@@ -0,0 +1,949 @@
+/* arrays_class_field_initializer.c generated by valac, the Vala compiler
+ * generated from arrays_class_field_initializer.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+#include <glib-object.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+typedef struct _ParamSpecBar ParamSpecBar;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _bar_unref0(var) ((var == NULL) ? NULL : (var = (bar_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+       gchar** f;
+       gint f_length1;
+       gint _f_size_;
+       gchar** i;
+       gint i_length1;
+       gint _i_size_;
+       gchar** ia;
+       gint ia_length1;
+       gint _ia_size_;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+struct _Bar {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       BarPrivate * priv;
+       gchar** f;
+       gint f_length1;
+       gint _f_size_;
+};
+
+struct _BarClass {
+       GTypeClass parent_class;
+       void (*finalize) (Bar *self);
+};
+
+struct _ParamSpecBar {
+       GParamSpec parent_instance;
+};
+
+VALA_EXTERN gchar** manam;
+gchar** manam = NULL;
+static gpointer foo_parent_class = NULL;
+VALA_EXTERN gchar** foo_sf;
+VALA_EXTERN gint foo_sf_length1;
+gchar** foo_sf = NULL;
+gint foo_sf_length1 = 0;
+static gint _foo_sf_size_ = 0;
+VALA_EXTERN gchar** foo_si;
+VALA_EXTERN gint foo_si_length1;
+gchar** foo_si = NULL;
+gint foo_si_length1 = 0;
+static gint _foo_si_size_ = 0;
+VALA_EXTERN gchar** foo_sa;
+VALA_EXTERN gint foo_sa_length1;
+gchar** foo_sa = NULL;
+gint foo_sa_length1 = 0;
+static gint _foo_sa_size_ = 0;
+VALA_EXTERN gchar** minim;
+gchar** minim = NULL;
+static gpointer bar_parent_class = NULL;
+VALA_EXTERN gchar** bar_sf;
+VALA_EXTERN gint bar_sf_length1;
+gchar** bar_sf = NULL;
+gint bar_sf_length1 = 0;
+static gint _bar_sf_size_ = 0;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+static gchar** _vala_array_dup1 (gchar** self,
+                          gssize length);
+static gchar** _vala_array_dup2 (gchar** self,
+                          gssize length);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN gpointer bar_ref (gpointer instance);
+VALA_EXTERN void bar_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_bar (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_bar (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_bar (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_bar (const GValue* value);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, bar_unref)
+static gchar** _vala_array_dup3 (gchar** self,
+                          gssize length);
+static gchar** _vala_array_dup4 (gchar** self,
+                          gssize length);
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static void bar_finalize (Bar * obj);
+static GType bar_get_type_once (void);
+static void _vala_main (void);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+static gssize _vala_array_length (gpointer array);
+
+static gchar**
+_vala_array_dup1 (gchar** self,
+                  gssize length)
+{
+       if (length >= 0) {
+               gchar** result;
+               gssize i;
+               result = g_new0 (gchar*, length + 1);
+               for (i = 0; i < length; i++) {
+                       gchar* _tmp0_;
+                       _tmp0_ = g_strdup (self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+static gchar**
+_vala_array_dup2 (gchar** self,
+                  gssize length)
+{
+       if (length >= 0) {
+               gchar** result;
+               gssize i;
+               result = g_new0 (gchar*, length + 1);
+               for (i = 0; i < length; i++) {
+                       gchar* _tmp0_;
+                       _tmp0_ = g_strdup (self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       gchar** _tmp0_;
+       gint _tmp0__length1;
+       gchar** _tmp1_;
+       gint _tmp1__length1;
+       gchar* _tmp2_;
+       gchar* _tmp3_;
+       gchar* _tmp4_;
+       gchar** _tmp5_;
+       gchar* _tmp6_;
+       gchar** _tmp7_;
+       gint _tmp7__length1;
+       const gchar* _tmp8_;
+       gchar* _tmp9_;
+       gchar* _tmp10_;
+       gchar** _tmp11_;
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       _tmp0_ = manam;
+       _tmp0__length1 = _vala_array_length (manam);
+       _tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup2 (_tmp0_, _tmp0__length1) : _tmp0_;
+       _tmp1__length1 = _tmp0__length1;
+       foo_sf = _tmp1_;
+       foo_sf_length1 = _tmp1__length1;
+       _tmp2_ = g_strdup ("baz");
+       _tmp3_ = g_strdup ("foo");
+       _tmp4_ = g_strdup ("bar");
+       _tmp5_ = g_new0 (gchar*, 3 + 1);
+       _tmp5_[0] = _tmp2_;
+       _tmp5_[1] = _tmp3_;
+       _tmp5_[2] = _tmp4_;
+       foo_si = _tmp5_;
+       foo_si_length1 = 3;
+       _tmp6_ = g_strdup ("baz");
+       _tmp7_ = manam;
+       _tmp7__length1 = _vala_array_length (manam);
+       _tmp8_ = _tmp7_[0];
+       _tmp9_ = g_strdup (_tmp8_);
+       _tmp10_ = g_strdup ("bar");
+       _tmp11_ = g_new0 (gchar*, 3 + 1);
+       _tmp11_[0] = _tmp6_;
+       _tmp11_[1] = _tmp9_;
+       _tmp11_[2] = _tmp10_;
+       foo_sa = _tmp11_;
+       foo_sa_length1 = 3;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       gchar** _tmp0_;
+       gint _tmp0__length1;
+       gchar** _tmp1_;
+       gint _tmp1__length1;
+       gchar* _tmp2_;
+       gchar* _tmp3_;
+       gchar* _tmp4_;
+       gchar** _tmp5_;
+       gchar* _tmp6_;
+       gchar** _tmp7_;
+       gint _tmp7__length1;
+       const gchar* _tmp8_;
+       gchar* _tmp9_;
+       gchar* _tmp10_;
+       gchar** _tmp11_;
+       _tmp0_ = manam;
+       _tmp0__length1 = _vala_array_length (manam);
+       _tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup1 (_tmp0_, _tmp0__length1) : _tmp0_;
+       _tmp1__length1 = _tmp0__length1;
+       self->f = _tmp1_;
+       self->f_length1 = _tmp1__length1;
+       self->_f_size_ = self->f_length1;
+       _tmp2_ = g_strdup ("baz");
+       _tmp3_ = g_strdup ("foo");
+       _tmp4_ = g_strdup ("bar");
+       _tmp5_ = g_new0 (gchar*, 3 + 1);
+       _tmp5_[0] = _tmp2_;
+       _tmp5_[1] = _tmp3_;
+       _tmp5_[2] = _tmp4_;
+       self->i = _tmp5_;
+       self->i_length1 = 3;
+       self->_i_size_ = self->i_length1;
+       _tmp6_ = g_strdup ("baz");
+       _tmp7_ = manam;
+       _tmp7__length1 = _vala_array_length (manam);
+       _tmp8_ = _tmp7_[0];
+       _tmp9_ = g_strdup (_tmp8_);
+       _tmp10_ = g_strdup ("bar");
+       _tmp11_ = g_new0 (gchar*, 3 + 1);
+       _tmp11_[0] = _tmp6_;
+       _tmp11_[1] = _tmp9_;
+       _tmp11_[2] = _tmp10_;
+       self->ia = _tmp11_;
+       self->ia_length1 = 3;
+       self->_ia_size_ = self->ia_length1;
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+       self->f = (_vala_array_free (self->f, self->f_length1, (GDestroyNotify) g_free), NULL);
+       self->i = (_vala_array_free (self->i, self->i_length1, (GDestroyNotify) g_free), NULL);
+       self->ia = (_vala_array_free (self->ia, self->ia_length1, (GDestroyNotify) g_free), NULL);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static gchar**
+_vala_array_dup3 (gchar** self,
+                  gssize length)
+{
+       if (length >= 0) {
+               gchar** result;
+               gssize i;
+               result = g_new0 (gchar*, length + 1);
+               for (i = 0; i < length; i++) {
+                       gchar* _tmp0_;
+                       _tmp0_ = g_strdup (self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+static gchar**
+_vala_array_dup4 (gchar** self,
+                  gssize length)
+{
+       if (length >= 0) {
+               gchar** result;
+               gssize i;
+               result = g_new0 (gchar*, length + 1);
+               for (i = 0; i < length; i++) {
+                       gchar* _tmp0_;
+                       _tmp0_ = g_strdup (self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar* self = NULL;
+       self = (Bar*) g_type_create_instance (object_type);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+value_bar_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_bar_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               bar_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_bar_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = bar_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_bar_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_bar_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Bar * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = bar_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_bar_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Bar ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = bar_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_bar (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecBar* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_BAR), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_bar (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_bar (GValue* value,
+               gpointer v_object)
+{
+       Bar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               bar_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_unref (old);
+       }
+}
+
+void
+value_take_bar (GValue* value,
+                gpointer v_object)
+{
+       Bar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_unref (old);
+       }
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       gchar** _tmp0_;
+       gint _tmp0__length1;
+       gchar** _tmp1_;
+       gint _tmp1__length1;
+       bar_parent_class = g_type_class_peek_parent (klass);
+       ((BarClass *) klass)->finalize = bar_finalize;
+       _tmp0_ = minim;
+       _tmp0__length1 = -1;
+       _tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup4 (_tmp0_, _tmp0__length1) : _tmp0_;
+       _tmp1__length1 = _tmp0__length1;
+       bar_sf = _tmp1_;
+       bar_sf_length1 = _tmp1__length1;
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+       gchar** _tmp0_;
+       gint _tmp0__length1;
+       gchar** _tmp1_;
+       gint _tmp1__length1;
+       _tmp0_ = minim;
+       _tmp0__length1 = -1;
+       _tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup3 (_tmp0_, _tmp0__length1) : _tmp0_;
+       _tmp1__length1 = _tmp0__length1;
+       self->f = _tmp1_;
+       self->f_length1 = _tmp1__length1;
+       self->_f_size_ = self->f_length1;
+       self->ref_count = 1;
+}
+
+static void
+bar_finalize (Bar * obj)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       g_signal_handlers_destroy (self);
+       self->f = (_vala_array_free (self->f, self->f_length1, (GDestroyNotify) g_free), NULL);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_bar_init, value_bar_free_value, 
value_bar_copy_value, value_bar_peek_pointer, "p", value_bar_collect_value, "p", value_bar_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType bar_type_id;
+       bar_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Bar", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+gpointer
+bar_ref (gpointer instance)
+{
+       Bar * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+bar_unref (gpointer instance)
+{
+       Bar * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               BAR_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       {
+               gchar* _tmp0_;
+               gchar* _tmp1_;
+               gchar* _tmp2_;
+               gchar** _tmp3_;
+               gchar** _tmp4_;
+               gint _tmp4__length1;
+               Foo* foo = NULL;
+               Foo* _tmp5_;
+               gchar** _tmp6_;
+               gint _tmp6__length1;
+               gchar** _tmp7_;
+               gint _tmp7__length1;
+               const gchar* _tmp8_;
+               gchar** _tmp9_;
+               gint _tmp9__length1;
+               gchar** _tmp10_;
+               gint _tmp10__length1;
+               const gchar* _tmp11_;
+               gchar** _tmp12_;
+               gint _tmp12__length1;
+               gchar** _tmp13_;
+               gint _tmp13__length1;
+               gchar** _tmp14_;
+               gint _tmp14__length1;
+               const gchar* _tmp15_;
+               gchar** _tmp16_;
+               gint _tmp16__length1;
+               gchar** _tmp17_;
+               gint _tmp17__length1;
+               gchar** _tmp18_;
+               gint _tmp18__length1;
+               const gchar* _tmp19_;
+               _tmp0_ = g_strdup ("manam");
+               _tmp1_ = g_strdup ("foo");
+               _tmp2_ = g_strdup ("bar");
+               _tmp3_ = g_new0 (gchar*, 3 + 1);
+               _tmp3_[0] = _tmp0_;
+               _tmp3_[1] = _tmp1_;
+               _tmp3_[2] = _tmp2_;
+               manam = (_vala_array_free (manam, _vala_array_length (manam), (GDestroyNotify) g_free), NULL);
+               manam = _tmp3_;
+               _tmp4_ = manam;
+               _tmp4__length1 = _vala_array_length (manam);
+               _vala_assert (_tmp4__length1 == 3, "manam.length == 3");
+               _tmp5_ = foo_new ();
+               foo = _tmp5_;
+               _tmp6_ = foo->f;
+               _tmp6__length1 = foo->f_length1;
+               _vala_assert (_tmp6__length1 == 3, "foo.f.length == 3");
+               _tmp7_ = foo->f;
+               _tmp7__length1 = foo->f_length1;
+               _tmp8_ = _tmp7_[0];
+               _vala_assert (g_strcmp0 (_tmp8_, "manam") == 0, "foo.f[0] == \"manam\"");
+               _tmp9_ = foo_sf;
+               _tmp9__length1 = foo_sf_length1;
+               _vala_assert (_tmp9__length1 == 3, "Foo.sf.length == 3");
+               _tmp10_ = foo_sf;
+               _tmp10__length1 = foo_sf_length1;
+               _tmp11_ = _tmp10_[0];
+               _vala_assert (g_strcmp0 (_tmp11_, "manam") == 0, "Foo.sf[0] == \"manam\"");
+               _tmp12_ = foo->i;
+               _tmp12__length1 = foo->i_length1;
+               _vala_assert (_tmp12__length1 == 3, "foo.i.length == 3");
+               _tmp13_ = foo->ia;
+               _tmp13__length1 = foo->ia_length1;
+               _vala_assert (_tmp13__length1 == 3, "foo.ia.length == 3");
+               _tmp14_ = foo->ia;
+               _tmp14__length1 = foo->ia_length1;
+               _tmp15_ = _tmp14_[1];
+               _vala_assert (g_strcmp0 (_tmp15_, "manam") == 0, "foo.ia[1] == \"manam\"");
+               _tmp16_ = foo_si;
+               _tmp16__length1 = foo_si_length1;
+               _vala_assert (_tmp16__length1 == 3, "Foo.si.length == 3");
+               _tmp17_ = foo_sa;
+               _tmp17__length1 = foo_sa_length1;
+               _vala_assert (_tmp17__length1 == 3, "Foo.sa.length == 3");
+               _tmp18_ = foo_sa;
+               _tmp18__length1 = foo_sa_length1;
+               _tmp19_ = _tmp18_[1];
+               _vala_assert (g_strcmp0 (_tmp19_, "manam") == 0, "Foo.sa[1] == \"manam\"");
+               _foo_unref0 (foo);
+       }
+       {
+               gchar* _tmp20_;
+               gchar* _tmp21_;
+               gchar* _tmp22_;
+               gchar** _tmp23_;
+               gchar** _tmp24_;
+               gint _tmp24__length1;
+               Bar* bar = NULL;
+               Bar* _tmp25_;
+               gchar** _tmp26_;
+               gint _tmp26__length1;
+               gchar** _tmp27_;
+               gint _tmp27__length1;
+               _tmp20_ = g_strdup ("minim");
+               _tmp21_ = g_strdup ("foo");
+               _tmp22_ = g_strdup ("bar");
+               _tmp23_ = g_new0 (gchar*, 3 + 1);
+               _tmp23_[0] = _tmp20_;
+               _tmp23_[1] = _tmp21_;
+               _tmp23_[2] = _tmp22_;
+               minim = (g_free (minim), NULL);
+               minim = _tmp23_;
+               _tmp24_ = minim;
+               _tmp24__length1 = -1;
+               _vala_assert (_tmp24__length1 == -1, "minim.length == -1");
+               _tmp25_ = bar_new ();
+               bar = _tmp25_;
+               _tmp26_ = bar->f;
+               _tmp26__length1 = bar->f_length1;
+               _vala_assert (_tmp26__length1 == -1, "bar.f.length == -1");
+               _tmp27_ = bar_sf;
+               _tmp27__length1 = bar_sf_length1;
+               _vala_assert (_tmp27__length1 == -1, "Bar.sf.length == -1");
+               _bar_unref0 (bar);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
+static gssize
+_vala_array_length (gpointer array)
+{
+       gssize length;
+       length = 0;
+       if (array) {
+               while (((gpointer*) array)[length]) {
+                       length++;
+               }
+       }
+       return length;
+}
+
diff --git a/tests/arrays/class-field-length-cname.c-expected 
b/tests/arrays/class-field-length-cname.c-expected
new file mode 100644
index 000000000..3fc4107e9
--- /dev/null
+++ b/tests/arrays/class-field-length-cname.c-expected
@@ -0,0 +1,320 @@
+/* arrays_class_field_length_cname.c generated by valac, the Vala compiler
+ * generated from arrays_class_field_length_cname.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+typedef struct _ParamSpecBar ParamSpecBar;
+#define _bar_unref0(var) ((var == NULL) ? NULL : (var = (bar_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Bar {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       BarPrivate * priv;
+       gint* foo;
+       gint foo_len;
+       gint _foo_size_;
+       gint foo_length1;
+};
+
+struct _BarClass {
+       GTypeClass parent_class;
+       void (*finalize) (Bar *self);
+};
+
+struct _ParamSpecBar {
+       GParamSpec parent_instance;
+};
+
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN gpointer bar_ref (gpointer instance);
+VALA_EXTERN void bar_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_bar (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_bar (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_bar (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_bar (const GValue* value);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, bar_unref)
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static void bar_finalize (Bar * obj);
+static GType bar_get_type_once (void);
+static void _vala_main (void);
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar* self = NULL;
+       self = (Bar*) g_type_create_instance (object_type);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+value_bar_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_bar_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               bar_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_bar_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = bar_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_bar_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_bar_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Bar * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = bar_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_bar_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Bar ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = bar_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_bar (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecBar* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_BAR), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_bar (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_bar (GValue* value,
+               gpointer v_object)
+{
+       Bar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               bar_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_unref (old);
+       }
+}
+
+void
+value_take_bar (GValue* value,
+                gpointer v_object)
+{
+       Bar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_unref (old);
+       }
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       ((BarClass *) klass)->finalize = bar_finalize;
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+bar_finalize (Bar * obj)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       g_signal_handlers_destroy (self);
+       self->foo = (g_free (self->foo), NULL);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_bar_init, value_bar_free_value, 
value_bar_copy_value, value_bar_peek_pointer, "p", value_bar_collect_value, "p", value_bar_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType bar_type_id;
+       bar_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Bar", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+gpointer
+bar_ref (gpointer instance)
+{
+       Bar * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+bar_unref (gpointer instance)
+{
+       Bar * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               BAR_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Bar* bar = NULL;
+       Bar* _tmp0_;
+       gint* _tmp1_;
+       gint* _tmp2_;
+       gint _tmp2__length1;
+       _tmp0_ = bar_new ();
+       bar = _tmp0_;
+       _tmp1_ = g_new0 (gint, 2);
+       _tmp1_[0] = 23;
+       _tmp1_[1] = 42;
+       bar->foo = (g_free (bar->foo), NULL);
+       bar->foo = _tmp1_;
+       bar->foo_len = 2;
+       bar->_foo_size_ = bar->foo_len;
+       _tmp2_ = bar->foo;
+       _tmp2__length1 = bar->foo_len;
+       _vala_assert (_tmp2__length1 == 2, "bar.foo.length == 2");
+       _bar_unref0 (bar);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/arrays/constant-element-access.c-expected b/tests/arrays/constant-element-access.c-expected
new file mode 100644
index 000000000..7fd70f27b
--- /dev/null
+++ b/tests/arrays/constant-element-access.c-expected
@@ -0,0 +1,179 @@
+/* arrays_constant_element_access.c generated by valac, the Vala compiler
+ * generated from arrays_constant_element_access.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (void);
+
+const gchar* FOO[3][3] = {{"00", "01", "02"}, {"10", "11", "12"}, {"20", "21", "22"}};
+
+static void
+_vala_main (void)
+{
+       static const gchar* BAR[3][3] = {{"00", "01", "02"}, {"10", "11", "12"}, {"20", "21", "22"}};
+       const gchar* _tmp24_;
+       gchar* _tmp25_;
+       gchar* _tmp26_;
+       const gchar* _tmp27_;
+       gchar* _tmp28_;
+       gchar* _tmp29_;
+       const gchar* _tmp30_;
+       gchar* _tmp31_;
+       gchar* _tmp32_;
+       const gchar* _tmp33_;
+       gchar* _tmp34_;
+       gchar* _tmp35_;
+       const gchar* _tmp36_;
+       gchar* _tmp37_;
+       gchar* _tmp38_;
+       const gchar* _tmp39_;
+       gchar* _tmp40_;
+       gchar* _tmp41_;
+       {
+               gint i = 0;
+               i = 0;
+               {
+                       gboolean _tmp0_ = FALSE;
+                       _tmp0_ = TRUE;
+                       while (TRUE) {
+                               gint _tmp2_;
+                               const gchar* _tmp3_;
+                               gchar* _tmp4_;
+                               gchar* _tmp5_;
+                               const gchar* _tmp6_;
+                               gchar* _tmp7_;
+                               gchar* _tmp8_;
+                               const gchar* _tmp9_;
+                               gchar* _tmp10_;
+                               gchar* _tmp11_;
+                               if (!_tmp0_) {
+                                       gint _tmp1_;
+                                       _tmp1_ = i;
+                                       i = _tmp1_ + 1;
+                               }
+                               _tmp0_ = FALSE;
+                               _tmp2_ = G_N_ELEMENTS (FOO);
+                               if (!(i < _tmp2_)) {
+                                       break;
+                               }
+                               _tmp3_ = FOO[i][0];
+                               _tmp4_ = g_strdup_printf ("%d%d", i, 0);
+                               _tmp5_ = _tmp4_;
+                               _vala_assert (g_strcmp0 (_tmp3_, _tmp5_) == 0, "FOO[i,0] == \"%d%d\".printf 
(i, 0)");
+                               _g_free0 (_tmp5_);
+                               _tmp6_ = FOO[i][1];
+                               _tmp7_ = g_strdup_printf ("%d%d", i, 1);
+                               _tmp8_ = _tmp7_;
+                               _vala_assert (g_strcmp0 (_tmp6_, _tmp8_) == 0, "FOO[i,1] == \"%d%d\".printf 
(i, 1)");
+                               _g_free0 (_tmp8_);
+                               _tmp9_ = FOO[i][2];
+                               _tmp10_ = g_strdup_printf ("%d%d", i, 2);
+                               _tmp11_ = _tmp10_;
+                               _vala_assert (g_strcmp0 (_tmp9_, _tmp11_) == 0, "FOO[i,2] == \"%d%d\".printf 
(i, 2)");
+                               _g_free0 (_tmp11_);
+                       }
+               }
+       }
+       {
+               gint i = 0;
+               i = 0;
+               {
+                       gboolean _tmp12_ = FALSE;
+                       _tmp12_ = TRUE;
+                       while (TRUE) {
+                               gint _tmp14_;
+                               const gchar* _tmp15_;
+                               gchar* _tmp16_;
+                               gchar* _tmp17_;
+                               const gchar* _tmp18_;
+                               gchar* _tmp19_;
+                               gchar* _tmp20_;
+                               const gchar* _tmp21_;
+                               gchar* _tmp22_;
+                               gchar* _tmp23_;
+                               if (!_tmp12_) {
+                                       gint _tmp13_;
+                                       _tmp13_ = i;
+                                       i = _tmp13_ + 1;
+                               }
+                               _tmp12_ = FALSE;
+                               _tmp14_ = G_N_ELEMENTS (BAR);
+                               if (!(i < _tmp14_)) {
+                                       break;
+                               }
+                               _tmp15_ = BAR[i][0];
+                               _tmp16_ = g_strdup_printf ("%d%d", i, 0);
+                               _tmp17_ = _tmp16_;
+                               _vala_assert (g_strcmp0 (_tmp15_, _tmp17_) == 0, "BAR[i,0] == \"%d%d\".printf 
(i, 0)");
+                               _g_free0 (_tmp17_);
+                               _tmp18_ = BAR[i][1];
+                               _tmp19_ = g_strdup_printf ("%d%d", i, 1);
+                               _tmp20_ = _tmp19_;
+                               _vala_assert (g_strcmp0 (_tmp18_, _tmp20_) == 0, "BAR[i,1] == \"%d%d\".printf 
(i, 1)");
+                               _g_free0 (_tmp20_);
+                               _tmp21_ = BAR[i][2];
+                               _tmp22_ = g_strdup_printf ("%d%d", i, 2);
+                               _tmp23_ = _tmp22_;
+                               _vala_assert (g_strcmp0 (_tmp21_, _tmp23_) == 0, "BAR[i,2] == \"%d%d\".printf 
(i, 2)");
+                               _g_free0 (_tmp23_);
+                       }
+               }
+       }
+       _tmp24_ = FOO[0][0];
+       _tmp25_ = g_strdup_printf ("%d%d", 0, 0);
+       _tmp26_ = _tmp25_;
+       _vala_assert (g_strcmp0 (_tmp24_, _tmp26_) == 0, "FOO[0,0] == \"%d%d\".printf (0, 0)");
+       _g_free0 (_tmp26_);
+       _tmp27_ = FOO[1][1];
+       _tmp28_ = g_strdup_printf ("%d%d", 1, 1);
+       _tmp29_ = _tmp28_;
+       _vala_assert (g_strcmp0 (_tmp27_, _tmp29_) == 0, "FOO[1,1] == \"%d%d\".printf (1, 1)");
+       _g_free0 (_tmp29_);
+       _tmp30_ = FOO[2][2];
+       _tmp31_ = g_strdup_printf ("%d%d", 2, 2);
+       _tmp32_ = _tmp31_;
+       _vala_assert (g_strcmp0 (_tmp30_, _tmp32_) == 0, "FOO[2,2] == \"%d%d\".printf (2, 2)");
+       _g_free0 (_tmp32_);
+       _tmp33_ = BAR[0][0];
+       _tmp34_ = g_strdup_printf ("%d%d", 0, 0);
+       _tmp35_ = _tmp34_;
+       _vala_assert (g_strcmp0 (_tmp33_, _tmp35_) == 0, "BAR[0,0] == \"%d%d\".printf (0, 0)");
+       _g_free0 (_tmp35_);
+       _tmp36_ = BAR[1][1];
+       _tmp37_ = g_strdup_printf ("%d%d", 1, 1);
+       _tmp38_ = _tmp37_;
+       _vala_assert (g_strcmp0 (_tmp36_, _tmp38_) == 0, "BAR[1,1] == \"%d%d\".printf (1, 1)");
+       _g_free0 (_tmp38_);
+       _tmp39_ = BAR[2][2];
+       _tmp40_ = g_strdup_printf ("%d%d", 2, 2);
+       _tmp41_ = _tmp40_;
+       _vala_assert (g_strcmp0 (_tmp39_, _tmp41_) == 0, "BAR[2,2] == \"%d%d\".printf (2, 2)");
+       _g_free0 (_tmp41_);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/arrays/empty-length-0.c-expected b/tests/arrays/empty-length-0.c-expected
new file mode 100644
index 000000000..e4337efa0
--- /dev/null
+++ b/tests/arrays/empty-length-0.c-expected
@@ -0,0 +1,420 @@
+/* arrays_empty_length_0.c generated by valac, the Vala compiler
+ * generated from arrays_empty_length_0.vala, do not modify */
+
+#include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_MANAM (manam_get_type ())
+typedef struct _Manam Manam;
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Manam {
+       gchar* s;
+};
+
+VALA_EXTERN gchar** foo;
+VALA_EXTERN gint foo_length1;
+gchar** foo = NULL;
+gint foo_length1 = 0;
+static gint _foo_size_ = 0;
+VALA_EXTERN gint* bar;
+VALA_EXTERN gint bar_length1;
+gint* bar = NULL;
+gint bar_length1 = 0;
+static gint _bar_size_ = 0;
+VALA_EXTERN Manam* manam;
+VALA_EXTERN gint manam_length1;
+Manam* manam = NULL;
+gint manam_length1 = 0;
+static gint _manam_size_ = 0;
+
+VALA_EXTERN GType manam_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Manam* manam_dup (const Manam* self);
+VALA_EXTERN void manam_free (Manam* self);
+VALA_EXTERN void manam_copy (const Manam* self,
+                 Manam* dest);
+VALA_EXTERN void manam_destroy (Manam* self);
+VALA_EXTERN gchar** get_foo (gint* result_length1);
+static gchar** _vala_array_dup1 (gchar** self,
+                          gssize length);
+VALA_EXTERN gint* get_bar (gint* result_length1);
+static gint* _vala_array_dup2 (gint* self,
+                        gssize length);
+VALA_EXTERN Manam* get_manam (gint* result_length1);
+static Manam* _vala_array_dup3 (Manam* self,
+                         gssize length);
+static void _vala_main (void);
+static void _vala_Manam_array_free (Manam * array,
+                             gssize array_length);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+static inline gpointer _vala_memdup2 (gconstpointer mem,
+                        gsize byte_size);
+
+void
+manam_copy (const Manam* self,
+            Manam* dest)
+{
+       const gchar* _tmp0_;
+       gchar* _tmp1_;
+       _tmp0_ = (*self).s;
+       _tmp1_ = g_strdup (_tmp0_);
+       _g_free0 ((*dest).s);
+       (*dest).s = _tmp1_;
+}
+
+void
+manam_destroy (Manam* self)
+{
+       _g_free0 ((*self).s);
+}
+
+Manam*
+manam_dup (const Manam* self)
+{
+       Manam* dup;
+       dup = g_new0 (Manam, 1);
+       manam_copy (self, dup);
+       return dup;
+}
+
+void
+manam_free (Manam* self)
+{
+       manam_destroy (self);
+       g_free (self);
+}
+
+static GType
+manam_get_type_once (void)
+{
+       GType manam_type_id;
+       manam_type_id = g_boxed_type_register_static ("Manam", (GBoxedCopyFunc) manam_dup, (GBoxedFreeFunc) 
manam_free);
+       return manam_type_id;
+}
+
+GType
+manam_get_type (void)
+{
+       static volatile gsize manam_type_id__volatile = 0;
+       if (g_once_init_enter (&manam_type_id__volatile)) {
+               GType manam_type_id;
+               manam_type_id = manam_get_type_once ();
+               g_once_init_leave (&manam_type_id__volatile, manam_type_id);
+       }
+       return manam_type_id__volatile;
+}
+
+static gchar**
+_vala_array_dup1 (gchar** self,
+                  gssize length)
+{
+       if (length >= 0) {
+               gchar** result;
+               gssize i;
+               result = g_new0 (gchar*, length + 1);
+               for (i = 0; i < length; i++) {
+                       gchar* _tmp0_;
+                       _tmp0_ = g_strdup (self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+gchar**
+get_foo (gint* result_length1)
+{
+       gchar** _tmp0_;
+       gint _tmp0__length1;
+       gchar** _tmp1_;
+       gint _tmp1__length1;
+       gchar** _tmp2_;
+       gint _tmp2__length1;
+       gchar** result = NULL;
+       _tmp0_ = foo;
+       _tmp0__length1 = foo_length1;
+       _tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup1 (_tmp0_, _tmp0__length1) : _tmp0_;
+       _tmp1__length1 = _tmp0__length1;
+       _tmp2_ = _tmp1_;
+       _tmp2__length1 = _tmp1__length1;
+       if (result_length1) {
+               *result_length1 = _tmp2__length1;
+       }
+       result = _tmp2_;
+       return result;
+}
+
+static gint*
+_vala_array_dup2 (gint* self,
+                  gssize length)
+{
+       if (length > 0) {
+               return _vala_memdup2 (self, length * sizeof (gint));
+       }
+       return NULL;
+}
+
+gint*
+get_bar (gint* result_length1)
+{
+       gint* _tmp0_;
+       gint _tmp0__length1;
+       gint* _tmp1_;
+       gint _tmp1__length1;
+       gint* _tmp2_;
+       gint _tmp2__length1;
+       gint* result = NULL;
+       _tmp0_ = bar;
+       _tmp0__length1 = bar_length1;
+       _tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup2 (_tmp0_, _tmp0__length1) : _tmp0_;
+       _tmp1__length1 = _tmp0__length1;
+       _tmp2_ = _tmp1_;
+       _tmp2__length1 = _tmp1__length1;
+       if (result_length1) {
+               *result_length1 = _tmp2__length1;
+       }
+       result = _tmp2_;
+       return result;
+}
+
+static Manam*
+_vala_array_dup3 (Manam* self,
+                  gssize length)
+{
+       if (length > 0) {
+               Manam* result;
+               gssize i;
+               result = g_new0 (Manam, length);
+               for (i = 0; i < length; i++) {
+                       Manam _tmp0_;
+                       Manam _tmp1_ = {0};
+                       _tmp0_ = self[i];
+                       manam_copy (&_tmp0_, &_tmp1_);
+                       result[i] = _tmp1_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+Manam*
+get_manam (gint* result_length1)
+{
+       Manam* _tmp0_;
+       gint _tmp0__length1;
+       Manam* _tmp1_;
+       gint _tmp1__length1;
+       Manam* _tmp2_;
+       gint _tmp2__length1;
+       Manam* result = NULL;
+       _tmp0_ = manam;
+       _tmp0__length1 = manam_length1;
+       _tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup3 (_tmp0_, _tmp0__length1) : _tmp0_;
+       _tmp1__length1 = _tmp0__length1;
+       _tmp2_ = _tmp1_;
+       _tmp2__length1 = _tmp1__length1;
+       if (result_length1) {
+               *result_length1 = _tmp2__length1;
+       }
+       result = _tmp2_;
+       return result;
+}
+
+static void
+_vala_Manam_array_free (Manam * array,
+                        gssize array_length)
+{
+       if (array != NULL) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       manam_destroy (&array[i]);
+               }
+       }
+       g_free (array);
+}
+
+static void
+_vala_main (void)
+{
+       {
+               gchar** _tmp0_;
+               gchar** _tmp1_;
+               gint _tmp1__length1;
+               gint _tmp2_ = 0;
+               gchar** _tmp3_;
+               gchar** _tmp4_;
+               gint _tmp4__length1;
+               _tmp0_ = g_new0 (gchar*, 0 + 1);
+               foo = (_vala_array_free (foo, foo_length1, (GDestroyNotify) g_free), NULL);
+               foo = _tmp0_;
+               foo_length1 = 0;
+               _foo_size_ = foo_length1;
+               _tmp1_ = foo;
+               _tmp1__length1 = foo_length1;
+               _vala_assert (_tmp1_ != NULL, "foo != null");
+               _tmp3_ = get_foo (&_tmp2_);
+               _tmp4_ = _tmp3_;
+               _tmp4__length1 = _tmp2_;
+               _vala_assert (_tmp4_ != NULL, "get_foo () != null");
+               _tmp4_ = (_vala_array_free (_tmp4_, _tmp4__length1, (GDestroyNotify) g_free), NULL);
+       }
+       {
+               gchar** _tmp5_;
+               gchar** _tmp6_;
+               gint _tmp6__length1;
+               gint _tmp7_ = 0;
+               gchar** _tmp8_;
+               gchar** _tmp9_;
+               gint _tmp9__length1;
+               _tmp5_ = g_new0 (gchar*, 0 + 1);
+               foo = (_vala_array_free (foo, foo_length1, (GDestroyNotify) g_free), NULL);
+               foo = _tmp5_;
+               foo_length1 = 0;
+               _foo_size_ = foo_length1;
+               _tmp6_ = foo;
+               _tmp6__length1 = foo_length1;
+               _vala_assert (_tmp6_ != NULL, "foo != null");
+               _tmp8_ = get_foo (&_tmp7_);
+               _tmp9_ = _tmp8_;
+               _tmp9__length1 = _tmp7_;
+               _vala_assert (_tmp9_ != NULL, "get_foo () != null");
+               _tmp9_ = (_vala_array_free (_tmp9_, _tmp9__length1, (GDestroyNotify) g_free), NULL);
+       }
+       {
+               gint* _tmp10_;
+               gint _tmp11_ = 0;
+               gint* _tmp12_;
+               gint* _tmp13_;
+               gint _tmp13__length1;
+               _tmp10_ = g_new0 (gint, 0);
+               bar = (g_free (bar), NULL);
+               bar = _tmp10_;
+               bar_length1 = 0;
+               _bar_size_ = bar_length1;
+               _tmp12_ = get_bar (&_tmp11_);
+               _tmp13_ = _tmp12_;
+               _tmp13__length1 = _tmp11_;
+               _vala_assert (_tmp13_ == NULL, "get_bar () == null");
+               _tmp13_ = (g_free (_tmp13_), NULL);
+       }
+       {
+               gint* _tmp14_;
+               gint _tmp15_ = 0;
+               gint* _tmp16_;
+               gint* _tmp17_;
+               gint _tmp17__length1;
+               _tmp14_ = g_new0 (gint, 0);
+               bar = (g_free (bar), NULL);
+               bar = _tmp14_;
+               bar_length1 = 0;
+               _bar_size_ = bar_length1;
+               _tmp16_ = get_bar (&_tmp15_);
+               _tmp17_ = _tmp16_;
+               _tmp17__length1 = _tmp15_;
+               _vala_assert (_tmp17_ == NULL, "get_bar () == null");
+               _tmp17_ = (g_free (_tmp17_), NULL);
+       }
+       {
+               Manam* _tmp18_;
+               gint _tmp19_ = 0;
+               Manam* _tmp20_;
+               Manam* _tmp21_;
+               gint _tmp21__length1;
+               _tmp18_ = g_new0 (Manam, 0);
+               manam = (_vala_Manam_array_free (manam, manam_length1), NULL);
+               manam = _tmp18_;
+               manam_length1 = 0;
+               _manam_size_ = manam_length1;
+               _tmp20_ = get_manam (&_tmp19_);
+               _tmp21_ = _tmp20_;
+               _tmp21__length1 = _tmp19_;
+               _vala_assert (_tmp21_ == NULL, "get_manam () == null");
+               _tmp21_ = (_vala_Manam_array_free (_tmp21_, _tmp21__length1), NULL);
+       }
+       {
+               Manam* _tmp22_;
+               gint _tmp23_ = 0;
+               Manam* _tmp24_;
+               Manam* _tmp25_;
+               gint _tmp25__length1;
+               _tmp22_ = g_new0 (Manam, 0);
+               manam = (_vala_Manam_array_free (manam, manam_length1), NULL);
+               manam = _tmp22_;
+               manam_length1 = 0;
+               _manam_size_ = manam_length1;
+               _tmp24_ = get_manam (&_tmp23_);
+               _tmp25_ = _tmp24_;
+               _tmp25__length1 = _tmp23_;
+               _vala_assert (_tmp25_ == NULL, "get_manam () == null");
+               _tmp25_ = (_vala_Manam_array_free (_tmp25_, _tmp25__length1), NULL);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
+static inline gpointer
+_vala_memdup2 (gconstpointer mem,
+               gsize byte_size)
+{
+       gpointer new_mem;
+       if (mem && byte_size != 0) {
+               new_mem = g_malloc (byte_size);
+               memcpy (new_mem, mem, byte_size);
+       } else {
+               new_mem = NULL;
+       }
+       return new_mem;
+}
+
diff --git a/tests/arrays/field-global-length-cname.c-expected 
b/tests/arrays/field-global-length-cname.c-expected
new file mode 100644
index 000000000..33e3ef1ae
--- /dev/null
+++ b/tests/arrays/field-global-length-cname.c-expected
@@ -0,0 +1,54 @@
+/* arrays_field_global_length_cname.c generated by valac, the Vala compiler
+ * generated from arrays_field_global_length_cname.vala, do not modify */
+
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN gint* foo;
+VALA_EXTERN gint foo_len;
+gint* foo = NULL;
+gint foo_len = 0;
+VALA_EXTERN gint foo_length1;
+gint foo_length1 = 0;
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+       gint* _tmp0_;
+       gint* _tmp1_;
+       gint _tmp1__length1;
+       _tmp0_ = g_new0 (gint, 2);
+       _tmp0_[0] = 23;
+       _tmp0_[1] = 42;
+       foo = (g_free (foo), NULL);
+       foo = _tmp0_;
+       foo_len = 2;
+       _tmp1_ = foo;
+       _tmp1__length1 = foo_len;
+       _vala_assert (_tmp1__length1 == 2, "foo.length == 2");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/arrays/fixed-length-enum-value.c-expected b/tests/arrays/fixed-length-enum-value.c-expected
new file mode 100644
index 000000000..9dd81c4b9
--- /dev/null
+++ b/tests/arrays/fixed-length-enum-value.c-expected
@@ -0,0 +1,123 @@
+/* arrays_fixed_length_enum_value.c generated by valac, the Vala compiler
+ * generated from arrays_fixed_length_enum_value.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef enum  {
+       FOO_BAR = 23
+} Foo;
+
+#define TYPE_FOO (foo_get_type ())
+
+#define TYPE_BAR (bar_get_type ())
+typedef struct _Bar Bar;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Bar {
+       gchar array[FOO_BAR];
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Bar* bar_dup (const Bar* self);
+VALA_EXTERN void bar_free (Bar* self);
+VALA_EXTERN void foo (guint* array);
+static void _vala_main (void);
+
+static GType
+foo_get_type_once (void)
+{
+       static const GEnumValue values[] = {{FOO_BAR, "FOO_BAR", "bar"}, {0, NULL, NULL}};
+       GType foo_type_id;
+       foo_type_id = g_enum_register_static ("Foo", values);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+Bar*
+bar_dup (const Bar* self)
+{
+       Bar* dup;
+       dup = g_new0 (Bar, 1);
+       memcpy (dup, self, sizeof (Bar));
+       return dup;
+}
+
+void
+bar_free (Bar* self)
+{
+       g_free (self);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       GType bar_type_id;
+       bar_type_id = g_boxed_type_register_static ("Bar", (GBoxedCopyFunc) bar_dup, (GBoxedFreeFunc) 
bar_free);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+void
+foo (guint* array)
+{
+       _vala_assert (FOO_BAR == 23, "array.length == 23");
+}
+
+static void
+_vala_main (void)
+{
+       gint array[FOO_BAR] = {0};
+       Bar bar = {0};
+       Bar _tmp0_;
+       _vala_assert (FOO_BAR == 23, "array.length == 23");
+       memset (&bar, 0, sizeof (Bar));
+       _tmp0_ = bar;
+       _vala_assert (FOO_BAR == 23, "bar.array.length == 23");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/arrays/fixed-length-init0-not-allowed.c-expected 
b/tests/arrays/fixed-length-init0-not-allowed.c-expected
new file mode 100644
index 000000000..d201b5660
--- /dev/null
+++ b/tests/arrays/fixed-length-init0-not-allowed.c-expected
@@ -0,0 +1,133 @@
+/* arrays_fixed_length_init0_not_allowed.c generated by valac, the Vala compiler
+ * generated from arrays_fixed_length_init0_not_allowed.vala, do not modify */
+
+#include <glib.h>
+#include <string.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+#define BAR 1024
+static void _vala_main (void);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static void
+_vala_main (void)
+{
+       {
+               static const gint FOO = 4;
+               gchar bar[FOO];
+               gchar _tmp0_[FOO];
+               gchar baz[FOO];
+               memset (_tmp0_, 0, FOO * sizeof (gchar));
+               _tmp0_[0] = 'f';
+               _tmp0_[1] = 'o';
+               _tmp0_[2] = 'o';
+               _tmp0_[3] = '\0';
+               memcpy (bar, _tmp0_, FOO * sizeof (gchar));
+               _vala_assert (g_strcmp0 ((const gchar*) bar, "foo") == 0, "(string) bar == \"foo\"");
+               memset (baz, 0, FOO * sizeof (gchar));
+               baz[0] = 'f';
+               baz[1] = 'o';
+               baz[2] = 'o';
+               baz[3] = '\0';
+               _vala_assert (g_strcmp0 ((const gchar*) baz, "foo") == 0, "(string) baz == \"foo\"");
+       }
+       {
+               static const gint FOO = 1024;
+               gchar* foo[FOO];
+               const gchar* _tmp1_;
+               const gchar* _tmp2_;
+               const gchar* _tmp3_;
+               memset (foo, 0, FOO * sizeof (gchar*));
+               _tmp1_ = foo[0];
+               _vala_assert (_tmp1_ == NULL, "foo[0] == null");
+               _tmp2_ = foo[FOO / 2];
+               _vala_assert (_tmp2_ == NULL, "foo[FOO / 2] == null");
+               _tmp3_ = foo[FOO - 1];
+               _vala_assert (_tmp3_ == NULL, "foo[FOO - 1] == null");
+               _vala_array_destroy (foo, FOO, (GDestroyNotify) g_free);
+       }
+       {
+               static const gint FOO = 1024;
+               gchar* array[16 * FOO];
+               const gchar* _tmp4_;
+               const gchar* _tmp5_;
+               const gchar* _tmp6_;
+               memset (array, 0, (16 * FOO) * sizeof (gchar*));
+               _tmp4_ = array[0];
+               _vala_assert (_tmp4_ == NULL, "array[0] == null");
+               _tmp5_ = array[(16 * FOO) / 2];
+               _vala_assert (_tmp5_ == NULL, "array[16 * FOO / 2] == null");
+               _tmp6_ = array[(16 * FOO) - 1];
+               _vala_assert (_tmp6_ == NULL, "array[16 * FOO - 1] == null");
+               _vala_array_destroy (array, 16 * FOO, (GDestroyNotify) g_free);
+       }
+       {
+               gchar* array[BAR] = {0};
+               const gchar* _tmp7_;
+               const gchar* _tmp8_;
+               const gchar* _tmp9_;
+               _tmp7_ = array[0];
+               _vala_assert (_tmp7_ == NULL, "array[0] == null");
+               _tmp8_ = array[BAR / 2];
+               _vala_assert (_tmp8_ == NULL, "array[BAR / 2] == null");
+               _tmp9_ = array[BAR - 1];
+               _vala_assert (_tmp9_ == NULL, "array[BAR - 1] == null");
+               _vala_array_destroy (array, BAR, (GDestroyNotify) g_free);
+       }
+       {
+               gchar* array[16 * BAR];
+               const gchar* _tmp10_;
+               const gchar* _tmp11_;
+               const gchar* _tmp12_;
+               memset (array, 0, (16 * BAR) * sizeof (gchar*));
+               _tmp10_ = array[0];
+               _vala_assert (_tmp10_ == NULL, "array[0] == null");
+               _tmp11_ = array[(16 * BAR) / 2];
+               _vala_assert (_tmp11_ == NULL, "array[16 * BAR / 2] == null");
+               _tmp12_ = array[(16 * BAR) - 1];
+               _vala_assert (_tmp12_ == NULL, "array[16 * BAR - 1] == null");
+               _vala_array_destroy (array, 16 * BAR, (GDestroyNotify) g_free);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/arrays/in-operator-with-boxed-needle.c-expected 
b/tests/arrays/in-operator-with-boxed-needle.c-expected
new file mode 100644
index 000000000..e5c5864b2
--- /dev/null
+++ b/tests/arrays/in-operator-with-boxed-needle.c-expected
@@ -0,0 +1,96 @@
+/* arrays_in_operator_with_boxed_needle.c generated by valac, the Vala compiler
+ * generated from arrays_in_operator_with_boxed_needle.vala, do not modify */
+
+#include <glib.h>
+#include <string.h>
+
+#define _g_free0(var) ((var == NULL) ? NULL : (var = (g_free (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (void);
+static gboolean _vala_int_array_contains (gint * stack,
+                                   gssize stack_length,
+                                   const gint needle);
+static gint* _int_dup (gint* self);
+
+static gboolean
+_vala_int_array_contains (gint * stack,
+                          gssize stack_length,
+                          const gint needle)
+{
+       gssize i;
+       for (i = 0; i < stack_length; i++) {
+               if (needle == stack[i]) {
+                       return TRUE;
+               }
+       }
+       return FALSE;
+}
+
+static gint*
+_int_dup (gint* self)
+{
+       gint* dup;
+       dup = g_new0 (gint, 1);
+       memcpy (dup, self, sizeof (gint));
+       return dup;
+}
+
+static gpointer
+__int_dup0 (gpointer self)
+{
+       return self ? _int_dup (self) : NULL;
+}
+
+static void
+_vala_main (void)
+{
+       gint* foo = NULL;
+       gint* _tmp0_;
+       gint foo_length1;
+       gint _foo_size_;
+       gint* i = NULL;
+       gint* _tmp1_;
+       gint _tmp2_;
+       gint* _tmp3_;
+       gint* _tmp4_;
+       gint _tmp5_;
+       gint* _tmp6_;
+       gint* _tmp7_;
+       _tmp0_ = g_new0 (gint, 3);
+       _tmp0_[0] = 0;
+       _tmp0_[1] = 23;
+       _tmp0_[2] = 42;
+       foo = _tmp0_;
+       foo_length1 = 3;
+       _foo_size_ = foo_length1;
+       i = NULL;
+       _tmp1_ = i;
+       _vala_assert (!((_tmp1_ == NULL) ? FALSE : _vala_int_array_contains (foo, foo_length1, *_tmp1_)), 
"!(i in foo)");
+       _tmp2_ = 23;
+       _tmp3_ = __int_dup0 (&_tmp2_);
+       _g_free0 (i);
+       i = _tmp3_;
+       _tmp4_ = i;
+       _vala_assert (((_tmp4_ == NULL) ? FALSE : _vala_int_array_contains (foo, foo_length1, *_tmp4_)), "i 
in foo");
+       _tmp5_ = 4711;
+       _tmp6_ = __int_dup0 (&_tmp5_);
+       _g_free0 (i);
+       i = _tmp6_;
+       _tmp7_ = i;
+       _vala_assert (!((_tmp7_ == NULL) ? FALSE : _vala_int_array_contains (foo, foo_length1, *_tmp7_)), 
"!(i in foo)");
+       _g_free0 (i);
+       foo = (g_free (foo), NULL);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/arrays/inline-struct.c-expected b/tests/arrays/inline-struct.c-expected
new file mode 100644
index 000000000..94197ec0c
--- /dev/null
+++ b/tests/arrays/inline-struct.c-expected
@@ -0,0 +1,135 @@
+/* arrays_inline_struct.c generated by valac, the Vala compiler
+ * generated from arrays_inline_struct.vala, do not modify */
+
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib-object.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef struct _FooStruct FooStruct;
+#define _g_free0(var) (var = (g_free (var), NULL))
+
+struct _FooStruct {
+       guint8 i;
+       gchar* s;
+};
+
+VALA_EXTERN FooStruct* foo_struct_dup (const FooStruct* self);
+VALA_EXTERN void foo_struct_free (FooStruct* self);
+VALA_EXTERN void foo_struct_copy (const FooStruct* self,
+                      FooStruct* dest);
+VALA_EXTERN void foo_struct_destroy (FooStruct* self);
+static void _vala_main (void);
+static void _vala_FooStruct_array_destroy (FooStruct * array,
+                                    gssize array_length);
+static void _vala_GValue_array_destroy (GValue * array,
+                                 gssize array_length);
+
+void
+foo_struct_copy (const FooStruct* self,
+                 FooStruct* dest)
+{
+       const gchar* _tmp0_;
+       gchar* _tmp1_;
+       (*dest).i = (*self).i;
+       _tmp0_ = (*self).s;
+       _tmp1_ = g_strdup (_tmp0_);
+       _g_free0 ((*dest).s);
+       (*dest).s = _tmp1_;
+}
+
+void
+foo_struct_destroy (FooStruct* self)
+{
+       _g_free0 ((*self).s);
+}
+
+FooStruct*
+foo_struct_dup (const FooStruct* self)
+{
+       FooStruct* dup;
+       dup = g_new0 (FooStruct, 1);
+       foo_struct_copy (self, dup);
+       return dup;
+}
+
+void
+foo_struct_free (FooStruct* self)
+{
+       foo_struct_destroy (self);
+       g_free (self);
+}
+
+static void
+_vala_FooStruct_array_destroy (FooStruct * array,
+                               gssize array_length)
+{
+       if (array != NULL) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       foo_struct_destroy (&array[i]);
+               }
+       }
+}
+
+static void
+_vala_GValue_array_destroy (GValue * array,
+                            gssize array_length)
+{
+       if (array != NULL) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       g_value_unset (&array[i]);
+               }
+       }
+}
+
+static void
+_vala_main (void)
+{
+       {
+               FooStruct array[2] = {0};
+               gchar* _tmp0_;
+               FooStruct _tmp1_ = {0};
+               gchar* _tmp2_;
+               FooStruct _tmp3_ = {0};
+               _tmp0_ = g_strdup ("foo");
+               _tmp1_.i = (guint8) 23;
+               _g_free0 (_tmp1_.s);
+               _tmp1_.s = _tmp0_;
+               foo_struct_destroy (&array[0]);
+               array[0] = _tmp1_;
+               _tmp2_ = g_strdup ("bar");
+               _tmp3_.i = (guint8) 42;
+               _g_free0 (_tmp3_.s);
+               _tmp3_.s = _tmp2_;
+               foo_struct_destroy (&array[1]);
+               array[1] = _tmp3_;
+               _vala_FooStruct_array_destroy (array, 2);
+       }
+       {
+               GValue array[2] = {0};
+               g_value_init (&array[0], G_TYPE_INT);
+               g_value_init (&array[1], G_TYPE_STRING);
+               _vala_GValue_array_destroy (array, 2);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/arrays/length-inline-assignment.c-expected 
b/tests/arrays/length-inline-assignment.c-expected
new file mode 100644
index 000000000..0255ae4ce
--- /dev/null
+++ b/tests/arrays/length-inline-assignment.c-expected
@@ -0,0 +1,99 @@
+/* arrays_length_inline_assignment.c generated by valac, the Vala compiler
+ * generated from arrays_length_inline_assignment.vala, do not modify */
+
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+       {
+               gint* i = NULL;
+               gint* _tmp0_;
+               gint i_length1;
+               gint _i_size_;
+               gint j = 0;
+               gint _tmp1_;
+               gint _tmp2_;
+               _tmp0_ = g_new0 (gint, 2);
+               _tmp0_[0] = 23;
+               _tmp0_[1] = 42;
+               i = _tmp0_;
+               i_length1 = 2;
+               _i_size_ = i_length1;
+               i_length1 = i_length1 - 1;
+               _tmp1_ = i_length1;
+               j = _tmp1_;
+               _vala_assert (i_length1 == 1, "i.length == 1");
+               _vala_assert (j == 1, "j == 1");
+               i_length1 = i_length1 + 1;
+               _tmp2_ = i_length1;
+               j = _tmp2_;
+               _vala_assert (i_length1 == 2, "i.length == 2");
+               _vala_assert (j == 2, "j == 2");
+               i = (g_free (i), NULL);
+       }
+       {
+               gint* i = NULL;
+               gint* _tmp3_;
+               gint i_length1;
+               gint _i_size_;
+               gint j = 0;
+               _tmp3_ = g_new0 (gint, 2);
+               _tmp3_[0] = 23;
+               _tmp3_[1] = 42;
+               i = _tmp3_;
+               i_length1 = 2;
+               _i_size_ = i_length1;
+               i_length1 = i_length1 - 1;
+               j = i_length1;
+               _vala_assert (i_length1 == 1, "i.length == 1");
+               _vala_assert (j == 1, "j == 1");
+               i_length1 = i_length1 + 1;
+               j = i_length1;
+               _vala_assert (i_length1 == 2, "i.length == 2");
+               _vala_assert (j == 2, "j == 2");
+               i = (g_free (i), NULL);
+       }
+       {
+               gint* i = NULL;
+               gint* _tmp4_;
+               gint i_length1;
+               gint _i_size_;
+               gint j = 0;
+               gint _tmp5_;
+               gint _tmp6_;
+               _tmp4_ = g_new0 (gint, 2);
+               _tmp4_[0] = 23;
+               _tmp4_[1] = 42;
+               i = _tmp4_;
+               i_length1 = 2;
+               _i_size_ = i_length1;
+               _tmp5_ = i_length1;
+               i_length1 = _tmp5_ - 1;
+               j = _tmp5_;
+               _vala_assert (i_length1 == 1, "i.length == 1");
+               _vala_assert (j == 2, "j == 2");
+               _tmp6_ = i_length1;
+               i_length1 = _tmp6_ + 1;
+               j = _tmp6_;
+               _vala_assert (i_length1 == 2, "i.length == 2");
+               _vala_assert (j == 1, "j == 1");
+               i = (g_free (i), NULL);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/arrays/length-type-include.c-expected b/tests/arrays/length-type-include.c-expected
new file mode 100644
index 000000000..a282eecfa
--- /dev/null
+++ b/tests/arrays/length-type-include.c-expected
@@ -0,0 +1,26 @@
+/* arrays_length_type_include.c generated by valac, the Vala compiler
+ * generated from arrays_length_type_include.vala, do not modify */
+
+#include <glib.h>
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+       void** foo = NULL;
+       gint foo_length1;
+       gint _foo_size_;
+       foo = NULL;
+       foo_length1 = 0;
+       _foo_size_ = foo_length1;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/arrays/resize-local-size-captured.c-expected 
b/tests/arrays/resize-local-size-captured.c-expected
new file mode 100644
index 000000000..190b45001
--- /dev/null
+++ b/tests/arrays/resize-local-size-captured.c-expected
@@ -0,0 +1,132 @@
+/* arrays_resize_local_size_captured.c generated by valac, the Vala compiler
+ * generated from arrays_resize_local_size_captured.vala, do not modify */
+
+#include <glib.h>
+#include <string.h>
+
+typedef void (*FooFunc) (gpointer user_data);
+typedef struct _Block1Data Block1Data;
+
+struct _Block1Data {
+       int _ref_count_;
+       gint* a;
+       gint a_length1;
+       gint _a_size_;
+};
+
+static void _vala_main (void);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static void __lambda4_ (Block1Data* _data1_);
+static void ___lambda4__foo_func (gpointer self);
+static void _vala_array_add1 (gint* * array,
+                       gint* length,
+                       gint* size,
+                       gint value);
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               _data1_->a = (g_free (_data1_->a), NULL);
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static void
+__lambda4_ (Block1Data* _data1_)
+{
+       gint _tmp0_;
+       _tmp0_ = 1;
+       _data1_->a = g_renew (gint, _data1_->a, 1);
+       (_tmp0_ > _data1_->a_length1) ? memset (_data1_->a + _data1_->a_length1, 0, sizeof (gint) * (_tmp0_ - 
_data1_->a_length1)) : NULL;
+       _data1_->a_length1 = _tmp0_;
+       _data1_->_a_size_ = _tmp0_;
+}
+
+static void
+___lambda4__foo_func (gpointer self)
+{
+       __lambda4_ (self);
+}
+
+static void
+_vala_array_add1 (gint* * array,
+                  gint* length,
+                  gint* size,
+                  gint value)
+{
+       if ((*length) == (*size)) {
+               *size = (*size) ? (2 * (*size)) : 4;
+               *array = g_renew (gint, *array, *size);
+       }
+       (*array)[(*length)++] = value;
+}
+
+static void
+_vala_main (void)
+{
+       Block1Data* _data1_;
+       gint* _tmp0_;
+       FooFunc func = NULL;
+       gpointer func_target;
+       GDestroyNotify func_target_destroy_notify;
+       FooFunc _tmp1_;
+       gpointer _tmp1__target;
+       _data1_ = g_slice_new0 (Block1Data);
+       _data1_->_ref_count_ = 1;
+       _tmp0_ = g_new0 (gint, (10 * 1024) * 1024);
+       _data1_->a = _tmp0_;
+       _data1_->a_length1 = (10 * 1024) * 1024;
+       _data1_->_a_size_ = _data1_->a_length1;
+       func = ___lambda4__foo_func;
+       func_target = block1_data_ref (_data1_);
+       func_target_destroy_notify = block1_data_unref;
+       _tmp1_ = func;
+       _tmp1__target = func_target;
+       _tmp1_ (_tmp1__target);
+       {
+               gint i = 0;
+               i = 1;
+               {
+                       gboolean _tmp2_ = FALSE;
+                       _tmp2_ = TRUE;
+                       while (TRUE) {
+                               if (!_tmp2_) {
+                                       gint _tmp3_;
+                                       _tmp3_ = i;
+                                       i = _tmp3_ + 1;
+                               }
+                               _tmp2_ = FALSE;
+                               if (!(i < ((10 * 1024) * 1024))) {
+                                       break;
+                               }
+                               _vala_array_add1 (&_data1_->a, &_data1_->a_length1, &_data1_->_a_size_, 4711);
+                       }
+               }
+       }
+       (func_target_destroy_notify == NULL) ? NULL : (func_target_destroy_notify (func_target), NULL);
+       func = NULL;
+       func_target = NULL;
+       func_target_destroy_notify = NULL;
+       block1_data_unref (_data1_);
+       _data1_ = NULL;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/arrays/resize-local-size.c-expected b/tests/arrays/resize-local-size.c-expected
new file mode 100644
index 000000000..f3c0464c1
--- /dev/null
+++ b/tests/arrays/resize-local-size.c-expected
@@ -0,0 +1,73 @@
+/* arrays_resize_local_size.c generated by valac, the Vala compiler
+ * generated from arrays_resize_local_size.vala, do not modify */
+
+#include <glib.h>
+#include <string.h>
+
+static void _vala_main (void);
+static void _vala_array_add1 (gint* * array,
+                       gint* length,
+                       gint* size,
+                       gint value);
+
+static void
+_vala_array_add1 (gint* * array,
+                  gint* length,
+                  gint* size,
+                  gint value)
+{
+       if ((*length) == (*size)) {
+               *size = (*size) ? (2 * (*size)) : 4;
+               *array = g_renew (gint, *array, *size);
+       }
+       (*array)[(*length)++] = value;
+}
+
+static void
+_vala_main (void)
+{
+       gint* a = NULL;
+       gint* _tmp0_;
+       gint a_length1;
+       gint _a_size_;
+       gint _tmp1_;
+       _tmp0_ = g_new0 (gint, (10 * 1024) * 1024);
+       a = _tmp0_;
+       a_length1 = (10 * 1024) * 1024;
+       _a_size_ = a_length1;
+       _tmp1_ = 1;
+       a = g_renew (gint, a, 1);
+       (_tmp1_ > a_length1) ? memset (a + a_length1, 0, sizeof (gint) * (_tmp1_ - a_length1)) : NULL;
+       a_length1 = _tmp1_;
+       _a_size_ = _tmp1_;
+       {
+               gint i = 0;
+               i = 1;
+               {
+                       gboolean _tmp2_ = FALSE;
+                       _tmp2_ = TRUE;
+                       while (TRUE) {
+                               if (!_tmp2_) {
+                                       gint _tmp3_;
+                                       _tmp3_ = i;
+                                       i = _tmp3_ + 1;
+                               }
+                               _tmp2_ = FALSE;
+                               if (!(i < ((10 * 1024) * 1024))) {
+                                       break;
+                               }
+                               _vala_array_add1 (&a, &a_length1, &_a_size_, 4711);
+                       }
+               }
+       }
+       a = (g_free (a), NULL);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/arrays/resize.c-expected b/tests/arrays/resize.c-expected
new file mode 100644
index 000000000..086493fa4
--- /dev/null
+++ b/tests/arrays/resize.c-expected
@@ -0,0 +1,166 @@
+/* arrays_resize.c generated by valac, the Vala compiler
+ * generated from arrays_resize.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+VALA_EXTERN gchar** boo;
+VALA_EXTERN gint boo_length1;
+gchar** boo = NULL;
+gint boo_length1 = 0;
+static gint _boo_size_ = 0;
+
+VALA_EXTERN void bar (gchar*** foo,
+          gint* foo_length1);
+VALA_EXTERN void manam (gchar*** foo,
+            gint* foo_length1);
+static void _vala_main (void);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+void
+bar (gchar*** foo,
+     gint* foo_length1)
+{
+       gint _tmp0_;
+       _tmp0_ = 42;
+       *foo = g_renew (gchar*, *foo, 42);
+       (_tmp0_ > (*foo_length1)) ? memset ((*foo) + (*foo_length1), 0, sizeof (gchar*) * (_tmp0_ - 
(*foo_length1))) : NULL;
+       *foo_length1 = _tmp0_;
+}
+
+void
+manam (gchar*** foo,
+       gint* foo_length1)
+{
+       gchar** _vala_foo = NULL;
+       gint _vala_foo_length1 = 0;
+       gchar** _tmp0_;
+       gint _tmp1_;
+       _tmp0_ = g_new0 (gchar*, 23 + 1);
+       _vala_foo = (_vala_array_free (_vala_foo, _vala_foo_length1, (GDestroyNotify) g_free), NULL);
+       _vala_foo = _tmp0_;
+       _vala_foo_length1 = 23;
+       _tmp1_ = 42;
+       _vala_foo = g_renew (gchar*, _vala_foo, 42);
+       (_tmp1_ > _vala_foo_length1) ? memset (_vala_foo + _vala_foo_length1, 0, sizeof (gchar*) * (_tmp1_ - 
_vala_foo_length1)) : NULL;
+       _vala_foo_length1 = _tmp1_;
+       if (foo) {
+               *foo = _vala_foo;
+       } else {
+               _vala_foo = (_vala_array_free (_vala_foo, _vala_foo_length1, (GDestroyNotify) g_free), NULL);
+       }
+       if (foo_length1) {
+               *foo_length1 = _vala_foo_length1;
+       }
+}
+
+static void
+_vala_main (void)
+{
+       {
+               gchar** foo = NULL;
+               gchar** _tmp0_;
+               gint foo_length1;
+               gint _foo_size_;
+               gint _tmp1_;
+               _tmp0_ = g_new0 (gchar*, 23 + 1);
+               foo = _tmp0_;
+               foo_length1 = 23;
+               _foo_size_ = foo_length1;
+               _tmp1_ = 42;
+               foo = g_renew (gchar*, foo, 42);
+               (_tmp1_ > foo_length1) ? memset (foo + foo_length1, 0, sizeof (gchar*) * (_tmp1_ - 
foo_length1)) : NULL;
+               foo_length1 = _tmp1_;
+               _foo_size_ = _tmp1_;
+               foo = (_vala_array_free (foo, foo_length1, (GDestroyNotify) g_free), NULL);
+       }
+       {
+               gchar** foo = NULL;
+               gchar** _tmp2_;
+               gint foo_length1;
+               gint _foo_size_;
+               _tmp2_ = g_new0 (gchar*, 23 + 1);
+               foo = _tmp2_;
+               foo_length1 = 23;
+               _foo_size_ = foo_length1;
+               bar (&foo, (gint*) (&foo_length1));
+               _foo_size_ = foo_length1;
+               foo = (_vala_array_free (foo, foo_length1, (GDestroyNotify) g_free), NULL);
+       }
+       {
+               gchar** foo = NULL;
+               gint foo_length1 = 0;
+               gint _foo_size_ = 0;
+               gchar** _tmp3_ = NULL;
+               gint _tmp4_ = 0;
+               manam (&_tmp3_, &_tmp4_);
+               foo = (_vala_array_free (foo, foo_length1, (GDestroyNotify) g_free), NULL);
+               foo = _tmp3_;
+               foo_length1 = _tmp4_;
+               _foo_size_ = foo_length1;
+               foo = (_vala_array_free (foo, foo_length1, (GDestroyNotify) g_free), NULL);
+       }
+       {
+               gchar** _tmp5_;
+               gint _tmp6_;
+               _tmp5_ = g_new0 (gchar*, 23 + 1);
+               boo = (_vala_array_free (boo, boo_length1, (GDestroyNotify) g_free), NULL);
+               boo = _tmp5_;
+               boo_length1 = 23;
+               _boo_size_ = boo_length1;
+               _tmp6_ = 42;
+               boo = g_renew (gchar*, boo, 42);
+               (_tmp6_ > boo_length1) ? memset (boo + boo_length1, 0, sizeof (gchar*) * (_tmp6_ - 
boo_length1)) : NULL;
+               boo_length1 = _tmp6_;
+               _boo_size_ = _tmp6_;
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/arrays/slice-fixed-length.c-expected b/tests/arrays/slice-fixed-length.c-expected
new file mode 100644
index 000000000..be50c1cc2
--- /dev/null
+++ b/tests/arrays/slice-fixed-length.c-expected
@@ -0,0 +1,406 @@
+/* arrays_slice_fixed_length.c generated by valac, the Vala compiler
+ * generated from arrays_slice_fixed_length.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN void manam (gchar** foo,
+            gint foo_length1);
+VALA_EXTERN void minim (gchar** foo,
+            gint foo_length1);
+static void _vala_main (void);
+static gchar** _vala_array_dup1 (gchar** self,
+                          gssize length);
+static gchar** _vala_array_dup2 (gchar** self,
+                          gssize length);
+static gchar** _vala_array_dup3 (gchar** self,
+                          gssize length);
+static gchar** _vala_array_dup4 (gchar** self,
+                          gssize length);
+static gchar** _vala_array_dup5 (gchar** self,
+                          gssize length);
+static gchar** _vala_array_dup6 (gchar** self,
+                          gssize length);
+static gchar** _vala_array_dup7 (gchar** self,
+                          gssize length);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+void
+manam (gchar** foo,
+       gint foo_length1)
+{
+       const gchar* _tmp0_;
+       const gchar* _tmp1_;
+       _vala_assert (foo_length1 == 2, "foo.length == 2");
+       _tmp0_ = foo[0];
+       _vala_assert (g_strcmp0 (_tmp0_, "bar") == 0, "foo[0] == \"bar\"");
+       _tmp1_ = foo[1];
+       _vala_assert (g_strcmp0 (_tmp1_, "baz") == 0, "foo[1] == \"baz\"");
+}
+
+void
+minim (gchar** foo,
+       gint foo_length1)
+{
+       const gchar* _tmp0_;
+       const gchar* _tmp1_;
+       _vala_assert (foo_length1 == 2, "foo.length == 2");
+       _tmp0_ = foo[0];
+       _vala_assert (g_strcmp0 (_tmp0_, "bar") == 0, "foo[0] == \"bar\"");
+       _tmp1_ = foo[1];
+       _vala_assert (g_strcmp0 (_tmp1_, "baz") == 0, "foo[1] == \"baz\"");
+       foo = (_vala_array_free (foo, foo_length1, (GDestroyNotify) g_free), NULL);
+}
+
+static gchar**
+_vala_array_dup1 (gchar** self,
+                  gssize length)
+{
+       if (length >= 0) {
+               gchar** result;
+               gssize i;
+               result = g_new0 (gchar*, length + 1);
+               for (i = 0; i < length; i++) {
+                       gchar* _tmp0_;
+                       _tmp0_ = g_strdup (self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+static gchar**
+_vala_array_dup2 (gchar** self,
+                  gssize length)
+{
+       if (length >= 0) {
+               gchar** result;
+               gssize i;
+               result = g_new0 (gchar*, length + 1);
+               for (i = 0; i < length; i++) {
+                       gchar* _tmp0_;
+                       _tmp0_ = g_strdup (self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+static gchar**
+_vala_array_dup3 (gchar** self,
+                  gssize length)
+{
+       if (length >= 0) {
+               gchar** result;
+               gssize i;
+               result = g_new0 (gchar*, length + 1);
+               for (i = 0; i < length; i++) {
+                       gchar* _tmp0_;
+                       _tmp0_ = g_strdup (self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+static gchar**
+_vala_array_dup4 (gchar** self,
+                  gssize length)
+{
+       if (length >= 0) {
+               gchar** result;
+               gssize i;
+               result = g_new0 (gchar*, length + 1);
+               for (i = 0; i < length; i++) {
+                       gchar* _tmp0_;
+                       _tmp0_ = g_strdup (self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+static gchar**
+_vala_array_dup5 (gchar** self,
+                  gssize length)
+{
+       if (length >= 0) {
+               gchar** result;
+               gssize i;
+               result = g_new0 (gchar*, length + 1);
+               for (i = 0; i < length; i++) {
+                       gchar* _tmp0_;
+                       _tmp0_ = g_strdup (self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+static gchar**
+_vala_array_dup6 (gchar** self,
+                  gssize length)
+{
+       if (length >= 0) {
+               gchar** result;
+               gssize i;
+               result = g_new0 (gchar*, length + 1);
+               for (i = 0; i < length; i++) {
+                       gchar* _tmp0_;
+                       _tmp0_ = g_strdup (self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+static gchar**
+_vala_array_dup7 (gchar** self,
+                  gssize length)
+{
+       if (length >= 0) {
+               gchar** result;
+               gssize i;
+               result = g_new0 (gchar*, length + 1);
+               for (i = 0; i < length; i++) {
+                       gchar* _tmp0_;
+                       _tmp0_ = g_strdup (self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+static void
+_vala_main (void)
+{
+       gchar* bar[4] = {0};
+       gchar* _tmp0_;
+       gchar* _tmp1_;
+       gchar* _tmp2_;
+       gchar* _tmp3_;
+       gchar* _tmp4_[4] = {0};
+       _tmp0_ = g_strdup ("foo");
+       _tmp1_ = g_strdup ("bar");
+       _tmp2_ = g_strdup ("baz");
+       _tmp3_ = g_strdup ("buzz");
+       _tmp4_[0] = _tmp0_;
+       _tmp4_[1] = _tmp1_;
+       _tmp4_[2] = _tmp2_;
+       _tmp4_[3] = _tmp3_;
+       memcpy (bar, _tmp4_, 4 * sizeof (gchar*));
+       {
+               gchar** foo = NULL;
+               gchar** _tmp5_;
+               gint _tmp5__length1;
+               gint foo_length1;
+               gint _foo_size_;
+               const gchar* _tmp6_;
+               const gchar* _tmp7_;
+               _tmp5_ = ((bar + 1) != NULL) ? _vala_array_dup1 (bar + 1, 3 - 1) : (bar + 1);
+               _tmp5__length1 = 3 - 1;
+               foo = _tmp5_;
+               foo_length1 = _tmp5__length1;
+               _foo_size_ = foo_length1;
+               _vala_assert (foo_length1 == 2, "foo.length == 2");
+               _tmp6_ = foo[0];
+               _vala_assert (g_strcmp0 (_tmp6_, "bar") == 0, "foo[0] == \"bar\"");
+               _tmp7_ = foo[1];
+               _vala_assert (g_strcmp0 (_tmp7_, "baz") == 0, "foo[1] == \"baz\"");
+               foo = (_vala_array_free (foo, foo_length1, (GDestroyNotify) g_free), NULL);
+       }
+       {
+               gchar** foo = NULL;
+               gint foo_length1;
+               gint _foo_size_;
+               const gchar* _tmp8_;
+               const gchar* _tmp9_;
+               foo = bar + 1;
+               foo_length1 = 3 - 1;
+               _foo_size_ = foo_length1;
+               _vala_assert (foo_length1 == 2, "foo.length == 2");
+               _tmp8_ = foo[0];
+               _vala_assert (g_strcmp0 (_tmp8_, "bar") == 0, "foo[0] == \"bar\"");
+               _tmp9_ = foo[1];
+               _vala_assert (g_strcmp0 (_tmp9_, "baz") == 0, "foo[1] == \"baz\"");
+       }
+       {
+               gint begin = 0;
+               gchar** foo = NULL;
+               gchar** _tmp10_;
+               gint _tmp10__length1;
+               gint foo_length1;
+               gint _foo_size_;
+               const gchar* _tmp11_;
+               const gchar* _tmp12_;
+               begin = 1;
+               _tmp10_ = ((bar + begin) != NULL) ? _vala_array_dup2 (bar + begin, 3 - begin) : (bar + begin);
+               _tmp10__length1 = 3 - begin;
+               foo = _tmp10_;
+               foo_length1 = _tmp10__length1;
+               _foo_size_ = foo_length1;
+               _vala_assert (foo_length1 == 2, "foo.length == 2");
+               _tmp11_ = foo[0];
+               _vala_assert (g_strcmp0 (_tmp11_, "bar") == 0, "foo[0] == \"bar\"");
+               _tmp12_ = foo[1];
+               _vala_assert (g_strcmp0 (_tmp12_, "baz") == 0, "foo[1] == \"baz\"");
+               foo = (_vala_array_free (foo, foo_length1, (GDestroyNotify) g_free), NULL);
+       }
+       {
+               gchar** foo = NULL;
+               gchar** _tmp13_;
+               gint _tmp13__length1;
+               gint foo_length1;
+               gint _foo_size_;
+               const gchar* _tmp14_;
+               const gchar* _tmp15_;
+               _tmp13_ = ((bar + 1) != NULL) ? _vala_array_dup3 (bar + 1, 3 - 1) : (bar + 1);
+               _tmp13__length1 = 3 - 1;
+               foo = _tmp13_;
+               foo_length1 = _tmp13__length1;
+               _foo_size_ = foo_length1;
+               _vala_assert (foo_length1 == 2, "foo.length == 2");
+               _tmp14_ = foo[0];
+               _vala_assert (g_strcmp0 (_tmp14_, "bar") == 0, "foo[0] == \"bar\"");
+               _tmp15_ = foo[1];
+               _vala_assert (g_strcmp0 (_tmp15_, "baz") == 0, "foo[1] == \"baz\"");
+               foo = (_vala_array_free (foo, foo_length1, (GDestroyNotify) g_free), NULL);
+       }
+       {
+               gchar** foo = NULL;
+               gint foo_length1;
+               gint _foo_size_;
+               const gchar* _tmp16_;
+               const gchar* _tmp17_;
+               foo = bar + 1;
+               foo_length1 = 3 - 1;
+               _foo_size_ = foo_length1;
+               _vala_assert (foo_length1 == 2, "foo.length == 2");
+               _tmp16_ = foo[0];
+               _vala_assert (g_strcmp0 (_tmp16_, "bar") == 0, "foo[0] == \"bar\"");
+               _tmp17_ = foo[1];
+               _vala_assert (g_strcmp0 (_tmp17_, "baz") == 0, "foo[1] == \"baz\"");
+       }
+       {
+               gint end = 0;
+               gchar** foo = NULL;
+               gchar** _tmp18_;
+               gint _tmp18__length1;
+               gint foo_length1;
+               gint _foo_size_;
+               const gchar* _tmp19_;
+               const gchar* _tmp20_;
+               end = 3;
+               _tmp18_ = ((bar + 1) != NULL) ? _vala_array_dup4 (bar + 1, end - 1) : (bar + 1);
+               _tmp18__length1 = end - 1;
+               foo = _tmp18_;
+               foo_length1 = _tmp18__length1;
+               _foo_size_ = foo_length1;
+               _vala_assert (foo_length1 == 2, "foo.length == 2");
+               _tmp19_ = foo[0];
+               _vala_assert (g_strcmp0 (_tmp19_, "bar") == 0, "foo[0] == \"bar\"");
+               _tmp20_ = foo[1];
+               _vala_assert (g_strcmp0 (_tmp20_, "baz") == 0, "foo[1] == \"baz\"");
+               foo = (_vala_array_free (foo, foo_length1, (GDestroyNotify) g_free), NULL);
+       }
+       {
+               manam (bar + 1, (gint) (3 - 1));
+       }
+       {
+               gint begin = 0;
+               begin = 1;
+               manam (bar + begin, (gint) (3 - begin));
+       }
+       {
+               gint end = 0;
+               end = 3;
+               manam (bar + 1, (gint) (end - 1));
+       }
+       {
+               gchar** _tmp21_;
+               gint _tmp21__length1;
+               _tmp21_ = ((bar + 1) != NULL) ? _vala_array_dup5 (bar + 1, 3 - 1) : (bar + 1);
+               _tmp21__length1 = 3 - 1;
+               minim (_tmp21_, (gint) _tmp21__length1);
+       }
+       {
+               gint begin = 0;
+               gchar** _tmp22_;
+               gint _tmp22__length1;
+               begin = 1;
+               _tmp22_ = ((bar + begin) != NULL) ? _vala_array_dup6 (bar + begin, 3 - begin) : (bar + begin);
+               _tmp22__length1 = 3 - begin;
+               minim (_tmp22_, (gint) _tmp22__length1);
+       }
+       {
+               gint end = 0;
+               gchar** _tmp23_;
+               gint _tmp23__length1;
+               end = 3;
+               _tmp23_ = ((bar + 1) != NULL) ? _vala_array_dup7 (bar + 1, end - 1) : (bar + 1);
+               _tmp23__length1 = end - 1;
+               minim (_tmp23_, (gint) _tmp23__length1);
+       }
+       _vala_array_destroy (bar, 4, (GDestroyNotify) g_free);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/arrays/struct-field-initializer.c-expected 
b/tests/arrays/struct-field-initializer.c-expected
new file mode 100644
index 000000000..5bf92c2cf
--- /dev/null
+++ b/tests/arrays/struct-field-initializer.c-expected
@@ -0,0 +1,120 @@
+/* arrays_struct_field_initializer.c generated by valac, the Vala compiler
+ * generated from arrays_struct_field_initializer.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef struct _Foo Foo;
+typedef struct _Bar Bar;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       gchar** array;
+       gint array_length1;
+       gint _array_size_;
+       gint i;
+};
+
+struct _Bar {
+       gchar** array;
+       gint array_length1;
+       gint i;
+};
+
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN Bar* bar_dup (const Bar* self);
+VALA_EXTERN void bar_free (Bar* self);
+static void _vala_main (void);
+
+const gchar* SARRAY[2] = {"foo", "bar"};
+const Foo FOO = {SARRAY, G_N_ELEMENTS (SARRAY), G_N_ELEMENTS (SARRAY), 23};
+const Bar BAR = {SARRAY, G_N_ELEMENTS (SARRAY), 42};
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       memcpy (dup, self, sizeof (Foo));
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       g_free (self);
+}
+
+Bar*
+bar_dup (const Bar* self)
+{
+       Bar* dup;
+       dup = g_new0 (Bar, 1);
+       memcpy (dup, self, sizeof (Bar));
+       return dup;
+}
+
+void
+bar_free (Bar* self)
+{
+       g_free (self);
+}
+
+static void
+_vala_main (void)
+{
+       {
+               gchar** _tmp0_;
+               gint _tmp0__length1;
+               gchar** _tmp1_;
+               gint _tmp1__length1;
+               _tmp0_ = FOO.array;
+               _tmp0__length1 = FOO.array_length1;
+               _vala_assert (_tmp0__length1 == 2, "FOO.array.length == 2");
+               _vala_assert (FOO.i == 23, "FOO.i == 23");
+               _tmp1_ = BAR.array;
+               _tmp1__length1 = BAR.array_length1;
+               _vala_assert (_tmp1__length1 == 2, "BAR.array.length == 2");
+               _vala_assert (BAR.i == 42, "BAR.i == 42");
+       }
+       {
+               static const Foo foo = {SARRAY, G_N_ELEMENTS (SARRAY), G_N_ELEMENTS (SARRAY), 23};
+               static const Bar bar = {SARRAY, G_N_ELEMENTS (SARRAY), 42};
+               gchar** _tmp2_;
+               gint _tmp2__length1;
+               gchar** _tmp3_;
+               gint _tmp3__length1;
+               _tmp2_ = foo.array;
+               _tmp2__length1 = foo.array_length1;
+               _vala_assert (_tmp2__length1 == 2, "foo.array.length == 2");
+               _vala_assert (foo.i == 23, "foo.i == 23");
+               _tmp3_ = bar.array;
+               _tmp3__length1 = bar.array_length1;
+               _vala_assert (_tmp3__length1 == 2, "bar.array.length == 2");
+               _vala_assert (bar.i == 42, "bar.i == 42");
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/arrays/struct-field-length-cname.c-expected 
b/tests/arrays/struct-field-length-cname.c-expected
new file mode 100644
index 000000000..bf19aff07
--- /dev/null
+++ b/tests/arrays/struct-field-length-cname.c-expected
@@ -0,0 +1,161 @@
+/* arrays_struct_field_length_cname.c generated by valac, the Vala compiler
+ * generated from arrays_struct_field_length_cname.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_BAR (bar_get_type ())
+typedef struct _Bar Bar;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Bar {
+       gint* foo;
+       gint foo_len;
+       gint _foo_size_;
+       gint foo_length1;
+};
+
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Bar* bar_dup (const Bar* self);
+VALA_EXTERN void bar_free (Bar* self);
+VALA_EXTERN void bar_copy (const Bar* self,
+               Bar* dest);
+VALA_EXTERN void bar_destroy (Bar* self);
+static gint* _vala_array_dup1 (gint* self,
+                        gssize length);
+static void _vala_main (void);
+static inline gpointer _vala_memdup2 (gconstpointer mem,
+                        gsize byte_size);
+
+static gint*
+_vala_array_dup1 (gint* self,
+                  gssize length)
+{
+       if (length > 0) {
+               return _vala_memdup2 (self, length * sizeof (gint));
+       }
+       return NULL;
+}
+
+void
+bar_copy (const Bar* self,
+          Bar* dest)
+{
+       gint* _tmp0_;
+       gint _tmp0__length1;
+       gint* _tmp1_;
+       gint _tmp1__length1;
+       _tmp0_ = (*self).foo;
+       _tmp0__length1 = (*self).foo_len;
+       _tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup1 (_tmp0_, _tmp0__length1) : _tmp0_;
+       _tmp1__length1 = _tmp0__length1;
+       (*dest).foo = (g_free ((*dest).foo), NULL);
+       (*dest).foo = _tmp1_;
+       (*dest).foo_len = _tmp1__length1;
+       (*dest)._foo_size_ = (*dest).foo_len;
+       (*dest).foo_length1 = (*self).foo_length1;
+}
+
+void
+bar_destroy (Bar* self)
+{
+       (*self).foo = (g_free ((*self).foo), NULL);
+}
+
+Bar*
+bar_dup (const Bar* self)
+{
+       Bar* dup;
+       dup = g_new0 (Bar, 1);
+       bar_copy (self, dup);
+       return dup;
+}
+
+void
+bar_free (Bar* self)
+{
+       bar_destroy (self);
+       g_free (self);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       GType bar_type_id;
+       bar_type_id = g_boxed_type_register_static ("Bar", (GBoxedCopyFunc) bar_dup, (GBoxedFreeFunc) 
bar_free);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Bar bar = {0};
+       gint* _tmp0_;
+       Bar _tmp1_ = {0};
+       Bar _tmp2_;
+       gint* _tmp3_;
+       gint _tmp3__length1;
+       _tmp0_ = g_new0 (gint, 2);
+       _tmp0_[0] = 23;
+       _tmp0_[1] = 42;
+       _tmp1_.foo = (g_free (_tmp1_.foo), NULL);
+       _tmp1_.foo = _tmp0_;
+       _tmp1_.foo_len = 2;
+       _tmp1_._foo_size_ = _tmp1_.foo_len;
+       _tmp1_.foo_length1 = -1;
+       bar = _tmp1_;
+       _tmp2_ = bar;
+       _tmp3_ = _tmp2_.foo;
+       _tmp3__length1 = _tmp2_.foo_len;
+       _vala_assert (_tmp3__length1 == 2, "bar.foo.length == 2");
+       bar_destroy (&bar);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static inline gpointer
+_vala_memdup2 (gconstpointer mem,
+               gsize byte_size)
+{
+       gpointer new_mem;
+       if (mem && byte_size != 0) {
+               new_mem = g_malloc (byte_size);
+               memcpy (new_mem, mem, byte_size);
+       } else {
+               new_mem = NULL;
+       }
+       return new_mem;
+}
+
diff --git a/tests/arrays/struct-initializer-null.c-expected b/tests/arrays/struct-initializer-null.c-expected
new file mode 100644
index 000000000..1f7ea2aec
--- /dev/null
+++ b/tests/arrays/struct-initializer-null.c-expected
@@ -0,0 +1,114 @@
+/* arrays_struct_initializer_null.c generated by valac, the Vala compiler
+ * generated from arrays_struct_initializer_null.vala, do not modify */
+
+#include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+
+struct _Foo {
+       const gchar* s;
+       gint i;
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+static void _vala_main (void);
+
+const Foo FOOS[2] = {{"foo", 23}, {0}};
+const Foo BARS[2] = {{"bar", 42}, (Foo) {0}};
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       memcpy (dup, self, sizeof (Foo));
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foos = NULL;
+       Foo _tmp0_ = {0};
+       Foo _tmp1_ = {0};
+       Foo* _tmp2_;
+       gint foos_length1;
+       gint _foos_size_;
+       Foo* bars = NULL;
+       Foo _tmp3_ = {0};
+       Foo* _tmp4_;
+       gint bars_length1;
+       gint _bars_size_;
+       memset (&_tmp0_, 0, sizeof (Foo));
+       _tmp0_.s = "foo";
+       _tmp0_.i = 23;
+       memset (&_tmp1_, 0, sizeof (Foo));
+       _tmp2_ = g_new0 (Foo, 2);
+       _tmp2_[0] = _tmp0_;
+       _tmp2_[1] = _tmp1_;
+       foos = _tmp2_;
+       foos_length1 = 2;
+       _foos_size_ = foos_length1;
+       memset (&_tmp3_, 0, sizeof (Foo));
+       _tmp3_.s = "bar";
+       _tmp3_.i = 42;
+       _tmp4_ = g_new0 (Foo, 2);
+       _tmp4_[0] = _tmp3_;
+       _tmp4_[1] = (Foo) {0};
+       bars = _tmp4_;
+       bars_length1 = 2;
+       _bars_size_ = bars_length1;
+       bars = (g_free (bars), NULL);
+       foos = (g_free (foos), NULL);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/arrays/struct-namespaced-initializer.c-expected 
b/tests/arrays/struct-namespaced-initializer.c-expected
new file mode 100644
index 000000000..3ed7b2cc9
--- /dev/null
+++ b/tests/arrays/struct-namespaced-initializer.c-expected
@@ -0,0 +1,481 @@
+/* arrays_struct_namespaced_initializer.c generated by valac, the Vala compiler
+ * generated from arrays_struct_namespaced_initializer.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+#include <stdlib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define MANAM_BAR_TYPE_FOO (manam_bar_foo_get_type ())
+typedef struct _ManamBarFoo ManamBarFoo;
+
+#define MANAM_TYPE_BAZ (manam_baz_get_type ())
+#define MANAM_BAZ(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MANAM_TYPE_BAZ, ManamBaz))
+#define MANAM_BAZ_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MANAM_TYPE_BAZ, ManamBazClass))
+#define MANAM_IS_BAZ(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MANAM_TYPE_BAZ))
+#define MANAM_IS_BAZ_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MANAM_TYPE_BAZ))
+#define MANAM_BAZ_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MANAM_TYPE_BAZ, ManamBazClass))
+
+typedef struct _ManamBaz ManamBaz;
+typedef struct _ManamBazClass ManamBazClass;
+typedef struct _ManamBazPrivate ManamBazPrivate;
+
+#define MANAM_BAZ_TYPE_FAZ (manam_baz_faz_get_type ())
+typedef struct _ManamBazFaz ManamBazFaz;
+#define _g_free0(var) (var = (g_free (var), NULL))
+typedef struct _ManamParamSpecBaz ManamParamSpecBaz;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _ManamBarFoo {
+       gint i;
+       gint j;
+};
+
+struct _ManamBaz {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       ManamBazPrivate * priv;
+};
+
+struct _ManamBazClass {
+       GTypeClass parent_class;
+       void (*finalize) (ManamBaz *self);
+};
+
+struct _ManamBazFaz {
+       gchar* s;
+       guint i;
+};
+
+struct _ManamParamSpecBaz {
+       GParamSpec parent_instance;
+};
+
+static gpointer manam_baz_parent_class = NULL;
+
+VALA_EXTERN GType manam_bar_foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN ManamBarFoo* manam_bar_foo_dup (const ManamBarFoo* self);
+VALA_EXTERN void manam_bar_foo_free (ManamBarFoo* self);
+VALA_EXTERN gpointer manam_baz_ref (gpointer instance);
+VALA_EXTERN void manam_baz_unref (gpointer instance);
+VALA_EXTERN GParamSpec* manam_param_spec_baz (const gchar* name,
+                                  const gchar* nick,
+                                  const gchar* blurb,
+                                  GType object_type,
+                                  GParamFlags flags);
+VALA_EXTERN void manam_value_set_baz (GValue* value,
+                          gpointer v_object);
+VALA_EXTERN void manam_value_take_baz (GValue* value,
+                           gpointer v_object);
+VALA_EXTERN gpointer manam_value_get_baz (const GValue* value);
+VALA_EXTERN GType manam_baz_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (ManamBaz, manam_baz_unref)
+VALA_EXTERN ManamBaz* manam_baz_new (void);
+VALA_EXTERN ManamBaz* manam_baz_construct (GType object_type);
+VALA_EXTERN GType manam_baz_faz_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN ManamBazFaz* manam_baz_faz_dup (const ManamBazFaz* self);
+VALA_EXTERN void manam_baz_faz_free (ManamBazFaz* self);
+VALA_EXTERN void manam_baz_faz_copy (const ManamBazFaz* self,
+                         ManamBazFaz* dest);
+VALA_EXTERN void manam_baz_faz_destroy (ManamBazFaz* self);
+static void manam_baz_finalize (ManamBaz * obj);
+static GType manam_baz_get_type_once (void);
+static void _vala_main (void);
+static void _vala_ManamBazFaz_array_free (ManamBazFaz * array,
+                                   gssize array_length);
+
+ManamBarFoo*
+manam_bar_foo_dup (const ManamBarFoo* self)
+{
+       ManamBarFoo* dup;
+       dup = g_new0 (ManamBarFoo, 1);
+       memcpy (dup, self, sizeof (ManamBarFoo));
+       return dup;
+}
+
+void
+manam_bar_foo_free (ManamBarFoo* self)
+{
+       g_free (self);
+}
+
+static GType
+manam_bar_foo_get_type_once (void)
+{
+       GType manam_bar_foo_type_id;
+       manam_bar_foo_type_id = g_boxed_type_register_static ("ManamBarFoo", (GBoxedCopyFunc) 
manam_bar_foo_dup, (GBoxedFreeFunc) manam_bar_foo_free);
+       return manam_bar_foo_type_id;
+}
+
+GType
+manam_bar_foo_get_type (void)
+{
+       static volatile gsize manam_bar_foo_type_id__volatile = 0;
+       if (g_once_init_enter (&manam_bar_foo_type_id__volatile)) {
+               GType manam_bar_foo_type_id;
+               manam_bar_foo_type_id = manam_bar_foo_get_type_once ();
+               g_once_init_leave (&manam_bar_foo_type_id__volatile, manam_bar_foo_type_id);
+       }
+       return manam_bar_foo_type_id__volatile;
+}
+
+ManamBaz*
+manam_baz_construct (GType object_type)
+{
+       ManamBaz* self = NULL;
+       self = (ManamBaz*) g_type_create_instance (object_type);
+       return self;
+}
+
+ManamBaz*
+manam_baz_new (void)
+{
+       return manam_baz_construct (MANAM_TYPE_BAZ);
+}
+
+void
+manam_baz_faz_copy (const ManamBazFaz* self,
+                    ManamBazFaz* dest)
+{
+       const gchar* _tmp0_;
+       gchar* _tmp1_;
+       _tmp0_ = (*self).s;
+       _tmp1_ = g_strdup (_tmp0_);
+       _g_free0 ((*dest).s);
+       (*dest).s = _tmp1_;
+       (*dest).i = (*self).i;
+}
+
+void
+manam_baz_faz_destroy (ManamBazFaz* self)
+{
+       _g_free0 ((*self).s);
+}
+
+ManamBazFaz*
+manam_baz_faz_dup (const ManamBazFaz* self)
+{
+       ManamBazFaz* dup;
+       dup = g_new0 (ManamBazFaz, 1);
+       manam_baz_faz_copy (self, dup);
+       return dup;
+}
+
+void
+manam_baz_faz_free (ManamBazFaz* self)
+{
+       manam_baz_faz_destroy (self);
+       g_free (self);
+}
+
+static GType
+manam_baz_faz_get_type_once (void)
+{
+       GType manam_baz_faz_type_id;
+       manam_baz_faz_type_id = g_boxed_type_register_static ("ManamBazFaz", (GBoxedCopyFunc) 
manam_baz_faz_dup, (GBoxedFreeFunc) manam_baz_faz_free);
+       return manam_baz_faz_type_id;
+}
+
+GType
+manam_baz_faz_get_type (void)
+{
+       static volatile gsize manam_baz_faz_type_id__volatile = 0;
+       if (g_once_init_enter (&manam_baz_faz_type_id__volatile)) {
+               GType manam_baz_faz_type_id;
+               manam_baz_faz_type_id = manam_baz_faz_get_type_once ();
+               g_once_init_leave (&manam_baz_faz_type_id__volatile, manam_baz_faz_type_id);
+       }
+       return manam_baz_faz_type_id__volatile;
+}
+
+static void
+manam_value_baz_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+manam_value_baz_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               manam_baz_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+manam_value_baz_copy_value (const GValue* src_value,
+                            GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = manam_baz_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+manam_value_baz_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+manam_value_baz_collect_value (GValue* value,
+                               guint n_collect_values,
+                               GTypeCValue* collect_values,
+                               guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               ManamBaz * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = manam_baz_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+manam_value_baz_lcopy_value (const GValue* value,
+                             guint n_collect_values,
+                             GTypeCValue* collect_values,
+                             guint collect_flags)
+{
+       ManamBaz ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = manam_baz_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+manam_param_spec_baz (const gchar* name,
+                      const gchar* nick,
+                      const gchar* blurb,
+                      GType object_type,
+                      GParamFlags flags)
+{
+       ManamParamSpecBaz* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, MANAM_TYPE_BAZ), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+manam_value_get_baz (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, MANAM_TYPE_BAZ), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+manam_value_set_baz (GValue* value,
+                     gpointer v_object)
+{
+       ManamBaz * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, MANAM_TYPE_BAZ));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, MANAM_TYPE_BAZ));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               manam_baz_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               manam_baz_unref (old);
+       }
+}
+
+void
+manam_value_take_baz (GValue* value,
+                      gpointer v_object)
+{
+       ManamBaz * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, MANAM_TYPE_BAZ));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, MANAM_TYPE_BAZ));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               manam_baz_unref (old);
+       }
+}
+
+static void
+manam_baz_class_init (ManamBazClass * klass,
+                      gpointer klass_data)
+{
+       manam_baz_parent_class = g_type_class_peek_parent (klass);
+       ((ManamBazClass *) klass)->finalize = manam_baz_finalize;
+}
+
+static void
+manam_baz_instance_init (ManamBaz * self,
+                         gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+manam_baz_finalize (ManamBaz * obj)
+{
+       ManamBaz * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, MANAM_TYPE_BAZ, ManamBaz);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+manam_baz_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { manam_value_baz_init, 
manam_value_baz_free_value, manam_value_baz_copy_value, manam_value_baz_peek_pointer, "p", 
manam_value_baz_collect_value, "p", manam_value_baz_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (ManamBazClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) manam_baz_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(ManamBaz), 0, (GInstanceInitFunc) manam_baz_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType manam_baz_type_id;
+       manam_baz_type_id = g_type_register_fundamental (g_type_fundamental_next (), "ManamBaz", 
&g_define_type_info, &g_define_type_fundamental_info, 0);
+       return manam_baz_type_id;
+}
+
+GType
+manam_baz_get_type (void)
+{
+       static volatile gsize manam_baz_type_id__volatile = 0;
+       if (g_once_init_enter (&manam_baz_type_id__volatile)) {
+               GType manam_baz_type_id;
+               manam_baz_type_id = manam_baz_get_type_once ();
+               g_once_init_leave (&manam_baz_type_id__volatile, manam_baz_type_id);
+       }
+       return manam_baz_type_id__volatile;
+}
+
+gpointer
+manam_baz_ref (gpointer instance)
+{
+       ManamBaz * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+manam_baz_unref (gpointer instance)
+{
+       ManamBaz * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               MANAM_BAZ_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_ManamBazFaz_array_free (ManamBazFaz * array,
+                              gssize array_length)
+{
+       if (array != NULL) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       manam_baz_faz_destroy (&array[i]);
+               }
+       }
+       g_free (array);
+}
+
+static void
+_vala_main (void)
+{
+       ManamBarFoo* foo = NULL;
+       ManamBarFoo _tmp0_ = {0};
+       ManamBarFoo _tmp1_ = {0};
+       ManamBarFoo* _tmp2_;
+       gint foo_length1;
+       gint _foo_size_;
+       ManamBarFoo _tmp3_;
+       ManamBarFoo _tmp4_;
+       ManamBazFaz* faz = NULL;
+       gchar* _tmp5_;
+       ManamBazFaz _tmp6_ = {0};
+       ManamBazFaz* _tmp7_;
+       gint faz_length1;
+       gint _faz_size_;
+       ManamBazFaz _tmp8_;
+       const gchar* _tmp9_;
+       ManamBazFaz _tmp10_;
+       memset (&_tmp0_, 0, sizeof (ManamBarFoo));
+       _tmp0_.i = 42;
+       _tmp0_.j = 4711;
+       memset (&_tmp1_, 0, sizeof (ManamBarFoo));
+       _tmp1_.i = 23;
+       _tmp1_.j = 17;
+       _tmp2_ = g_new0 (ManamBarFoo, 2);
+       _tmp2_[0] = _tmp0_;
+       _tmp2_[1] = _tmp1_;
+       foo = _tmp2_;
+       foo_length1 = 2;
+       _foo_size_ = foo_length1;
+       _vala_assert (foo_length1 == 2, "foo.length == 2");
+       _tmp3_ = foo[0];
+       _vala_assert (_tmp3_.i == 42, "foo[0].i == 42");
+       _tmp4_ = foo[1];
+       _vala_assert (_tmp4_.j == 17, "foo[1].j == 17");
+       _tmp5_ = g_strdup ("manam");
+       memset (&_tmp6_, 0, sizeof (ManamBazFaz));
+       _g_free0 (_tmp6_.s);
+       _tmp6_.s = _tmp5_;
+       _tmp6_.i = 4711U;
+       _tmp7_ = g_new0 (ManamBazFaz, 1);
+       _tmp7_[0] = _tmp6_;
+       faz = _tmp7_;
+       faz_length1 = 1;
+       _faz_size_ = faz_length1;
+       _vala_assert (faz_length1 == 1, "faz.length == 1");
+       _tmp8_ = faz[0];
+       _tmp9_ = _tmp8_.s;
+       _vala_assert (g_strcmp0 (_tmp9_, "manam") == 0, "faz[0].s == \"manam\"");
+       _tmp10_ = faz[0];
+       _vala_assert (_tmp10_.i == 4711U, "faz[0].i == 4711U");
+       faz = (_vala_ManamBazFaz_array_free (faz, faz_length1), NULL);
+       foo = (g_free (foo), NULL);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/asynchronous/bug595735.c-expected b/tests/asynchronous/bug595735.c-expected
new file mode 100644
index 000000000..0f035d9fb
--- /dev/null
+++ b/tests/asynchronous/bug595735.c-expected
@@ -0,0 +1,466 @@
+/* asynchronous_bug595735.c generated by valac, the Vala compiler
+ * generated from asynchronous_bug595735.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+typedef struct _BarDoFooData BarDoFooData;
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+       void (*do_foo) (Foo* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+       void (*do_foo_finish) (Foo* self, GAsyncResult* _res_);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+struct _Bar {
+       Foo parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       FooClass parent_class;
+};
+
+struct _BarDoFooData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Bar* self;
+};
+
+static gpointer foo_parent_class = NULL;
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN void foo_do_foo (Foo* self,
+                 GAsyncReadyCallback _callback_,
+                 gpointer _user_data_);
+VALA_EXTERN void foo_do_foo_finish (Foo* self,
+                        GAsyncResult* _res_);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, foo_unref)
+static void bar_real_do_foo_data_free (gpointer _data);
+static void bar_real_do_foo (Foo* base,
+                      GAsyncReadyCallback _callback_,
+                      gpointer _user_data_);
+static gboolean bar_real_do_foo_co (BarDoFooData* _data_);
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static GType bar_get_type_once (void);
+static void _vala_main (void);
+
+void
+foo_do_foo (Foo* self,
+            GAsyncReadyCallback _callback_,
+            gpointer _user_data_)
+{
+       FooClass* _klass_;
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->do_foo) {
+               _klass_->do_foo (self, _callback_, _user_data_);
+       }
+}
+
+void
+foo_do_foo_finish (Foo* self,
+                   GAsyncResult* _res_)
+{
+       FooClass* _klass_;
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->do_foo_finish) {
+               _klass_->do_foo_finish (self, _res_);
+       }
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, G_TYPE_FLAG_ABSTRACT);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+bar_real_do_foo_data_free (gpointer _data)
+{
+       BarDoFooData* _data_;
+       _data_ = _data;
+       _foo_unref0 (_data_->self);
+       g_slice_free (BarDoFooData, _data_);
+}
+
+static gpointer
+_foo_ref0 (gpointer self)
+{
+       return self ? foo_ref (self) : NULL;
+}
+
+static void
+bar_real_do_foo (Foo* base,
+                 GAsyncReadyCallback _callback_,
+                 gpointer _user_data_)
+{
+       Bar * self;
+       BarDoFooData* _data_;
+       Bar* _tmp0_;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAR, Bar);
+       _data_ = g_slice_new0 (BarDoFooData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, bar_real_do_foo_data_free);
+       _tmp0_ = _foo_ref0 (self);
+       _data_->self = _tmp0_;
+       bar_real_do_foo_co (_data_);
+}
+
+static void
+bar_do_foo_finish (Foo* base,
+                   GAsyncResult* _res_)
+{
+       BarDoFooData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static gboolean
+bar_real_do_foo_co (BarDoFooData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar* self = NULL;
+       self = (Bar*) foo_construct (object_type);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->do_foo = (void (*) (Foo*, GAsyncReadyCallback, gpointer)) bar_real_do_foo;
+       ((FooClass *) klass)->do_foo_finish = (void (*) (Foo*, GAsyncResult*)) bar_do_foo_finish;
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (TYPE_FOO, "Bar", &g_define_type_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/asynchronous/bug595755.c-expected b/tests/asynchronous/bug595755.c-expected
new file mode 100644
index 000000000..ba1b49bac
--- /dev/null
+++ b/tests/asynchronous/bug595755.c-expected
@@ -0,0 +1,210 @@
+/* asynchronous_bug595755.c generated by valac, the Vala compiler
+ * generated from asynchronous_bug595755.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+typedef struct _FooDoFooData FooDoFooData;
+enum  {
+       FOO_BAR_SIGNAL,
+       FOO_NUM_SIGNALS
+};
+static guint foo_signals[FOO_NUM_SIGNALS] = {0};
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _FooDoFooData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Foo* self;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+static void foo_do_foo_data_free (gpointer _data);
+VALA_EXTERN void foo_do_foo (Foo* self,
+                 GAsyncReadyCallback _callback_,
+                 gpointer _user_data_);
+VALA_EXTERN void foo_do_foo_finish (Foo* self,
+                        GAsyncResult* _res_);
+static gboolean foo_do_foo_co (FooDoFooData* _data_);
+static void __lambda4_ (Foo* self);
+static void ___lambda4__foo_bar (Foo* _sender,
+                          gpointer self);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+static void
+foo_do_foo_data_free (gpointer _data)
+{
+       FooDoFooData* _data_;
+       _data_ = _data;
+       _g_object_unref0 (_data_->self);
+       g_slice_free (FooDoFooData, _data_);
+}
+
+static gpointer
+_g_object_ref0 (gpointer self)
+{
+       return self ? g_object_ref (self) : NULL;
+}
+
+void
+foo_do_foo (Foo* self,
+            GAsyncReadyCallback _callback_,
+            gpointer _user_data_)
+{
+       FooDoFooData* _data_;
+       Foo* _tmp0_;
+       g_return_if_fail (IS_FOO (self));
+       _data_ = g_slice_new0 (FooDoFooData);
+       _data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, foo_do_foo_data_free);
+       _tmp0_ = _g_object_ref0 (self);
+       _data_->self = _tmp0_;
+       foo_do_foo_co (_data_);
+}
+
+void
+foo_do_foo_finish (Foo* self,
+                   GAsyncResult* _res_)
+{
+       FooDoFooData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static void
+__lambda4_ (Foo* self)
+{
+}
+
+static void
+___lambda4__foo_bar (Foo* _sender,
+                     gpointer self)
+{
+       __lambda4_ ((Foo*) self);
+}
+
+static gboolean
+foo_do_foo_co (FooDoFooData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       g_signal_connect_object (_data_->self, "bar", (GCallback) ___lambda4__foo_bar, _data_->self, 0);
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       foo_signals[FOO_BAR_SIGNAL] = g_signal_new ("bar", TYPE_FOO, G_SIGNAL_RUN_LAST, 0, NULL, NULL, 
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/asynchronous/bug596177.c-expected b/tests/asynchronous/bug596177.c-expected
new file mode 100644
index 000000000..4022aa852
--- /dev/null
+++ b/tests/asynchronous/bug596177.c-expected
@@ -0,0 +1,400 @@
+/* asynchronous_bug596177.c generated by valac, the Vala compiler
+ * generated from asynchronous_bug596177.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+typedef struct _FooDoFooData FooDoFooData;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _FooPrivate {
+       GType t_type;
+       GBoxedCopyFunc t_dup_func;
+       GDestroyNotify t_destroy_func;
+};
+
+struct _FooDoFooData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Foo* self;
+       GType t;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+static void foo_do_foo_data_free (gpointer _data);
+VALA_EXTERN void foo_do_foo (Foo* self,
+                 GAsyncReadyCallback _callback_,
+                 gpointer _user_data_);
+VALA_EXTERN void foo_do_foo_finish (Foo* self,
+                        GAsyncResult* _res_);
+static gboolean foo_do_foo_co (FooDoFooData* _data_);
+VALA_EXTERN Foo* foo_new (GType t_type,
+              GBoxedCopyFunc t_dup_func,
+              GDestroyNotify t_destroy_func);
+VALA_EXTERN Foo* foo_construct (GType object_type,
+                    GType t_type,
+                    GBoxedCopyFunc t_dup_func,
+                    GDestroyNotify t_destroy_func);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+static void
+foo_do_foo_data_free (gpointer _data)
+{
+       FooDoFooData* _data_;
+       _data_ = _data;
+       _foo_unref0 (_data_->self);
+       g_slice_free (FooDoFooData, _data_);
+}
+
+static gpointer
+_foo_ref0 (gpointer self)
+{
+       return self ? foo_ref (self) : NULL;
+}
+
+void
+foo_do_foo (Foo* self,
+            GAsyncReadyCallback _callback_,
+            gpointer _user_data_)
+{
+       FooDoFooData* _data_;
+       Foo* _tmp0_;
+       g_return_if_fail (IS_FOO (self));
+       _data_ = g_slice_new0 (FooDoFooData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, foo_do_foo_data_free);
+       _tmp0_ = _foo_ref0 (self);
+       _data_->self = _tmp0_;
+       foo_do_foo_co (_data_);
+}
+
+void
+foo_do_foo_finish (Foo* self,
+                   GAsyncResult* _res_)
+{
+       FooDoFooData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static gboolean
+foo_do_foo_co (FooDoFooData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->t = _data_->self->priv->t_type;
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+Foo*
+foo_construct (GType object_type,
+               GType t_type,
+               GBoxedCopyFunc t_dup_func,
+               GDestroyNotify t_destroy_func)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       self->priv->t_type = t_type;
+       self->priv->t_dup_func = t_dup_func;
+       self->priv->t_destroy_func = t_destroy_func;
+       return self;
+}
+
+Foo*
+foo_new (GType t_type,
+         GBoxedCopyFunc t_dup_func,
+         GDestroyNotify t_destroy_func)
+{
+       return foo_construct (TYPE_FOO, t_type, t_dup_func, t_destroy_func);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/asynchronous/bug596861.c-expected b/tests/asynchronous/bug596861.c-expected
new file mode 100644
index 000000000..8139574a9
--- /dev/null
+++ b/tests/asynchronous/bug596861.c-expected
@@ -0,0 +1,218 @@
+/* asynchronous_bug596861.c generated by valac, the Vala compiler
+ * generated from asynchronous_bug596861.vala, do not modify */
+
+#include <gio/gio.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef struct _FooData FooData;
+
+struct _FooData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       gint result;
+       gint* _tmp0_;
+       gint* e_collection;
+       gint e_collection_length1;
+       gint _e_collection_size_;
+       gint e_it;
+       gint e;
+       gint* _tmp1_;
+       gint* _vala1_e_collection;
+       gint _vala1_e_collection_length1;
+       gint __vala1_e_collection_size_;
+       gint _vala1_e_it;
+       gint _vala1_e;
+       GError* _inner_error0_;
+};
+
+static void foo_data_free (gpointer _data);
+VALA_EXTERN void foo (GAsyncReadyCallback _callback_,
+          gpointer _user_data_);
+VALA_EXTERN gint foo_finish (GAsyncResult* _res_,
+                 GError** error);
+static gboolean foo_co (FooData* _data_);
+static void foo_ready (GObject* source_object,
+                GAsyncResult* _res_,
+                gpointer _user_data_);
+static void _vala_main (void);
+
+static void
+foo_data_free (gpointer _data)
+{
+       FooData* _data_;
+       _data_ = _data;
+       g_slice_free (FooData, _data_);
+}
+
+void
+foo (GAsyncReadyCallback _callback_,
+     gpointer _user_data_)
+{
+       FooData* _data_;
+       _data_ = g_slice_new0 (FooData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, foo_data_free);
+       foo_co (_data_);
+}
+
+gint
+foo_finish (GAsyncResult* _res_,
+            GError** error)
+{
+       gint result;
+       FooData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), error);
+       if (NULL == _data_) {
+               gint _tmp0_ = 0;
+               return _tmp0_;
+       }
+       result = _data_->result;
+       return result;
+}
+
+static void
+foo_ready (GObject* source_object,
+           GAsyncResult* _res_,
+           gpointer _user_data_)
+{
+       FooData* _data_;
+       _data_ = _user_data_;
+       _data_->_source_object_ = source_object;
+       _data_->_res_ = _res_;
+       foo_co (_data_);
+}
+
+static gboolean
+foo_co (FooData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               case 1:
+               goto _state_1;
+               case 2:
+               goto _state_2;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       {
+               _data_->_state_ = 1;
+               foo (foo_ready, _data_);
+               return FALSE;
+               _state_1:
+               foo_finish (_data_->_res_, &_data_->_inner_error0_);
+               if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+                       goto __catch0_g_error;
+               }
+       }
+       goto __finally0;
+       __catch0_g_error:
+       {
+               g_clear_error (&_data_->_inner_error0_);
+               {
+                       _data_->_state_ = 2;
+                       foo (foo_ready, _data_);
+                       return FALSE;
+                       _state_2:
+                       foo_finish (_data_->_res_, &_data_->_inner_error0_);
+                       if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+                               goto __catch1_g_error;
+                       }
+               }
+               goto __finally1;
+               __catch1_g_error:
+               {
+                       g_clear_error (&_data_->_inner_error0_);
+                       _data_->result = 0;
+                       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+                       if (_data_->_state_ != 0) {
+                               while (!g_task_get_completed (_data_->_async_result)) {
+                                       g_main_context_iteration (g_task_get_context (_data_->_async_result), 
TRUE);
+                               }
+                       }
+                       g_object_unref (_data_->_async_result);
+                       return FALSE;
+               }
+               __finally1:
+               if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+                       g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, 
_data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), 
_data_->_inner_error0_->code);
+                       g_clear_error (&_data_->_inner_error0_);
+                       g_object_unref (_data_->_async_result);
+                       return FALSE;
+               }
+       }
+       __finally0:
+       if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+               g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
+               g_object_unref (_data_->_async_result);
+               return FALSE;
+       }
+       _data_->_tmp0_ = g_new0 (gint, 3);
+       _data_->_tmp0_[0] = 1;
+       _data_->_tmp0_[1] = 2;
+       _data_->_tmp0_[2] = 3;
+       {
+               _data_->e_collection_length1 = 0;
+               _data_->_e_collection_size_ = 0;
+               _data_->e_collection = _data_->_tmp0_;
+               _data_->e_collection_length1 = 3;
+               for (_data_->e_it = 0; _data_->e_it < _data_->e_collection_length1; _data_->e_it = 
_data_->e_it + 1) {
+                       _data_->e = _data_->e_collection[_data_->e_it];
+                       {
+                       }
+               }
+               _data_->e_collection = (g_free (_data_->e_collection), NULL);
+       }
+       _data_->_tmp1_ = g_new0 (gint, 3);
+       _data_->_tmp1_[0] = 1;
+       _data_->_tmp1_[1] = 2;
+       _data_->_tmp1_[2] = 3;
+       {
+               _data_->_vala1_e_collection_length1 = 0;
+               _data_->__vala1_e_collection_size_ = 0;
+               _data_->_vala1_e_collection = _data_->_tmp1_;
+               _data_->_vala1_e_collection_length1 = 3;
+               for (_data_->_vala1_e_it = 0; _data_->_vala1_e_it < _data_->_vala1_e_collection_length1; 
_data_->_vala1_e_it = _data_->_vala1_e_it + 1) {
+                       _data_->_vala1_e = _data_->_vala1_e_collection[_data_->_vala1_e_it];
+                       {
+                       }
+               }
+               _data_->_vala1_e_collection = (g_free (_data_->_vala1_e_collection), NULL);
+       }
+       _data_->result = 0;
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/asynchronous/bug597294.c-expected b/tests/asynchronous/bug597294.c-expected
new file mode 100644
index 000000000..ee890d6fb
--- /dev/null
+++ b/tests/asynchronous/bug597294.c-expected
@@ -0,0 +1,117 @@
+/* asynchronous_bug597294.c generated by valac, the Vala compiler
+ * generated from asynchronous_bug597294.vala, do not modify */
+
+#include <glib.h>
+#include <gio/gio.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef void (*Foo) (gpointer user_data);
+typedef struct _DoFooData DoFooData;
+
+struct _DoFooData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Foo f;
+       gpointer f_target;
+       GDestroyNotify f_target_destroy_notify;
+};
+
+static void do_foo_data_free (gpointer _data);
+VALA_EXTERN void do_foo (Foo f,
+             gpointer f_target,
+             GDestroyNotify f_target_destroy_notify,
+             GAsyncReadyCallback _callback_,
+             gpointer _user_data_);
+VALA_EXTERN void do_foo_finish (GAsyncResult* _res_);
+static gboolean do_foo_co (DoFooData* _data_);
+static void _vala_main (void);
+
+static void
+do_foo_data_free (gpointer _data)
+{
+       DoFooData* _data_;
+       _data_ = _data;
+       (_data_->f_target_destroy_notify == NULL) ? NULL : (_data_->f_target_destroy_notify 
(_data_->f_target), NULL);
+       _data_->f = NULL;
+       _data_->f_target = NULL;
+       _data_->f_target_destroy_notify = NULL;
+       g_slice_free (DoFooData, _data_);
+}
+
+void
+do_foo (Foo f,
+        gpointer f_target,
+        GDestroyNotify f_target_destroy_notify,
+        GAsyncReadyCallback _callback_,
+        gpointer _user_data_)
+{
+       DoFooData* _data_;
+       _data_ = g_slice_new0 (DoFooData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, do_foo_data_free);
+       (_data_->f_target_destroy_notify == NULL) ? NULL : (_data_->f_target_destroy_notify 
(_data_->f_target), NULL);
+       _data_->f = NULL;
+       _data_->f_target = NULL;
+       _data_->f_target_destroy_notify = NULL;
+       _data_->f = f;
+       _data_->f_target = f_target;
+       _data_->f_target_destroy_notify = f_target_destroy_notify;
+       do_foo_co (_data_);
+}
+
+void
+do_foo_finish (GAsyncResult* _res_)
+{
+       DoFooData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static gboolean
+do_foo_co (DoFooData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->f (_data_->f_target);
+       (_data_->f_target_destroy_notify == NULL) ? NULL : (_data_->f_target_destroy_notify 
(_data_->f_target), NULL);
+       _data_->f = NULL;
+       _data_->f_target = NULL;
+       _data_->f_target_destroy_notify = NULL;
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/asynchronous/bug598677.c-expected b/tests/asynchronous/bug598677.c-expected
new file mode 100644
index 000000000..5933f8d6c
--- /dev/null
+++ b/tests/asynchronous/bug598677.c-expected
@@ -0,0 +1,371 @@
+/* asynchronous_bug598677.c generated by valac, the Vala compiler
+ * generated from asynchronous_bug598677.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+#include <gio/gio.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+typedef struct _DoFooData DoFooData;
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+struct _DoFooData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Foo* _tmp0_;
+       Foo* _tmp1_;
+       GError* _inner_error0_;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new (GError** error);
+VALA_EXTERN Foo* foo_construct (GType object_type,
+                    GError** error);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void do_foo_data_free (gpointer _data);
+VALA_EXTERN void do_foo (GAsyncReadyCallback _callback_,
+             gpointer _user_data_);
+VALA_EXTERN void do_foo_finish (GAsyncResult* _res_,
+                    GError** error);
+static gboolean do_foo_co (DoFooData* _data_);
+static void _vala_main (void);
+
+Foo*
+foo_construct (GType object_type,
+               GError** error)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (GError** error)
+{
+       return foo_construct (TYPE_FOO, error);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+do_foo_data_free (gpointer _data)
+{
+       DoFooData* _data_;
+       _data_ = _data;
+       g_slice_free (DoFooData, _data_);
+}
+
+void
+do_foo (GAsyncReadyCallback _callback_,
+        gpointer _user_data_)
+{
+       DoFooData* _data_;
+       _data_ = g_slice_new0 (DoFooData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, do_foo_data_free);
+       do_foo_co (_data_);
+}
+
+void
+do_foo_finish (GAsyncResult* _res_,
+               GError** error)
+{
+       DoFooData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), error);
+       if (NULL == _data_) {
+               return;
+       }
+}
+
+static gboolean
+do_foo_co (DoFooData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->_tmp0_ = foo_new (&_data_->_inner_error0_);
+       _data_->_tmp1_ = _data_->_tmp0_;
+       _foo_unref0 (_data_->_tmp1_);
+       if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+               g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
+               g_object_unref (_data_->_async_result);
+               return FALSE;
+       }
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/asynchronous/bug598697.c-expected b/tests/asynchronous/bug598697.c-expected
new file mode 100644
index 000000000..9d7884fbb
--- /dev/null
+++ b/tests/asynchronous/bug598697.c-expected
@@ -0,0 +1,394 @@
+/* asynchronous_bug598697.c generated by valac, the Vala compiler
+ * generated from asynchronous_bug598697.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef void (*Func) (gpointer user_data);
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+typedef struct _FooDoFooData FooDoFooData;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _FooDoFooData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Foo* self;
+       Func f;
+       gpointer f_target;
+       GDestroyNotify f_target_destroy_notify;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+static void foo_do_foo_data_free (gpointer _data);
+VALA_EXTERN void foo_do_foo (Foo* self,
+                 GAsyncReadyCallback _callback_,
+                 gpointer _user_data_);
+VALA_EXTERN void foo_do_foo_finish (Foo* self,
+                        GAsyncResult* _res_);
+static gboolean foo_do_foo_co (FooDoFooData* _data_);
+static void __lambda4_ (Foo* self);
+static void ___lambda4__func (gpointer self);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+static void
+foo_do_foo_data_free (gpointer _data)
+{
+       FooDoFooData* _data_;
+       _data_ = _data;
+       _foo_unref0 (_data_->self);
+       g_slice_free (FooDoFooData, _data_);
+}
+
+static gpointer
+_foo_ref0 (gpointer self)
+{
+       return self ? foo_ref (self) : NULL;
+}
+
+void
+foo_do_foo (Foo* self,
+            GAsyncReadyCallback _callback_,
+            gpointer _user_data_)
+{
+       FooDoFooData* _data_;
+       Foo* _tmp0_;
+       g_return_if_fail (IS_FOO (self));
+       _data_ = g_slice_new0 (FooDoFooData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, foo_do_foo_data_free);
+       _tmp0_ = _foo_ref0 (self);
+       _data_->self = _tmp0_;
+       foo_do_foo_co (_data_);
+}
+
+void
+foo_do_foo_finish (Foo* self,
+                   GAsyncResult* _res_)
+{
+       FooDoFooData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static void
+__lambda4_ (Foo* self)
+{
+}
+
+static void
+___lambda4__func (gpointer self)
+{
+       __lambda4_ ((Foo*) self);
+}
+
+static gboolean
+foo_do_foo_co (FooDoFooData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->f = ___lambda4__func;
+       _data_->f_target = foo_ref (_data_->self);
+       _data_->f_target_destroy_notify = foo_unref;
+       (_data_->f_target_destroy_notify == NULL) ? NULL : (_data_->f_target_destroy_notify 
(_data_->f_target), NULL);
+       _data_->f = NULL;
+       _data_->f_target = NULL;
+       _data_->f_target_destroy_notify = NULL;
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/asynchronous/bug598698.c-expected b/tests/asynchronous/bug598698.c-expected
new file mode 100644
index 000000000..ebd96d2a2
--- /dev/null
+++ b/tests/asynchronous/bug598698.c-expected
@@ -0,0 +1,398 @@
+/* asynchronous_bug598698.c generated by valac, the Vala compiler
+ * generated from asynchronous_bug598698.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define FOO_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_FOO, FooIface))
+
+typedef struct _Foo Foo;
+typedef struct _FooIface FooIface;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+typedef struct _ParamSpecBar ParamSpecBar;
+
+struct _FooIface {
+       GTypeInterface parent_iface;
+       void (*do_foo) (Foo* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+       void (*do_foo_finish) (Foo* self, GAsyncResult* _res_);
+};
+
+struct _Bar {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       GTypeClass parent_class;
+       void (*finalize) (Bar *self);
+       void (*do_foo) (Bar* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+       void (*do_foo_finish) (Bar* self, GAsyncResult* _res_);
+};
+
+struct _ParamSpecBar {
+       GParamSpec parent_instance;
+};
+
+static gpointer bar_parent_class = NULL;
+static FooIface * bar_foo_parent_iface = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN void foo_do_foo (Foo* self,
+                 GAsyncReadyCallback _callback_,
+                 gpointer _user_data_);
+VALA_EXTERN void foo_do_foo_finish (Foo* self,
+                        GAsyncResult* _res_);
+static GType foo_get_type_once (void);
+VALA_EXTERN gpointer bar_ref (gpointer instance);
+VALA_EXTERN void bar_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_bar (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_bar (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_bar (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_bar (const GValue* value);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, bar_unref)
+VALA_EXTERN void bar_do_foo (Bar* self,
+                 GAsyncReadyCallback _callback_,
+                 gpointer _user_data_);
+VALA_EXTERN void bar_do_foo_finish (Bar* self,
+                        GAsyncResult* _res_);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static void bar_finalize (Bar * obj);
+static GType bar_get_type_once (void);
+static void _vala_main (void);
+
+void
+foo_do_foo (Foo* self,
+            GAsyncReadyCallback _callback_,
+            gpointer _user_data_)
+{
+       FooIface* _iface_;
+       _iface_ = FOO_GET_INTERFACE (self);
+       if (_iface_->do_foo) {
+               _iface_->do_foo (self, _callback_, _user_data_);
+       }
+}
+
+void
+foo_do_foo_finish (Foo* self,
+                   GAsyncResult* _res_)
+{
+       FooIface* _iface_;
+       _iface_ = FOO_GET_INTERFACE (self);
+       if (_iface_->do_foo_finish) {
+               _iface_->do_foo_finish (self, _res_);
+       }
+}
+
+static void
+foo_default_init (FooIface * iface,
+                  gpointer iface_data)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_INTERFACE, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+void
+bar_do_foo (Bar* self,
+            GAsyncReadyCallback _callback_,
+            gpointer _user_data_)
+{
+       BarClass* _klass_;
+       _klass_ = BAR_GET_CLASS (self);
+       if (_klass_->do_foo) {
+               _klass_->do_foo (self, _callback_, _user_data_);
+       }
+}
+
+void
+bar_do_foo_finish (Bar* self,
+                   GAsyncResult* _res_)
+{
+       BarClass* _klass_;
+       _klass_ = BAR_GET_CLASS (self);
+       if (_klass_->do_foo_finish) {
+               _klass_->do_foo_finish (self, _res_);
+       }
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar* self = NULL;
+       self = (Bar*) g_type_create_instance (object_type);
+       return self;
+}
+
+static void
+value_bar_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_bar_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               bar_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_bar_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = bar_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_bar_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_bar_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Bar * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = bar_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_bar_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Bar ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = bar_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_bar (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecBar* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_BAR), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_bar (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_bar (GValue* value,
+               gpointer v_object)
+{
+       Bar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               bar_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_unref (old);
+       }
+}
+
+void
+value_take_bar (GValue* value,
+                gpointer v_object)
+{
+       Bar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_unref (old);
+       }
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       ((BarClass *) klass)->finalize = bar_finalize;
+}
+
+static void
+bar_foo_interface_init (FooIface * iface,
+                        gpointer iface_data)
+{
+       bar_foo_parent_iface = g_type_interface_peek_parent (iface);
+       iface->do_foo = (void (*) (Foo*, GAsyncReadyCallback, gpointer)) bar_do_foo;
+       iface->do_foo_finish = (void (*) (Foo*, GAsyncResult*)) bar_do_foo_finish;
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+bar_finalize (Bar * obj)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_bar_init, value_bar_free_value, 
value_bar_copy_value, value_bar_peek_pointer, "p", value_bar_collect_value, "p", value_bar_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       static const GInterfaceInfo foo_info = { (GInterfaceInitFunc) bar_foo_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       GType bar_type_id;
+       bar_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Bar", &g_define_type_info, 
&g_define_type_fundamental_info, G_TYPE_FLAG_ABSTRACT);
+       g_type_add_interface_static (bar_type_id, TYPE_FOO, &foo_info);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+gpointer
+bar_ref (gpointer instance)
+{
+       Bar * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+bar_unref (gpointer instance)
+{
+       Bar * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               BAR_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/asynchronous/bug599568.c-expected b/tests/asynchronous/bug599568.c-expected
new file mode 100644
index 000000000..8ae3247b5
--- /dev/null
+++ b/tests/asynchronous/bug599568.c-expected
@@ -0,0 +1,120 @@
+/* asynchronous_bug599568.c generated by valac, the Vala compiler
+ * generated from asynchronous_bug599568.vala, do not modify */
+
+#include <gio/gio.h>
+#include <glib.h>
+#include <glib-object.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef struct _DoFooData DoFooData;
+
+struct _DoFooData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       gint i;
+       gboolean _tmp0_;
+       gint _tmp1_;
+       GValue value;
+       GValue _tmp2_;
+};
+
+static void do_foo_data_free (gpointer _data);
+VALA_EXTERN void do_foo (GAsyncReadyCallback _callback_,
+             gpointer _user_data_);
+VALA_EXTERN void do_foo_finish (GAsyncResult* _res_);
+static gboolean do_foo_co (DoFooData* _data_);
+static void _vala_main (void);
+
+static void
+do_foo_data_free (gpointer _data)
+{
+       DoFooData* _data_;
+       _data_ = _data;
+       g_slice_free (DoFooData, _data_);
+}
+
+void
+do_foo (GAsyncReadyCallback _callback_,
+        gpointer _user_data_)
+{
+       DoFooData* _data_;
+       _data_ = g_slice_new0 (DoFooData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, do_foo_data_free);
+       do_foo_co (_data_);
+}
+
+void
+do_foo_finish (GAsyncResult* _res_)
+{
+       DoFooData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static gboolean
+do_foo_co (DoFooData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       {
+               _data_->i = 0;
+               {
+                       _data_->_tmp0_ = TRUE;
+                       while (TRUE) {
+                               if (!_data_->_tmp0_) {
+                                       _data_->_tmp1_ = _data_->i;
+                                       _data_->i = _data_->_tmp1_ + 1;
+                               }
+                               _data_->_tmp0_ = FALSE;
+                               if (!(_data_->i < 2)) {
+                                       break;
+                               }
+                               memset (&_data_->_tmp2_, 0, sizeof (GValue));
+                               g_value_init (&_data_->_tmp2_, G_TYPE_INT);
+                               g_value_set_int (&_data_->_tmp2_, 42);
+                               _data_->value = _data_->_tmp2_;
+                               G_IS_VALUE (&_data_->value) ? (g_value_unset (&_data_->value), NULL) : NULL;
+                       }
+               }
+       }
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+_vala_main (void)
+{
+       do_foo (NULL, NULL);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/asynchronous/bug600827.c-expected b/tests/asynchronous/bug600827.c-expected
new file mode 100644
index 000000000..1fab1268c
--- /dev/null
+++ b/tests/asynchronous/bug600827.c-expected
@@ -0,0 +1,404 @@
+/* asynchronous_bug600827.c generated by valac, the Vala compiler
+ * generated from asynchronous_bug600827.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <gobject/gvaluecollector.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+typedef struct _FooDoFooData FooDoFooData;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+       void (*do_foo) (Foo* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+       void (*do_foo_finish) (Foo* self, GAsyncResult* _res_);
+};
+
+struct _FooDoFooData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Foo* self;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN void foo_do_foo (Foo* self,
+                 GAsyncReadyCallback _callback_,
+                 gpointer _user_data_);
+VALA_EXTERN void foo_do_foo_finish (Foo* self,
+                        GAsyncResult* _res_);
+static void foo_real_do_foo_data_free (gpointer _data);
+static void foo_real_do_foo (Foo* self,
+                      GAsyncReadyCallback _callback_,
+                      gpointer _user_data_);
+static gboolean foo_real_do_foo_co (FooDoFooData* _data_);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+static void
+foo_real_do_foo_data_free (gpointer _data)
+{
+       FooDoFooData* _data_;
+       _data_ = _data;
+       _foo_unref0 (_data_->self);
+       g_slice_free (FooDoFooData, _data_);
+}
+
+static gpointer
+_foo_ref0 (gpointer self)
+{
+       return self ? foo_ref (self) : NULL;
+}
+
+static void
+foo_real_do_foo (Foo* self,
+                 GAsyncReadyCallback _callback_,
+                 gpointer _user_data_)
+{
+       FooDoFooData* _data_;
+       Foo* _tmp0_;
+       _data_ = g_slice_new0 (FooDoFooData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, foo_real_do_foo_data_free);
+       _tmp0_ = _foo_ref0 (self);
+       _data_->self = _tmp0_;
+       foo_real_do_foo_co (_data_);
+}
+
+static void
+foo_real_do_foo_finish (Foo* self,
+                        GAsyncResult* _res_)
+{
+       FooDoFooData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static gboolean
+foo_real_do_foo_co (FooDoFooData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+void
+foo_do_foo (Foo* self,
+            GAsyncReadyCallback _callback_,
+            gpointer _user_data_)
+{
+       FooClass* _klass_;
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->do_foo) {
+               _klass_->do_foo (self, _callback_, _user_data_);
+       }
+}
+
+void
+foo_do_foo_finish (Foo* self,
+                   GAsyncResult* _res_)
+{
+       FooClass* _klass_;
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->do_foo_finish) {
+               _klass_->do_foo_finish (self, _res_);
+       }
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       ((FooClass *) klass)->do_foo = (void (*) (Foo*, GAsyncReadyCallback, gpointer)) foo_real_do_foo;
+       ((FooClass *) klass)->do_foo_finish = (void (*) (Foo*, GAsyncResult*)) foo_real_do_foo_finish;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       foo_do_foo (foo, NULL, NULL);
+       _foo_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/asynchronous/bug601558.c-expected b/tests/asynchronous/bug601558.c-expected
new file mode 100644
index 000000000..3c80e87cf
--- /dev/null
+++ b/tests/asynchronous/bug601558.c-expected
@@ -0,0 +1,563 @@
+/* asynchronous_bug601558.c generated by valac, the Vala compiler
+ * generated from asynchronous_bug601558.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+typedef struct _FooDoFooData FooDoFooData;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+typedef struct _BarDoFooData BarDoFooData;
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+       void (*do_foo) (Foo* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+       void (*do_foo_finish) (Foo* self, GAsyncResult* _res_);
+};
+
+struct _FooDoFooData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Foo* self;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+struct _Bar {
+       Foo parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       FooClass parent_class;
+};
+
+struct _BarDoFooData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Bar* self;
+};
+
+static gpointer foo_parent_class = NULL;
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN void foo_do_foo (Foo* self,
+                 GAsyncReadyCallback _callback_,
+                 gpointer _user_data_);
+VALA_EXTERN void foo_do_foo_finish (Foo* self,
+                        GAsyncResult* _res_);
+static void foo_real_do_foo_data_free (gpointer _data);
+static void foo_real_do_foo (Foo* self,
+                      GAsyncReadyCallback _callback_,
+                      gpointer _user_data_);
+static gboolean foo_real_do_foo_co (FooDoFooData* _data_);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, foo_unref)
+static void bar_real_do_foo_data_free (gpointer _data);
+static void bar_real_do_foo (Foo* base,
+                      GAsyncReadyCallback _callback_,
+                      gpointer _user_data_);
+static gboolean bar_real_do_foo_co (BarDoFooData* _data_);
+static void bar_do_foo_ready (GObject* source_object,
+                       GAsyncResult* _res_,
+                       gpointer _user_data_);
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static GType bar_get_type_once (void);
+static void _vala_main (void);
+
+static void
+foo_real_do_foo_data_free (gpointer _data)
+{
+       FooDoFooData* _data_;
+       _data_ = _data;
+       _foo_unref0 (_data_->self);
+       g_slice_free (FooDoFooData, _data_);
+}
+
+static gpointer
+_foo_ref0 (gpointer self)
+{
+       return self ? foo_ref (self) : NULL;
+}
+
+static void
+foo_real_do_foo (Foo* self,
+                 GAsyncReadyCallback _callback_,
+                 gpointer _user_data_)
+{
+       FooDoFooData* _data_;
+       Foo* _tmp0_;
+       _data_ = g_slice_new0 (FooDoFooData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, foo_real_do_foo_data_free);
+       _tmp0_ = _foo_ref0 (self);
+       _data_->self = _tmp0_;
+       foo_real_do_foo_co (_data_);
+}
+
+static void
+foo_real_do_foo_finish (Foo* self,
+                        GAsyncResult* _res_)
+{
+       FooDoFooData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static gboolean
+foo_real_do_foo_co (FooDoFooData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+void
+foo_do_foo (Foo* self,
+            GAsyncReadyCallback _callback_,
+            gpointer _user_data_)
+{
+       FooClass* _klass_;
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->do_foo) {
+               _klass_->do_foo (self, _callback_, _user_data_);
+       }
+}
+
+void
+foo_do_foo_finish (Foo* self,
+                   GAsyncResult* _res_)
+{
+       FooClass* _klass_;
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->do_foo_finish) {
+               _klass_->do_foo_finish (self, _res_);
+       }
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       ((FooClass *) klass)->do_foo = (void (*) (Foo*, GAsyncReadyCallback, gpointer)) foo_real_do_foo;
+       ((FooClass *) klass)->do_foo_finish = (void (*) (Foo*, GAsyncResult*)) foo_real_do_foo_finish;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+bar_real_do_foo_data_free (gpointer _data)
+{
+       BarDoFooData* _data_;
+       _data_ = _data;
+       _foo_unref0 (_data_->self);
+       g_slice_free (BarDoFooData, _data_);
+}
+
+static void
+bar_real_do_foo (Foo* base,
+                 GAsyncReadyCallback _callback_,
+                 gpointer _user_data_)
+{
+       Bar * self;
+       BarDoFooData* _data_;
+       Bar* _tmp0_;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAR, Bar);
+       _data_ = g_slice_new0 (BarDoFooData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, bar_real_do_foo_data_free);
+       _tmp0_ = _foo_ref0 (self);
+       _data_->self = _tmp0_;
+       bar_real_do_foo_co (_data_);
+}
+
+static void
+bar_do_foo_finish (Foo* base,
+                   GAsyncResult* _res_)
+{
+       BarDoFooData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static void
+bar_do_foo_ready (GObject* source_object,
+                  GAsyncResult* _res_,
+                  gpointer _user_data_)
+{
+       BarDoFooData* _data_;
+       _data_ = _user_data_;
+       _data_->_source_object_ = source_object;
+       _data_->_res_ = _res_;
+       bar_real_do_foo_co (_data_);
+}
+
+static gboolean
+bar_real_do_foo_co (BarDoFooData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               case 1:
+               goto _state_1;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->_state_ = 1;
+       FOO_CLASS (bar_parent_class)->do_foo (G_TYPE_CHECK_INSTANCE_CAST (_data_->self, TYPE_FOO, Foo), 
bar_do_foo_ready, _data_);
+       return FALSE;
+       _state_1:
+       FOO_CLASS (bar_parent_class)->do_foo_finish (G_TYPE_CHECK_INSTANCE_CAST (_data_->self, TYPE_FOO, 
Foo), _data_->_res_);
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar* self = NULL;
+       self = (Bar*) foo_construct (object_type);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->do_foo = (void (*) (Foo*, GAsyncReadyCallback, gpointer)) bar_real_do_foo;
+       ((FooClass *) klass)->do_foo_finish = (void (*) (Foo*, GAsyncResult*)) bar_do_foo_finish;
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (TYPE_FOO, "Bar", &g_define_type_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/asynchronous/bug612641.c-expected b/tests/asynchronous/bug612641.c-expected
new file mode 100644
index 000000000..5ed1f5a66
--- /dev/null
+++ b/tests/asynchronous/bug612641.c-expected
@@ -0,0 +1,409 @@
+/* asynchronous_bug612641.c generated by valac, the Vala compiler
+ * generated from asynchronous_bug612641.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef void (*FooFunc) (gpointer user_data);
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+typedef struct _FooFooData FooFooData;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _FooFooData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Foo* self;
+       FooFunc result;
+       gpointer result_target;
+       GDestroyNotify result_target_destroy_notify;
+       FooFunc _tmp0_;
+       gpointer _tmp0__target;
+       GDestroyNotify _tmp0__target_destroy_notify;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+static void foo_foo_data_free (gpointer _data);
+static void foo_foo (Foo* self,
+              GAsyncReadyCallback _callback_,
+              gpointer _user_data_);
+static FooFunc foo_foo_finish (Foo* self,
+                        GAsyncResult* _res_,
+                        gpointer* result_target,
+                        GDestroyNotify* result_target_destroy_notify);
+static gboolean foo_foo_co (FooFooData* _data_);
+static void __lambda4_ (Foo* self);
+static void ___lambda4__foo_func (gpointer self);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+static void
+foo_foo_data_free (gpointer _data)
+{
+       FooFooData* _data_;
+       _data_ = _data;
+       (_data_->result_target_destroy_notify == NULL) ? NULL : (_data_->result_target_destroy_notify 
(_data_->result_target), NULL);
+       _data_->result = NULL;
+       _data_->result_target = NULL;
+       _data_->result_target_destroy_notify = NULL;
+       _foo_unref0 (_data_->self);
+       g_slice_free (FooFooData, _data_);
+}
+
+static gpointer
+_foo_ref0 (gpointer self)
+{
+       return self ? foo_ref (self) : NULL;
+}
+
+static void
+foo_foo (Foo* self,
+         GAsyncReadyCallback _callback_,
+         gpointer _user_data_)
+{
+       FooFooData* _data_;
+       Foo* _tmp0_;
+       g_return_if_fail (IS_FOO (self));
+       _data_ = g_slice_new0 (FooFooData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, foo_foo_data_free);
+       _tmp0_ = _foo_ref0 (self);
+       _data_->self = _tmp0_;
+       foo_foo_co (_data_);
+}
+
+static FooFunc
+foo_foo_finish (Foo* self,
+                GAsyncResult* _res_,
+                gpointer* result_target,
+                GDestroyNotify* result_target_destroy_notify)
+{
+       FooFunc result;
+       FooFooData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+       result = _data_->result;
+       *result_target = _data_->result_target;
+       _data_->result = NULL;
+       return result;
+}
+
+static void
+__lambda4_ (Foo* self)
+{
+}
+
+static void
+___lambda4__foo_func (gpointer self)
+{
+       __lambda4_ ((Foo*) self);
+}
+
+static gboolean
+foo_foo_co (FooFooData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->_tmp0_ = ___lambda4__foo_func;
+       _data_->_tmp0__target = foo_ref (_data_->self);
+       _data_->_tmp0__target_destroy_notify = foo_unref;
+       _data_->result_target = _data_->_tmp0__target;
+       _data_->result_target_destroy_notify = _data_->_tmp0__target_destroy_notify;
+       _data_->result = _data_->_tmp0_;
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/asynchronous/bug613484.c-expected b/tests/asynchronous/bug613484.c-expected
new file mode 100644
index 000000000..da6ce5340
--- /dev/null
+++ b/tests/asynchronous/bug613484.c-expected
@@ -0,0 +1,172 @@
+/* asynchronous_bug613484.c generated by valac, the Vala compiler
+ * generated from asynchronous_bug613484.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+#include <gio/gio.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+typedef struct _DoFooAsyncData DoFooAsyncData;
+
+struct _Foo {
+       gint i;
+};
+
+struct _DoFooAsyncData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Foo foo;
+       GValue value;
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN void do_foo (Foo* foo,
+             GValue* value);
+static void do_foo_async_data_free (gpointer _data);
+VALA_EXTERN void do_foo_async (Foo* foo,
+                   GValue* value,
+                   GAsyncReadyCallback _callback_,
+                   gpointer _user_data_);
+VALA_EXTERN void do_foo_finish (GAsyncResult* _res_);
+static gboolean do_foo_async_co (DoFooAsyncData* _data_);
+static void _vala_main (void);
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       memcpy (dup, self, sizeof (Foo));
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+void
+do_foo (Foo* foo,
+        GValue* value)
+{
+       g_return_if_fail (foo != NULL);
+       g_return_if_fail (value != NULL);
+}
+
+static void
+do_foo_async_data_free (gpointer _data)
+{
+       DoFooAsyncData* _data_;
+       _data_ = _data;
+       G_IS_VALUE (&_data_->value) ? (g_value_unset (&_data_->value), NULL) : NULL;
+       g_slice_free (DoFooAsyncData, _data_);
+}
+
+void
+do_foo_async (Foo* foo,
+              GValue* value,
+              GAsyncReadyCallback _callback_,
+              gpointer _user_data_)
+{
+       DoFooAsyncData* _data_;
+       Foo _tmp0_;
+       GValue _tmp1_;
+       GValue _tmp2_;
+       GValue _tmp3_ = {0};
+       g_return_if_fail (foo != NULL);
+       g_return_if_fail (value != NULL);
+       _data_ = g_slice_new0 (DoFooAsyncData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, do_foo_async_data_free);
+       _tmp0_ = *foo;
+       _data_->foo = _tmp0_;
+       _tmp1_ = *value;
+       _tmp2_ = _tmp1_;
+       if (G_IS_VALUE (&_tmp2_)) {
+               g_value_init (&_tmp3_, G_VALUE_TYPE (&_tmp2_));
+               g_value_copy (&_tmp2_, &_tmp3_);
+       } else {
+               _tmp3_ = _tmp2_;
+       }
+       G_IS_VALUE (&_data_->value) ? (g_value_unset (&_data_->value), NULL) : NULL;
+       _data_->value = _tmp3_;
+       do_foo_async_co (_data_);
+}
+
+void
+do_foo_finish (GAsyncResult* _res_)
+{
+       DoFooAsyncData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static gboolean
+do_foo_async_co (DoFooAsyncData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/asynchronous/bug614294.c-expected b/tests/asynchronous/bug614294.c-expected
new file mode 100644
index 000000000..4845677fd
--- /dev/null
+++ b/tests/asynchronous/bug614294.c-expected
@@ -0,0 +1,1132 @@
+/* asynchronous_bug614294.c generated by valac, the Vala compiler
+ * generated from asynchronous_bug614294.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_IFOO (ifoo_get_type ())
+#define IFOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IFOO, IFoo))
+#define IS_IFOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IFOO))
+#define IFOO_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_IFOO, IFooIface))
+
+typedef struct _IFoo IFoo;
+typedef struct _IFooIface IFooIface;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+enum  {
+       BAR_0_PROPERTY,
+       BAR_NUM_PROPERTIES
+};
+static GParamSpec* bar_properties[BAR_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+typedef struct _BarFooAsyncData BarFooAsyncData;
+
+#define TYPE_SUB_BAR (sub_bar_get_type ())
+#define SUB_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SUB_BAR, SubBar))
+#define SUB_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SUB_BAR, SubBarClass))
+#define IS_SUB_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SUB_BAR))
+#define IS_SUB_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SUB_BAR))
+#define SUB_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SUB_BAR, SubBarClass))
+
+typedef struct _SubBar SubBar;
+typedef struct _SubBarClass SubBarClass;
+typedef struct _SubBarPrivate SubBarPrivate;
+enum  {
+       SUB_BAR_0_PROPERTY,
+       SUB_BAR_NUM_PROPERTIES
+};
+static GParamSpec* sub_bar_properties[SUB_BAR_NUM_PROPERTIES];
+typedef struct _SubBarFooAsyncData SubBarFooAsyncData;
+
+#define TYPE_AFOO (afoo_get_type ())
+#define AFOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_AFOO, AFoo))
+#define AFOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_AFOO, AFooClass))
+#define IS_AFOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_AFOO))
+#define IS_AFOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_AFOO))
+#define AFOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_AFOO, AFooClass))
+
+typedef struct _AFoo AFoo;
+typedef struct _AFooClass AFooClass;
+typedef struct _AFooPrivate AFooPrivate;
+enum  {
+       AFOO_0_PROPERTY,
+       AFOO_NUM_PROPERTIES
+};
+static GParamSpec* afoo_properties[AFOO_NUM_PROPERTIES];
+
+#define TYPE_BAZ (baz_get_type ())
+#define BAZ(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAZ, Baz))
+#define BAZ_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAZ, BazClass))
+#define IS_BAZ(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAZ))
+#define IS_BAZ_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAZ))
+#define BAZ_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAZ, BazClass))
+
+typedef struct _Baz Baz;
+typedef struct _BazClass BazClass;
+typedef struct _BazPrivate BazPrivate;
+enum  {
+       BAZ_0_PROPERTY,
+       BAZ_NUM_PROPERTIES
+};
+static GParamSpec* baz_properties[BAZ_NUM_PROPERTIES];
+typedef struct _BazFooAsyncData BazFooAsyncData;
+
+#define TYPE_SUB_BAZ (sub_baz_get_type ())
+#define SUB_BAZ(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SUB_BAZ, SubBaz))
+#define SUB_BAZ_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SUB_BAZ, SubBazClass))
+#define IS_SUB_BAZ(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SUB_BAZ))
+#define IS_SUB_BAZ_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SUB_BAZ))
+#define SUB_BAZ_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SUB_BAZ, SubBazClass))
+
+typedef struct _SubBaz SubBaz;
+typedef struct _SubBazClass SubBazClass;
+typedef struct _SubBazPrivate SubBazPrivate;
+enum  {
+       SUB_BAZ_0_PROPERTY,
+       SUB_BAZ_NUM_PROPERTIES
+};
+static GParamSpec* sub_baz_properties[SUB_BAZ_NUM_PROPERTIES];
+typedef struct _SubBazFooAsyncData SubBazFooAsyncData;
+typedef struct _RunData RunData;
+
+struct _IFooIface {
+       GTypeInterface parent_iface;
+       void (*foo_async) (IFoo* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+       void (*foo_finish) (IFoo* self, GAsyncResult* _res_, GError** error);
+       void (*foo) (IFoo* self, GError** error);
+};
+
+struct _Bar {
+       GObject parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       GObjectClass parent_class;
+       void (*foo_async) (Bar* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+       void (*foo_finish) (Bar* self, GAsyncResult* _res_, GError** error);
+       void (*foo) (Bar* self, GError** error);
+};
+
+struct _BarFooAsyncData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Bar* self;
+};
+
+struct _SubBar {
+       Bar parent_instance;
+       SubBarPrivate * priv;
+};
+
+struct _SubBarClass {
+       BarClass parent_class;
+};
+
+struct _SubBarFooAsyncData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       SubBar* self;
+};
+
+struct _AFoo {
+       GObject parent_instance;
+       AFooPrivate * priv;
+};
+
+struct _AFooClass {
+       GObjectClass parent_class;
+       void (*foo_async) (AFoo* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+       void (*foo_finish) (AFoo* self, GAsyncResult* _res_, GError** error);
+       void (*foo) (AFoo* self, GError** error);
+};
+
+struct _Baz {
+       AFoo parent_instance;
+       BazPrivate * priv;
+};
+
+struct _BazClass {
+       AFooClass parent_class;
+};
+
+struct _BazFooAsyncData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Baz* self;
+};
+
+struct _SubBaz {
+       Baz parent_instance;
+       SubBazPrivate * priv;
+};
+
+struct _SubBazClass {
+       BazClass parent_class;
+};
+
+struct _SubBazFooAsyncData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       SubBaz* self;
+};
+
+struct _RunData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Bar* bar;
+       Bar* _tmp0_;
+       Bar* _tmp1_;
+       Bar* _tmp2_;
+       SubBar* subbar;
+       SubBar* _tmp3_;
+       SubBar* _tmp4_;
+       SubBar* _tmp5_;
+       Baz* baz;
+       Baz* _tmp6_;
+       Baz* _tmp7_;
+       Bar* _tmp8_;
+       SubBaz* subbaz;
+       SubBaz* _tmp9_;
+       SubBaz* _tmp10_;
+       SubBaz* _tmp11_;
+       GError* _inner_error0_;
+};
+
+static gpointer bar_parent_class = NULL;
+static IFooIface * bar_ifoo_parent_iface = NULL;
+static gpointer sub_bar_parent_class = NULL;
+static gpointer afoo_parent_class = NULL;
+static gpointer baz_parent_class = NULL;
+static gpointer sub_baz_parent_class = NULL;
+
+VALA_EXTERN GType ifoo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN void ifoo_foo_async (IFoo* self,
+                     GAsyncReadyCallback _callback_,
+                     gpointer _user_data_);
+VALA_EXTERN void ifoo_foo_finish (IFoo* self,
+                      GAsyncResult* _res_,
+                      GError** error);
+VALA_EXTERN void ifoo_foo (IFoo* self,
+               GError** error);
+static GType ifoo_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
+VALA_EXTERN void bar_foo_async (Bar* self,
+                    GAsyncReadyCallback _callback_,
+                    gpointer _user_data_);
+VALA_EXTERN void bar_foo_finish (Bar* self,
+                     GAsyncResult* _res_,
+                     GError** error);
+VALA_EXTERN void bar_foo (Bar* self,
+              GError** error);
+static void bar_real_foo_async_data_free (gpointer _data);
+static void bar_real_foo_async (Bar* self,
+                         GAsyncReadyCallback _callback_,
+                         gpointer _user_data_);
+static gboolean bar_real_foo_async_co (BarFooAsyncData* _data_);
+static void bar_real_foo (Bar* self,
+                   GError** error);
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static GType bar_get_type_once (void);
+VALA_EXTERN GType sub_bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (SubBar, g_object_unref)
+static void sub_bar_real_foo_async_data_free (gpointer _data);
+static void sub_bar_real_foo_async (Bar* base,
+                             GAsyncReadyCallback _callback_,
+                             gpointer _user_data_);
+static gboolean sub_bar_real_foo_async_co (SubBarFooAsyncData* _data_);
+static void sub_bar_real_foo (Bar* base,
+                       GError** error);
+VALA_EXTERN SubBar* sub_bar_new (void);
+VALA_EXTERN SubBar* sub_bar_construct (GType object_type);
+static GType sub_bar_get_type_once (void);
+VALA_EXTERN GType afoo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (AFoo, g_object_unref)
+VALA_EXTERN void afoo_foo (AFoo* self,
+               GError** error);
+VALA_EXTERN void afoo_foo_async (AFoo* self,
+                     GAsyncReadyCallback _callback_,
+                     gpointer _user_data_);
+VALA_EXTERN void afoo_foo_finish (AFoo* self,
+                      GAsyncResult* _res_,
+                      GError** error);
+static void afoo_real_foo (AFoo* self,
+                    GError** error);
+VALA_EXTERN AFoo* afoo_construct (GType object_type);
+static GType afoo_get_type_once (void);
+VALA_EXTERN GType baz_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Baz, g_object_unref)
+static void baz_real_foo_async_data_free (gpointer _data);
+static void baz_real_foo_async (AFoo* base,
+                         GAsyncReadyCallback _callback_,
+                         gpointer _user_data_);
+static gboolean baz_real_foo_async_co (BazFooAsyncData* _data_);
+static void baz_real_foo (AFoo* base,
+                   GError** error);
+VALA_EXTERN Baz* baz_new (void);
+VALA_EXTERN Baz* baz_construct (GType object_type);
+static GType baz_get_type_once (void);
+VALA_EXTERN GType sub_baz_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (SubBaz, g_object_unref)
+static void sub_baz_real_foo_async_data_free (gpointer _data);
+static void sub_baz_real_foo_async (AFoo* base,
+                             GAsyncReadyCallback _callback_,
+                             gpointer _user_data_);
+static gboolean sub_baz_real_foo_async_co (SubBazFooAsyncData* _data_);
+static void sub_baz_real_foo (AFoo* base,
+                       GError** error);
+VALA_EXTERN SubBaz* sub_baz_new (void);
+VALA_EXTERN SubBaz* sub_baz_construct (GType object_type);
+static GType sub_baz_get_type_once (void);
+static void run_data_free (gpointer _data);
+VALA_EXTERN void run (GAsyncReadyCallback _callback_,
+          gpointer _user_data_);
+VALA_EXTERN void run_finish (GAsyncResult* _res_);
+static gboolean run_co (RunData* _data_);
+static void run_ready (GObject* source_object,
+                GAsyncResult* _res_,
+                gpointer _user_data_);
+static void _vala_main (void);
+
+void
+ifoo_foo_async (IFoo* self,
+                GAsyncReadyCallback _callback_,
+                gpointer _user_data_)
+{
+       IFooIface* _iface_;
+       _iface_ = IFOO_GET_INTERFACE (self);
+       if (_iface_->foo_async) {
+               _iface_->foo_async (self, _callback_, _user_data_);
+       }
+}
+
+void
+ifoo_foo_finish (IFoo* self,
+                 GAsyncResult* _res_,
+                 GError** error)
+{
+       IFooIface* _iface_;
+       _iface_ = IFOO_GET_INTERFACE (self);
+       if (_iface_->foo_finish) {
+               _iface_->foo_finish (self, _res_, error);
+       }
+}
+
+void
+ifoo_foo (IFoo* self,
+          GError** error)
+{
+       IFooIface* _iface_;
+       g_return_if_fail (IS_IFOO (self));
+       _iface_ = IFOO_GET_INTERFACE (self);
+       if (_iface_->foo) {
+               _iface_->foo (self, error);
+       }
+}
+
+static void
+ifoo_default_init (IFooIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+ifoo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (IFooIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) ifoo_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType ifoo_type_id;
+       ifoo_type_id = g_type_register_static (G_TYPE_INTERFACE, "IFoo", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (ifoo_type_id, G_TYPE_OBJECT);
+       return ifoo_type_id;
+}
+
+GType
+ifoo_get_type (void)
+{
+       static volatile gsize ifoo_type_id__volatile = 0;
+       if (g_once_init_enter (&ifoo_type_id__volatile)) {
+               GType ifoo_type_id;
+               ifoo_type_id = ifoo_get_type_once ();
+               g_once_init_leave (&ifoo_type_id__volatile, ifoo_type_id);
+       }
+       return ifoo_type_id__volatile;
+}
+
+static void
+bar_real_foo_async_data_free (gpointer _data)
+{
+       BarFooAsyncData* _data_;
+       _data_ = _data;
+       _g_object_unref0 (_data_->self);
+       g_slice_free (BarFooAsyncData, _data_);
+}
+
+static gpointer
+_g_object_ref0 (gpointer self)
+{
+       return self ? g_object_ref (self) : NULL;
+}
+
+static void
+bar_real_foo_async (Bar* self,
+                    GAsyncReadyCallback _callback_,
+                    gpointer _user_data_)
+{
+       BarFooAsyncData* _data_;
+       Bar* _tmp0_;
+       _data_ = g_slice_new0 (BarFooAsyncData);
+       _data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, bar_real_foo_async_data_free);
+       _tmp0_ = _g_object_ref0 (self);
+       _data_->self = _tmp0_;
+       bar_real_foo_async_co (_data_);
+}
+
+static void
+bar_real_foo_finish (Bar* self,
+                     GAsyncResult* _res_,
+                     GError** error)
+{
+       BarFooAsyncData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static gboolean
+bar_real_foo_async_co (BarFooAsyncData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+void
+bar_foo_async (Bar* self,
+               GAsyncReadyCallback _callback_,
+               gpointer _user_data_)
+{
+       BarClass* _klass_;
+       _klass_ = BAR_GET_CLASS (self);
+       if (_klass_->foo_async) {
+               _klass_->foo_async (self, _callback_, _user_data_);
+       }
+}
+
+void
+bar_foo_finish (Bar* self,
+                GAsyncResult* _res_,
+                GError** error)
+{
+       BarClass* _klass_;
+       _klass_ = BAR_GET_CLASS (self);
+       if (_klass_->foo_finish) {
+               _klass_->foo_finish (self, _res_, error);
+       }
+}
+
+static void
+bar_real_foo (Bar* self,
+              GError** error)
+{
+}
+
+void
+bar_foo (Bar* self,
+         GError** error)
+{
+       BarClass* _klass_;
+       g_return_if_fail (IS_BAR (self));
+       _klass_ = BAR_GET_CLASS (self);
+       if (_klass_->foo) {
+               _klass_->foo (self, error);
+       }
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar * self = NULL;
+       self = (Bar*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       ((BarClass *) klass)->foo_async = (void (*) (Bar*, GAsyncReadyCallback, gpointer)) bar_real_foo_async;
+       ((BarClass *) klass)->foo_finish = (void (*) (Bar*, GAsyncResult*, GError**)) bar_real_foo_finish;
+       ((BarClass *) klass)->foo = (void (*) (Bar*, GError**)) bar_real_foo;
+}
+
+static void
+bar_ifoo_interface_init (IFooIface * iface,
+                         gpointer iface_data)
+{
+       bar_ifoo_parent_iface = g_type_interface_peek_parent (iface);
+       iface->foo_async = (void (*) (IFoo*, GAsyncReadyCallback, gpointer)) bar_foo_async;
+       iface->foo_finish = (void (*) (IFoo*, GAsyncResult*, GError**)) bar_foo_finish;
+       iface->foo = (void (*) (IFoo*, GError**)) bar_foo;
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       static const GInterfaceInfo ifoo_info = { (GInterfaceInitFunc) bar_ifoo_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (G_TYPE_OBJECT, "Bar", &g_define_type_info, 0);
+       g_type_add_interface_static (bar_type_id, TYPE_IFOO, &ifoo_info);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+sub_bar_real_foo_async_data_free (gpointer _data)
+{
+       SubBarFooAsyncData* _data_;
+       _data_ = _data;
+       _g_object_unref0 (_data_->self);
+       g_slice_free (SubBarFooAsyncData, _data_);
+}
+
+static void
+sub_bar_real_foo_async (Bar* base,
+                        GAsyncReadyCallback _callback_,
+                        gpointer _user_data_)
+{
+       SubBar * self;
+       SubBarFooAsyncData* _data_;
+       SubBar* _tmp0_;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_SUB_BAR, SubBar);
+       _data_ = g_slice_new0 (SubBarFooAsyncData);
+       _data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, sub_bar_real_foo_async_data_free);
+       _tmp0_ = _g_object_ref0 (self);
+       _data_->self = _tmp0_;
+       sub_bar_real_foo_async_co (_data_);
+}
+
+static void
+sub_bar_foo_finish (Bar* base,
+                    GAsyncResult* _res_,
+                    GError** error)
+{
+       SubBarFooAsyncData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static gboolean
+sub_bar_real_foo_async_co (SubBarFooAsyncData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+sub_bar_real_foo (Bar* base,
+                  GError** error)
+{
+       SubBar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_SUB_BAR, SubBar);
+}
+
+SubBar*
+sub_bar_construct (GType object_type)
+{
+       SubBar * self = NULL;
+       self = (SubBar*) bar_construct (object_type);
+       return self;
+}
+
+SubBar*
+sub_bar_new (void)
+{
+       return sub_bar_construct (TYPE_SUB_BAR);
+}
+
+static void
+sub_bar_class_init (SubBarClass * klass,
+                    gpointer klass_data)
+{
+       sub_bar_parent_class = g_type_class_peek_parent (klass);
+       ((BarClass *) klass)->foo_async = (void (*) (Bar*, GAsyncReadyCallback, gpointer)) 
sub_bar_real_foo_async;
+       ((BarClass *) klass)->foo_finish = (void (*) (Bar*, GAsyncResult*, GError**)) sub_bar_foo_finish;
+       ((BarClass *) klass)->foo = (void (*) (Bar*, GError**)) sub_bar_real_foo;
+}
+
+static void
+sub_bar_instance_init (SubBar * self,
+                       gpointer klass)
+{
+}
+
+static GType
+sub_bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (SubBarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) sub_bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(SubBar), 0, (GInstanceInitFunc) sub_bar_instance_init, NULL };
+       GType sub_bar_type_id;
+       sub_bar_type_id = g_type_register_static (TYPE_BAR, "SubBar", &g_define_type_info, 0);
+       return sub_bar_type_id;
+}
+
+GType
+sub_bar_get_type (void)
+{
+       static volatile gsize sub_bar_type_id__volatile = 0;
+       if (g_once_init_enter (&sub_bar_type_id__volatile)) {
+               GType sub_bar_type_id;
+               sub_bar_type_id = sub_bar_get_type_once ();
+               g_once_init_leave (&sub_bar_type_id__volatile, sub_bar_type_id);
+       }
+       return sub_bar_type_id__volatile;
+}
+
+void
+afoo_foo_async (AFoo* self,
+                GAsyncReadyCallback _callback_,
+                gpointer _user_data_)
+{
+       AFooClass* _klass_;
+       _klass_ = AFOO_GET_CLASS (self);
+       if (_klass_->foo_async) {
+               _klass_->foo_async (self, _callback_, _user_data_);
+       }
+}
+
+void
+afoo_foo_finish (AFoo* self,
+                 GAsyncResult* _res_,
+                 GError** error)
+{
+       AFooClass* _klass_;
+       _klass_ = AFOO_GET_CLASS (self);
+       if (_klass_->foo_finish) {
+               _klass_->foo_finish (self, _res_, error);
+       }
+}
+
+static void
+afoo_real_foo (AFoo* self,
+               GError** error)
+{
+       g_critical ("Type `%s' does not implement abstract method `afoo_foo'", g_type_name 
(G_TYPE_FROM_INSTANCE (self)));
+       return;
+}
+
+void
+afoo_foo (AFoo* self,
+          GError** error)
+{
+       AFooClass* _klass_;
+       g_return_if_fail (IS_AFOO (self));
+       _klass_ = AFOO_GET_CLASS (self);
+       if (_klass_->foo) {
+               _klass_->foo (self, error);
+       }
+}
+
+AFoo*
+afoo_construct (GType object_type)
+{
+       AFoo * self = NULL;
+       self = (AFoo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+static void
+afoo_class_init (AFooClass * klass,
+                 gpointer klass_data)
+{
+       afoo_parent_class = g_type_class_peek_parent (klass);
+       ((AFooClass *) klass)->foo = (void (*) (AFoo*, GError**)) afoo_real_foo;
+}
+
+static void
+afoo_instance_init (AFoo * self,
+                    gpointer klass)
+{
+}
+
+static GType
+afoo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (AFooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) afoo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (AFoo), 
0, (GInstanceInitFunc) afoo_instance_init, NULL };
+       GType afoo_type_id;
+       afoo_type_id = g_type_register_static (G_TYPE_OBJECT, "AFoo", &g_define_type_info, 
G_TYPE_FLAG_ABSTRACT);
+       return afoo_type_id;
+}
+
+GType
+afoo_get_type (void)
+{
+       static volatile gsize afoo_type_id__volatile = 0;
+       if (g_once_init_enter (&afoo_type_id__volatile)) {
+               GType afoo_type_id;
+               afoo_type_id = afoo_get_type_once ();
+               g_once_init_leave (&afoo_type_id__volatile, afoo_type_id);
+       }
+       return afoo_type_id__volatile;
+}
+
+static void
+baz_real_foo_async_data_free (gpointer _data)
+{
+       BazFooAsyncData* _data_;
+       _data_ = _data;
+       _g_object_unref0 (_data_->self);
+       g_slice_free (BazFooAsyncData, _data_);
+}
+
+static void
+baz_real_foo_async (AFoo* base,
+                    GAsyncReadyCallback _callback_,
+                    gpointer _user_data_)
+{
+       Baz * self;
+       BazFooAsyncData* _data_;
+       Baz* _tmp0_;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAZ, Baz);
+       _data_ = g_slice_new0 (BazFooAsyncData);
+       _data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, baz_real_foo_async_data_free);
+       _tmp0_ = _g_object_ref0 (self);
+       _data_->self = _tmp0_;
+       baz_real_foo_async_co (_data_);
+}
+
+static void
+baz_foo_finish (AFoo* base,
+                GAsyncResult* _res_,
+                GError** error)
+{
+       BazFooAsyncData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static gboolean
+baz_real_foo_async_co (BazFooAsyncData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+baz_real_foo (AFoo* base,
+              GError** error)
+{
+       Baz * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAZ, Baz);
+}
+
+Baz*
+baz_construct (GType object_type)
+{
+       Baz * self = NULL;
+       self = (Baz*) afoo_construct (object_type);
+       return self;
+}
+
+Baz*
+baz_new (void)
+{
+       return baz_construct (TYPE_BAZ);
+}
+
+static void
+baz_class_init (BazClass * klass,
+                gpointer klass_data)
+{
+       baz_parent_class = g_type_class_peek_parent (klass);
+       ((AFooClass *) klass)->foo_async = (void (*) (AFoo*, GAsyncReadyCallback, gpointer)) 
baz_real_foo_async;
+       ((AFooClass *) klass)->foo_finish = (void (*) (AFoo*, GAsyncResult*, GError**)) baz_foo_finish;
+       ((AFooClass *) klass)->foo = (void (*) (AFoo*, GError**)) baz_real_foo;
+}
+
+static void
+baz_instance_init (Baz * self,
+                   gpointer klass)
+{
+}
+
+static GType
+baz_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BazClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) baz_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Baz), 0, 
(GInstanceInitFunc) baz_instance_init, NULL };
+       GType baz_type_id;
+       baz_type_id = g_type_register_static (TYPE_AFOO, "Baz", &g_define_type_info, 0);
+       return baz_type_id;
+}
+
+GType
+baz_get_type (void)
+{
+       static volatile gsize baz_type_id__volatile = 0;
+       if (g_once_init_enter (&baz_type_id__volatile)) {
+               GType baz_type_id;
+               baz_type_id = baz_get_type_once ();
+               g_once_init_leave (&baz_type_id__volatile, baz_type_id);
+       }
+       return baz_type_id__volatile;
+}
+
+static void
+sub_baz_real_foo_async_data_free (gpointer _data)
+{
+       SubBazFooAsyncData* _data_;
+       _data_ = _data;
+       _g_object_unref0 (_data_->self);
+       g_slice_free (SubBazFooAsyncData, _data_);
+}
+
+static void
+sub_baz_real_foo_async (AFoo* base,
+                        GAsyncReadyCallback _callback_,
+                        gpointer _user_data_)
+{
+       SubBaz * self;
+       SubBazFooAsyncData* _data_;
+       SubBaz* _tmp0_;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_SUB_BAZ, SubBaz);
+       _data_ = g_slice_new0 (SubBazFooAsyncData);
+       _data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, sub_baz_real_foo_async_data_free);
+       _tmp0_ = _g_object_ref0 (self);
+       _data_->self = _tmp0_;
+       sub_baz_real_foo_async_co (_data_);
+}
+
+static void
+sub_baz_foo_finish (AFoo* base,
+                    GAsyncResult* _res_,
+                    GError** error)
+{
+       SubBazFooAsyncData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static gboolean
+sub_baz_real_foo_async_co (SubBazFooAsyncData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+sub_baz_real_foo (AFoo* base,
+                  GError** error)
+{
+       SubBaz * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_SUB_BAZ, SubBaz);
+}
+
+SubBaz*
+sub_baz_construct (GType object_type)
+{
+       SubBaz * self = NULL;
+       self = (SubBaz*) baz_construct (object_type);
+       return self;
+}
+
+SubBaz*
+sub_baz_new (void)
+{
+       return sub_baz_construct (TYPE_SUB_BAZ);
+}
+
+static void
+sub_baz_class_init (SubBazClass * klass,
+                    gpointer klass_data)
+{
+       sub_baz_parent_class = g_type_class_peek_parent (klass);
+       ((AFooClass *) klass)->foo_async = (void (*) (AFoo*, GAsyncReadyCallback, gpointer)) 
sub_baz_real_foo_async;
+       ((AFooClass *) klass)->foo_finish = (void (*) (AFoo*, GAsyncResult*, GError**)) sub_baz_foo_finish;
+       ((AFooClass *) klass)->foo = (void (*) (AFoo*, GError**)) sub_baz_real_foo;
+}
+
+static void
+sub_baz_instance_init (SubBaz * self,
+                       gpointer klass)
+{
+}
+
+static GType
+sub_baz_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (SubBazClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) sub_baz_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(SubBaz), 0, (GInstanceInitFunc) sub_baz_instance_init, NULL };
+       GType sub_baz_type_id;
+       sub_baz_type_id = g_type_register_static (TYPE_BAZ, "SubBaz", &g_define_type_info, 0);
+       return sub_baz_type_id;
+}
+
+GType
+sub_baz_get_type (void)
+{
+       static volatile gsize sub_baz_type_id__volatile = 0;
+       if (g_once_init_enter (&sub_baz_type_id__volatile)) {
+               GType sub_baz_type_id;
+               sub_baz_type_id = sub_baz_get_type_once ();
+               g_once_init_leave (&sub_baz_type_id__volatile, sub_baz_type_id);
+       }
+       return sub_baz_type_id__volatile;
+}
+
+static void
+run_data_free (gpointer _data)
+{
+       RunData* _data_;
+       _data_ = _data;
+       g_slice_free (RunData, _data_);
+}
+
+void
+run (GAsyncReadyCallback _callback_,
+     gpointer _user_data_)
+{
+       RunData* _data_;
+       _data_ = g_slice_new0 (RunData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, run_data_free);
+       run_co (_data_);
+}
+
+void
+run_finish (GAsyncResult* _res_)
+{
+       RunData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static void
+run_ready (GObject* source_object,
+           GAsyncResult* _res_,
+           gpointer _user_data_)
+{
+       RunData* _data_;
+       _data_ = _user_data_;
+       _data_->_source_object_ = source_object;
+       _data_->_res_ = _res_;
+       run_co (_data_);
+}
+
+static gboolean
+run_co (RunData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               case 1:
+               goto _state_1;
+               case 2:
+               goto _state_2;
+               case 3:
+               goto _state_3;
+               case 4:
+               goto _state_4;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->_tmp0_ = bar_new ();
+       _data_->bar = _data_->_tmp0_;
+       _data_->_tmp1_ = _data_->bar;
+       bar_foo (_data_->_tmp1_, NULL);
+       _data_->_tmp2_ = _data_->bar;
+       _data_->_state_ = 1;
+       bar_foo_async (_data_->_tmp2_, run_ready, _data_);
+       return FALSE;
+       _state_1:
+       bar_foo_finish (_data_->_tmp2_, _data_->_res_, NULL);
+       _data_->_tmp3_ = sub_bar_new ();
+       _data_->subbar = _data_->_tmp3_;
+       _data_->_tmp4_ = _data_->subbar;
+       bar_foo (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp4_, TYPE_BAR, Bar), NULL);
+       _data_->_tmp5_ = _data_->subbar;
+       _data_->_state_ = 2;
+       bar_foo_async (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp5_, TYPE_BAR, Bar), run_ready, _data_);
+       return FALSE;
+       _state_2:
+       bar_foo_finish (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp5_, TYPE_BAR, Bar), _data_->_res_, NULL);
+       _data_->_tmp6_ = baz_new ();
+       _data_->baz = _data_->_tmp6_;
+       _data_->_tmp7_ = _data_->baz;
+       afoo_foo (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp7_, TYPE_AFOO, AFoo), &_data_->_inner_error0_);
+       if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+               _g_object_unref0 (_data_->baz);
+               _g_object_unref0 (_data_->subbar);
+               _g_object_unref0 (_data_->bar);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), 
_data_->_inner_error0_->code);
+               g_clear_error (&_data_->_inner_error0_);
+               g_object_unref (_data_->_async_result);
+               return FALSE;
+       }
+       _data_->_tmp8_ = _data_->bar;
+       _data_->_state_ = 3;
+       bar_foo_async (_data_->_tmp8_, run_ready, _data_);
+       return FALSE;
+       _state_3:
+       bar_foo_finish (_data_->_tmp8_, _data_->_res_, NULL);
+       _data_->_tmp9_ = sub_baz_new ();
+       _data_->subbaz = _data_->_tmp9_;
+       _data_->_tmp10_ = _data_->subbaz;
+       afoo_foo (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp10_, TYPE_AFOO, AFoo), &_data_->_inner_error0_);
+       if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+               _g_object_unref0 (_data_->subbaz);
+               _g_object_unref0 (_data_->baz);
+               _g_object_unref0 (_data_->subbar);
+               _g_object_unref0 (_data_->bar);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), 
_data_->_inner_error0_->code);
+               g_clear_error (&_data_->_inner_error0_);
+               g_object_unref (_data_->_async_result);
+               return FALSE;
+       }
+       _data_->_tmp11_ = _data_->subbaz;
+       _data_->_state_ = 4;
+       afoo_foo_async (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp11_, TYPE_AFOO, AFoo), run_ready, _data_);
+       return FALSE;
+       _state_4:
+       afoo_foo_finish (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp11_, TYPE_AFOO, AFoo), _data_->_res_, 
&_data_->_inner_error0_);
+       if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+               _g_object_unref0 (_data_->subbaz);
+               _g_object_unref0 (_data_->baz);
+               _g_object_unref0 (_data_->subbar);
+               _g_object_unref0 (_data_->bar);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), 
_data_->_inner_error0_->code);
+               g_clear_error (&_data_->_inner_error0_);
+               g_object_unref (_data_->_async_result);
+               return FALSE;
+       }
+       _g_object_unref0 (_data_->subbaz);
+       _g_object_unref0 (_data_->baz);
+       _g_object_unref0 (_data_->subbar);
+       _g_object_unref0 (_data_->bar);
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+_vala_main (void)
+{
+       run (NULL, NULL);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/asynchronous/bug620740.c-expected b/tests/asynchronous/bug620740.c-expected
new file mode 100644
index 000000000..a14c76e90
--- /dev/null
+++ b/tests/asynchronous/bug620740.c-expected
@@ -0,0 +1,145 @@
+/* asynchronous_bug620740.c generated by valac, the Vala compiler
+ * generated from asynchronous_bug620740.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+#include <gio/gio.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+typedef struct _DoFooAsyncData DoFooAsyncData;
+
+struct _Foo {
+       gint i;
+};
+
+struct _DoFooAsyncData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Foo result;
+       Foo _tmp0_;
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+static void do_foo_async_data_free (gpointer _data);
+VALA_EXTERN void do_foo_async (GAsyncReadyCallback _callback_,
+                   gpointer _user_data_);
+VALA_EXTERN void do_foo_finish (GAsyncResult* _res_,
+                    Foo* result);
+static gboolean do_foo_async_co (DoFooAsyncData* _data_);
+static void _vala_main (void);
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       memcpy (dup, self, sizeof (Foo));
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+do_foo_async_data_free (gpointer _data)
+{
+       DoFooAsyncData* _data_;
+       _data_ = _data;
+       g_slice_free (DoFooAsyncData, _data_);
+}
+
+void
+do_foo_async (GAsyncReadyCallback _callback_,
+              gpointer _user_data_)
+{
+       DoFooAsyncData* _data_;
+       _data_ = g_slice_new0 (DoFooAsyncData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, do_foo_async_data_free);
+       do_foo_async_co (_data_);
+}
+
+void
+do_foo_finish (GAsyncResult* _res_,
+               Foo* result)
+{
+       DoFooAsyncData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+       *result = _data_->result;
+}
+
+static gboolean
+do_foo_async_co (DoFooAsyncData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       memset (&_data_->_tmp0_, 0, sizeof (Foo));
+       memset (&_data_->_tmp0_, 0, sizeof (Foo));
+       _data_->result = _data_->_tmp0_;
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/asynchronous/bug626053.c-expected b/tests/asynchronous/bug626053.c-expected
new file mode 100644
index 000000000..3d6258f60
--- /dev/null
+++ b/tests/asynchronous/bug626053.c-expected
@@ -0,0 +1,425 @@
+/* asynchronous_bug626053.c generated by valac, the Vala compiler
+ * generated from asynchronous_bug626053.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+typedef struct _FooFooData FooFooData;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _FooFooData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Foo* self;
+       gchar** result;
+       gint result_length1;
+       gchar* _tmp0_;
+       gchar* _tmp1_;
+       gchar** _tmp2_;
+       gchar** _tmp3_;
+       gint _tmp3__length1;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+static void foo_foo_data_free (gpointer _data);
+static void foo_foo (Foo* self,
+              GAsyncReadyCallback _callback_,
+              gpointer _user_data_);
+static gchar** foo_foo_finish (Foo* self,
+                        GAsyncResult* _res_,
+                        gint* result_length1);
+static gboolean foo_foo_co (FooFooData* _data_);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static void
+foo_foo_data_free (gpointer _data)
+{
+       FooFooData* _data_;
+       _data_ = _data;
+       _data_->result = (_vala_array_free (_data_->result, _data_->result_length1, (GDestroyNotify) g_free), 
NULL);
+       _foo_unref0 (_data_->self);
+       g_slice_free (FooFooData, _data_);
+}
+
+static gpointer
+_foo_ref0 (gpointer self)
+{
+       return self ? foo_ref (self) : NULL;
+}
+
+static void
+foo_foo (Foo* self,
+         GAsyncReadyCallback _callback_,
+         gpointer _user_data_)
+{
+       FooFooData* _data_;
+       Foo* _tmp0_;
+       g_return_if_fail (IS_FOO (self));
+       _data_ = g_slice_new0 (FooFooData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, foo_foo_data_free);
+       _tmp0_ = _foo_ref0 (self);
+       _data_->self = _tmp0_;
+       foo_foo_co (_data_);
+}
+
+static gchar**
+foo_foo_finish (Foo* self,
+                GAsyncResult* _res_,
+                gint* result_length1)
+{
+       gchar** result;
+       FooFooData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+       result = _data_->result;
+       *result_length1 = _data_->result_length1;
+       _data_->result = NULL;
+       return result;
+}
+
+static gboolean
+foo_foo_co (FooFooData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->_tmp0_ = g_strdup ("foo");
+       _data_->_tmp1_ = g_strdup ("bar");
+       _data_->_tmp2_ = g_new0 (gchar*, 2 + 1);
+       _data_->_tmp2_[0] = _data_->_tmp0_;
+       _data_->_tmp2_[1] = _data_->_tmp1_;
+       _data_->_tmp3_ = _data_->_tmp2_;
+       _data_->_tmp3__length1 = 2;
+       _data_->result_length1 = _data_->_tmp3__length1;
+       _data_->result = _data_->_tmp3_;
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/asynchronous/bug639591.c-expected b/tests/asynchronous/bug639591.c-expected
new file mode 100644
index 000000000..ecc5ec297
--- /dev/null
+++ b/tests/asynchronous/bug639591.c-expected
@@ -0,0 +1,184 @@
+/* asynchronous_bug639591.c generated by valac, the Vala compiler
+ * generated from asynchronous_bug639591.vala, do not modify */
+
+#include <glib.h>
+#include <gio/gio.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef void (*Deleg) (gpointer user_data);
+typedef struct _Block1Data Block1Data;
+typedef struct _FooData FooData;
+
+struct _Block1Data {
+       int _ref_count_;
+       Deleg deleg;
+       gpointer deleg_target;
+       GDestroyNotify deleg_target_destroy_notify;
+       gpointer _async_data_;
+};
+
+struct _FooData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Deleg deleg;
+       gpointer deleg_target;
+       GDestroyNotify deleg_target_destroy_notify;
+       Block1Data* _data1_;
+       Deleg d;
+       gpointer d_target;
+       GDestroyNotify d_target_destroy_notify;
+};
+
+static void foo_data_free (gpointer _data);
+VALA_EXTERN void foo (Deleg deleg,
+          gpointer deleg_target,
+          GDestroyNotify deleg_target_destroy_notify,
+          GAsyncReadyCallback _callback_,
+          gpointer _user_data_);
+VALA_EXTERN void foo_finish (GAsyncResult* _res_);
+static gboolean foo_co (FooData* _data_);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static void __lambda4_ (Block1Data* _data1_);
+static void ___lambda4__deleg (gpointer self);
+static void _vala_main (void);
+
+static void
+foo_data_free (gpointer _data)
+{
+       FooData* _data_;
+       _data_ = _data;
+       g_slice_free (FooData, _data_);
+}
+
+void
+foo (Deleg deleg,
+     gpointer deleg_target,
+     GDestroyNotify deleg_target_destroy_notify,
+     GAsyncReadyCallback _callback_,
+     gpointer _user_data_)
+{
+       FooData* _data_;
+       _data_ = g_slice_new0 (FooData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, foo_data_free);
+       (_data_->deleg_target_destroy_notify == NULL) ? NULL : (_data_->deleg_target_destroy_notify 
(_data_->deleg_target), NULL);
+       _data_->deleg = NULL;
+       _data_->deleg_target = NULL;
+       _data_->deleg_target_destroy_notify = NULL;
+       _data_->deleg = deleg;
+       _data_->deleg_target = deleg_target;
+       _data_->deleg_target_destroy_notify = deleg_target_destroy_notify;
+       foo_co (_data_);
+}
+
+void
+foo_finish (GAsyncResult* _res_)
+{
+       FooData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               (_data1_->deleg_target_destroy_notify == NULL) ? NULL : (_data1_->deleg_target_destroy_notify 
(_data1_->deleg_target), NULL);
+               _data1_->deleg = NULL;
+               _data1_->deleg_target = NULL;
+               _data1_->deleg_target_destroy_notify = NULL;
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static void
+__lambda4_ (Block1Data* _data1_)
+{
+       _data1_->deleg (_data1_->deleg_target);
+}
+
+static void
+___lambda4__deleg (gpointer self)
+{
+       __lambda4_ (self);
+}
+
+static gboolean
+foo_co (FooData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->_data1_ = g_slice_new0 (Block1Data);
+       _data_->_data1_->_ref_count_ = 1;
+       (_data_->_data1_->deleg_target_destroy_notify == NULL) ? NULL : 
(_data_->_data1_->deleg_target_destroy_notify (_data_->_data1_->deleg_target), NULL);
+       _data_->_data1_->deleg = NULL;
+       _data_->_data1_->deleg_target = NULL;
+       _data_->_data1_->deleg_target_destroy_notify = NULL;
+       _data_->_data1_->deleg = _data_->deleg;
+       _data_->_data1_->deleg_target = _data_->deleg_target;
+       _data_->_data1_->deleg_target_destroy_notify = _data_->deleg_target_destroy_notify;
+       _data_->_data1_->_async_data_ = _data_;
+       _data_->d = ___lambda4__deleg;
+       _data_->d_target = block1_data_ref (_data_->_data1_);
+       _data_->d_target_destroy_notify = block1_data_unref;
+       (_data_->d_target_destroy_notify == NULL) ? NULL : (_data_->d_target_destroy_notify 
(_data_->d_target), NULL);
+       _data_->d = NULL;
+       _data_->d_target = NULL;
+       _data_->d_target_destroy_notify = NULL;
+       _data_->d = NULL;
+       _data_->d_target = NULL;
+       _data_->d_target_destroy_notify = NULL;
+       (_data_->d_target_destroy_notify == NULL) ? NULL : (_data_->d_target_destroy_notify 
(_data_->d_target), NULL);
+       _data_->d = NULL;
+       _data_->d_target = NULL;
+       _data_->d_target_destroy_notify = NULL;
+       block1_data_unref (_data_->_data1_);
+       _data_->_data1_ = NULL;
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/asynchronous/bug640721.c-expected b/tests/asynchronous/bug640721.c-expected
new file mode 100644
index 000000000..3a0427f28
--- /dev/null
+++ b/tests/asynchronous/bug640721.c-expected
@@ -0,0 +1,161 @@
+/* asynchronous_bug640721.c generated by valac, the Vala compiler
+ * generated from asynchronous_bug640721.vala, do not modify */
+
+#include <gio/gio.h>
+#include <glib.h>
+#include <glib-object.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef struct _FooData FooData;
+typedef struct _Block1Data Block1Data;
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+
+struct _FooData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       gint i;
+};
+
+struct _Block1Data {
+       int _ref_count_;
+       GMainLoop* loop;
+};
+
+static void foo_data_free (gpointer _data);
+VALA_EXTERN void foo (GAsyncReadyCallback _callback_,
+          gpointer _user_data_);
+VALA_EXTERN void foo_finish (GAsyncResult* _res_,
+                 gint* i);
+static gboolean foo_co (FooData* _data_);
+static void _vala_main (void);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static void __lambda4_ (Block1Data* _data1_,
+                 GObject* s,
+                 GAsyncResult* r);
+static void ___lambda4__gasync_ready_callback (GObject* source_object,
+                                        GAsyncResult* res,
+                                        gpointer self);
+
+static void
+foo_data_free (gpointer _data)
+{
+       FooData* _data_;
+       _data_ = _data;
+       g_slice_free (FooData, _data_);
+}
+
+void
+foo (GAsyncReadyCallback _callback_,
+     gpointer _user_data_)
+{
+       FooData* _data_;
+       _data_ = g_slice_new0 (FooData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, foo_data_free);
+       foo_co (_data_);
+}
+
+void
+foo_finish (GAsyncResult* _res_,
+            gint* i)
+{
+       FooData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+       if (i) {
+               *i = _data_->i;
+       }
+}
+
+static gboolean
+foo_co (FooData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               _g_main_loop_unref0 (_data1_->loop);
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static void
+__lambda4_ (Block1Data* _data1_,
+            GObject* s,
+            GAsyncResult* r)
+{
+       g_return_if_fail ((s == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (s, G_TYPE_OBJECT));
+       g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (r, g_async_result_get_type ()));
+       foo_finish (r, NULL);
+       g_main_loop_quit (_data1_->loop);
+}
+
+static void
+___lambda4__gasync_ready_callback (GObject* source_object,
+                                   GAsyncResult* res,
+                                   gpointer self)
+{
+       __lambda4_ (self, source_object, res);
+       block1_data_unref (self);
+}
+
+static void
+_vala_main (void)
+{
+       Block1Data* _data1_;
+       GMainLoop* _tmp0_;
+       _data1_ = g_slice_new0 (Block1Data);
+       _data1_->_ref_count_ = 1;
+       _tmp0_ = g_main_loop_new (NULL, FALSE);
+       _data1_->loop = _tmp0_;
+       foo (___lambda4__gasync_ready_callback, block1_data_ref (_data1_));
+       g_main_loop_run (_data1_->loop);
+       block1_data_unref (_data1_);
+       _data1_ = NULL;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/asynchronous/bug641182.c-expected b/tests/asynchronous/bug641182.c-expected
new file mode 100644
index 000000000..77f87145d
--- /dev/null
+++ b/tests/asynchronous/bug641182.c-expected
@@ -0,0 +1,470 @@
+/* asynchronous_bug641182.c generated by valac, the Vala compiler
+ * generated from asynchronous_bug641182.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gobject/gvaluecollector.h>
+#include <gio/gio.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef void (*Bar) (gpointer user_data);
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+typedef struct _Block1Data Block1Data;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+typedef struct _TestData TestData;
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _FooPrivate {
+       Bar _bar;
+       gpointer _bar_target;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+struct _Block1Data {
+       int _ref_count_;
+       gint i;
+       gpointer _async_data_;
+};
+
+struct _TestData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Block1Data* _data1_;
+       Foo* foo;
+       Foo* _tmp0_;
+       Bar _tmp1_;
+       gpointer _tmp1__target;
+       Bar _tmp2_;
+       gpointer _tmp2__target;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+VALA_EXTERN Bar foo_get_bar (Foo* self,
+                 gpointer* result_target);
+VALA_EXTERN void foo_set_bar (Foo* self,
+                  Bar value,
+                  gpointer value_target);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void test_data_free (gpointer _data);
+VALA_EXTERN void test (GAsyncReadyCallback _callback_,
+           gpointer _user_data_);
+VALA_EXTERN void test_finish (GAsyncResult* _res_);
+static gboolean test_co (TestData* _data_);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static void __lambda4_ (Block1Data* _data1_);
+static void ___lambda4__bar (gpointer self);
+static void _vala_main (void);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+Bar
+foo_get_bar (Foo* self,
+             gpointer* result_target)
+{
+       Bar result;
+       Bar _tmp0_;
+       gpointer _tmp0__target;
+       Bar _tmp1_;
+       gpointer _tmp1__target;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = self->priv->_bar;
+       _tmp0__target = self->priv->_bar_target;
+       _tmp1_ = _tmp0_;
+       _tmp1__target = _tmp0__target;
+       *result_target = _tmp1__target;
+       result = _tmp1_;
+       return result;
+}
+
+void
+foo_set_bar (Foo* self,
+             Bar value,
+             gpointer value_target)
+{
+       g_return_if_fail (IS_FOO (self));
+       self->priv->_bar = value;
+       self->priv->_bar_target = value_target;
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+test_data_free (gpointer _data)
+{
+       TestData* _data_;
+       _data_ = _data;
+       g_slice_free (TestData, _data_);
+}
+
+void
+test (GAsyncReadyCallback _callback_,
+      gpointer _user_data_)
+{
+       TestData* _data_;
+       _data_ = g_slice_new0 (TestData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, test_data_free);
+       test_co (_data_);
+}
+
+void
+test_finish (GAsyncResult* _res_)
+{
+       TestData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static void
+__lambda4_ (Block1Data* _data1_)
+{
+       gint _tmp0_;
+       _tmp0_ = _data1_->i;
+       _data1_->i = _tmp0_ + 1;
+}
+
+static void
+___lambda4__bar (gpointer self)
+{
+       __lambda4_ (self);
+}
+
+static gboolean
+test_co (TestData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->_data1_ = g_slice_new0 (Block1Data);
+       _data_->_data1_->_ref_count_ = 1;
+       _data_->_data1_->_async_data_ = _data_;
+       _data_->_tmp0_ = foo_new ();
+       _data_->foo = _data_->_tmp0_;
+       _data_->_data1_->i = 0;
+       foo_set_bar (_data_->foo, ___lambda4__bar, _data_->_data1_);
+       _data_->_tmp1_ = NULL;
+       _data_->_tmp1__target = NULL;
+       _data_->_tmp1_ = foo_get_bar (_data_->foo, &_data_->_tmp1__target);
+       _data_->_tmp2_ = _data_->_tmp1_;
+       _data_->_tmp2__target = _data_->_tmp1__target;
+       _data_->_tmp2_ (_data_->_tmp2__target);
+       _foo_unref0 (_data_->foo);
+       block1_data_unref (_data_->_data1_);
+       _data_->_data1_ = NULL;
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+_vala_main (void)
+{
+       test (NULL, NULL);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/asynchronous/bug646945.c-expected b/tests/asynchronous/bug646945.c-expected
new file mode 100644
index 000000000..525f44f3c
--- /dev/null
+++ b/tests/asynchronous/bug646945.c-expected
@@ -0,0 +1,587 @@
+/* asynchronous_bug646945.c generated by valac, the Vala compiler
+ * generated from asynchronous_bug646945.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+typedef struct _FooMethod1Data FooMethod1Data;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define BAR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_BAR, BarIface))
+
+typedef struct _Bar Bar;
+typedef struct _BarIface BarIface;
+typedef struct _BarMethod2Data BarMethod2Data;
+
+#define TYPE_BAZ (baz_get_type ())
+#define BAZ(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAZ, Baz))
+#define BAZ_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAZ, BazClass))
+#define IS_BAZ(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAZ))
+#define IS_BAZ_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAZ))
+#define BAZ_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAZ, BazClass))
+
+typedef struct _Baz Baz;
+typedef struct _BazClass BazClass;
+typedef struct _BazPrivate BazPrivate;
+enum  {
+       BAZ_0_PROPERTY,
+       BAZ_NUM_PROPERTIES
+};
+static GParamSpec* baz_properties[BAZ_NUM_PROPERTIES];
+typedef struct _BazMethod1Data BazMethod1Data;
+typedef struct _BazMethod2Data BazMethod2Data;
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+       void (*method1) (Foo* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+       void (*method1_finish) (Foo* self, GAsyncResult* _res_);
+};
+
+struct _FooMethod1Data {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Foo* self;
+};
+
+struct _BarIface {
+       GTypeInterface parent_iface;
+       void (*method2) (Bar* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+       void (*method2_finish) (Bar* self, GAsyncResult* _res_);
+};
+
+struct _BarMethod2Data {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Bar* self;
+};
+
+struct _Baz {
+       Foo parent_instance;
+       BazPrivate * priv;
+};
+
+struct _BazClass {
+       FooClass parent_class;
+};
+
+struct _BazMethod1Data {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Baz* self;
+};
+
+struct _BazMethod2Data {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Baz* self;
+};
+
+static gpointer foo_parent_class = NULL;
+static gpointer baz_parent_class = NULL;
+static BarIface * baz_bar_parent_iface = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN void foo_method1 (Foo* self,
+                  GAsyncReadyCallback _callback_,
+                  gpointer _user_data_);
+VALA_EXTERN void foo_method1_finish (Foo* self,
+                         GAsyncResult* _res_);
+static void foo_real_method1_data_free (gpointer _data);
+static void foo_real_method1 (Foo* self,
+                       GAsyncReadyCallback _callback_,
+                       gpointer _user_data_);
+static gboolean foo_real_method1_co (FooMethod1Data* _data_);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static GType foo_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+static void bar_real_method2_data_free (gpointer _data);
+static void bar_real_method2 (Bar* self,
+                       GAsyncReadyCallback _callback_,
+                       gpointer _user_data_);
+VALA_EXTERN void bar_method2 (Bar* self,
+                  GAsyncReadyCallback _callback_,
+                  gpointer _user_data_);
+VALA_EXTERN void bar_method2_finish (Bar* self,
+                         GAsyncResult* _res_);
+static gboolean bar_real_method2_co (BarMethod2Data* _data_);
+static GType bar_get_type_once (void);
+VALA_EXTERN GType baz_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Baz, g_object_unref)
+static void baz_real_method1_data_free (gpointer _data);
+static void baz_real_method1 (Foo* base,
+                       GAsyncReadyCallback _callback_,
+                       gpointer _user_data_);
+static gboolean baz_real_method1_co (BazMethod1Data* _data_);
+static void baz_real_method2_data_free (gpointer _data);
+static void baz_real_method2 (Bar* base,
+                       GAsyncReadyCallback _callback_,
+                       gpointer _user_data_);
+static gboolean baz_real_method2_co (BazMethod2Data* _data_);
+VALA_EXTERN Baz* baz_new (void);
+VALA_EXTERN Baz* baz_construct (GType object_type);
+static GType baz_get_type_once (void);
+static void _vala_main (void);
+
+static void
+foo_real_method1_data_free (gpointer _data)
+{
+       FooMethod1Data* _data_;
+       _data_ = _data;
+       _g_object_unref0 (_data_->self);
+       g_slice_free (FooMethod1Data, _data_);
+}
+
+static gpointer
+_g_object_ref0 (gpointer self)
+{
+       return self ? g_object_ref (self) : NULL;
+}
+
+static void
+foo_real_method1 (Foo* self,
+                  GAsyncReadyCallback _callback_,
+                  gpointer _user_data_)
+{
+       FooMethod1Data* _data_;
+       Foo* _tmp0_;
+       _data_ = g_slice_new0 (FooMethod1Data);
+       _data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, foo_real_method1_data_free);
+       _tmp0_ = _g_object_ref0 (self);
+       _data_->self = _tmp0_;
+       foo_real_method1_co (_data_);
+}
+
+static void
+foo_real_method1_finish (Foo* self,
+                         GAsyncResult* _res_)
+{
+       FooMethod1Data* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static gboolean
+foo_real_method1_co (FooMethod1Data* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+void
+foo_method1 (Foo* self,
+             GAsyncReadyCallback _callback_,
+             gpointer _user_data_)
+{
+       FooClass* _klass_;
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->method1) {
+               _klass_->method1 (self, _callback_, _user_data_);
+       }
+}
+
+void
+foo_method1_finish (Foo* self,
+                    GAsyncResult* _res_)
+{
+       FooClass* _klass_;
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->method1_finish) {
+               _klass_->method1_finish (self, _res_);
+       }
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->method1 = (void (*) (Foo*, GAsyncReadyCallback, gpointer)) foo_real_method1;
+       ((FooClass *) klass)->method1_finish = (void (*) (Foo*, GAsyncResult*)) foo_real_method1_finish;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+bar_real_method2_data_free (gpointer _data)
+{
+       BarMethod2Data* _data_;
+       _data_ = _data;
+       _g_object_unref0 (_data_->self);
+       g_slice_free (BarMethod2Data, _data_);
+}
+
+static void
+bar_real_method2 (Bar* self,
+                  GAsyncReadyCallback _callback_,
+                  gpointer _user_data_)
+{
+       BarMethod2Data* _data_;
+       Bar* _tmp0_;
+       _data_ = g_slice_new0 (BarMethod2Data);
+       _data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, bar_real_method2_data_free);
+       _tmp0_ = _g_object_ref0 (self);
+       _data_->self = _tmp0_;
+       bar_real_method2_co (_data_);
+}
+
+static void
+bar_real_method2_finish (Bar* self,
+                         GAsyncResult* _res_)
+{
+       BarMethod2Data* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static gboolean
+bar_real_method2_co (BarMethod2Data* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+void
+bar_method2 (Bar* self,
+             GAsyncReadyCallback _callback_,
+             gpointer _user_data_)
+{
+       BarIface* _iface_;
+       _iface_ = BAR_GET_INTERFACE (self);
+       if (_iface_->method2) {
+               _iface_->method2 (self, _callback_, _user_data_);
+       }
+}
+
+void
+bar_method2_finish (Bar* self,
+                    GAsyncResult* _res_)
+{
+       BarIface* _iface_;
+       _iface_ = BAR_GET_INTERFACE (self);
+       if (_iface_->method2_finish) {
+               _iface_->method2_finish (self, _res_);
+       }
+}
+
+static void
+bar_default_init (BarIface * iface,
+                  gpointer iface_data)
+{
+       iface->method2 = bar_real_method2;
+       iface->method2_finish = bar_real_method2_finish;
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (G_TYPE_INTERFACE, "Bar", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (bar_type_id, G_TYPE_OBJECT);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+baz_real_method1_data_free (gpointer _data)
+{
+       BazMethod1Data* _data_;
+       _data_ = _data;
+       _g_object_unref0 (_data_->self);
+       g_slice_free (BazMethod1Data, _data_);
+}
+
+static void
+baz_real_method1 (Foo* base,
+                  GAsyncReadyCallback _callback_,
+                  gpointer _user_data_)
+{
+       Baz * self;
+       BazMethod1Data* _data_;
+       Baz* _tmp0_;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAZ, Baz);
+       _data_ = g_slice_new0 (BazMethod1Data);
+       _data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, baz_real_method1_data_free);
+       _tmp0_ = _g_object_ref0 (self);
+       _data_->self = _tmp0_;
+       baz_real_method1_co (_data_);
+}
+
+static void
+baz_method1_finish (Foo* base,
+                    GAsyncResult* _res_)
+{
+       BazMethod1Data* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static gboolean
+baz_real_method1_co (BazMethod1Data* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       baz_real_method1_co (_data_);
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+baz_real_method2_data_free (gpointer _data)
+{
+       BazMethod2Data* _data_;
+       _data_ = _data;
+       _g_object_unref0 (_data_->self);
+       g_slice_free (BazMethod2Data, _data_);
+}
+
+static void
+baz_real_method2 (Bar* base,
+                  GAsyncReadyCallback _callback_,
+                  gpointer _user_data_)
+{
+       Baz * self;
+       BazMethod2Data* _data_;
+       Baz* _tmp0_;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAZ, Baz);
+       _data_ = g_slice_new0 (BazMethod2Data);
+       _data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, baz_real_method2_data_free);
+       _tmp0_ = _g_object_ref0 (self);
+       _data_->self = _tmp0_;
+       baz_real_method2_co (_data_);
+}
+
+static void
+baz_method2_finish (Bar* base,
+                    GAsyncResult* _res_)
+{
+       BazMethod2Data* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static gboolean
+baz_real_method2_co (BazMethod2Data* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       baz_real_method2_co (_data_);
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+Baz*
+baz_construct (GType object_type)
+{
+       Baz * self = NULL;
+       self = (Baz*) foo_construct (object_type);
+       return self;
+}
+
+Baz*
+baz_new (void)
+{
+       return baz_construct (TYPE_BAZ);
+}
+
+static void
+baz_class_init (BazClass * klass,
+                gpointer klass_data)
+{
+       baz_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->method1 = (void (*) (Foo*, GAsyncReadyCallback, gpointer)) baz_real_method1;
+       ((FooClass *) klass)->method1_finish = (void (*) (Foo*, GAsyncResult*)) baz_method1_finish;
+}
+
+static void
+baz_bar_interface_init (BarIface * iface,
+                        gpointer iface_data)
+{
+       baz_bar_parent_iface = g_type_interface_peek_parent (iface);
+       iface->method2 = (void (*) (Bar*, GAsyncReadyCallback, gpointer)) baz_real_method2;
+       iface->method2_finish = (void (*) (Bar*, GAsyncResult*)) baz_method2_finish;
+}
+
+static void
+baz_instance_init (Baz * self,
+                   gpointer klass)
+{
+}
+
+static GType
+baz_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BazClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) baz_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Baz), 0, 
(GInstanceInitFunc) baz_instance_init, NULL };
+       static const GInterfaceInfo bar_info = { (GInterfaceInitFunc) baz_bar_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       GType baz_type_id;
+       baz_type_id = g_type_register_static (TYPE_FOO, "Baz", &g_define_type_info, 0);
+       g_type_add_interface_static (baz_type_id, TYPE_BAR, &bar_info);
+       return baz_type_id;
+}
+
+GType
+baz_get_type (void)
+{
+       static volatile gsize baz_type_id__volatile = 0;
+       if (g_once_init_enter (&baz_type_id__volatile)) {
+               GType baz_type_id;
+               baz_type_id = baz_get_type_once ();
+               g_once_init_leave (&baz_type_id__volatile, baz_type_id);
+       }
+       return baz_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/asynchronous/bug652252.c-expected b/tests/asynchronous/bug652252.c-expected
new file mode 100644
index 000000000..7494b39ef
--- /dev/null
+++ b/tests/asynchronous/bug652252.c-expected
@@ -0,0 +1,337 @@
+/* asynchronous_bug652252.c generated by valac, the Vala compiler
+ * generated from asynchronous_bug652252.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define FOO_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_FOO, FooIface))
+
+typedef struct _Foo Foo;
+typedef struct _FooIface FooIface;
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+typedef struct _FooFooData FooFooData;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+enum  {
+       BAR_0_PROPERTY,
+       BAR_NUM_PROPERTIES
+};
+static GParamSpec* bar_properties[BAR_NUM_PROPERTIES];
+typedef struct _Block1Data Block1Data;
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+
+struct _FooIface {
+       GTypeInterface parent_iface;
+       void (*foo) (Foo* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+       void (*foo_finish) (Foo* self, GAsyncResult* _res_);
+};
+
+struct _FooFooData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Foo* self;
+};
+
+struct _Bar {
+       GObject parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       GObjectClass parent_class;
+};
+
+struct _Block1Data {
+       int _ref_count_;
+       GMainLoop* loop;
+       Bar* bar;
+};
+
+static gpointer bar_parent_class = NULL;
+static FooIface * bar_foo_parent_iface = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+static void foo_real_foo_data_free (gpointer _data);
+static void foo_real_foo (Foo* self,
+                   GAsyncReadyCallback _callback_,
+                   gpointer _user_data_);
+VALA_EXTERN void foo_foo (Foo* self,
+              GAsyncReadyCallback _callback_,
+              gpointer _user_data_);
+VALA_EXTERN void foo_foo_finish (Foo* self,
+                     GAsyncResult* _res_);
+static gboolean foo_real_foo_co (FooFooData* _data_);
+static GType foo_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static GType bar_get_type_once (void);
+static void _vala_main (void);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static void __lambda4_ (Block1Data* _data1_,
+                 GObject* s,
+                 GAsyncResult* r);
+static void ___lambda4__gasync_ready_callback (GObject* source_object,
+                                        GAsyncResult* res,
+                                        gpointer self);
+
+static void
+foo_real_foo_data_free (gpointer _data)
+{
+       FooFooData* _data_;
+       _data_ = _data;
+       _g_object_unref0 (_data_->self);
+       g_slice_free (FooFooData, _data_);
+}
+
+static gpointer
+_g_object_ref0 (gpointer self)
+{
+       return self ? g_object_ref (self) : NULL;
+}
+
+static void
+foo_real_foo (Foo* self,
+              GAsyncReadyCallback _callback_,
+              gpointer _user_data_)
+{
+       FooFooData* _data_;
+       Foo* _tmp0_;
+       _data_ = g_slice_new0 (FooFooData);
+       _data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, foo_real_foo_data_free);
+       _tmp0_ = _g_object_ref0 (self);
+       _data_->self = _tmp0_;
+       foo_real_foo_co (_data_);
+}
+
+static void
+foo_real_foo_finish (Foo* self,
+                     GAsyncResult* _res_)
+{
+       FooFooData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static gboolean
+foo_real_foo_co (FooFooData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+void
+foo_foo (Foo* self,
+         GAsyncReadyCallback _callback_,
+         gpointer _user_data_)
+{
+       FooIface* _iface_;
+       _iface_ = FOO_GET_INTERFACE (self);
+       if (_iface_->foo) {
+               _iface_->foo (self, _callback_, _user_data_);
+       }
+}
+
+void
+foo_foo_finish (Foo* self,
+                GAsyncResult* _res_)
+{
+       FooIface* _iface_;
+       _iface_ = FOO_GET_INTERFACE (self);
+       if (_iface_->foo_finish) {
+               _iface_->foo_finish (self, _res_);
+       }
+}
+
+static void
+foo_default_init (FooIface * iface,
+                  gpointer iface_data)
+{
+       iface->foo = foo_real_foo;
+       iface->foo_finish = foo_real_foo_finish;
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_INTERFACE, "Foo", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (foo_type_id, G_TYPE_OBJECT);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar * self = NULL;
+       self = (Bar*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+bar_foo_interface_init (FooIface * iface,
+                        gpointer iface_data)
+{
+       bar_foo_parent_iface = g_type_interface_peek_parent (iface);
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       static const GInterfaceInfo foo_info = { (GInterfaceInitFunc) bar_foo_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (G_TYPE_OBJECT, "Bar", &g_define_type_info, 0);
+       g_type_add_interface_static (bar_type_id, TYPE_FOO, &foo_info);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               _g_object_unref0 (_data1_->bar);
+               _g_main_loop_unref0 (_data1_->loop);
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static void
+__lambda4_ (Block1Data* _data1_,
+            GObject* s,
+            GAsyncResult* r)
+{
+       g_return_if_fail ((s == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (s, G_TYPE_OBJECT));
+       g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (r, g_async_result_get_type ()));
+       foo_foo_finish (G_TYPE_CHECK_INSTANCE_CAST (_data1_->bar, TYPE_FOO, Foo), r);
+       g_main_loop_quit (_data1_->loop);
+}
+
+static void
+___lambda4__gasync_ready_callback (GObject* source_object,
+                                   GAsyncResult* res,
+                                   gpointer self)
+{
+       __lambda4_ (self, source_object, res);
+       block1_data_unref (self);
+}
+
+static void
+_vala_main (void)
+{
+       Block1Data* _data1_;
+       GMainLoop* _tmp0_;
+       Bar* _tmp1_;
+       _data1_ = g_slice_new0 (Block1Data);
+       _data1_->_ref_count_ = 1;
+       _tmp0_ = g_main_loop_new (NULL, FALSE);
+       _data1_->loop = _tmp0_;
+       _tmp1_ = bar_new ();
+       _data1_->bar = _tmp1_;
+       foo_foo (G_TYPE_CHECK_INSTANCE_CAST (_data1_->bar, TYPE_FOO, Foo), ___lambda4__gasync_ready_callback, 
block1_data_ref (_data1_));
+       g_main_loop_run (_data1_->loop);
+       block1_data_unref (_data1_);
+       _data1_ = NULL;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/asynchronous/bug653861.c-expected b/tests/asynchronous/bug653861.c-expected
new file mode 100644
index 000000000..1bd375fd7
--- /dev/null
+++ b/tests/asynchronous/bug653861.c-expected
@@ -0,0 +1,406 @@
+/* asynchronous_bug653861.c generated by valac, the Vala compiler
+ * generated from asynchronous_bug653861.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+typedef struct _FooBarData FooBarData;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _FooBarData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Foo* self;
+       gpointer arg;
+       GType t;
+       GType g_type;
+       GBoxedCopyFunc g_dup_func;
+       GDestroyNotify g_destroy_func;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+static void foo_bar_data_free (gpointer _data);
+VALA_EXTERN void foo_bar (Foo* self,
+              GType g_type,
+              GBoxedCopyFunc g_dup_func,
+              GDestroyNotify g_destroy_func,
+              gconstpointer arg,
+              GType t,
+              GAsyncReadyCallback _callback_,
+              gpointer _user_data_);
+VALA_EXTERN void foo_bar_finish (Foo* self,
+                     GAsyncResult* _res_);
+static gboolean foo_bar_co (FooBarData* _data_);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+static void
+foo_bar_data_free (gpointer _data)
+{
+       FooBarData* _data_;
+       _data_ = _data;
+       ((_data_->arg == NULL) || (_data_->g_destroy_func == NULL)) ? NULL : (_data_->arg = 
(_data_->g_destroy_func (_data_->arg), NULL));
+       _foo_unref0 (_data_->self);
+       g_slice_free (FooBarData, _data_);
+}
+
+static gpointer
+_foo_ref0 (gpointer self)
+{
+       return self ? foo_ref (self) : NULL;
+}
+
+void
+foo_bar (Foo* self,
+         GType g_type,
+         GBoxedCopyFunc g_dup_func,
+         GDestroyNotify g_destroy_func,
+         gconstpointer arg,
+         GType t,
+         GAsyncReadyCallback _callback_,
+         gpointer _user_data_)
+{
+       FooBarData* _data_;
+       Foo* _tmp0_;
+       gpointer _tmp1_;
+       g_return_if_fail (IS_FOO (self));
+       _data_ = g_slice_new0 (FooBarData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, foo_bar_data_free);
+       _tmp0_ = _foo_ref0 (self);
+       _data_->self = _tmp0_;
+       _tmp1_ = ((arg != NULL) && (g_dup_func != NULL)) ? g_dup_func ((gpointer) arg) : ((gpointer) arg);
+       ((_data_->arg == NULL) || (_data_->g_destroy_func == NULL)) ? NULL : (_data_->arg = 
(_data_->g_destroy_func (_data_->arg), NULL));
+       _data_->arg = _tmp1_;
+       _data_->t = t;
+       _data_->g_type = g_type;
+       _data_->g_dup_func = g_dup_func;
+       _data_->g_destroy_func = g_destroy_func;
+       foo_bar_co (_data_);
+}
+
+void
+foo_bar_finish (Foo* self,
+                GAsyncResult* _res_)
+{
+       FooBarData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static gboolean
+foo_bar_co (FooBarData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _vala_assert (_data_->g_type == _data_->t, "typeof (G) == t");
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       foo_bar (foo, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, "foo", 
G_TYPE_STRING, NULL, NULL);
+       _foo_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/asynchronous/bug654336.c-expected b/tests/asynchronous/bug654336.c-expected
new file mode 100644
index 000000000..71a1e1a47
--- /dev/null
+++ b/tests/asynchronous/bug654336.c-expected
@@ -0,0 +1,185 @@
+/* asynchronous_bug654336.c generated by valac, the Vala compiler
+ * generated from asynchronous_bug654336.vala, do not modify */
+
+#include <gio/gio.h>
+#include <glib-object.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef struct _FooData FooData;
+typedef struct _BarData BarData;
+
+struct _FooData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       GType t_type;
+       GBoxedCopyFunc t_dup_func;
+       GDestroyNotify t_destroy_func;
+};
+
+struct _BarData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+};
+
+static void foo_data_free (gpointer _data);
+VALA_EXTERN void foo (GType t_type,
+          GBoxedCopyFunc t_dup_func,
+          GDestroyNotify t_destroy_func,
+          GAsyncReadyCallback _callback_,
+          gpointer _user_data_);
+VALA_EXTERN void foo_finish (GAsyncResult* _res_);
+static gboolean foo_co (FooData* _data_);
+static void bar_data_free (gpointer _data);
+VALA_EXTERN void bar (GAsyncReadyCallback _callback_,
+          gpointer _user_data_);
+VALA_EXTERN void bar_finish (GAsyncResult* _res_);
+static gboolean bar_co (BarData* _data_);
+static void bar_ready (GObject* source_object,
+                GAsyncResult* _res_,
+                gpointer _user_data_);
+static void _vala_main (void);
+
+static void
+foo_data_free (gpointer _data)
+{
+       FooData* _data_;
+       _data_ = _data;
+       g_slice_free (FooData, _data_);
+}
+
+void
+foo (GType t_type,
+     GBoxedCopyFunc t_dup_func,
+     GDestroyNotify t_destroy_func,
+     GAsyncReadyCallback _callback_,
+     gpointer _user_data_)
+{
+       FooData* _data_;
+       _data_ = g_slice_new0 (FooData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, foo_data_free);
+       _data_->t_type = t_type;
+       _data_->t_dup_func = t_dup_func;
+       _data_->t_destroy_func = t_destroy_func;
+       foo_co (_data_);
+}
+
+void
+foo_finish (GAsyncResult* _res_)
+{
+       FooData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static gboolean
+foo_co (FooData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+bar_data_free (gpointer _data)
+{
+       BarData* _data_;
+       _data_ = _data;
+       g_slice_free (BarData, _data_);
+}
+
+void
+bar (GAsyncReadyCallback _callback_,
+     gpointer _user_data_)
+{
+       BarData* _data_;
+       _data_ = g_slice_new0 (BarData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, bar_data_free);
+       bar_co (_data_);
+}
+
+void
+bar_finish (GAsyncResult* _res_)
+{
+       BarData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static void
+bar_ready (GObject* source_object,
+           GAsyncResult* _res_,
+           gpointer _user_data_)
+{
+       BarData* _data_;
+       _data_ = _user_data_;
+       _data_->_source_object_ = source_object;
+       _data_->_res_ = _res_;
+       bar_co (_data_);
+}
+
+static gboolean
+bar_co (BarData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               case 1:
+               goto _state_1;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->_state_ = 1;
+       foo (G_TYPE_INT, NULL, NULL, bar_ready, _data_);
+       return FALSE;
+       _state_1:
+       foo_finish (_data_->_res_);
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/asynchronous/bug654337.c-expected b/tests/asynchronous/bug654337.c-expected
new file mode 100644
index 000000000..925cba654
--- /dev/null
+++ b/tests/asynchronous/bug654337.c-expected
@@ -0,0 +1,181 @@
+/* asynchronous_bug654337.c generated by valac, the Vala compiler
+ * generated from asynchronous_bug654337.vala, do not modify */
+
+#include <gio/gio.h>
+#include <glib-object.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef struct _Block1Data Block1Data;
+typedef struct _FooData FooData;
+
+struct _Block1Data {
+       int _ref_count_;
+       GType t_type;
+       GBoxedCopyFunc t_dup_func;
+       GDestroyNotify t_destroy_func;
+       gpointer _async_data_;
+};
+
+struct _FooData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       GType t_type;
+       GBoxedCopyFunc t_dup_func;
+       GDestroyNotify t_destroy_func;
+       Block1Data* _data1_;
+       GSourceFunc c;
+       gpointer c_target;
+       GDestroyNotify c_target_destroy_notify;
+};
+
+static void foo_data_free (gpointer _data);
+VALA_EXTERN void foo (GType t_type,
+          GBoxedCopyFunc t_dup_func,
+          GDestroyNotify t_destroy_func,
+          GAsyncReadyCallback _callback_,
+          gpointer _user_data_);
+VALA_EXTERN void foo_finish (GAsyncResult* _res_);
+static gboolean foo_co (FooData* _data_);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static gboolean __lambda4_ (Block1Data* _data1_);
+static gboolean ___lambda4__gsource_func (gpointer self);
+static void _vala_main (void);
+
+static void
+foo_data_free (gpointer _data)
+{
+       FooData* _data_;
+       _data_ = _data;
+       g_slice_free (FooData, _data_);
+}
+
+void
+foo (GType t_type,
+     GBoxedCopyFunc t_dup_func,
+     GDestroyNotify t_destroy_func,
+     GAsyncReadyCallback _callback_,
+     gpointer _user_data_)
+{
+       FooData* _data_;
+       _data_ = g_slice_new0 (FooData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, foo_data_free);
+       _data_->t_type = t_type;
+       _data_->t_dup_func = t_dup_func;
+       _data_->t_destroy_func = t_destroy_func;
+       foo_co (_data_);
+}
+
+void
+foo_finish (GAsyncResult* _res_)
+{
+       FooData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               GType t_type;
+               GBoxedCopyFunc t_dup_func;
+               GDestroyNotify t_destroy_func;
+               t_type = _data1_->t_type;
+               t_dup_func = _data1_->t_dup_func;
+               t_destroy_func = _data1_->t_destroy_func;
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static gboolean
+__lambda4_ (Block1Data* _data1_)
+{
+       GType t_type;
+       GBoxedCopyFunc t_dup_func;
+       GDestroyNotify t_destroy_func;
+       gboolean result = FALSE;
+       t_type = _data1_->t_type;
+       t_dup_func = _data1_->t_dup_func;
+       t_destroy_func = _data1_->t_destroy_func;
+       result = foo_co (_data1_->_async_data_);
+       return result;
+}
+
+static gboolean
+___lambda4__gsource_func (gpointer self)
+{
+       gboolean result;
+       result = __lambda4_ (self);
+       return result;
+}
+
+static gboolean
+foo_co (FooData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->_data1_ = g_slice_new0 (Block1Data);
+       _data_->_data1_->_ref_count_ = 1;
+       _data_->_data1_->t_type = _data_->t_type;
+       _data_->_data1_->t_dup_func = _data_->t_dup_func;
+       _data_->_data1_->t_destroy_func = _data_->t_destroy_func;
+       _data_->_data1_->_async_data_ = _data_;
+       _data_->c = ___lambda4__gsource_func;
+       _data_->c_target = block1_data_ref (_data_->_data1_);
+       _data_->c_target_destroy_notify = block1_data_unref;
+       (_data_->c_target_destroy_notify == NULL) ? NULL : (_data_->c_target_destroy_notify 
(_data_->c_target), NULL);
+       _data_->c = NULL;
+       _data_->c_target = NULL;
+       _data_->c_target_destroy_notify = NULL;
+       block1_data_unref (_data_->_data1_);
+       _data_->_data1_ = NULL;
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/asynchronous/bug659886.c-expected b/tests/asynchronous/bug659886.c-expected
new file mode 100644
index 000000000..653823b9d
--- /dev/null
+++ b/tests/asynchronous/bug659886.c-expected
@@ -0,0 +1,268 @@
+/* asynchronous_bug659886.c generated by valac, the Vala compiler
+ * generated from asynchronous_bug659886.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+typedef struct _FooNewData FooNewData;
+typedef struct _BarData BarData;
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _FooNewData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       GType object_type;
+       Foo* self;
+};
+
+struct _BarData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Foo* _tmp0_;
+};
+
+static gpointer foo_parent_class = NULL;
+VALA_EXTERN Foo* f;
+Foo* f = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+static void foo_construct_data_free (gpointer _data);
+VALA_EXTERN void foo_new (GAsyncReadyCallback _callback_,
+              gpointer _user_data_);
+VALA_EXTERN Foo* foo_new_finish (GAsyncResult* _res_);
+VALA_EXTERN void foo_construct (GType object_type,
+                    GAsyncReadyCallback _callback_,
+                    gpointer _user_data_);
+VALA_EXTERN Foo* foo_construct_finish (GAsyncResult* _res_);
+static gboolean foo_construct_co (FooNewData* _data_);
+static GType foo_get_type_once (void);
+static void bar_data_free (gpointer _data);
+VALA_EXTERN void bar (GAsyncReadyCallback _callback_,
+          gpointer _user_data_);
+VALA_EXTERN void bar_finish (GAsyncResult* _res_);
+static gboolean bar_co (BarData* _data_);
+static void bar_ready (GObject* source_object,
+                GAsyncResult* _res_,
+                gpointer _user_data_);
+static void _vala_main (void);
+
+static void
+foo_construct_data_free (gpointer _data)
+{
+       FooNewData* _data_;
+       _data_ = _data;
+       _g_object_unref0 (_data_->self);
+       g_slice_free (FooNewData, _data_);
+}
+
+void
+foo_construct (GType object_type,
+               GAsyncReadyCallback _callback_,
+               gpointer _user_data_)
+{
+       FooNewData* _data_;
+       _data_ = g_slice_new0 (FooNewData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, foo_construct_data_free);
+       _data_->object_type = object_type;
+       foo_construct_co (_data_);
+}
+
+Foo*
+foo_construct_finish (GAsyncResult* _res_)
+{
+       Foo* result;
+       FooNewData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+       result = _data_->self;
+       _data_->self = NULL;
+       return result;
+}
+
+static gboolean
+foo_construct_co (FooNewData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->self = (Foo*) g_object_new (_data_->object_type, NULL);
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+void
+foo_new (GAsyncReadyCallback _callback_,
+         gpointer _user_data_)
+{
+       foo_construct (TYPE_FOO, _callback_, _user_data_);
+}
+
+Foo*
+foo_new_finish (GAsyncResult* _res_)
+{
+       return foo_construct_finish (_res_);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+bar_data_free (gpointer _data)
+{
+       BarData* _data_;
+       _data_ = _data;
+       g_slice_free (BarData, _data_);
+}
+
+void
+bar (GAsyncReadyCallback _callback_,
+     gpointer _user_data_)
+{
+       BarData* _data_;
+       _data_ = g_slice_new0 (BarData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, bar_data_free);
+       bar_co (_data_);
+}
+
+void
+bar_finish (GAsyncResult* _res_)
+{
+       BarData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static void
+bar_ready (GObject* source_object,
+           GAsyncResult* _res_,
+           gpointer _user_data_)
+{
+       BarData* _data_;
+       _data_ = _user_data_;
+       _data_->_source_object_ = source_object;
+       _data_->_res_ = _res_;
+       bar_co (_data_);
+}
+
+static gboolean
+bar_co (BarData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               case 1:
+               goto _state_1;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->_state_ = 1;
+       foo_new (bar_ready, _data_);
+       return FALSE;
+       _state_1:
+       _data_->_tmp0_ = foo_new_finish (_data_->_res_);
+       _g_object_unref0 (f);
+       f = _data_->_tmp0_;
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/asynchronous/bug661961.c-expected b/tests/asynchronous/bug661961.c-expected
new file mode 100644
index 000000000..c6f8da664
--- /dev/null
+++ b/tests/asynchronous/bug661961.c-expected
@@ -0,0 +1,196 @@
+/* asynchronous_bug661961.c generated by valac, the Vala compiler
+ * generated from asynchronous_bug661961.vala, do not modify */
+
+#include <gio/gio.h>
+#include <glib-object.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef struct _FooData FooData;
+typedef struct _Block1Data Block1Data;
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _FooData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       gpointer bar;
+       GType t_type;
+       GBoxedCopyFunc t_dup_func;
+       GDestroyNotify t_destroy_func;
+       gpointer result;
+       gpointer _tmp0_;
+};
+
+struct _Block1Data {
+       int _ref_count_;
+       GMainLoop* loop;
+};
+
+static void foo_data_free (gpointer _data);
+VALA_EXTERN void foo (GType t_type,
+          GBoxedCopyFunc t_dup_func,
+          GDestroyNotify t_destroy_func,
+          gconstpointer bar,
+          GAsyncReadyCallback _callback_,
+          gpointer _user_data_);
+VALA_EXTERN gpointer foo_finish (GAsyncResult* _res_);
+static gboolean foo_co (FooData* _data_);
+static void _vala_main (void);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static void __lambda4_ (Block1Data* _data1_,
+                 GObject* s,
+                 GAsyncResult* r);
+static void ___lambda4__gasync_ready_callback (GObject* source_object,
+                                        GAsyncResult* res,
+                                        gpointer self);
+
+static void
+foo_data_free (gpointer _data)
+{
+       FooData* _data_;
+       _data_ = _data;
+       ((_data_->bar == NULL) || (_data_->t_destroy_func == NULL)) ? NULL : (_data_->bar = 
(_data_->t_destroy_func (_data_->bar), NULL));
+       ((_data_->result == NULL) || (_data_->t_destroy_func == NULL)) ? NULL : (_data_->result = 
(_data_->t_destroy_func (_data_->result), NULL));
+       g_slice_free (FooData, _data_);
+}
+
+void
+foo (GType t_type,
+     GBoxedCopyFunc t_dup_func,
+     GDestroyNotify t_destroy_func,
+     gconstpointer bar,
+     GAsyncReadyCallback _callback_,
+     gpointer _user_data_)
+{
+       FooData* _data_;
+       gpointer _tmp0_;
+       _data_ = g_slice_new0 (FooData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, foo_data_free);
+       _tmp0_ = ((bar != NULL) && (t_dup_func != NULL)) ? t_dup_func ((gpointer) bar) : ((gpointer) bar);
+       ((_data_->bar == NULL) || (_data_->t_destroy_func == NULL)) ? NULL : (_data_->bar = 
(_data_->t_destroy_func (_data_->bar), NULL));
+       _data_->bar = _tmp0_;
+       _data_->t_type = t_type;
+       _data_->t_dup_func = t_dup_func;
+       _data_->t_destroy_func = t_destroy_func;
+       foo_co (_data_);
+}
+
+gpointer
+foo_finish (GAsyncResult* _res_)
+{
+       gpointer result;
+       FooData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+       result = _data_->result;
+       _data_->result = NULL;
+       return result;
+}
+
+static gboolean
+foo_co (FooData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->_tmp0_ = ((_data_->bar != NULL) && (_data_->t_dup_func != NULL)) ? _data_->t_dup_func 
((gpointer) _data_->bar) : ((gpointer) _data_->bar);
+       _data_->result = _data_->_tmp0_;
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               _g_main_loop_unref0 (_data1_->loop);
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static void
+__lambda4_ (Block1Data* _data1_,
+            GObject* s,
+            GAsyncResult* r)
+{
+       gpointer _tmp0_;
+       gchar* _tmp1_;
+       g_return_if_fail ((s == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (s, G_TYPE_OBJECT));
+       g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (r, g_async_result_get_type ()));
+       _tmp0_ = foo_finish (r);
+       _tmp1_ = (gchar*) _tmp0_;
+       _vala_assert (g_strcmp0 (_tmp1_, "test") == 0, "foo.end<string> (r) == \"test\"");
+       _g_free0 (_tmp1_);
+       g_main_loop_quit (_data1_->loop);
+}
+
+static void
+___lambda4__gasync_ready_callback (GObject* source_object,
+                                   GAsyncResult* res,
+                                   gpointer self)
+{
+       __lambda4_ (self, source_object, res);
+       block1_data_unref (self);
+}
+
+static void
+_vala_main (void)
+{
+       Block1Data* _data1_;
+       GMainLoop* _tmp0_;
+       _data1_ = g_slice_new0 (Block1Data);
+       _data1_->_ref_count_ = 1;
+       _tmp0_ = g_main_loop_new (NULL, FALSE);
+       _data1_->loop = _tmp0_;
+       foo (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, "test", 
___lambda4__gasync_ready_callback, block1_data_ref (_data1_));
+       g_main_loop_run (_data1_->loop);
+       block1_data_unref (_data1_);
+       _data1_ = NULL;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/asynchronous/bug710103.c-expected b/tests/asynchronous/bug710103.c-expected
new file mode 100644
index 000000000..beb59a98d
--- /dev/null
+++ b/tests/asynchronous/bug710103.c-expected
@@ -0,0 +1,595 @@
+/* asynchronous_bug710103.c generated by valac, the Vala compiler
+ * generated from asynchronous_bug710103.vala, do not modify */
+
+#include <gio/gio.h>
+#include <glib.h>
+#include <glib-object.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef struct _Block1Data Block1Data;
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+typedef struct _FooBarData FooBarData;
+typedef struct _FooNewAsyncData FooNewAsyncData;
+typedef struct _FooCreateFooAsyncData FooCreateFooAsyncData;
+typedef struct _Block2Data Block2Data;
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+typedef struct _Block3Data Block3Data;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Block1Data {
+       int _ref_count_;
+       GIOStream* is0;
+};
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+       gint manam;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _FooBarData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Foo* self;
+};
+
+struct _FooNewAsyncData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       GType object_type;
+       Foo* self;
+};
+
+struct _FooCreateFooAsyncData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Foo* result;
+       Foo* foo;
+       Foo* _tmp0_;
+};
+
+struct _Block2Data {
+       int _ref_count_;
+       GMainLoop* loop;
+};
+
+struct _Block3Data {
+       int _ref_count_;
+       Block2Data * _data2_;
+       Foo* foo;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN void iostream (void);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static void __lambda4_ (Block1Data* _data1_,
+                 GObject* obj,
+                 GAsyncResult* res);
+static void ___lambda4__gasync_ready_callback (GObject* source_object,
+                                        GAsyncResult* res,
+                                        gpointer self);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+static void foo_bar_data_free (gpointer _data);
+VALA_EXTERN void foo_bar (Foo* self,
+              GAsyncReadyCallback _callback_,
+              gpointer _user_data_);
+VALA_EXTERN void foo_bar_finish (GAsyncResult* _res_);
+static gboolean foo_bar_co (FooBarData* _data_);
+static void foo_construct_async_data_free (gpointer _data);
+VALA_EXTERN void foo_new_async (GAsyncReadyCallback _callback_,
+                    gpointer _user_data_);
+VALA_EXTERN Foo* foo_new_finish (GAsyncResult* _res_);
+VALA_EXTERN void foo_construct_async (GType object_type,
+                          GAsyncReadyCallback _callback_,
+                          gpointer _user_data_);
+VALA_EXTERN Foo* foo_construct_finish (GAsyncResult* _res_);
+static gboolean foo_construct_async_co (FooNewAsyncData* _data_);
+static void foo_create_foo_async_data_free (gpointer _data);
+VALA_EXTERN void foo_create_foo_async (GAsyncReadyCallback _callback_,
+                           gpointer _user_data_);
+VALA_EXTERN Foo* foo_create_foo_finish (GAsyncResult* _res_);
+static gboolean foo_create_foo_async_co (FooCreateFooAsyncData* _data_);
+static void foo_create_foo_async_ready (GObject* source_object,
+                                 GAsyncResult* _res_,
+                                 gpointer _user_data_);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (GObject * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+static Block2Data* block2_data_ref (Block2Data* _data2_);
+static void block2_data_unref (void * _userdata_);
+static void __lambda5_ (Block2Data* _data2_,
+                 GObject* obj,
+                 GAsyncResult* res);
+static Block3Data* block3_data_ref (Block3Data* _data3_);
+static void block3_data_unref (void * _userdata_);
+static void __lambda6_ (Block3Data* _data3_,
+                 GObject* obj,
+                 GAsyncResult* res);
+static void ___lambda6__gasync_ready_callback (GObject* source_object,
+                                        GAsyncResult* res,
+                                        gpointer self);
+static void ___lambda5__gasync_ready_callback (GObject* source_object,
+                                        GAsyncResult* res,
+                                        gpointer self);
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               _g_object_unref0 (_data1_->is0);
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static void
+__lambda4_ (Block1Data* _data1_,
+            GObject* obj,
+            GAsyncResult* res)
+{
+       GError* _inner_error0_ = NULL;
+       g_return_if_fail ((obj == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (obj, G_TYPE_OBJECT));
+       g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (res, g_async_result_get_type ()));
+       {
+               g_io_stream_splice_finish (res, &_inner_error0_);
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       goto __catch0_g_error;
+               }
+       }
+       goto __finally0;
+       __catch0_g_error:
+       {
+               g_clear_error (&_inner_error0_);
+       }
+       __finally0:
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+}
+
+static void
+___lambda4__gasync_ready_callback (GObject* source_object,
+                                   GAsyncResult* res,
+                                   gpointer self)
+{
+       __lambda4_ (self, source_object, res);
+       block1_data_unref (self);
+}
+
+void
+iostream (void)
+{
+       Block1Data* _data1_;
+       GIOStream* is1 = NULL;
+       _data1_ = g_slice_new0 (Block1Data);
+       _data1_->_ref_count_ = 1;
+       _data1_->is0 = NULL;
+       is1 = NULL;
+       g_io_stream_splice_async (_data1_->is0, is1, G_IO_STREAM_SPLICE_NONE, G_PRIORITY_DEFAULT, NULL, 
___lambda4__gasync_ready_callback, block1_data_ref (_data1_));
+       _g_object_unref0 (is1);
+       block1_data_unref (_data1_);
+       _data1_ = NULL;
+}
+
+static void
+foo_bar_data_free (gpointer _data)
+{
+       FooBarData* _data_;
+       _data_ = _data;
+       _g_object_unref0 (_data_->self);
+       g_slice_free (FooBarData, _data_);
+}
+
+static gpointer
+_g_object_ref0 (gpointer self)
+{
+       return self ? g_object_ref (self) : NULL;
+}
+
+void
+foo_bar (Foo* self,
+         GAsyncReadyCallback _callback_,
+         gpointer _user_data_)
+{
+       FooBarData* _data_;
+       Foo* _tmp0_;
+       g_return_if_fail (IS_FOO (self));
+       _data_ = g_slice_new0 (FooBarData);
+       _data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, foo_bar_data_free);
+       _tmp0_ = _g_object_ref0 (self);
+       _data_->self = _tmp0_;
+       foo_bar_co (_data_);
+}
+
+void
+foo_bar_finish (GAsyncResult* _res_)
+{
+       FooBarData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static gboolean
+foo_bar_co (FooBarData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->self->manam = 23;
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+foo_construct_async_data_free (gpointer _data)
+{
+       FooNewAsyncData* _data_;
+       _data_ = _data;
+       _g_object_unref0 (_data_->self);
+       g_slice_free (FooNewAsyncData, _data_);
+}
+
+void
+foo_construct_async (GType object_type,
+                     GAsyncReadyCallback _callback_,
+                     gpointer _user_data_)
+{
+       FooNewAsyncData* _data_;
+       _data_ = g_slice_new0 (FooNewAsyncData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, foo_construct_async_data_free);
+       _data_->object_type = object_type;
+       foo_construct_async_co (_data_);
+}
+
+Foo*
+foo_construct_finish (GAsyncResult* _res_)
+{
+       Foo* result;
+       FooNewAsyncData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+       result = _data_->self;
+       _data_->self = NULL;
+       return result;
+}
+
+static gboolean
+foo_construct_async_co (FooNewAsyncData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->self = (Foo*) g_object_new (_data_->object_type, NULL);
+       _data_->self->manam = 42;
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+void
+foo_new_async (GAsyncReadyCallback _callback_,
+               gpointer _user_data_)
+{
+       foo_construct_async (TYPE_FOO, _callback_, _user_data_);
+}
+
+Foo*
+foo_new_finish (GAsyncResult* _res_)
+{
+       return foo_construct_finish (_res_);
+}
+
+static void
+foo_create_foo_async_data_free (gpointer _data)
+{
+       FooCreateFooAsyncData* _data_;
+       _data_ = _data;
+       _g_object_unref0 (_data_->result);
+       g_slice_free (FooCreateFooAsyncData, _data_);
+}
+
+void
+foo_create_foo_async (GAsyncReadyCallback _callback_,
+                      gpointer _user_data_)
+{
+       FooCreateFooAsyncData* _data_;
+       _data_ = g_slice_new0 (FooCreateFooAsyncData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, foo_create_foo_async_data_free);
+       foo_create_foo_async_co (_data_);
+}
+
+Foo*
+foo_create_foo_finish (GAsyncResult* _res_)
+{
+       Foo* result;
+       FooCreateFooAsyncData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+       result = _data_->result;
+       _data_->result = NULL;
+       return result;
+}
+
+static void
+foo_create_foo_async_ready (GObject* source_object,
+                            GAsyncResult* _res_,
+                            gpointer _user_data_)
+{
+       FooCreateFooAsyncData* _data_;
+       _data_ = _user_data_;
+       _data_->_source_object_ = source_object;
+       _data_->_res_ = _res_;
+       foo_create_foo_async_co (_data_);
+}
+
+static gboolean
+foo_create_foo_async_co (FooCreateFooAsyncData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               case 1:
+               goto _state_1;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->_state_ = 1;
+       foo_new_async (foo_create_foo_async_ready, _data_);
+       return FALSE;
+       _state_1:
+       _data_->_tmp0_ = foo_new_finish (_data_->_res_);
+       _data_->foo = _data_->_tmp0_;
+       _data_->result = _data_->foo;
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       G_OBJECT_CLASS (klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static void
+foo_finalize (GObject * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       G_OBJECT_CLASS (foo_parent_class)->finalize (obj);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static Block2Data*
+block2_data_ref (Block2Data* _data2_)
+{
+       g_atomic_int_inc (&_data2_->_ref_count_);
+       return _data2_;
+}
+
+static void
+block2_data_unref (void * _userdata_)
+{
+       Block2Data* _data2_;
+       _data2_ = (Block2Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data2_->_ref_count_)) {
+               _g_main_loop_unref0 (_data2_->loop);
+               g_slice_free (Block2Data, _data2_);
+       }
+}
+
+static Block3Data*
+block3_data_ref (Block3Data* _data3_)
+{
+       g_atomic_int_inc (&_data3_->_ref_count_);
+       return _data3_;
+}
+
+static void
+block3_data_unref (void * _userdata_)
+{
+       Block3Data* _data3_;
+       _data3_ = (Block3Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data3_->_ref_count_)) {
+               _g_object_unref0 (_data3_->foo);
+               block2_data_unref (_data3_->_data2_);
+               _data3_->_data2_ = NULL;
+               g_slice_free (Block3Data, _data3_);
+       }
+}
+
+static void
+__lambda6_ (Block3Data* _data3_,
+            GObject* obj,
+            GAsyncResult* res)
+{
+       Block2Data* _data2_;
+       _data2_ = _data3_->_data2_;
+       g_return_if_fail ((obj == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (obj, G_TYPE_OBJECT));
+       g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (res, g_async_result_get_type ()));
+       foo_bar_finish (res);
+       _vala_assert (_data3_->foo->manam == 23, "foo.manam == 23");
+       g_main_loop_quit (_data2_->loop);
+}
+
+static void
+___lambda6__gasync_ready_callback (GObject* source_object,
+                                   GAsyncResult* res,
+                                   gpointer self)
+{
+       __lambda6_ (self, source_object, res);
+       block3_data_unref (self);
+}
+
+static void
+__lambda5_ (Block2Data* _data2_,
+            GObject* obj,
+            GAsyncResult* res)
+{
+       Block3Data* _data3_;
+       Foo* _tmp0_;
+       g_return_if_fail ((obj == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (obj, G_TYPE_OBJECT));
+       g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (res, g_async_result_get_type ()));
+       _data3_ = g_slice_new0 (Block3Data);
+       _data3_->_ref_count_ = 1;
+       _data3_->_data2_ = block2_data_ref (_data2_);
+       _tmp0_ = foo_create_foo_finish (res);
+       _data3_->foo = _tmp0_;
+       _vala_assert (_data3_->foo->manam == 42, "foo.manam == 42");
+       foo_bar (_data3_->foo, ___lambda6__gasync_ready_callback, block3_data_ref (_data3_));
+       block3_data_unref (_data3_);
+       _data3_ = NULL;
+}
+
+static void
+___lambda5__gasync_ready_callback (GObject* source_object,
+                                   GAsyncResult* res,
+                                   gpointer self)
+{
+       __lambda5_ (self, source_object, res);
+       block2_data_unref (self);
+}
+
+static void
+_vala_main (void)
+{
+       Block2Data* _data2_;
+       GMainLoop* _tmp0_;
+       _data2_ = g_slice_new0 (Block2Data);
+       _data2_->_ref_count_ = 1;
+       _tmp0_ = g_main_loop_new (NULL, FALSE);
+       _data2_->loop = _tmp0_;
+       foo_create_foo_async (___lambda5__gasync_ready_callback, block2_data_ref (_data2_));
+       g_main_loop_run (_data2_->loop);
+       block2_data_unref (_data2_);
+       _data2_ = NULL;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/asynchronous/bug741929.c-expected b/tests/asynchronous/bug741929.c-expected
new file mode 100644
index 000000000..7001c73ce
--- /dev/null
+++ b/tests/asynchronous/bug741929.c-expected
@@ -0,0 +1,587 @@
+/* asynchronous_bug741929.c generated by valac, the Vala compiler
+ * generated from asynchronous_bug741929.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gio/gio.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+typedef struct _FooQueryAsyncData FooQueryAsyncData;
+typedef struct _FooInternalQueryAsyncData FooInternalQueryAsyncData;
+typedef struct _FooCloseQueryAsyncData FooCloseQueryAsyncData;
+typedef struct _GoAsyncData GoAsyncData;
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _FooPrivate {
+       gboolean running;
+};
+
+struct _FooQueryAsyncData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Foo* self;
+       gboolean _tmp0_;
+       GError* _inner_error1_;
+       GError* _inner_error0_;
+};
+
+struct _FooInternalQueryAsyncData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Foo* self;
+       gboolean result;
+};
+
+struct _FooCloseQueryAsyncData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Foo* self;
+};
+
+struct _GoAsyncData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Foo* foo;
+       Foo* _tmp0_;
+       GMainLoop* _tmp1_;
+       GError* _inner_error0_;
+};
+
+VALA_EXTERN GMainLoop* loop;
+GMainLoop* loop = NULL;
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_query_async_data_free (gpointer _data);
+VALA_EXTERN void foo_query_async (Foo* self,
+                      GAsyncReadyCallback _callback_,
+                      gpointer _user_data_);
+VALA_EXTERN void foo_query_finish (Foo* self,
+                       GAsyncResult* _res_,
+                       GError** error);
+static gboolean foo_query_async_co (FooQueryAsyncData* _data_);
+static void foo_internal_query_async (Foo* self,
+                               GAsyncReadyCallback _callback_,
+                               gpointer _user_data_);
+static gboolean foo_internal_query_finish (Foo* self,
+                                    GAsyncResult* _res_,
+                                    GError** error);
+static void foo_query_async_ready (GObject* source_object,
+                            GAsyncResult* _res_,
+                            gpointer _user_data_);
+static void foo_close_query_async (Foo* self,
+                            GAsyncReadyCallback _callback_,
+                            gpointer _user_data_);
+static void foo_close_query_finish (Foo* self,
+                             GAsyncResult* _res_,
+                             GError** error);
+static void foo_internal_query_async_data_free (gpointer _data);
+static gboolean foo_internal_query_async_co (FooInternalQueryAsyncData* _data_);
+static void foo_close_query_async_data_free (gpointer _data);
+static gboolean foo_close_query_async_co (FooCloseQueryAsyncData* _data_);
+static void foo_finalize (GObject * obj);
+static GType foo_get_type_once (void);
+static void go_async_data_free (gpointer _data);
+VALA_EXTERN void go_async (GAsyncReadyCallback _callback_,
+               gpointer _user_data_);
+VALA_EXTERN void go_finish (GAsyncResult* _res_);
+static gboolean go_async_co (GoAsyncData* _data_);
+static void go_async_ready (GObject* source_object,
+                     GAsyncResult* _res_,
+                     gpointer _user_data_);
+static void _vala_main (void);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+foo_query_async_data_free (gpointer _data)
+{
+       FooQueryAsyncData* _data_;
+       _data_ = _data;
+       _g_object_unref0 (_data_->self);
+       g_slice_free (FooQueryAsyncData, _data_);
+}
+
+static gpointer
+_g_object_ref0 (gpointer self)
+{
+       return self ? g_object_ref (self) : NULL;
+}
+
+void
+foo_query_async (Foo* self,
+                 GAsyncReadyCallback _callback_,
+                 gpointer _user_data_)
+{
+       FooQueryAsyncData* _data_;
+       Foo* _tmp0_;
+       g_return_if_fail (IS_FOO (self));
+       _data_ = g_slice_new0 (FooQueryAsyncData);
+       _data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, foo_query_async_data_free);
+       _tmp0_ = _g_object_ref0 (self);
+       _data_->self = _tmp0_;
+       foo_query_async_co (_data_);
+}
+
+void
+foo_query_finish (Foo* self,
+                  GAsyncResult* _res_,
+                  GError** error)
+{
+       FooQueryAsyncData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), error);
+       if (NULL == _data_) {
+               return;
+       }
+}
+
+static void
+foo_query_async_ready (GObject* source_object,
+                       GAsyncResult* _res_,
+                       gpointer _user_data_)
+{
+       FooQueryAsyncData* _data_;
+       _data_ = _user_data_;
+       _data_->_source_object_ = source_object;
+       _data_->_res_ = _res_;
+       foo_query_async_co (_data_);
+}
+
+static gboolean
+foo_query_async_co (FooQueryAsyncData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               case 1:
+               goto _state_1;
+               case 2:
+               goto _state_2;
+               case 3:
+               goto _state_3;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->self->priv->running = TRUE;
+       {
+               _data_->_state_ = 1;
+               foo_internal_query_async (_data_->self, foo_query_async_ready, _data_);
+               return FALSE;
+               _state_1:
+               _data_->_tmp0_ = foo_internal_query_finish (_data_->self, _data_->_res_, 
&_data_->_inner_error0_);
+               if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+                       goto __finally0;
+               }
+               if (!_data_->_tmp0_) {
+                       {
+                               {
+                                       _data_->_state_ = 2;
+                                       foo_close_query_async (_data_->self, foo_query_async_ready, _data_);
+                                       return FALSE;
+                                       _state_2:
+                                       foo_close_query_finish (_data_->self, _data_->_res_, 
&_data_->_inner_error0_);
+                                       if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+                                               goto __catch1_g_error;
+                                       }
+                               }
+                               goto __finally1;
+                               __catch1_g_error:
+                               {
+                                       g_clear_error (&_data_->_inner_error0_);
+                               }
+                               __finally1:
+                               if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+                               }
+                               _data_->self->priv->running = FALSE;
+                       }
+                       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+                       if (_data_->_state_ != 0) {
+                               while (!g_task_get_completed (_data_->_async_result)) {
+                                       g_main_context_iteration (g_task_get_context (_data_->_async_result), 
TRUE);
+                               }
+                       }
+                       g_object_unref (_data_->_async_result);
+                       return FALSE;
+               }
+       }
+       __finally0:
+       {
+               {
+                       _data_->_state_ = 3;
+                       foo_close_query_async (_data_->self, foo_query_async_ready, _data_);
+                       return FALSE;
+                       _state_3:
+                       foo_close_query_finish (_data_->self, _data_->_res_, &_data_->_inner_error1_);
+                       if (G_UNLIKELY (_data_->_inner_error1_ != NULL)) {
+                               goto __catch2_g_error;
+                       }
+               }
+               goto __finally2;
+               __catch2_g_error:
+               {
+                       g_clear_error (&_data_->_inner_error1_);
+               }
+               __finally2:
+               if (G_UNLIKELY (_data_->_inner_error1_ != NULL)) {
+                       g_task_return_error (_data_->_async_result, _data_->_inner_error1_);
+                       g_object_unref (_data_->_async_result);
+                       return FALSE;
+               }
+               _data_->self->priv->running = FALSE;
+       }
+       if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+               g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
+               g_object_unref (_data_->_async_result);
+               return FALSE;
+       }
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+foo_internal_query_async_data_free (gpointer _data)
+{
+       FooInternalQueryAsyncData* _data_;
+       _data_ = _data;
+       _g_object_unref0 (_data_->self);
+       g_slice_free (FooInternalQueryAsyncData, _data_);
+}
+
+static void
+foo_internal_query_async (Foo* self,
+                          GAsyncReadyCallback _callback_,
+                          gpointer _user_data_)
+{
+       FooInternalQueryAsyncData* _data_;
+       Foo* _tmp0_;
+       g_return_if_fail (IS_FOO (self));
+       _data_ = g_slice_new0 (FooInternalQueryAsyncData);
+       _data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, foo_internal_query_async_data_free);
+       _tmp0_ = _g_object_ref0 (self);
+       _data_->self = _tmp0_;
+       foo_internal_query_async_co (_data_);
+}
+
+static gboolean
+foo_internal_query_finish (Foo* self,
+                           GAsyncResult* _res_,
+                           GError** error)
+{
+       gboolean result;
+       FooInternalQueryAsyncData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), error);
+       if (NULL == _data_) {
+               gboolean _tmp0_ = FALSE;
+               return _tmp0_;
+       }
+       result = _data_->result;
+       return result;
+}
+
+static gboolean
+foo_internal_query_async_co (FooInternalQueryAsyncData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->result = TRUE;
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+foo_close_query_async_data_free (gpointer _data)
+{
+       FooCloseQueryAsyncData* _data_;
+       _data_ = _data;
+       _g_object_unref0 (_data_->self);
+       g_slice_free (FooCloseQueryAsyncData, _data_);
+}
+
+static void
+foo_close_query_async (Foo* self,
+                       GAsyncReadyCallback _callback_,
+                       gpointer _user_data_)
+{
+       FooCloseQueryAsyncData* _data_;
+       Foo* _tmp0_;
+       g_return_if_fail (IS_FOO (self));
+       _data_ = g_slice_new0 (FooCloseQueryAsyncData);
+       _data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, foo_close_query_async_data_free);
+       _tmp0_ = _g_object_ref0 (self);
+       _data_->self = _tmp0_;
+       foo_close_query_async_co (_data_);
+}
+
+static void
+foo_close_query_finish (Foo* self,
+                        GAsyncResult* _res_,
+                        GError** error)
+{
+       FooCloseQueryAsyncData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), error);
+       if (NULL == _data_) {
+               return;
+       }
+}
+
+static gboolean
+foo_close_query_async_co (FooCloseQueryAsyncData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+       G_OBJECT_CLASS (klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+       self->priv->running = FALSE;
+}
+
+static void
+foo_finalize (GObject * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       G_OBJECT_CLASS (foo_parent_class)->finalize (obj);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+go_async_data_free (gpointer _data)
+{
+       GoAsyncData* _data_;
+       _data_ = _data;
+       g_slice_free (GoAsyncData, _data_);
+}
+
+void
+go_async (GAsyncReadyCallback _callback_,
+          gpointer _user_data_)
+{
+       GoAsyncData* _data_;
+       _data_ = g_slice_new0 (GoAsyncData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, go_async_data_free);
+       go_async_co (_data_);
+}
+
+void
+go_finish (GAsyncResult* _res_)
+{
+       GoAsyncData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static void
+go_async_ready (GObject* source_object,
+                GAsyncResult* _res_,
+                gpointer _user_data_)
+{
+       GoAsyncData* _data_;
+       _data_ = _user_data_;
+       _data_->_source_object_ = source_object;
+       _data_->_res_ = _res_;
+       go_async_co (_data_);
+}
+
+static gboolean
+go_async_co (GoAsyncData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               case 1:
+               goto _state_1;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->_tmp0_ = foo_new ();
+       _data_->foo = _data_->_tmp0_;
+       {
+               _data_->_state_ = 1;
+               foo_query_async (_data_->foo, go_async_ready, _data_);
+               return FALSE;
+               _state_1:
+               foo_query_finish (_data_->foo, _data_->_res_, &_data_->_inner_error0_);
+               if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+                       goto __catch0_g_error;
+               }
+       }
+       goto __finally0;
+       __catch0_g_error:
+       {
+               g_clear_error (&_data_->_inner_error0_);
+       }
+       __finally0:
+       if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+               _g_object_unref0 (_data_->foo);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), 
_data_->_inner_error0_->code);
+               g_clear_error (&_data_->_inner_error0_);
+               g_object_unref (_data_->_async_result);
+               return FALSE;
+       }
+       _data_->_tmp1_ = loop;
+       g_main_loop_quit (_data_->_tmp1_);
+       _g_object_unref0 (_data_->foo);
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+_vala_main (void)
+{
+       GMainLoop* _tmp0_;
+       GMainLoop* _tmp1_;
+       _tmp0_ = g_main_loop_new (NULL, FALSE);
+       _g_main_loop_unref0 (loop);
+       loop = _tmp0_;
+       go_async (NULL, NULL);
+       _tmp1_ = loop;
+       g_main_loop_run (_tmp1_);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/asynchronous/bug742621.c-expected b/tests/asynchronous/bug742621.c-expected
new file mode 100644
index 000000000..5e1ceda92
--- /dev/null
+++ b/tests/asynchronous/bug742621.c-expected
@@ -0,0 +1,298 @@
+/* asynchronous_bug742621.c generated by valac, the Vala compiler
+ * generated from asynchronous_bug742621.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gio/gio.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_XYZZY (xyzzy_get_type ())
+#define XYZZY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_XYZZY, Xyzzy))
+#define XYZZY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_XYZZY, XyzzyClass))
+#define IS_XYZZY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_XYZZY))
+#define IS_XYZZY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_XYZZY))
+#define XYZZY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_XYZZY, XyzzyClass))
+
+typedef struct _Xyzzy Xyzzy;
+typedef struct _XyzzyClass XyzzyClass;
+typedef struct _XyzzyPrivate XyzzyPrivate;
+enum  {
+       XYZZY_0_PROPERTY,
+       XYZZY_B_PROPERTY,
+       XYZZY_NUM_PROPERTIES
+};
+static GParamSpec* xyzzy_properties[XYZZY_NUM_PROPERTIES];
+typedef struct _GoAsyncData GoAsyncData;
+
+struct _Xyzzy {
+       GObject parent_instance;
+       XyzzyPrivate * priv;
+};
+
+struct _XyzzyClass {
+       GObjectClass parent_class;
+};
+
+struct _XyzzyPrivate {
+       gboolean _b;
+};
+
+struct _GoAsyncData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Xyzzy* _tmp0_;
+       guint _tmp1_;
+       GQuark _tmp2_;
+};
+
+static gint Xyzzy_private_offset;
+static gpointer xyzzy_parent_class = NULL;
+VALA_EXTERN Xyzzy* xyzzy;
+Xyzzy* xyzzy = NULL;
+
+VALA_EXTERN GType xyzzy_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Xyzzy, g_object_unref)
+VALA_EXTERN Xyzzy* xyzzy_new (void);
+VALA_EXTERN Xyzzy* xyzzy_construct (GType object_type);
+VALA_EXTERN gboolean xyzzy_get_b (Xyzzy* self);
+VALA_EXTERN void xyzzy_set_b (Xyzzy* self,
+                  gboolean value);
+static void xyzzy_finalize (GObject * obj);
+static GType xyzzy_get_type_once (void);
+static void _vala_xyzzy_get_property (GObject * object,
+                               guint property_id,
+                               GValue * value,
+                               GParamSpec * pspec);
+static void _vala_xyzzy_set_property (GObject * object,
+                               guint property_id,
+                               const GValue * value,
+                               GParamSpec * pspec);
+VALA_EXTERN void on_b (void);
+static void go_async_data_free (gpointer _data);
+VALA_EXTERN void go_async (GAsyncReadyCallback _callback_,
+               gpointer _user_data_);
+VALA_EXTERN void go_finish (GAsyncResult* _res_,
+                GError** error);
+static gboolean go_async_co (GoAsyncData* _data_);
+static void _on_b_g_object_notify (GObject* _sender,
+                            GParamSpec* pspec,
+                            gpointer self);
+static void _vala_main (void);
+
+static inline gpointer
+xyzzy_get_instance_private (Xyzzy* self)
+{
+       return G_STRUCT_MEMBER_P (self, Xyzzy_private_offset);
+}
+
+Xyzzy*
+xyzzy_construct (GType object_type)
+{
+       Xyzzy * self = NULL;
+       self = (Xyzzy*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Xyzzy*
+xyzzy_new (void)
+{
+       return xyzzy_construct (TYPE_XYZZY);
+}
+
+gboolean
+xyzzy_get_b (Xyzzy* self)
+{
+       gboolean result;
+       g_return_val_if_fail (IS_XYZZY (self), FALSE);
+       result = self->priv->_b;
+       return result;
+}
+
+void
+xyzzy_set_b (Xyzzy* self,
+             gboolean value)
+{
+       gboolean old_value;
+       g_return_if_fail (IS_XYZZY (self));
+       old_value = xyzzy_get_b (self);
+       if (old_value != value) {
+               self->priv->_b = value;
+               g_object_notify_by_pspec ((GObject *) self, xyzzy_properties[XYZZY_B_PROPERTY]);
+       }
+}
+
+static void
+xyzzy_class_init (XyzzyClass * klass,
+                  gpointer klass_data)
+{
+       xyzzy_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Xyzzy_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_xyzzy_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_xyzzy_set_property;
+       G_OBJECT_CLASS (klass)->finalize = xyzzy_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), XYZZY_B_PROPERTY, 
xyzzy_properties[XYZZY_B_PROPERTY] = g_param_spec_boolean ("b", "b", "b", FALSE, G_PARAM_STATIC_STRINGS | 
G_PARAM_READABLE | G_PARAM_WRITABLE));
+}
+
+static void
+xyzzy_instance_init (Xyzzy * self,
+                     gpointer klass)
+{
+       self->priv = xyzzy_get_instance_private (self);
+}
+
+static void
+xyzzy_finalize (GObject * obj)
+{
+       Xyzzy * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_XYZZY, Xyzzy);
+       G_OBJECT_CLASS (xyzzy_parent_class)->finalize (obj);
+}
+
+static GType
+xyzzy_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (XyzzyClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) xyzzy_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Xyzzy), 
0, (GInstanceInitFunc) xyzzy_instance_init, NULL };
+       GType xyzzy_type_id;
+       xyzzy_type_id = g_type_register_static (G_TYPE_OBJECT, "Xyzzy", &g_define_type_info, 0);
+       Xyzzy_private_offset = g_type_add_instance_private (xyzzy_type_id, sizeof (XyzzyPrivate));
+       return xyzzy_type_id;
+}
+
+GType
+xyzzy_get_type (void)
+{
+       static volatile gsize xyzzy_type_id__volatile = 0;
+       if (g_once_init_enter (&xyzzy_type_id__volatile)) {
+               GType xyzzy_type_id;
+               xyzzy_type_id = xyzzy_get_type_once ();
+               g_once_init_leave (&xyzzy_type_id__volatile, xyzzy_type_id);
+       }
+       return xyzzy_type_id__volatile;
+}
+
+static void
+_vala_xyzzy_get_property (GObject * object,
+                          guint property_id,
+                          GValue * value,
+                          GParamSpec * pspec)
+{
+       Xyzzy * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_XYZZY, Xyzzy);
+       switch (property_id) {
+               case XYZZY_B_PROPERTY:
+               g_value_set_boolean (value, xyzzy_get_b (self));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_xyzzy_set_property (GObject * object,
+                          guint property_id,
+                          const GValue * value,
+                          GParamSpec * pspec)
+{
+       Xyzzy * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_XYZZY, Xyzzy);
+       switch (property_id) {
+               case XYZZY_B_PROPERTY:
+               xyzzy_set_b (self, g_value_get_boolean (value));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+void
+on_b (void)
+{
+}
+
+static void
+go_async_data_free (gpointer _data)
+{
+       GoAsyncData* _data_;
+       _data_ = _data;
+       g_slice_free (GoAsyncData, _data_);
+}
+
+void
+go_async (GAsyncReadyCallback _callback_,
+          gpointer _user_data_)
+{
+       GoAsyncData* _data_;
+       _data_ = g_slice_new0 (GoAsyncData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, go_async_data_free);
+       go_async_co (_data_);
+}
+
+void
+go_finish (GAsyncResult* _res_,
+           GError** error)
+{
+       GoAsyncData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), error);
+       if (NULL == _data_) {
+               return;
+       }
+}
+
+static void
+_on_b_g_object_notify (GObject* _sender,
+                       GParamSpec* pspec,
+                       gpointer self)
+{
+       on_b ();
+}
+
+static gboolean
+go_async_co (GoAsyncData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->_tmp0_ = xyzzy;
+       g_signal_parse_name ("notify::b", G_TYPE_OBJECT, &_data_->_tmp1_, &_data_->_tmp2_, TRUE);
+       g_signal_handlers_disconnect_matched (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp0_, G_TYPE_OBJECT, 
GObject), G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DETAIL | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, 
_data_->_tmp1_, _data_->_tmp2_, NULL, (GCallback) _on_b_g_object_notify, NULL);
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/asynchronous/bug762819.c-expected b/tests/asynchronous/bug762819.c-expected
new file mode 100644
index 000000000..ecaa4d039
--- /dev/null
+++ b/tests/asynchronous/bug762819.c-expected
@@ -0,0 +1,438 @@
+/* asynchronous_bug762819.c generated by valac, the Vala compiler
+ * generated from asynchronous_bug762819.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+enum  {
+       BAR_0_PROPERTY,
+       BAR_NUM_PROPERTIES
+};
+static GParamSpec* bar_properties[BAR_NUM_PROPERTIES];
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+typedef struct _FooGetStringAsyncData FooGetStringAsyncData;
+typedef struct _Block1Data Block1Data;
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Bar {
+       GObject parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       GObjectClass parent_class;
+       void (*get_string_async) (Bar* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+       gchar** (*get_string_finish) (Bar* self, GAsyncResult* _res_);
+};
+
+struct _Foo {
+       Bar parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       BarClass parent_class;
+};
+
+struct _FooGetStringAsyncData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Foo* self;
+       gchar** result;
+       gchar* _tmp0_;
+       gchar* _tmp1_;
+       gchar** _tmp2_;
+};
+
+struct _Block1Data {
+       int _ref_count_;
+       GMainLoop* loop;
+       Foo* foo;
+};
+
+static gpointer bar_parent_class = NULL;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
+VALA_EXTERN void bar_get_string_async (Bar* self,
+                           GAsyncReadyCallback _callback_,
+                           gpointer _user_data_);
+VALA_EXTERN gchar** bar_get_string_finish (Bar* self,
+                               GAsyncResult* _res_);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static GType bar_get_type_once (void);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+static void foo_real_get_string_async_data_free (gpointer _data);
+static void foo_real_get_string_async (Bar* base,
+                                GAsyncReadyCallback _callback_,
+                                gpointer _user_data_);
+static gboolean foo_real_get_string_async_co (FooGetStringAsyncData* _data_);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static void __lambda4_ (Block1Data* _data1_,
+                 GObject* obj,
+                 GAsyncResult* res);
+static void ___lambda4__gasync_ready_callback (GObject* source_object,
+                                        GAsyncResult* res,
+                                        gpointer self);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+static gssize _vala_array_length (gpointer array);
+
+void
+bar_get_string_async (Bar* self,
+                      GAsyncReadyCallback _callback_,
+                      gpointer _user_data_)
+{
+       BarClass* _klass_;
+       _klass_ = BAR_GET_CLASS (self);
+       if (_klass_->get_string_async) {
+               _klass_->get_string_async (self, _callback_, _user_data_);
+       }
+}
+
+gchar**
+bar_get_string_finish (Bar* self,
+                       GAsyncResult* _res_)
+{
+       BarClass* _klass_;
+       _klass_ = BAR_GET_CLASS (self);
+       if (_klass_->get_string_finish) {
+               return _klass_->get_string_finish (self, _res_);
+       }
+       return NULL;
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar * self = NULL;
+       self = (Bar*) g_object_new (object_type, NULL);
+       return self;
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (G_TYPE_OBJECT, "Bar", &g_define_type_info, 
G_TYPE_FLAG_ABSTRACT);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+foo_real_get_string_async_data_free (gpointer _data)
+{
+       FooGetStringAsyncData* _data_;
+       _data_ = _data;
+       _data_->result = (_vala_array_free (_data_->result, _vala_array_length (_data_->result), 
(GDestroyNotify) g_free), NULL);
+       _g_object_unref0 (_data_->self);
+       g_slice_free (FooGetStringAsyncData, _data_);
+}
+
+static gpointer
+_g_object_ref0 (gpointer self)
+{
+       return self ? g_object_ref (self) : NULL;
+}
+
+static void
+foo_real_get_string_async (Bar* base,
+                           GAsyncReadyCallback _callback_,
+                           gpointer _user_data_)
+{
+       Foo * self;
+       FooGetStringAsyncData* _data_;
+       Foo* _tmp0_;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_FOO, Foo);
+       _data_ = g_slice_new0 (FooGetStringAsyncData);
+       _data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, foo_real_get_string_async_data_free);
+       _tmp0_ = _g_object_ref0 (self);
+       _data_->self = _tmp0_;
+       foo_real_get_string_async_co (_data_);
+}
+
+static gchar**
+foo_get_string_finish (Bar* base,
+                       GAsyncResult* _res_)
+{
+       gchar** result;
+       FooGetStringAsyncData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+       result = _data_->result;
+       _data_->result = NULL;
+       return result;
+}
+
+static gboolean
+foo_real_get_string_async_co (FooGetStringAsyncData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->_tmp0_ = g_strdup ("foo");
+       _data_->_tmp1_ = g_strdup ("bar");
+       _data_->_tmp2_ = g_new0 (gchar*, 2 + 1);
+       _data_->_tmp2_[0] = _data_->_tmp0_;
+       _data_->_tmp2_[1] = _data_->_tmp1_;
+       _data_->result = _data_->_tmp2_;
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) bar_construct (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((BarClass *) klass)->get_string_async = (void (*) (Bar*, GAsyncReadyCallback, gpointer)) 
foo_real_get_string_async;
+       ((BarClass *) klass)->get_string_finish = (gchar** (*) (Bar*, GAsyncResult*)) foo_get_string_finish;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (TYPE_BAR, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               _g_object_unref0 (_data1_->foo);
+               _g_main_loop_unref0 (_data1_->loop);
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static void
+__lambda4_ (Block1Data* _data1_,
+            GObject* obj,
+            GAsyncResult* res)
+{
+       gchar** _result_ = NULL;
+       gchar** _tmp0_;
+       gchar** _tmp1_;
+       gint _result__length1;
+       gint __result__size_;
+       const gchar* _tmp2_;
+       g_return_if_fail ((obj == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (obj, G_TYPE_OBJECT));
+       g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (res, g_async_result_get_type ()));
+       _tmp1_ = _tmp0_ = bar_get_string_finish (G_TYPE_CHECK_INSTANCE_CAST (_data1_->foo, TYPE_BAR, Bar), 
res);
+       _result_ = _tmp1_;
+       _result__length1 = _vala_array_length (_tmp0_);
+       __result__size_ = _result__length1;
+       _vala_assert (_result__length1 == 2, "result.length == 2");
+       _tmp2_ = _result_[1];
+       _vala_assert (g_strcmp0 (_tmp2_, "bar") == 0, "result[1] == \"bar\"");
+       g_main_loop_quit (_data1_->loop);
+       _result_ = (_vala_array_free (_result_, _result__length1, (GDestroyNotify) g_free), NULL);
+}
+
+static void
+___lambda4__gasync_ready_callback (GObject* source_object,
+                                   GAsyncResult* res,
+                                   gpointer self)
+{
+       __lambda4_ (self, source_object, res);
+       block1_data_unref (self);
+}
+
+static void
+_vala_main (void)
+{
+       Block1Data* _data1_;
+       GMainLoop* _tmp0_;
+       Foo* _tmp1_;
+       _data1_ = g_slice_new0 (Block1Data);
+       _data1_->_ref_count_ = 1;
+       _tmp0_ = g_main_loop_new (NULL, FALSE);
+       _data1_->loop = _tmp0_;
+       _tmp1_ = foo_new ();
+       _data1_->foo = _tmp1_;
+       bar_get_string_async (G_TYPE_CHECK_INSTANCE_CAST (_data1_->foo, TYPE_BAR, Bar), 
___lambda4__gasync_ready_callback, block1_data_ref (_data1_));
+       g_main_loop_run (_data1_->loop);
+       block1_data_unref (_data1_);
+       _data1_ = NULL;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
+static gssize
+_vala_array_length (gpointer array)
+{
+       gssize length;
+       length = 0;
+       if (array) {
+               while (((gpointer*) array)[length]) {
+                       length++;
+               }
+       }
+       return length;
+}
+
diff --git a/tests/asynchronous/bug777242.c-expected b/tests/asynchronous/bug777242.c-expected
new file mode 100644
index 000000000..8579446a8
--- /dev/null
+++ b/tests/asynchronous/bug777242.c-expected
@@ -0,0 +1,170 @@
+/* asynchronous_bug777242.c generated by valac, the Vala compiler
+ * generated from asynchronous_bug777242.vala, do not modify */
+
+#include <glib.h>
+#include <gio/gio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+typedef struct _RunData RunData;
+typedef struct _Block1Data Block1Data;
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+
+struct _RunData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       gchar* foo;
+       gchar* _tmp0_;
+       gint _tmp1_;
+};
+
+struct _Block1Data {
+       int _ref_count_;
+       GMainLoop* loop;
+};
+
+VALA_EXTERN gint i;
+gint i = 0;
+
+static void run_data_free (gpointer _data);
+VALA_EXTERN void run (GAsyncReadyCallback _callback_,
+          gpointer _user_data_);
+VALA_EXTERN void run_finish (GAsyncResult* _res_);
+static gboolean run_co (RunData* _data_);
+static void _vala_main (void);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static gboolean __lambda4_ (Block1Data* _data1_);
+static gboolean ___lambda4__gsource_func (gpointer self);
+
+static void
+run_data_free (gpointer _data)
+{
+       RunData* _data_;
+       _data_ = _data;
+       g_slice_free (RunData, _data_);
+}
+
+void
+run (GAsyncReadyCallback _callback_,
+     gpointer _user_data_)
+{
+       RunData* _data_;
+       _data_ = g_slice_new0 (RunData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, run_data_free);
+       run_co (_data_);
+}
+
+void
+run_finish (GAsyncResult* _res_)
+{
+       RunData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static gboolean
+run_co (RunData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       while (TRUE) {
+               if (i == 0) {
+                       _data_->_tmp0_ = g_strdup ("foo");
+                       _g_free0 (_data_->foo);
+                       _data_->foo = _data_->_tmp0_;
+                       _data_->_tmp1_ = i;
+                       i = _data_->_tmp1_ + 1;
+               } else {
+                       _g_free0 (_data_->foo);
+                       break;
+               }
+               _g_free0 (_data_->foo);
+       }
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               _g_main_loop_unref0 (_data1_->loop);
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static gboolean
+__lambda4_ (Block1Data* _data1_)
+{
+       gboolean result = FALSE;
+       run (NULL, NULL);
+       g_main_loop_quit (_data1_->loop);
+       result = FALSE;
+       return result;
+}
+
+static gboolean
+___lambda4__gsource_func (gpointer self)
+{
+       gboolean result;
+       result = __lambda4_ (self);
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       Block1Data* _data1_;
+       GMainLoop* _tmp0_;
+       _data1_ = g_slice_new0 (Block1Data);
+       _data1_->_ref_count_ = 1;
+       _tmp0_ = g_main_loop_new (NULL, FALSE);
+       _data1_->loop = _tmp0_;
+       g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, ___lambda4__gsource_func, block1_data_ref (_data1_), 
block1_data_unref);
+       g_main_loop_run (_data1_->loop);
+       block1_data_unref (_data1_);
+       _data1_ = NULL;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/asynchronous/bug783543.c-expected b/tests/asynchronous/bug783543.c-expected
new file mode 100644
index 000000000..12532c48e
--- /dev/null
+++ b/tests/asynchronous/bug783543.c-expected
@@ -0,0 +1,265 @@
+/* asynchronous_bug783543.c generated by valac, the Vala compiler
+ * generated from asynchronous_bug783543.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+typedef struct _FooBarData FooBarData;
+typedef struct _Block1Data Block1Data;
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _FooBarData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Foo* self;
+};
+
+struct _Block1Data {
+       int _ref_count_;
+       GMainLoop* loop;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+static void foo_bar_data_free (gpointer _data);
+VALA_EXTERN void foo_bar (Foo* self,
+              GAsyncReadyCallback _callback_,
+              gpointer _user_data_);
+VALA_EXTERN void foo_bar_finish (Foo* self,
+                     GAsyncResult* _res_);
+static gboolean foo_bar_co (FooBarData* _data_);
+static gboolean _foo_bar_co_gsource_func (gpointer self);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static void __lambda4_ (Block1Data* _data1_);
+static void ___lambda4__gasync_ready_callback (GObject* source_object,
+                                        GAsyncResult* res,
+                                        gpointer self);
+
+static void
+foo_bar_data_free (gpointer _data)
+{
+       FooBarData* _data_;
+       _data_ = _data;
+       _g_object_unref0 (_data_->self);
+       g_slice_free (FooBarData, _data_);
+}
+
+static gpointer
+_g_object_ref0 (gpointer self)
+{
+       return self ? g_object_ref (self) : NULL;
+}
+
+void
+foo_bar (Foo* self,
+         GAsyncReadyCallback _callback_,
+         gpointer _user_data_)
+{
+       FooBarData* _data_;
+       Foo* _tmp0_;
+       g_return_if_fail (IS_FOO (self));
+       _data_ = g_slice_new0 (FooBarData);
+       _data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, foo_bar_data_free);
+       _tmp0_ = _g_object_ref0 (self);
+       _data_->self = _tmp0_;
+       foo_bar_co (_data_);
+}
+
+void
+foo_bar_finish (Foo* self,
+                GAsyncResult* _res_)
+{
+       FooBarData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static gboolean
+_foo_bar_co_gsource_func (gpointer self)
+{
+       gboolean result;
+       result = foo_bar_co (self);
+       return result;
+}
+
+static gboolean
+foo_bar_co (FooBarData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               case 1:
+               goto _state_1;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _foo_bar_co_gsource_func, _data_, NULL);
+       _data_->_state_ = 1;
+       return FALSE;
+       _state_1:
+       ;
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               _g_main_loop_unref0 (_data1_->loop);
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static void
+__lambda4_ (Block1Data* _data1_)
+{
+       g_main_loop_quit (_data1_->loop);
+}
+
+static void
+___lambda4__gasync_ready_callback (GObject* source_object,
+                                   GAsyncResult* res,
+                                   gpointer self)
+{
+       __lambda4_ (self);
+       block1_data_unref (self);
+}
+
+static void
+_vala_main (void)
+{
+       Block1Data* _data1_;
+       GMainLoop* _tmp0_;
+       Foo* foo = NULL;
+       Foo* _tmp1_;
+       _data1_ = g_slice_new0 (Block1Data);
+       _data1_->_ref_count_ = 1;
+       _tmp0_ = g_main_loop_new (NULL, FALSE);
+       _data1_->loop = _tmp0_;
+       _tmp1_ = foo_new ();
+       foo = _tmp1_;
+       foo_bar (foo, ___lambda4__gasync_ready_callback, block1_data_ref (_data1_));
+       g_main_loop_run (_data1_->loop);
+       _g_object_unref0 (foo);
+       block1_data_unref (_data1_);
+       _data1_ = NULL;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/asynchronous/bug792660.c-expected b/tests/asynchronous/bug792660.c-expected
new file mode 100644
index 000000000..1e7675af0
--- /dev/null
+++ b/tests/asynchronous/bug792660.c-expected
@@ -0,0 +1,537 @@
+/* asynchronous_bug792660.c generated by valac, the Vala compiler
+ * generated from asynchronous_bug792660.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+typedef struct _BarFooData BarFooData;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+       void (*foo) (Foo* self, gchar** a, gint i, GAsyncReadyCallback _callback_, gpointer _user_data_);
+       void (*foo_finish) (Foo* self, GAsyncResult* _res_);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+struct _Bar {
+       Foo parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       FooClass parent_class;
+};
+
+struct _BarFooData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Bar* self;
+       gchar** a;
+       gint i;
+};
+
+static gpointer foo_parent_class = NULL;
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN void foo_foo (Foo* self,
+              gchar** a,
+              gint i,
+              GAsyncReadyCallback _callback_,
+              gpointer _user_data_);
+VALA_EXTERN void foo_foo_finish (Foo* self,
+                     GAsyncResult* _res_);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, foo_unref)
+static void bar_real_foo_data_free (gpointer _data);
+static void bar_real_foo (Foo* base,
+                   gchar** a,
+                   gint i,
+                   GAsyncReadyCallback _callback_,
+                   gpointer _user_data_);
+static gboolean bar_real_foo_co (BarFooData* _data_);
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static GType bar_get_type_once (void);
+static void _vala_main (void);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+void
+foo_foo (Foo* self,
+         gchar** a,
+         gint i,
+         GAsyncReadyCallback _callback_,
+         gpointer _user_data_)
+{
+       FooClass* _klass_;
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->foo) {
+               _klass_->foo (self, a, i, _callback_, _user_data_);
+       }
+}
+
+void
+foo_foo_finish (Foo* self,
+                GAsyncResult* _res_)
+{
+       FooClass* _klass_;
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->foo_finish) {
+               _klass_->foo_finish (self, _res_);
+       }
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, G_TYPE_FLAG_ABSTRACT);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+bar_real_foo_data_free (gpointer _data)
+{
+       BarFooData* _data_;
+       _data_ = _data;
+       _foo_unref0 (_data_->self);
+       g_slice_free (BarFooData, _data_);
+}
+
+static gpointer
+_foo_ref0 (gpointer self)
+{
+       return self ? foo_ref (self) : NULL;
+}
+
+static void
+bar_real_foo (Foo* base,
+              gchar** a,
+              gint i,
+              GAsyncReadyCallback _callback_,
+              gpointer _user_data_)
+{
+       Bar * self;
+       BarFooData* _data_;
+       Bar* _tmp0_;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAR, Bar);
+       _data_ = g_slice_new0 (BarFooData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, bar_real_foo_data_free);
+       _tmp0_ = _foo_ref0 (self);
+       _data_->self = _tmp0_;
+       _data_->a = a;
+       _data_->i = i;
+       bar_real_foo_co (_data_);
+}
+
+static void
+bar_foo_finish (Foo* base,
+                GAsyncResult* _res_)
+{
+       BarFooData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static gboolean
+bar_real_foo_co (BarFooData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _vala_assert (_data_->i == 42, "i == 42");
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar* self = NULL;
+       self = (Bar*) foo_construct (object_type);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->foo = (void (*) (Foo*, gchar**, gint, GAsyncReadyCallback, gpointer)) 
bar_real_foo;
+       ((FooClass *) klass)->foo_finish = (void (*) (Foo*, GAsyncResult*)) bar_foo_finish;
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (TYPE_FOO, "Bar", &g_define_type_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       gchar** a = NULL;
+       gchar* _tmp0_;
+       gchar* _tmp1_;
+       gchar** _tmp2_;
+       gint a_length1;
+       gint _a_size_;
+       Bar* bar = NULL;
+       Bar* _tmp3_;
+       _tmp0_ = g_strdup ("foo");
+       _tmp1_ = g_strdup ("bar");
+       _tmp2_ = g_new0 (gchar*, 2 + 1);
+       _tmp2_[0] = _tmp0_;
+       _tmp2_[1] = _tmp1_;
+       a = _tmp2_;
+       a_length1 = 2;
+       _a_size_ = a_length1;
+       _tmp3_ = bar_new ();
+       bar = _tmp3_;
+       foo_foo (G_TYPE_CHECK_INSTANCE_CAST (bar, TYPE_FOO, Foo), a, 42, NULL, NULL);
+       _foo_unref0 (bar);
+       a = (_vala_array_free (a, a_length1, (GDestroyNotify) g_free), NULL);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/asynchronous/bug792942.c-expected b/tests/asynchronous/bug792942.c-expected
new file mode 100644
index 000000000..23a053bd8
--- /dev/null
+++ b/tests/asynchronous/bug792942.c-expected
@@ -0,0 +1,476 @@
+/* asynchronous_bug792942.c generated by valac, the Vala compiler
+ * generated from asynchronous_bug792942.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+typedef struct _FooNewData FooNewData;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+typedef struct _RunData RunData;
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _FooNewData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       GType object_type;
+       Foo* self;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+struct _RunData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Foo* foo;
+       Foo* _tmp0_;
+       GError* _inner_error0_;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+static void foo_construct_data_free (gpointer _data);
+VALA_EXTERN void foo_new (GAsyncReadyCallback _callback_,
+              gpointer _user_data_);
+VALA_EXTERN Foo* foo_new_finish (GAsyncResult* _res_,
+                     GError** error);
+VALA_EXTERN void foo_construct (GType object_type,
+                    GAsyncReadyCallback _callback_,
+                    gpointer _user_data_);
+VALA_EXTERN Foo* foo_construct_finish (GAsyncResult* _res_,
+                           GError** error);
+static gboolean foo_construct_co (FooNewData* _data_);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void run_data_free (gpointer _data);
+VALA_EXTERN void run (GAsyncReadyCallback _callback_,
+          gpointer _user_data_);
+VALA_EXTERN void run_finish (GAsyncResult* _res_);
+static gboolean run_co (RunData* _data_);
+static void run_ready (GObject* source_object,
+                GAsyncResult* _res_,
+                gpointer _user_data_);
+static void _vala_main (void);
+
+static void
+foo_construct_data_free (gpointer _data)
+{
+       FooNewData* _data_;
+       _data_ = _data;
+       _foo_unref0 (_data_->self);
+       g_slice_free (FooNewData, _data_);
+}
+
+void
+foo_construct (GType object_type,
+               GAsyncReadyCallback _callback_,
+               gpointer _user_data_)
+{
+       FooNewData* _data_;
+       _data_ = g_slice_new0 (FooNewData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, foo_construct_data_free);
+       _data_->object_type = object_type;
+       foo_construct_co (_data_);
+}
+
+Foo*
+foo_construct_finish (GAsyncResult* _res_,
+                      GError** error)
+{
+       Foo* result;
+       FooNewData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), error);
+       if (NULL == _data_) {
+               return NULL;
+       }
+       result = _data_->self;
+       _data_->self = NULL;
+       return result;
+}
+
+static gboolean
+foo_construct_co (FooNewData* _data_)
+{
+       Foo* self = NULL;
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->self = (Foo*) g_type_create_instance (_data_->object_type);
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+void
+foo_new (GAsyncReadyCallback _callback_,
+         gpointer _user_data_)
+{
+       foo_construct (TYPE_FOO, _callback_, _user_data_);
+}
+
+Foo*
+foo_new_finish (GAsyncResult* _res_,
+                GError** error)
+{
+       return foo_construct_finish (_res_, error);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+run_data_free (gpointer _data)
+{
+       RunData* _data_;
+       _data_ = _data;
+       g_slice_free (RunData, _data_);
+}
+
+void
+run (GAsyncReadyCallback _callback_,
+     gpointer _user_data_)
+{
+       RunData* _data_;
+       _data_ = g_slice_new0 (RunData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, run_data_free);
+       run_co (_data_);
+}
+
+void
+run_finish (GAsyncResult* _res_)
+{
+       RunData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static void
+run_ready (GObject* source_object,
+           GAsyncResult* _res_,
+           gpointer _user_data_)
+{
+       RunData* _data_;
+       _data_ = _user_data_;
+       _data_->_source_object_ = source_object;
+       _data_->_res_ = _res_;
+       run_co (_data_);
+}
+
+static gboolean
+run_co (RunData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               case 1:
+               goto _state_1;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       {
+               _data_->_state_ = 1;
+               foo_new (run_ready, _data_);
+               return FALSE;
+               _state_1:
+               _data_->_tmp0_ = foo_new_finish (_data_->_res_, &_data_->_inner_error0_);
+               _data_->foo = _data_->_tmp0_;
+               if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+                       goto __catch0_g_error;
+               }
+               _foo_unref0 (_data_->foo);
+       }
+       goto __finally0;
+       __catch0_g_error:
+       {
+               g_clear_error (&_data_->_inner_error0_);
+       }
+       __finally0:
+       if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), 
_data_->_inner_error0_->code);
+               g_clear_error (&_data_->_inner_error0_);
+               g_object_unref (_data_->_async_result);
+               return FALSE;
+       }
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+_vala_main (void)
+{
+       run (NULL, NULL);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/asynchronous/bug793158.c-expected b/tests/asynchronous/bug793158.c-expected
new file mode 100644
index 000000000..53f775245
--- /dev/null
+++ b/tests/asynchronous/bug793158.c-expected
@@ -0,0 +1,250 @@
+/* asynchronous_bug793158.c generated by valac, the Vala compiler
+ * generated from asynchronous_bug793158.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gio/gio.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+typedef struct _FooBarData FooBarData;
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+
+typedef enum  {
+       FOO_ERROR_BAR
+} FooError;
+#define FOO_ERROR foo_error_quark ()
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _FooBarData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Foo* self;
+       gboolean result;
+};
+
+static gpointer foo_parent_class = NULL;
+VALA_EXTERN GMainLoop* loop;
+GMainLoop* loop = NULL;
+
+VALA_EXTERN GQuark foo_error_quark (void);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+static void foo_bar_data_free (gpointer _data);
+VALA_EXTERN void foo_bar (Foo* self,
+              GAsyncReadyCallback _callback_,
+              gpointer _user_data_);
+VALA_EXTERN gboolean foo_bar_finish (Foo* self,
+                         GAsyncResult* _res_,
+                         GError** error);
+static gboolean foo_bar_co (FooBarData* _data_);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+static void __lambda4_ (GObject* o,
+                 GAsyncResult* r);
+static void ___lambda4__gasync_ready_callback (GObject* source_object,
+                                        GAsyncResult* res,
+                                        gpointer self);
+
+GQuark
+foo_error_quark (void)
+{
+       return g_quark_from_static_string ("foo-error-quark");
+}
+
+static void
+foo_bar_data_free (gpointer _data)
+{
+       FooBarData* _data_;
+       _data_ = _data;
+       _g_object_unref0 (_data_->self);
+       g_slice_free (FooBarData, _data_);
+}
+
+static gpointer
+_g_object_ref0 (gpointer self)
+{
+       return self ? g_object_ref (self) : NULL;
+}
+
+void
+foo_bar (Foo* self,
+         GAsyncReadyCallback _callback_,
+         gpointer _user_data_)
+{
+       FooBarData* _data_;
+       Foo* _tmp0_;
+       g_return_if_fail (IS_FOO (self));
+       _data_ = g_slice_new0 (FooBarData);
+       _data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, foo_bar_data_free);
+       _tmp0_ = _g_object_ref0 (self);
+       _data_->self = _tmp0_;
+       foo_bar_co (_data_);
+}
+
+gboolean
+foo_bar_finish (Foo* self,
+                GAsyncResult* _res_,
+                GError** error)
+{
+       gboolean result;
+       FooBarData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), error);
+       if (NULL == _data_) {
+               gboolean _tmp0_ = FALSE;
+               return _tmp0_;
+       }
+       result = _data_->result;
+       return result;
+}
+
+static gboolean
+foo_bar_co (FooBarData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->result = TRUE;
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+__lambda4_ (GObject* o,
+            GAsyncResult* r)
+{
+       GMainLoop* _tmp0_;
+       g_return_if_fail ((o == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (o, G_TYPE_OBJECT));
+       g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (r, g_async_result_get_type ()));
+       _tmp0_ = loop;
+       g_main_loop_quit (_tmp0_);
+}
+
+static void
+___lambda4__gasync_ready_callback (GObject* source_object,
+                                   GAsyncResult* res,
+                                   gpointer self)
+{
+       __lambda4_ (source_object, res);
+}
+
+static void
+_vala_main (void)
+{
+       GMainLoop* _tmp0_;
+       Foo* foo = NULL;
+       Foo* _tmp1_;
+       GMainLoop* _tmp2_;
+       _tmp0_ = g_main_loop_new (NULL, FALSE);
+       _g_main_loop_unref0 (loop);
+       loop = _tmp0_;
+       _tmp1_ = foo_new ();
+       foo = _tmp1_;
+       foo_bar (foo, ___lambda4__gasync_ready_callback, NULL);
+       _tmp2_ = loop;
+       g_main_loop_run (_tmp2_);
+       _g_object_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/asynchronous/captured-fixed-array.c-expected 
b/tests/asynchronous/captured-fixed-array.c-expected
new file mode 100644
index 000000000..8f153f064
--- /dev/null
+++ b/tests/asynchronous/captured-fixed-array.c-expected
@@ -0,0 +1,121 @@
+/* asynchronous_captured_fixed_array.c generated by valac, the Vala compiler
+ * generated from asynchronous_captured_fixed_array.vala, do not modify */
+
+#include <gio/gio.h>
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef struct _FooData FooData;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _FooData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       gint array_param[3];
+       gint array[2];
+       gint _tmp0_[2];
+       gint _tmp1_;
+       gint _tmp2_;
+};
+
+static void foo_data_free (gpointer _data);
+VALA_EXTERN void foo (gint* array_param,
+          GAsyncReadyCallback _callback_,
+          gpointer _user_data_);
+VALA_EXTERN void foo_finish (GAsyncResult* _res_);
+static gboolean foo_co (FooData* _data_);
+static void _vala_main (void);
+
+static void
+foo_data_free (gpointer _data)
+{
+       FooData* _data_;
+       _data_ = _data;
+       g_slice_free (FooData, _data_);
+}
+
+void
+foo (gint* array_param,
+     GAsyncReadyCallback _callback_,
+     gpointer _user_data_)
+{
+       FooData* _data_;
+       _data_ = g_slice_new0 (FooData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, foo_data_free);
+       memcpy (_data_->array_param, array_param, 3 * sizeof (gint));
+       foo_co (_data_);
+}
+
+void
+foo_finish (GAsyncResult* _res_)
+{
+       FooData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static gboolean
+foo_co (FooData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       memset (&_data_->_tmp0_, 0, 2 * sizeof (gint));
+       _data_->_tmp0_[0] = 23;
+       _data_->_tmp0_[1] = 42;
+       memcpy (_data_->array, _data_->_tmp0_, 2 * sizeof (gint));
+       _vala_assert (2 == 2, "array.length == 2");
+       _data_->_tmp1_ = _data_->array[1];
+       _vala_assert (_data_->_tmp1_ == 42, "array[1] == 42");
+       _vala_assert (3 == 3, "array_param.length == 3");
+       _data_->_tmp2_ = _data_->array_param[2];
+       _vala_assert (_data_->_tmp2_ == 4711, "array_param[2] == 4711");
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+_vala_main (void)
+{
+       gint array[3] = {0};
+       gint _tmp0_[3] = {0};
+       _tmp0_[0] = 42;
+       _tmp0_[1] = 23;
+       _tmp0_[2] = 4711;
+       memcpy (array, _tmp0_, 3 * sizeof (gint));
+       foo (array, NULL, NULL);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/asynchronous/catch-error-scope.c-expected b/tests/asynchronous/catch-error-scope.c-expected
new file mode 100644
index 000000000..77d20d30b
--- /dev/null
+++ b/tests/asynchronous/catch-error-scope.c-expected
@@ -0,0 +1,222 @@
+/* asynchronous_catch_error_scope.c generated by valac, the Vala compiler
+ * generated from asynchronous_catch_error_scope.vala, do not modify */
+
+#include <glib.h>
+#include <gio/gio.h>
+#include <glib-object.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
+typedef struct _FooData FooData;
+typedef struct _Block1Data Block1Data;
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+typedef enum  {
+       FOO_ERROR_FAIL
+} FooError;
+#define FOO_ERROR foo_error_quark ()
+struct _FooData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       GError* _tmp0_;
+       GError* e;
+       const gchar* _tmp1_;
+       GError* _tmp2_;
+       GError* _vala1_e;
+       const gchar* _tmp3_;
+       GError* _inner_error0_;
+};
+
+struct _Block1Data {
+       int _ref_count_;
+       GMainLoop* loop;
+};
+
+VALA_EXTERN GQuark foo_error_quark (void);
+static void foo_data_free (gpointer _data);
+VALA_EXTERN void foo (GAsyncReadyCallback _callback_,
+          gpointer _user_data_);
+VALA_EXTERN void foo_finish (GAsyncResult* _res_);
+static gboolean foo_co (FooData* _data_);
+static void _vala_main (void);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static void __lambda4_ (Block1Data* _data1_,
+                 GObject* o,
+                 GAsyncResult* res);
+static void ___lambda4__gasync_ready_callback (GObject* source_object,
+                                        GAsyncResult* res,
+                                        gpointer self);
+
+GQuark
+foo_error_quark (void)
+{
+       return g_quark_from_static_string ("foo-error-quark");
+}
+
+static void
+foo_data_free (gpointer _data)
+{
+       FooData* _data_;
+       _data_ = _data;
+       g_slice_free (FooData, _data_);
+}
+
+void
+foo (GAsyncReadyCallback _callback_,
+     gpointer _user_data_)
+{
+       FooData* _data_;
+       _data_ = g_slice_new0 (FooData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, foo_data_free);
+       foo_co (_data_);
+}
+
+void
+foo_finish (GAsyncResult* _res_)
+{
+       FooData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static gboolean
+foo_co (FooData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       {
+               _data_->_tmp0_ = g_error_new_literal (FOO_ERROR, FOO_ERROR_FAIL, "Foo");
+               _data_->_inner_error0_ = _data_->_tmp0_;
+               goto __catch0_g_error;
+       }
+       goto __finally0;
+       __catch0_g_error:
+       {
+               _data_->e = _data_->_inner_error0_;
+               _data_->_inner_error0_ = NULL;
+               _vala_assert (_data_->e->domain == FOO_ERROR, "e is FooError");
+               _data_->_tmp1_ = _data_->e->message;
+               _vala_assert (g_strcmp0 (_data_->_tmp1_, "Foo") == 0, "e.message == \"Foo\"");
+               _g_error_free0 (_data_->e);
+       }
+       __finally0:
+       if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), 
_data_->_inner_error0_->code);
+               g_clear_error (&_data_->_inner_error0_);
+               g_object_unref (_data_->_async_result);
+               return FALSE;
+       }
+       {
+               _data_->_tmp2_ = g_error_new_literal (FOO_ERROR, FOO_ERROR_FAIL, "Bar");
+               _data_->_inner_error0_ = _data_->_tmp2_;
+               goto __catch1_g_error;
+       }
+       goto __finally1;
+       __catch1_g_error:
+       {
+               _data_->_vala1_e = _data_->_inner_error0_;
+               _data_->_inner_error0_ = NULL;
+               _vala_assert (_data_->_vala1_e->domain == FOO_ERROR, "e is FooError");
+               _data_->_tmp3_ = _data_->_vala1_e->message;
+               _vala_assert (g_strcmp0 (_data_->_tmp3_, "Bar") == 0, "e.message == \"Bar\"");
+               _g_error_free0 (_data_->_vala1_e);
+       }
+       __finally1:
+       if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), 
_data_->_inner_error0_->code);
+               g_clear_error (&_data_->_inner_error0_);
+               g_object_unref (_data_->_async_result);
+               return FALSE;
+       }
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               _g_main_loop_unref0 (_data1_->loop);
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static void
+__lambda4_ (Block1Data* _data1_,
+            GObject* o,
+            GAsyncResult* res)
+{
+       g_return_if_fail ((o == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (o, G_TYPE_OBJECT));
+       g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (res, g_async_result_get_type ()));
+       foo_finish (res);
+       g_main_loop_quit (_data1_->loop);
+}
+
+static void
+___lambda4__gasync_ready_callback (GObject* source_object,
+                                   GAsyncResult* res,
+                                   gpointer self)
+{
+       __lambda4_ (self, source_object, res);
+       block1_data_unref (self);
+}
+
+static void
+_vala_main (void)
+{
+       Block1Data* _data1_;
+       GMainLoop* _tmp0_;
+       _data1_ = g_slice_new0 (Block1Data);
+       _data1_->_ref_count_ = 1;
+       _tmp0_ = g_main_loop_new (NULL, FALSE);
+       _data1_->loop = _tmp0_;
+       foo (___lambda4__gasync_ready_callback, block1_data_ref (_data1_));
+       g_main_loop_run (_data1_->loop);
+       block1_data_unref (_data1_);
+       _data1_ = NULL;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/asynchronous/catch-in-finally.c-expected b/tests/asynchronous/catch-in-finally.c-expected
new file mode 100644
index 000000000..3364392a0
--- /dev/null
+++ b/tests/asynchronous/catch-in-finally.c-expected
@@ -0,0 +1,714 @@
+/* asynchronous_catch_in_finally.c generated by valac, the Vala compiler
+ * generated from asynchronous_catch_in_finally.vala, do not modify */
+
+#include <glib.h>
+#include <gio/gio.h>
+#include <glib-object.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef struct _FailData FailData;
+typedef struct _MayFailData MayFailData;
+typedef struct _FooData FooData;
+typedef struct _BarData BarData;
+#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
+typedef struct _RunData RunData;
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+typedef enum  {
+       FOO_ERROR_FAIL
+} FooError;
+#define FOO_ERROR foo_error_quark ()
+struct _FailData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       GError* _tmp0_;
+       GError* _inner_error0_;
+};
+
+struct _MayFailData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+};
+
+struct _FooData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       GError* _inner_error1_;
+       GError* _inner_error0_;
+};
+
+struct _BarData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       GError* _inner_error1_;
+       GError* _inner_error0_;
+};
+
+struct _RunData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+};
+
+VALA_EXTERN GMainLoop* loop;
+GMainLoop* loop = NULL;
+
+VALA_EXTERN GQuark foo_error_quark (void);
+static void fail_data_free (gpointer _data);
+VALA_EXTERN void fail (GAsyncReadyCallback _callback_,
+           gpointer _user_data_);
+VALA_EXTERN void fail_finish (GAsyncResult* _res_,
+                  GError** error);
+static gboolean fail_co (FailData* _data_);
+static void may_fail_data_free (gpointer _data);
+VALA_EXTERN void may_fail (GAsyncReadyCallback _callback_,
+               gpointer _user_data_);
+VALA_EXTERN void may_fail_finish (GAsyncResult* _res_,
+                      GError** error);
+static gboolean may_fail_co (MayFailData* _data_);
+static void foo_data_free (gpointer _data);
+VALA_EXTERN void foo (GAsyncReadyCallback _callback_,
+          gpointer _user_data_);
+VALA_EXTERN void foo_finish (GAsyncResult* _res_,
+                 GError** error);
+static gboolean foo_co (FooData* _data_);
+static void foo_ready (GObject* source_object,
+                GAsyncResult* _res_,
+                gpointer _user_data_);
+static void bar_data_free (gpointer _data);
+VALA_EXTERN void bar (GAsyncReadyCallback _callback_,
+          gpointer _user_data_);
+VALA_EXTERN void bar_finish (GAsyncResult* _res_,
+                 GError** error);
+static gboolean bar_co (BarData* _data_);
+static void bar_ready (GObject* source_object,
+                GAsyncResult* _res_,
+                gpointer _user_data_);
+static void run_data_free (gpointer _data);
+VALA_EXTERN void run (GAsyncReadyCallback _callback_,
+          gpointer _user_data_);
+VALA_EXTERN void run_finish (GAsyncResult* _res_);
+static gboolean run_co (RunData* _data_);
+static void __lambda4_ (GObject* o,
+                 GAsyncResult* r);
+static void ___lambda4__gasync_ready_callback (GObject* source_object,
+                                        GAsyncResult* res,
+                                        gpointer self);
+static void __lambda5_ (GObject* o,
+                 GAsyncResult* r);
+static void ___lambda5__gasync_ready_callback (GObject* source_object,
+                                        GAsyncResult* res,
+                                        gpointer self);
+static void _vala_main (void);
+
+GQuark
+foo_error_quark (void)
+{
+       return g_quark_from_static_string ("foo-error-quark");
+}
+
+static void
+fail_data_free (gpointer _data)
+{
+       FailData* _data_;
+       _data_ = _data;
+       g_slice_free (FailData, _data_);
+}
+
+void
+fail (GAsyncReadyCallback _callback_,
+      gpointer _user_data_)
+{
+       FailData* _data_;
+       _data_ = g_slice_new0 (FailData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, fail_data_free);
+       fail_co (_data_);
+}
+
+void
+fail_finish (GAsyncResult* _res_,
+             GError** error)
+{
+       FailData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), error);
+       if (NULL == _data_) {
+               return;
+       }
+}
+
+static gboolean
+fail_co (FailData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->_tmp0_ = g_error_new_literal (FOO_ERROR, FOO_ERROR_FAIL, "fail");
+       _data_->_inner_error0_ = _data_->_tmp0_;
+       if (_data_->_inner_error0_->domain == FOO_ERROR) {
+               g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
+               g_object_unref (_data_->_async_result);
+               return FALSE;
+       } else {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), 
_data_->_inner_error0_->code);
+               g_clear_error (&_data_->_inner_error0_);
+               g_object_unref (_data_->_async_result);
+               return FALSE;
+       }
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+may_fail_data_free (gpointer _data)
+{
+       MayFailData* _data_;
+       _data_ = _data;
+       g_slice_free (MayFailData, _data_);
+}
+
+void
+may_fail (GAsyncReadyCallback _callback_,
+          gpointer _user_data_)
+{
+       MayFailData* _data_;
+       _data_ = g_slice_new0 (MayFailData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, may_fail_data_free);
+       may_fail_co (_data_);
+}
+
+void
+may_fail_finish (GAsyncResult* _res_,
+                 GError** error)
+{
+       MayFailData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), error);
+       if (NULL == _data_) {
+               return;
+       }
+}
+
+static gboolean
+may_fail_co (MayFailData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+foo_data_free (gpointer _data)
+{
+       FooData* _data_;
+       _data_ = _data;
+       g_slice_free (FooData, _data_);
+}
+
+void
+foo (GAsyncReadyCallback _callback_,
+     gpointer _user_data_)
+{
+       FooData* _data_;
+       _data_ = g_slice_new0 (FooData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, foo_data_free);
+       foo_co (_data_);
+}
+
+void
+foo_finish (GAsyncResult* _res_,
+            GError** error)
+{
+       FooData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), error);
+       if (NULL == _data_) {
+               return;
+       }
+}
+
+static void
+foo_ready (GObject* source_object,
+           GAsyncResult* _res_,
+           gpointer _user_data_)
+{
+       FooData* _data_;
+       _data_ = _user_data_;
+       _data_->_source_object_ = source_object;
+       _data_->_res_ = _res_;
+       foo_co (_data_);
+}
+
+static gboolean
+foo_co (FooData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               case 1:
+               goto _state_1;
+               case 2:
+               goto _state_2;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       {
+               _data_->_state_ = 1;
+               fail (foo_ready, _data_);
+               return FALSE;
+               _state_1:
+               fail_finish (_data_->_res_, &_data_->_inner_error0_);
+               if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+                       goto __finally0;
+               }
+       }
+       __finally0:
+       {
+               {
+                       _data_->_state_ = 2;
+                       may_fail (foo_ready, _data_);
+                       return FALSE;
+                       _state_2:
+                       may_fail_finish (_data_->_res_, &_data_->_inner_error1_);
+                       if (G_UNLIKELY (_data_->_inner_error1_ != NULL)) {
+                               if (_data_->_inner_error1_->domain == FOO_ERROR) {
+                                       goto __catch1_foo_error;
+                               }
+                       }
+               }
+               goto __finally1;
+               __catch1_foo_error:
+               {
+                       g_clear_error (&_data_->_inner_error1_);
+                       g_assert_not_reached ();
+               }
+               __finally1:
+               if (G_UNLIKELY (_data_->_inner_error1_ != NULL)) {
+                       if (_data_->_inner_error1_->domain == FOO_ERROR) {
+                               g_task_return_error (_data_->_async_result, _data_->_inner_error1_);
+                               g_object_unref (_data_->_async_result);
+                               return FALSE;
+                       } else {
+                               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, 
__LINE__, _data_->_inner_error1_->message, g_quark_to_string (_data_->_inner_error1_->domain), 
_data_->_inner_error1_->code);
+                               g_clear_error (&_data_->_inner_error1_);
+                               g_object_unref (_data_->_async_result);
+                               return FALSE;
+                       }
+               }
+       }
+       if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+               if (_data_->_inner_error0_->domain == FOO_ERROR) {
+                       g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
+                       g_object_unref (_data_->_async_result);
+                       return FALSE;
+               } else {
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), 
_data_->_inner_error0_->code);
+                       g_clear_error (&_data_->_inner_error0_);
+                       g_object_unref (_data_->_async_result);
+                       return FALSE;
+               }
+       }
+       g_assert_not_reached ();
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+bar_data_free (gpointer _data)
+{
+       BarData* _data_;
+       _data_ = _data;
+       g_slice_free (BarData, _data_);
+}
+
+void
+bar (GAsyncReadyCallback _callback_,
+     gpointer _user_data_)
+{
+       BarData* _data_;
+       _data_ = g_slice_new0 (BarData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, bar_data_free);
+       bar_co (_data_);
+}
+
+void
+bar_finish (GAsyncResult* _res_,
+            GError** error)
+{
+       BarData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), error);
+       if (NULL == _data_) {
+               return;
+       }
+}
+
+static void
+bar_ready (GObject* source_object,
+           GAsyncResult* _res_,
+           gpointer _user_data_)
+{
+       BarData* _data_;
+       _data_ = _user_data_;
+       _data_->_source_object_ = source_object;
+       _data_->_res_ = _res_;
+       bar_co (_data_);
+}
+
+static gboolean
+bar_co (BarData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               case 1:
+               goto _state_1;
+               case 2:
+               goto _state_2;
+               case 3:
+               goto _state_3;
+               case 4:
+               goto _state_4;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       {
+               _data_->_state_ = 1;
+               may_fail (bar_ready, _data_);
+               return FALSE;
+               _state_1:
+               may_fail_finish (_data_->_res_, &_data_->_inner_error0_);
+               if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+                       goto __finally0;
+               }
+       }
+       __finally0:
+       {
+               {
+                       _data_->_state_ = 2;
+                       fail (bar_ready, _data_);
+                       return FALSE;
+                       _state_2:
+                       fail_finish (_data_->_res_, &_data_->_inner_error1_);
+                       if (G_UNLIKELY (_data_->_inner_error1_ != NULL)) {
+                               if (_data_->_inner_error1_->domain == FOO_ERROR) {
+                                       goto __catch1_foo_error;
+                               }
+                       }
+               }
+               goto __finally1;
+               __catch1_foo_error:
+               {
+                       g_clear_error (&_data_->_inner_error1_);
+               }
+               __finally1:
+               if (G_UNLIKELY (_data_->_inner_error1_ != NULL)) {
+                       if (_data_->_inner_error1_->domain == FOO_ERROR) {
+                               g_task_return_error (_data_->_async_result, _data_->_inner_error1_);
+                               g_object_unref (_data_->_async_result);
+                               return FALSE;
+                       } else {
+                               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, 
__LINE__, _data_->_inner_error1_->message, g_quark_to_string (_data_->_inner_error1_->domain), 
_data_->_inner_error1_->code);
+                               g_clear_error (&_data_->_inner_error1_);
+                               g_object_unref (_data_->_async_result);
+                               return FALSE;
+                       }
+               }
+       }
+       if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+               if (_data_->_inner_error0_->domain == FOO_ERROR) {
+                       g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
+                       g_object_unref (_data_->_async_result);
+                       return FALSE;
+               } else {
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), 
_data_->_inner_error0_->code);
+                       g_clear_error (&_data_->_inner_error0_);
+                       g_object_unref (_data_->_async_result);
+                       return FALSE;
+               }
+       }
+       {
+               _data_->_state_ = 3;
+               fail (bar_ready, _data_);
+               return FALSE;
+               _state_3:
+               fail_finish (_data_->_res_, &_data_->_inner_error0_);
+               if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+                       goto __finally2;
+               }
+       }
+       __finally2:
+       {
+               {
+                       _data_->_state_ = 4;
+                       may_fail (bar_ready, _data_);
+                       return FALSE;
+                       _state_4:
+                       may_fail_finish (_data_->_res_, &_data_->_inner_error1_);
+                       if (G_UNLIKELY (_data_->_inner_error1_ != NULL)) {
+                               if (_data_->_inner_error1_->domain == FOO_ERROR) {
+                                       goto __catch3_foo_error;
+                               }
+                       }
+               }
+               goto __finally3;
+               __catch3_foo_error:
+               {
+                       g_clear_error (&_data_->_inner_error1_);
+                       g_assert_not_reached ();
+               }
+               __finally3:
+               if (G_UNLIKELY (_data_->_inner_error1_ != NULL)) {
+                       if (_data_->_inner_error1_->domain == FOO_ERROR) {
+                               g_task_return_error (_data_->_async_result, _data_->_inner_error1_);
+                               g_object_unref (_data_->_async_result);
+                               return FALSE;
+                       } else {
+                               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, 
__LINE__, _data_->_inner_error1_->message, g_quark_to_string (_data_->_inner_error1_->domain), 
_data_->_inner_error1_->code);
+                               g_clear_error (&_data_->_inner_error1_);
+                               g_object_unref (_data_->_async_result);
+                               return FALSE;
+                       }
+               }
+       }
+       if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+               if (_data_->_inner_error0_->domain == FOO_ERROR) {
+                       g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
+                       g_object_unref (_data_->_async_result);
+                       return FALSE;
+               } else {
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), 
_data_->_inner_error0_->code);
+                       g_clear_error (&_data_->_inner_error0_);
+                       g_object_unref (_data_->_async_result);
+                       return FALSE;
+               }
+       }
+       g_assert_not_reached ();
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+run_data_free (gpointer _data)
+{
+       RunData* _data_;
+       _data_ = _data;
+       g_slice_free (RunData, _data_);
+}
+
+void
+run (GAsyncReadyCallback _callback_,
+     gpointer _user_data_)
+{
+       RunData* _data_;
+       _data_ = g_slice_new0 (RunData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, run_data_free);
+       run_co (_data_);
+}
+
+void
+run_finish (GAsyncResult* _res_)
+{
+       RunData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static void
+__lambda4_ (GObject* o,
+            GAsyncResult* r)
+{
+       GError* _inner_error0_ = NULL;
+       g_return_if_fail ((o == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (o, G_TYPE_OBJECT));
+       g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (r, g_async_result_get_type ()));
+       {
+               foo_finish (r, &_inner_error0_);
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       if (_inner_error0_->domain == FOO_ERROR) {
+                               goto __catch0_foo_error;
+                       }
+                       g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+       }
+       goto __finally0;
+       __catch0_foo_error:
+       {
+               GError* e = NULL;
+               GError* _tmp0_;
+               const gchar* _tmp1_;
+               e = _inner_error0_;
+               _inner_error0_ = NULL;
+               _tmp0_ = e;
+               _tmp1_ = _tmp0_->message;
+               _vala_assert (g_strcmp0 (_tmp1_, "fail") == 0, "e.message == \"fail\"");
+               _g_error_free0 (e);
+       }
+       __finally0:
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+}
+
+static void
+___lambda4__gasync_ready_callback (GObject* source_object,
+                                   GAsyncResult* res,
+                                   gpointer self)
+{
+       __lambda4_ (source_object, res);
+}
+
+static void
+__lambda5_ (GObject* o,
+            GAsyncResult* r)
+{
+       GError* _inner_error0_ = NULL;
+       g_return_if_fail ((o == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (o, G_TYPE_OBJECT));
+       g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (r, g_async_result_get_type ()));
+       {
+               bar_finish (r, &_inner_error0_);
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       if (_inner_error0_->domain == FOO_ERROR) {
+                               goto __catch0_foo_error;
+                       }
+                       g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+       }
+       goto __finally0;
+       __catch0_foo_error:
+       {
+               GError* e = NULL;
+               GError* _tmp0_;
+               const gchar* _tmp1_;
+               GMainLoop* _tmp2_;
+               e = _inner_error0_;
+               _inner_error0_ = NULL;
+               _tmp0_ = e;
+               _tmp1_ = _tmp0_->message;
+               _vala_assert (g_strcmp0 (_tmp1_, "fail") == 0, "e.message == \"fail\"");
+               _tmp2_ = loop;
+               g_main_loop_quit (_tmp2_);
+               _g_error_free0 (e);
+       }
+       __finally0:
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+}
+
+static void
+___lambda5__gasync_ready_callback (GObject* source_object,
+                                   GAsyncResult* res,
+                                   gpointer self)
+{
+       __lambda5_ (source_object, res);
+}
+
+static gboolean
+run_co (RunData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       foo (___lambda4__gasync_ready_callback, NULL);
+       bar (___lambda5__gasync_ready_callback, NULL);
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+_vala_main (void)
+{
+       GMainLoop* _tmp0_;
+       GMainLoop* _tmp1_;
+       _tmp0_ = g_main_loop_new (NULL, FALSE);
+       _g_main_loop_unref0 (loop);
+       loop = _tmp0_;
+       run (NULL, NULL);
+       _tmp1_ = loop;
+       g_main_loop_run (_tmp1_);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/asynchronous/closures.c-expected b/tests/asynchronous/closures.c-expected
new file mode 100644
index 000000000..9c2d0f92c
--- /dev/null
+++ b/tests/asynchronous/closures.c-expected
@@ -0,0 +1,213 @@
+/* asynchronous_closures.c generated by valac, the Vala compiler
+ * generated from asynchronous_closures.vala, do not modify */
+
+#include <glib.h>
+#include <gio/gio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef void (*Func) (gpointer user_data);
+#define _g_free0(var) (var = (g_free (var), NULL))
+typedef struct _Block1Data Block1Data;
+typedef struct _FooData FooData;
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Block1Data {
+       int _ref_count_;
+       GSourceFunc func;
+       gpointer func_target;
+       gchar* bar;
+       gchar* baz;
+       gpointer _async_data_;
+};
+
+struct _FooData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       gchar* baz;
+       Block1Data* _data1_;
+       gchar* _tmp0_;
+       Func foobar;
+       gpointer foobar_target;
+       GDestroyNotify foobar_target_destroy_notify;
+       GMainLoop* _tmp1_;
+};
+
+VALA_EXTERN GMainLoop* main_loop;
+GMainLoop* main_loop = NULL;
+
+static void foo_data_free (gpointer _data);
+VALA_EXTERN void foo (const gchar* baz,
+          GAsyncReadyCallback _callback_,
+          gpointer _user_data_);
+VALA_EXTERN void foo_finish (GAsyncResult* _res_);
+static gboolean foo_co (FooData* _data_);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static void __lambda4_ (Block1Data* _data1_);
+static void ___lambda4__func (gpointer self);
+static gboolean _foo_co_gsource_func (gpointer self);
+static void _vala_main (void);
+
+static void
+foo_data_free (gpointer _data)
+{
+       FooData* _data_;
+       _data_ = _data;
+       g_slice_free (FooData, _data_);
+}
+
+void
+foo (const gchar* baz,
+     GAsyncReadyCallback _callback_,
+     gpointer _user_data_)
+{
+       FooData* _data_;
+       gchar* _tmp0_;
+       g_return_if_fail (baz != NULL);
+       _data_ = g_slice_new0 (FooData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, foo_data_free);
+       _tmp0_ = g_strdup (baz);
+       _g_free0 (_data_->baz);
+       _data_->baz = _tmp0_;
+       foo_co (_data_);
+}
+
+void
+foo_finish (GAsyncResult* _res_)
+{
+       FooData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               _g_free0 (_data1_->bar);
+               _g_free0 (_data1_->baz);
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static void
+__lambda4_ (Block1Data* _data1_)
+{
+       gchar* _tmp0_;
+       _data1_->func = NULL;
+       _data1_->func_target = NULL;
+       _tmp0_ = g_strdup (_data1_->baz);
+       _g_free0 (_data1_->bar);
+       _data1_->bar = _tmp0_;
+}
+
+static void
+___lambda4__func (gpointer self)
+{
+       __lambda4_ (self);
+}
+
+static gboolean
+_foo_co_gsource_func (gpointer self)
+{
+       gboolean result;
+       result = foo_co (self);
+       return result;
+}
+
+static gboolean
+foo_co (FooData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               case 1:
+               goto _state_1;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->_data1_ = g_slice_new0 (Block1Data);
+       _data_->_data1_->_ref_count_ = 1;
+       _g_free0 (_data_->_data1_->baz);
+       _data_->_data1_->baz = _data_->baz;
+       _data_->_data1_->_async_data_ = _data_;
+       _data_->_data1_->func = NULL;
+       _data_->_data1_->func_target = NULL;
+       _data_->_tmp0_ = g_strdup ("hello");
+       _data_->_data1_->bar = _data_->_tmp0_;
+       _data_->foobar = ___lambda4__func;
+       _data_->foobar_target = block1_data_ref (_data_->_data1_);
+       _data_->foobar_target_destroy_notify = block1_data_unref;
+       _data_->foobar (_data_->foobar_target);
+       _vala_assert (g_strcmp0 (_data_->_data1_->bar, "world") == 0, "bar == \"world\"");
+       g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _foo_co_gsource_func, _data_, NULL);
+       _data_->_state_ = 1;
+       return FALSE;
+       _state_1:
+       ;
+       _data_->_tmp1_ = main_loop;
+       g_main_loop_quit (_data_->_tmp1_);
+       (_data_->foobar_target_destroy_notify == NULL) ? NULL : (_data_->foobar_target_destroy_notify 
(_data_->foobar_target), NULL);
+       _data_->foobar = NULL;
+       _data_->foobar_target = NULL;
+       _data_->foobar_target_destroy_notify = NULL;
+       block1_data_unref (_data_->_data1_);
+       _data_->_data1_ = NULL;
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+_vala_main (void)
+{
+       GMainLoop* _tmp0_;
+       GMainLoop* _tmp1_;
+       foo ("world", NULL, NULL);
+       _tmp0_ = g_main_loop_new (NULL, FALSE);
+       _g_main_loop_unref0 (main_loop);
+       main_loop = _tmp0_;
+       _tmp1_ = main_loop;
+       g_main_loop_run (_tmp1_);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/asynchronous/constructor-argument-check.c-expected 
b/tests/asynchronous/constructor-argument-check.c-expected
new file mode 100644
index 000000000..036038929
--- /dev/null
+++ b/tests/asynchronous/constructor-argument-check.c-expected
@@ -0,0 +1,470 @@
+/* asynchronous_constructor_argument_check.c generated by valac, the Vala compiler
+ * generated from asynchronous_constructor_argument_check.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+typedef struct _FooNewData FooNewData;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+typedef struct _RunData RunData;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _FooNewData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       GType object_type;
+       Foo* self;
+       gchar* bar;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+struct _RunData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Foo* _tmp0_;
+       Foo* _tmp1_;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+static void foo_construct_data_free (gpointer _data);
+VALA_EXTERN void foo_new (const gchar* bar,
+              GAsyncReadyCallback _callback_,
+              gpointer _user_data_);
+VALA_EXTERN Foo* foo_new_finish (GAsyncResult* _res_);
+VALA_EXTERN void foo_construct (GType object_type,
+                    const gchar* bar,
+                    GAsyncReadyCallback _callback_,
+                    gpointer _user_data_);
+VALA_EXTERN Foo* foo_construct_finish (GAsyncResult* _res_);
+static gboolean foo_construct_co (FooNewData* _data_);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void run_data_free (gpointer _data);
+VALA_EXTERN void run (GAsyncReadyCallback _callback_,
+          gpointer _user_data_);
+VALA_EXTERN void run_finish (GAsyncResult* _res_);
+static gboolean run_co (RunData* _data_);
+static void run_ready (GObject* source_object,
+                GAsyncResult* _res_,
+                gpointer _user_data_);
+static void _vala_main (void);
+
+static void
+foo_construct_data_free (gpointer _data)
+{
+       FooNewData* _data_;
+       _data_ = _data;
+       _g_free0 (_data_->bar);
+       _foo_unref0 (_data_->self);
+       g_slice_free (FooNewData, _data_);
+}
+
+void
+foo_construct (GType object_type,
+               const gchar* bar,
+               GAsyncReadyCallback _callback_,
+               gpointer _user_data_)
+{
+       FooNewData* _data_;
+       gchar* _tmp0_;
+       g_return_if_fail (bar != NULL);
+       _data_ = g_slice_new0 (FooNewData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, foo_construct_data_free);
+       _data_->object_type = object_type;
+       _tmp0_ = g_strdup (bar);
+       _g_free0 (_data_->bar);
+       _data_->bar = _tmp0_;
+       foo_construct_co (_data_);
+}
+
+Foo*
+foo_construct_finish (GAsyncResult* _res_)
+{
+       Foo* result;
+       FooNewData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+       result = _data_->self;
+       _data_->self = NULL;
+       return result;
+}
+
+static gboolean
+foo_construct_co (FooNewData* _data_)
+{
+       Foo* self = NULL;
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->self = (Foo*) g_type_create_instance (_data_->object_type);
+       _vala_assert (g_strcmp0 (_data_->bar, "foo") == 0, "bar == \"foo\"");
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+void
+foo_new (const gchar* bar,
+         GAsyncReadyCallback _callback_,
+         gpointer _user_data_)
+{
+       foo_construct (TYPE_FOO, bar, _callback_, _user_data_);
+}
+
+Foo*
+foo_new_finish (GAsyncResult* _res_)
+{
+       return foo_construct_finish (_res_);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+run_data_free (gpointer _data)
+{
+       RunData* _data_;
+       _data_ = _data;
+       g_slice_free (RunData, _data_);
+}
+
+void
+run (GAsyncReadyCallback _callback_,
+     gpointer _user_data_)
+{
+       RunData* _data_;
+       _data_ = g_slice_new0 (RunData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, run_data_free);
+       run_co (_data_);
+}
+
+void
+run_finish (GAsyncResult* _res_)
+{
+       RunData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static void
+run_ready (GObject* source_object,
+           GAsyncResult* _res_,
+           gpointer _user_data_)
+{
+       RunData* _data_;
+       _data_ = _user_data_;
+       _data_->_source_object_ = source_object;
+       _data_->_res_ = _res_;
+       run_co (_data_);
+}
+
+static gboolean
+run_co (RunData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               case 1:
+               goto _state_1;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->_state_ = 1;
+       foo_new ("foo", run_ready, _data_);
+       return FALSE;
+       _state_1:
+       _data_->_tmp0_ = foo_new_finish (_data_->_res_);
+       _data_->_tmp1_ = _data_->_tmp0_;
+       _foo_unref0 (_data_->_tmp1_);
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+_vala_main (void)
+{
+       run (NULL, NULL);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/asynchronous/finish-name.c-expected b/tests/asynchronous/finish-name.c-expected
new file mode 100644
index 000000000..3f727800f
--- /dev/null
+++ b/tests/asynchronous/finish-name.c-expected
@@ -0,0 +1,974 @@
+/* asynchronous_finish_name.c generated by valac, the Vala compiler
+ * generated from asynchronous_finish_name.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+typedef struct _FooNewAsyncData FooNewAsyncData;
+#define _g_free0(var) (var = (g_free (var), NULL))
+typedef struct _FooBarData FooBarData;
+typedef struct _FooBazData FooBazData;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+typedef struct _BarBazData BarBazData;
+typedef struct _ManamData ManamData;
+typedef struct _Block1Data Block1Data;
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+       void (*baz) (Foo* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+       gchar* (*baz_end) (Foo* self, GAsyncResult* _res_);
+};
+
+struct _FooNewAsyncData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       GType object_type;
+       Foo* self;
+};
+
+struct _FooBarData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Foo* self;
+       gchar* result;
+       gchar* _tmp0_;
+};
+
+struct _FooBazData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Foo* self;
+       gchar* result;
+       gchar* _tmp0_;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+struct _Bar {
+       Foo parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       FooClass parent_class;
+};
+
+struct _BarBazData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Bar* self;
+       gchar* result;
+       gchar* _tmp0_;
+};
+
+struct _ManamData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       gchar* result;
+       gchar* _tmp0_;
+};
+
+struct _Block1Data {
+       int _ref_count_;
+       Foo* foo;
+       Bar* bar;
+};
+
+static gpointer foo_parent_class = NULL;
+static gpointer bar_parent_class = NULL;
+VALA_EXTERN GMainLoop* loop;
+GMainLoop* loop = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN void foo_baz (Foo* self,
+              GAsyncReadyCallback _callback_,
+              gpointer _user_data_);
+VALA_EXTERN gchar* foo_baz_end (Foo* self,
+                    GAsyncResult* _res_);
+static void foo_construct_async_data_free (gpointer _data);
+VALA_EXTERN void foo_new_async (GAsyncReadyCallback _callback_,
+                    gpointer _user_data_);
+VALA_EXTERN Foo* foo_new_end (GAsyncResult* _res_);
+VALA_EXTERN void foo_construct_async (GType object_type,
+                          GAsyncReadyCallback _callback_,
+                          gpointer _user_data_);
+VALA_EXTERN Foo* foo_construct_finish (GAsyncResult* _res_);
+static gboolean foo_construct_async_co (FooNewAsyncData* _data_);
+static void foo_bar_data_free (gpointer _data);
+VALA_EXTERN void foo_bar (Foo* self,
+              GAsyncReadyCallback _callback_,
+              gpointer _user_data_);
+VALA_EXTERN gchar* foo_bar_end (Foo* self,
+                    GAsyncResult* _res_);
+static gboolean foo_bar_co (FooBarData* _data_);
+static void foo_real_baz_data_free (gpointer _data);
+static void foo_real_baz (Foo* self,
+                   GAsyncReadyCallback _callback_,
+                   gpointer _user_data_);
+static gboolean foo_real_baz_co (FooBazData* _data_);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, foo_unref)
+static void bar_real_baz_data_free (gpointer _data);
+static void bar_real_baz (Foo* base,
+                   GAsyncReadyCallback _callback_,
+                   gpointer _user_data_);
+static gboolean bar_real_baz_co (BarBazData* _data_);
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static GType bar_get_type_once (void);
+static void manam_data_free (gpointer _data);
+VALA_EXTERN void manam (GAsyncReadyCallback _callback_,
+            gpointer _user_data_);
+VALA_EXTERN gchar* manam_end (GAsyncResult* _res_);
+static gboolean manam_co (ManamData* _data_);
+static void _vala_main (void);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static void __lambda4_ (Block1Data* _data1_,
+                 GObject* o,
+                 GAsyncResult* r);
+static void ___lambda4__gasync_ready_callback (GObject* source_object,
+                                        GAsyncResult* res,
+                                        gpointer self);
+static void __lambda5_ (Block1Data* _data1_,
+                 GObject* o,
+                 GAsyncResult* r);
+static void ___lambda5__gasync_ready_callback (GObject* source_object,
+                                        GAsyncResult* res,
+                                        gpointer self);
+static void __lambda6_ (Block1Data* _data1_,
+                 GObject* o,
+                 GAsyncResult* r);
+static void ___lambda6__gasync_ready_callback (GObject* source_object,
+                                        GAsyncResult* res,
+                                        gpointer self);
+static void __lambda7_ (GObject* o,
+                 GAsyncResult* r);
+static void ___lambda7__gasync_ready_callback (GObject* source_object,
+                                        GAsyncResult* res,
+                                        gpointer self);
+
+static void
+foo_construct_async_data_free (gpointer _data)
+{
+       FooNewAsyncData* _data_;
+       _data_ = _data;
+       _foo_unref0 (_data_->self);
+       g_slice_free (FooNewAsyncData, _data_);
+}
+
+void
+foo_construct_async (GType object_type,
+                     GAsyncReadyCallback _callback_,
+                     gpointer _user_data_)
+{
+       FooNewAsyncData* _data_;
+       _data_ = g_slice_new0 (FooNewAsyncData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, foo_construct_async_data_free);
+       _data_->object_type = object_type;
+       foo_construct_async_co (_data_);
+}
+
+Foo*
+foo_construct_finish (GAsyncResult* _res_)
+{
+       Foo* result;
+       FooNewAsyncData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+       result = _data_->self;
+       _data_->self = NULL;
+       return result;
+}
+
+static gboolean
+foo_construct_async_co (FooNewAsyncData* _data_)
+{
+       Foo* self = NULL;
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->self = (Foo*) g_type_create_instance (_data_->object_type);
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+void
+foo_new_async (GAsyncReadyCallback _callback_,
+               gpointer _user_data_)
+{
+       foo_construct_async (TYPE_FOO, _callback_, _user_data_);
+}
+
+Foo*
+foo_new_end (GAsyncResult* _res_)
+{
+       return foo_construct_finish (_res_);
+}
+
+static void
+foo_bar_data_free (gpointer _data)
+{
+       FooBarData* _data_;
+       _data_ = _data;
+       _g_free0 (_data_->result);
+       _foo_unref0 (_data_->self);
+       g_slice_free (FooBarData, _data_);
+}
+
+static gpointer
+_foo_ref0 (gpointer self)
+{
+       return self ? foo_ref (self) : NULL;
+}
+
+void
+foo_bar (Foo* self,
+         GAsyncReadyCallback _callback_,
+         gpointer _user_data_)
+{
+       FooBarData* _data_;
+       Foo* _tmp0_;
+       g_return_if_fail (IS_FOO (self));
+       _data_ = g_slice_new0 (FooBarData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, foo_bar_data_free);
+       _tmp0_ = _foo_ref0 (self);
+       _data_->self = _tmp0_;
+       foo_bar_co (_data_);
+}
+
+gchar*
+foo_bar_end (Foo* self,
+             GAsyncResult* _res_)
+{
+       gchar* result;
+       FooBarData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+       result = _data_->result;
+       _data_->result = NULL;
+       return result;
+}
+
+static gboolean
+foo_bar_co (FooBarData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->_tmp0_ = g_strdup ("bar");
+       _data_->result = _data_->_tmp0_;
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+foo_real_baz_data_free (gpointer _data)
+{
+       FooBazData* _data_;
+       _data_ = _data;
+       _g_free0 (_data_->result);
+       _foo_unref0 (_data_->self);
+       g_slice_free (FooBazData, _data_);
+}
+
+static void
+foo_real_baz (Foo* self,
+              GAsyncReadyCallback _callback_,
+              gpointer _user_data_)
+{
+       FooBazData* _data_;
+       Foo* _tmp0_;
+       _data_ = g_slice_new0 (FooBazData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, foo_real_baz_data_free);
+       _tmp0_ = _foo_ref0 (self);
+       _data_->self = _tmp0_;
+       foo_real_baz_co (_data_);
+}
+
+static gchar*
+foo_real_baz_finish (Foo* self,
+                     GAsyncResult* _res_)
+{
+       gchar* result;
+       FooBazData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+       result = _data_->result;
+       _data_->result = NULL;
+       return result;
+}
+
+static gboolean
+foo_real_baz_co (FooBazData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->_tmp0_ = g_strdup ("baz");
+       _data_->result = _data_->_tmp0_;
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+void
+foo_baz (Foo* self,
+         GAsyncReadyCallback _callback_,
+         gpointer _user_data_)
+{
+       FooClass* _klass_;
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->baz) {
+               _klass_->baz (self, _callback_, _user_data_);
+       }
+}
+
+gchar*
+foo_baz_end (Foo* self,
+             GAsyncResult* _res_)
+{
+       FooClass* _klass_;
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->baz_end) {
+               return _klass_->baz_end (self, _res_);
+       }
+       return NULL;
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       ((FooClass *) klass)->baz = (void (*) (Foo*, GAsyncReadyCallback, gpointer)) foo_real_baz;
+       ((FooClass *) klass)->baz_end = (gchar* (*) (Foo*, GAsyncResult*)) foo_real_baz_finish;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+bar_real_baz_data_free (gpointer _data)
+{
+       BarBazData* _data_;
+       _data_ = _data;
+       _g_free0 (_data_->result);
+       _foo_unref0 (_data_->self);
+       g_slice_free (BarBazData, _data_);
+}
+
+static void
+bar_real_baz (Foo* base,
+              GAsyncReadyCallback _callback_,
+              gpointer _user_data_)
+{
+       Bar * self;
+       BarBazData* _data_;
+       Bar* _tmp0_;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAR, Bar);
+       _data_ = g_slice_new0 (BarBazData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, bar_real_baz_data_free);
+       _tmp0_ = _foo_ref0 (self);
+       _data_->self = _tmp0_;
+       bar_real_baz_co (_data_);
+}
+
+static gchar*
+bar_baz_end (Foo* base,
+             GAsyncResult* _res_)
+{
+       gchar* result;
+       BarBazData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+       result = _data_->result;
+       _data_->result = NULL;
+       return result;
+}
+
+static gboolean
+bar_real_baz_co (BarBazData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->_tmp0_ = g_strdup ("baz_bar");
+       _data_->result = _data_->_tmp0_;
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar* self = NULL;
+       self = (Bar*) foo_construct (object_type);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->baz = (void (*) (Foo*, GAsyncReadyCallback, gpointer)) bar_real_baz;
+       ((FooClass *) klass)->baz_end = (gchar* (*) (Foo*, GAsyncResult*)) bar_baz_end;
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (TYPE_FOO, "Bar", &g_define_type_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+manam_data_free (gpointer _data)
+{
+       ManamData* _data_;
+       _data_ = _data;
+       _g_free0 (_data_->result);
+       g_slice_free (ManamData, _data_);
+}
+
+void
+manam (GAsyncReadyCallback _callback_,
+       gpointer _user_data_)
+{
+       ManamData* _data_;
+       _data_ = g_slice_new0 (ManamData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, manam_data_free);
+       manam_co (_data_);
+}
+
+gchar*
+manam_end (GAsyncResult* _res_)
+{
+       gchar* result;
+       ManamData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+       result = _data_->result;
+       _data_->result = NULL;
+       return result;
+}
+
+static gboolean
+manam_co (ManamData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->_tmp0_ = g_strdup ("manam");
+       _data_->result = _data_->_tmp0_;
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               _foo_unref0 (_data1_->bar);
+               _foo_unref0 (_data1_->foo);
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static void
+__lambda4_ (Block1Data* _data1_,
+            GObject* o,
+            GAsyncResult* r)
+{
+       gchar* res = NULL;
+       gchar* _tmp0_;
+       g_return_if_fail ((o == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (o, G_TYPE_OBJECT));
+       g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (r, g_async_result_get_type ()));
+       _tmp0_ = foo_bar_end (_data1_->foo, r);
+       res = _tmp0_;
+       _vala_assert (g_strcmp0 (res, "bar") == 0, "res == \"bar\"");
+       _g_free0 (res);
+}
+
+static void
+___lambda4__gasync_ready_callback (GObject* source_object,
+                                   GAsyncResult* res,
+                                   gpointer self)
+{
+       __lambda4_ (self, source_object, res);
+       block1_data_unref (self);
+}
+
+static void
+__lambda5_ (Block1Data* _data1_,
+            GObject* o,
+            GAsyncResult* r)
+{
+       gchar* res = NULL;
+       gchar* _tmp0_;
+       g_return_if_fail ((o == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (o, G_TYPE_OBJECT));
+       g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (r, g_async_result_get_type ()));
+       _tmp0_ = foo_baz_end (_data1_->foo, r);
+       res = _tmp0_;
+       _vala_assert (g_strcmp0 (res, "baz") == 0, "res == \"baz\"");
+       _g_free0 (res);
+}
+
+static void
+___lambda5__gasync_ready_callback (GObject* source_object,
+                                   GAsyncResult* res,
+                                   gpointer self)
+{
+       __lambda5_ (self, source_object, res);
+       block1_data_unref (self);
+}
+
+static void
+__lambda6_ (Block1Data* _data1_,
+            GObject* o,
+            GAsyncResult* r)
+{
+       gchar* res = NULL;
+       gchar* _tmp0_;
+       g_return_if_fail ((o == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (o, G_TYPE_OBJECT));
+       g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (r, g_async_result_get_type ()));
+       _tmp0_ = foo_baz_end (G_TYPE_CHECK_INSTANCE_CAST (_data1_->bar, TYPE_FOO, Foo), r);
+       res = _tmp0_;
+       _vala_assert (g_strcmp0 (res, "baz_bar") == 0, "res == \"baz_bar\"");
+       _g_free0 (res);
+}
+
+static void
+___lambda6__gasync_ready_callback (GObject* source_object,
+                                   GAsyncResult* res,
+                                   gpointer self)
+{
+       __lambda6_ (self, source_object, res);
+       block1_data_unref (self);
+}
+
+static void
+__lambda7_ (GObject* o,
+            GAsyncResult* r)
+{
+       gchar* res = NULL;
+       gchar* _tmp0_;
+       GMainLoop* _tmp1_;
+       g_return_if_fail ((o == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (o, G_TYPE_OBJECT));
+       g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (r, g_async_result_get_type ()));
+       _tmp0_ = manam_end (r);
+       res = _tmp0_;
+       _vala_assert (g_strcmp0 (res, "manam") == 0, "res == \"manam\"");
+       _tmp1_ = loop;
+       g_main_loop_quit (_tmp1_);
+       _g_free0 (res);
+}
+
+static void
+___lambda7__gasync_ready_callback (GObject* source_object,
+                                   GAsyncResult* res,
+                                   gpointer self)
+{
+       __lambda7_ (source_object, res);
+}
+
+static void
+_vala_main (void)
+{
+       Block1Data* _data1_;
+       GMainLoop* _tmp0_;
+       Foo* _tmp1_;
+       Bar* _tmp2_;
+       GMainLoop* _tmp3_;
+       _data1_ = g_slice_new0 (Block1Data);
+       _data1_->_ref_count_ = 1;
+       _tmp0_ = g_main_loop_new (NULL, FALSE);
+       _g_main_loop_unref0 (loop);
+       loop = _tmp0_;
+       _tmp1_ = foo_new ();
+       _data1_->foo = _tmp1_;
+       foo_bar (_data1_->foo, ___lambda4__gasync_ready_callback, block1_data_ref (_data1_));
+       foo_baz (_data1_->foo, ___lambda5__gasync_ready_callback, block1_data_ref (_data1_));
+       _tmp2_ = bar_new ();
+       _data1_->bar = _tmp2_;
+       foo_baz (G_TYPE_CHECK_INSTANCE_CAST (_data1_->bar, TYPE_FOO, Foo), ___lambda6__gasync_ready_callback, 
block1_data_ref (_data1_));
+       manam (___lambda7__gasync_ready_callback, NULL);
+       _tmp3_ = loop;
+       g_main_loop_run (_tmp3_);
+       block1_data_unref (_data1_);
+       _data1_ = NULL;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/asynchronous/generator.c-expected b/tests/asynchronous/generator.c-expected
new file mode 100644
index 000000000..6ec0dbc79
--- /dev/null
+++ b/tests/asynchronous/generator.c-expected
@@ -0,0 +1,837 @@
+/* asynchronous_generator.c generated by valac, the Vala compiler
+ * generated from asynchronous_generator.vala, do not modify */
+
+/* This is based on Luca Bruno's Generator. It illustrates using async methods*/
+/* to emulate a generator style of iterator coding. Note that this runs fine*/
+/* without a main loop.*/
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_GENERATOR (generator_get_type ())
+#define GENERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_GENERATOR, Generator))
+#define GENERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_GENERATOR, GeneratorClass))
+#define IS_GENERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_GENERATOR))
+#define IS_GENERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_GENERATOR))
+#define GENERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_GENERATOR, GeneratorClass))
+
+typedef struct _Generator Generator;
+typedef struct _GeneratorClass GeneratorClass;
+typedef struct _GeneratorPrivate GeneratorPrivate;
+#define _generator_unref0(var) ((var == NULL) ? NULL : (var = (generator_unref (var), NULL)))
+typedef struct _GeneratorHelperData GeneratorHelperData;
+typedef struct _GeneratorFeedData GeneratorFeedData;
+typedef struct _ParamSpecGenerator ParamSpecGenerator;
+
+#define TYPE_INT_GENERATOR (int_generator_get_type ())
+#define INT_GENERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_INT_GENERATOR, IntGenerator))
+#define INT_GENERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_INT_GENERATOR, IntGeneratorClass))
+#define IS_INT_GENERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_INT_GENERATOR))
+#define IS_INT_GENERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_INT_GENERATOR))
+#define INT_GENERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_INT_GENERATOR, 
IntGeneratorClass))
+
+typedef struct _IntGenerator IntGenerator;
+typedef struct _IntGeneratorClass IntGeneratorClass;
+typedef struct _IntGeneratorPrivate IntGeneratorPrivate;
+typedef struct _IntGeneratorGenerateData IntGeneratorGenerateData;
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Generator {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       GeneratorPrivate * priv;
+};
+
+struct _GeneratorClass {
+       GTypeClass parent_class;
+       void (*finalize) (Generator *self);
+       void (*generate) (Generator* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+       void (*generate_finish) (Generator* self, GAsyncResult* _res_);
+};
+
+struct _GeneratorPrivate {
+       GType g_type;
+       GBoxedCopyFunc g_dup_func;
+       GDestroyNotify g_destroy_func;
+       gboolean consumed;
+       gconstpointer value;
+       GSourceFunc callback;
+       gpointer callback_target;
+       GDestroyNotify callback_target_destroy_notify;
+};
+
+struct _GeneratorHelperData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Generator* self;
+};
+
+struct _GeneratorFeedData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Generator* self;
+       gpointer value;
+};
+
+struct _ParamSpecGenerator {
+       GParamSpec parent_instance;
+};
+
+struct _IntGenerator {
+       Generator parent_instance;
+       IntGeneratorPrivate * priv;
+};
+
+struct _IntGeneratorClass {
+       GeneratorClass parent_class;
+};
+
+struct _IntGeneratorGenerateData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       IntGenerator* self;
+       gint i;
+       gboolean _tmp0_;
+       gint _tmp1_;
+};
+
+static gint Generator_private_offset;
+static gpointer generator_parent_class = NULL;
+static gpointer int_generator_parent_class = NULL;
+
+VALA_EXTERN gpointer generator_ref (gpointer instance);
+VALA_EXTERN void generator_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_generator (const gchar* name,
+                                  const gchar* nick,
+                                  const gchar* blurb,
+                                  GType object_type,
+                                  GParamFlags flags);
+VALA_EXTERN void value_set_generator (GValue* value,
+                          gpointer v_object);
+VALA_EXTERN void value_take_generator (GValue* value,
+                           gpointer v_object);
+VALA_EXTERN gpointer value_get_generator (const GValue* value);
+VALA_EXTERN GType generator_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Generator, generator_unref)
+VALA_EXTERN Generator* generator_construct (GType object_type,
+                                GType g_type,
+                                GBoxedCopyFunc g_dup_func,
+                                GDestroyNotify g_destroy_func);
+static void generator_helper (Generator* self,
+                       GAsyncReadyCallback _callback_,
+                       gpointer _user_data_);
+static void generator_helper_finish (Generator* self,
+                              GAsyncResult* _res_);
+static void generator_helper_data_free (gpointer _data);
+static gboolean generator_helper_co (GeneratorHelperData* _data_);
+VALA_EXTERN void generator_generate (Generator* self,
+                         GAsyncReadyCallback _callback_,
+                         gpointer _user_data_);
+VALA_EXTERN void generator_generate_finish (Generator* self,
+                                GAsyncResult* _res_);
+static void generator_helper_ready (GObject* source_object,
+                             GAsyncResult* _res_,
+                             gpointer _user_data_);
+static void generator_feed_data_free (gpointer _data);
+VALA_EXTERN void generator_feed (Generator* self,
+                     gconstpointer value,
+                     GAsyncReadyCallback _callback_,
+                     gpointer _user_data_);
+VALA_EXTERN void generator_feed_finish (Generator* self,
+                            GAsyncResult* _res_);
+static gboolean generator_feed_co (GeneratorFeedData* _data_);
+static gboolean _generator_feed_co_gsource_func (gpointer self);
+VALA_EXTERN gboolean generator_next (Generator* self);
+VALA_EXTERN gpointer generator_get (Generator* self);
+VALA_EXTERN Generator* generator_iterator (Generator* self);
+static void generator_finalize (Generator * obj);
+static GType generator_get_type_once (void);
+VALA_EXTERN GType int_generator_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (IntGenerator, generator_unref)
+static void int_generator_real_generate_data_free (gpointer _data);
+static void int_generator_real_generate (Generator* base,
+                                  GAsyncReadyCallback _callback_,
+                                  gpointer _user_data_);
+static gboolean int_generator_real_generate_co (IntGeneratorGenerateData* _data_);
+static void int_generator_generate_ready (GObject* source_object,
+                                   GAsyncResult* _res_,
+                                   gpointer _user_data_);
+VALA_EXTERN IntGenerator* int_generator_new (void);
+VALA_EXTERN IntGenerator* int_generator_construct (GType object_type);
+static GType int_generator_get_type_once (void);
+static void _vala_main (void);
+
+static inline gpointer
+generator_get_instance_private (Generator* self)
+{
+       return G_STRUCT_MEMBER_P (self, Generator_private_offset);
+}
+
+Generator*
+generator_construct (GType object_type,
+                     GType g_type,
+                     GBoxedCopyFunc g_dup_func,
+                     GDestroyNotify g_destroy_func)
+{
+       Generator* self = NULL;
+       self = (Generator*) g_type_create_instance (object_type);
+       self->priv->g_type = g_type;
+       self->priv->g_dup_func = g_dup_func;
+       self->priv->g_destroy_func = g_destroy_func;
+       generator_helper (self, NULL, NULL);
+       return self;
+}
+
+static void
+generator_helper_data_free (gpointer _data)
+{
+       GeneratorHelperData* _data_;
+       _data_ = _data;
+       _generator_unref0 (_data_->self);
+       g_slice_free (GeneratorHelperData, _data_);
+}
+
+static gpointer
+_generator_ref0 (gpointer self)
+{
+       return self ? generator_ref (self) : NULL;
+}
+
+static void
+generator_helper (Generator* self,
+                  GAsyncReadyCallback _callback_,
+                  gpointer _user_data_)
+{
+       GeneratorHelperData* _data_;
+       Generator* _tmp0_;
+       g_return_if_fail (IS_GENERATOR (self));
+       _data_ = g_slice_new0 (GeneratorHelperData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, generator_helper_data_free);
+       _tmp0_ = _generator_ref0 (self);
+       _data_->self = _tmp0_;
+       generator_helper_co (_data_);
+}
+
+static void
+generator_helper_finish (Generator* self,
+                         GAsyncResult* _res_)
+{
+       GeneratorHelperData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static void
+generator_helper_ready (GObject* source_object,
+                        GAsyncResult* _res_,
+                        gpointer _user_data_)
+{
+       GeneratorHelperData* _data_;
+       _data_ = _user_data_;
+       _data_->_source_object_ = source_object;
+       _data_->_res_ = _res_;
+       generator_helper_co (_data_);
+}
+
+static gboolean
+generator_helper_co (GeneratorHelperData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               case 1:
+               goto _state_1;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->_state_ = 1;
+       generator_generate (_data_->self, generator_helper_ready, _data_);
+       return FALSE;
+       _state_1:
+       generator_generate_finish (_data_->self, _data_->_res_);
+       _data_->self->priv->consumed = TRUE;
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+void
+generator_generate (Generator* self,
+                    GAsyncReadyCallback _callback_,
+                    gpointer _user_data_)
+{
+       GeneratorClass* _klass_;
+       _klass_ = GENERATOR_GET_CLASS (self);
+       if (_klass_->generate) {
+               _klass_->generate (self, _callback_, _user_data_);
+       }
+}
+
+void
+generator_generate_finish (Generator* self,
+                           GAsyncResult* _res_)
+{
+       GeneratorClass* _klass_;
+       _klass_ = GENERATOR_GET_CLASS (self);
+       if (_klass_->generate_finish) {
+               _klass_->generate_finish (self, _res_);
+       }
+}
+
+static void
+generator_feed_data_free (gpointer _data)
+{
+       GeneratorFeedData* _data_;
+       _data_ = _data;
+       ((_data_->value == NULL) || (_data_->self->priv->g_destroy_func == NULL)) ? NULL : (_data_->value = 
(_data_->self->priv->g_destroy_func (_data_->value), NULL));
+       _generator_unref0 (_data_->self);
+       g_slice_free (GeneratorFeedData, _data_);
+}
+
+void
+generator_feed (Generator* self,
+                gconstpointer value,
+                GAsyncReadyCallback _callback_,
+                gpointer _user_data_)
+{
+       GeneratorFeedData* _data_;
+       Generator* _tmp0_;
+       gpointer _tmp1_;
+       g_return_if_fail (IS_GENERATOR (self));
+       _data_ = g_slice_new0 (GeneratorFeedData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, generator_feed_data_free);
+       _tmp0_ = _generator_ref0 (self);
+       _data_->self = _tmp0_;
+       _tmp1_ = ((value != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) 
value) : ((gpointer) value);
+       ((_data_->value == NULL) || (_data_->self->priv->g_destroy_func == NULL)) ? NULL : (_data_->value = 
(_data_->self->priv->g_destroy_func (_data_->value), NULL));
+       _data_->value = _tmp1_;
+       generator_feed_co (_data_);
+}
+
+void
+generator_feed_finish (Generator* self,
+                       GAsyncResult* _res_)
+{
+       GeneratorFeedData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static gboolean
+_generator_feed_co_gsource_func (gpointer self)
+{
+       gboolean result;
+       result = generator_feed_co (self);
+       return result;
+}
+
+static gboolean
+generator_feed_co (GeneratorFeedData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               case 1:
+               goto _state_1;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->self->priv->value = _data_->value;
+       (_data_->self->priv->callback_target_destroy_notify == NULL) ? NULL : 
(_data_->self->priv->callback_target_destroy_notify (_data_->self->priv->callback_target), NULL);
+       _data_->self->priv->callback = NULL;
+       _data_->self->priv->callback_target = NULL;
+       _data_->self->priv->callback_target_destroy_notify = NULL;
+       _data_->self->priv->callback = _generator_feed_co_gsource_func;
+       _data_->self->priv->callback_target = _data_;
+       _data_->self->priv->callback_target_destroy_notify = NULL;
+       _data_->_state_ = 1;
+       return FALSE;
+       _state_1:
+       ;
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+gboolean
+generator_next (Generator* self)
+{
+       gboolean result = FALSE;
+       g_return_val_if_fail (IS_GENERATOR (self), FALSE);
+       result = !self->priv->consumed;
+       return result;
+}
+
+gpointer
+generator_get (Generator* self)
+{
+       gpointer _result_ = NULL;
+       gconstpointer _tmp0_;
+       gpointer _tmp1_;
+       GSourceFunc _tmp2_;
+       gpointer _tmp2__target;
+       gpointer result = NULL;
+       g_return_val_if_fail (IS_GENERATOR (self), NULL);
+       _tmp0_ = self->priv->value;
+       _tmp1_ = ((_tmp0_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) 
_tmp0_) : ((gpointer) _tmp0_);
+       _result_ = _tmp1_;
+       _tmp2_ = self->priv->callback;
+       _tmp2__target = self->priv->callback_target;
+       _tmp2_ (_tmp2__target);
+       result = _result_;
+       return result;
+}
+
+Generator*
+generator_iterator (Generator* self)
+{
+       Generator* _tmp0_;
+       Generator* result = NULL;
+       g_return_val_if_fail (IS_GENERATOR (self), NULL);
+       _tmp0_ = _generator_ref0 (self);
+       result = _tmp0_;
+       return result;
+}
+
+static void
+value_generator_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_generator_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               generator_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_generator_copy_value (const GValue* src_value,
+                            GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = generator_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_generator_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_generator_collect_value (GValue* value,
+                               guint n_collect_values,
+                               GTypeCValue* collect_values,
+                               guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Generator * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = generator_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_generator_lcopy_value (const GValue* value,
+                             guint n_collect_values,
+                             GTypeCValue* collect_values,
+                             guint collect_flags)
+{
+       Generator ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = generator_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_generator (const gchar* name,
+                      const gchar* nick,
+                      const gchar* blurb,
+                      GType object_type,
+                      GParamFlags flags)
+{
+       ParamSpecGenerator* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_GENERATOR), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_generator (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_GENERATOR), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_generator (GValue* value,
+                     gpointer v_object)
+{
+       Generator * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_GENERATOR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_GENERATOR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               generator_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               generator_unref (old);
+       }
+}
+
+void
+value_take_generator (GValue* value,
+                      gpointer v_object)
+{
+       Generator * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_GENERATOR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_GENERATOR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               generator_unref (old);
+       }
+}
+
+static void
+generator_class_init (GeneratorClass * klass,
+                      gpointer klass_data)
+{
+       generator_parent_class = g_type_class_peek_parent (klass);
+       ((GeneratorClass *) klass)->finalize = generator_finalize;
+       g_type_class_adjust_private_offset (klass, &Generator_private_offset);
+}
+
+static void
+generator_instance_init (Generator * self,
+                         gpointer klass)
+{
+       self->priv = generator_get_instance_private (self);
+       self->ref_count = 1;
+}
+
+static void
+generator_finalize (Generator * obj)
+{
+       Generator * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_GENERATOR, Generator);
+       g_signal_handlers_destroy (self);
+       (self->priv->callback_target_destroy_notify == NULL) ? NULL : 
(self->priv->callback_target_destroy_notify (self->priv->callback_target), NULL);
+       self->priv->callback = NULL;
+       self->priv->callback_target = NULL;
+       self->priv->callback_target_destroy_notify = NULL;
+}
+
+static GType
+generator_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_generator_init, 
value_generator_free_value, value_generator_copy_value, value_generator_peek_pointer, "p", 
value_generator_collect_value, "p", value_generator_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (GeneratorClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) generator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(Generator), 0, (GInstanceInitFunc) generator_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType generator_type_id;
+       generator_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Generator", 
&g_define_type_info, &g_define_type_fundamental_info, G_TYPE_FLAG_ABSTRACT);
+       Generator_private_offset = g_type_add_instance_private (generator_type_id, sizeof (GeneratorPrivate));
+       return generator_type_id;
+}
+
+GType
+generator_get_type (void)
+{
+       static volatile gsize generator_type_id__volatile = 0;
+       if (g_once_init_enter (&generator_type_id__volatile)) {
+               GType generator_type_id;
+               generator_type_id = generator_get_type_once ();
+               g_once_init_leave (&generator_type_id__volatile, generator_type_id);
+       }
+       return generator_type_id__volatile;
+}
+
+gpointer
+generator_ref (gpointer instance)
+{
+       Generator * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+generator_unref (gpointer instance)
+{
+       Generator * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               GENERATOR_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+int_generator_real_generate_data_free (gpointer _data)
+{
+       IntGeneratorGenerateData* _data_;
+       _data_ = _data;
+       _generator_unref0 (_data_->self);
+       g_slice_free (IntGeneratorGenerateData, _data_);
+}
+
+static void
+int_generator_real_generate (Generator* base,
+                             GAsyncReadyCallback _callback_,
+                             gpointer _user_data_)
+{
+       IntGenerator * self;
+       IntGeneratorGenerateData* _data_;
+       IntGenerator* _tmp0_;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_INT_GENERATOR, IntGenerator);
+       _data_ = g_slice_new0 (IntGeneratorGenerateData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, int_generator_real_generate_data_free);
+       _tmp0_ = _generator_ref0 (self);
+       _data_->self = _tmp0_;
+       int_generator_real_generate_co (_data_);
+}
+
+static void
+int_generator_generate_finish (Generator* base,
+                               GAsyncResult* _res_)
+{
+       IntGeneratorGenerateData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static void
+int_generator_generate_ready (GObject* source_object,
+                              GAsyncResult* _res_,
+                              gpointer _user_data_)
+{
+       IntGeneratorGenerateData* _data_;
+       _data_ = _user_data_;
+       _data_->_source_object_ = source_object;
+       _data_->_res_ = _res_;
+       int_generator_real_generate_co (_data_);
+}
+
+static gboolean
+int_generator_real_generate_co (IntGeneratorGenerateData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               case 1:
+               goto _state_1;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       {
+               _data_->i = 0;
+               {
+                       _data_->_tmp0_ = TRUE;
+                       while (TRUE) {
+                               if (!_data_->_tmp0_) {
+                                       _data_->_tmp1_ = _data_->i;
+                                       _data_->i = _data_->_tmp1_ + 1;
+                               }
+                               _data_->_tmp0_ = FALSE;
+                               if (!(_data_->i < 10)) {
+                                       break;
+                               }
+                               if ((_data_->i % 2) == 0) {
+                                       _data_->_state_ = 1;
+                                       generator_feed (G_TYPE_CHECK_INSTANCE_CAST (_data_->self, 
TYPE_GENERATOR, Generator), (gpointer) ((gintptr) _data_->i), int_generator_generate_ready, _data_);
+                                       return FALSE;
+                                       _state_1:
+                                       generator_feed_finish (G_TYPE_CHECK_INSTANCE_CAST (_data_->self, 
TYPE_GENERATOR, Generator), _data_->_res_);
+                               }
+                       }
+               }
+       }
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+IntGenerator*
+int_generator_construct (GType object_type)
+{
+       IntGenerator* self = NULL;
+       self = (IntGenerator*) generator_construct (object_type, G_TYPE_INT, NULL, NULL);
+       return self;
+}
+
+IntGenerator*
+int_generator_new (void)
+{
+       return int_generator_construct (TYPE_INT_GENERATOR);
+}
+
+static void
+int_generator_class_init (IntGeneratorClass * klass,
+                          gpointer klass_data)
+{
+       int_generator_parent_class = g_type_class_peek_parent (klass);
+       ((GeneratorClass *) klass)->generate = (void (*) (Generator*, GAsyncReadyCallback, gpointer)) 
int_generator_real_generate;
+       ((GeneratorClass *) klass)->generate_finish = (void (*) (Generator*, GAsyncResult*)) 
int_generator_generate_finish;
+}
+
+static void
+int_generator_instance_init (IntGenerator * self,
+                             gpointer klass)
+{
+}
+
+static GType
+int_generator_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (IntGeneratorClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) int_generator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(IntGenerator), 0, (GInstanceInitFunc) int_generator_instance_init, NULL };
+       GType int_generator_type_id;
+       int_generator_type_id = g_type_register_static (TYPE_GENERATOR, "IntGenerator", &g_define_type_info, 
0);
+       return int_generator_type_id;
+}
+
+GType
+int_generator_get_type (void)
+{
+       static volatile gsize int_generator_type_id__volatile = 0;
+       if (g_once_init_enter (&int_generator_type_id__volatile)) {
+               GType int_generator_type_id;
+               int_generator_type_id = int_generator_get_type_once ();
+               g_once_init_leave (&int_generator_type_id__volatile, int_generator_type_id);
+       }
+       return int_generator_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       IntGenerator* gen = NULL;
+       IntGenerator* _tmp0_;
+       gchar* _result_ = NULL;
+       gchar* _tmp1_;
+       const gchar* _tmp11_;
+       _tmp0_ = int_generator_new ();
+       gen = _tmp0_;
+       _tmp1_ = g_strdup ("");
+       _result_ = _tmp1_;
+       {
+               Generator* _item_it = NULL;
+               IntGenerator* _tmp2_;
+               Generator* _tmp3_;
+               _tmp2_ = gen;
+               _tmp3_ = generator_iterator (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, TYPE_GENERATOR, Generator));
+               _item_it = _tmp3_;
+               while (TRUE) {
+                       Generator* _tmp4_;
+                       gint item = 0;
+                       Generator* _tmp5_;
+                       gpointer _tmp6_;
+                       const gchar* _tmp7_;
+                       gchar* _tmp8_;
+                       gchar* _tmp9_;
+                       gchar* _tmp10_;
+                       _tmp4_ = _item_it;
+                       if (!generator_next (_tmp4_)) {
+                               break;
+                       }
+                       _tmp5_ = _item_it;
+                       _tmp6_ = generator_get (_tmp5_);
+                       item = (gint) ((gintptr) _tmp6_);
+                       _tmp7_ = _result_;
+                       _tmp8_ = g_strdup_printf ("%i ", item);
+                       _tmp9_ = _tmp8_;
+                       _tmp10_ = g_strconcat (_tmp7_, _tmp9_, NULL);
+                       _g_free0 (_result_);
+                       _result_ = _tmp10_;
+                       _g_free0 (_tmp9_);
+               }
+               _generator_unref0 (_item_it);
+       }
+       _tmp11_ = _result_;
+       _vala_assert (g_strcmp0 (_tmp11_, "0 2 4 6 8 ") == 0, "result == \"0 2 4 6 8 \"");
+       _g_free0 (_result_);
+       _generator_unref0 (gen);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/asynchronous/nowrapper.c-expected b/tests/asynchronous/nowrapper.c-expected
new file mode 100644
index 000000000..8b388a6ff
--- /dev/null
+++ b/tests/asynchronous/nowrapper.c-expected
@@ -0,0 +1,426 @@
+/* asynchronous_nowrapper.c generated by valac, the Vala compiler
+ * generated from asynchronous_nowrapper.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_IFOO (ifoo_get_type ())
+#define IFOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IFOO, IFoo))
+#define IS_IFOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IFOO))
+#define IFOO_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_IFOO, IFooIface))
+
+typedef struct _IFoo IFoo;
+typedef struct _IFooIface IFooIface;
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+typedef struct _FooBarData FooBarData;
+typedef struct _FooManamData FooManamData;
+typedef struct _Block1Data Block1Data;
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _IFooIface {
+       GTypeInterface parent_iface;
+       void (*manam) (IFoo* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+       gint (*manam_finish) (IFoo* self, GAsyncResult* _res_);
+};
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+       void (*bar) (Foo* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+       gint (*bar_finish) (Foo* self, GAsyncResult* _res_);
+};
+
+struct _FooBarData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Foo* self;
+       gint result;
+};
+
+struct _FooManamData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Foo* self;
+       gint result;
+};
+
+struct _Block1Data {
+       int _ref_count_;
+       Foo* foo;
+};
+
+static gpointer foo_parent_class = NULL;
+static IFooIface * foo_ifoo_parent_iface = NULL;
+VALA_EXTERN GMainLoop* loop;
+GMainLoop* loop = NULL;
+
+VALA_EXTERN GType ifoo_get_type (void) G_GNUC_CONST ;
+static GType ifoo_get_type_once (void);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+static void foo_real_bar_data_free (gpointer _data);
+static void foo_real_bar (Foo* self,
+                   GAsyncReadyCallback _callback_,
+                   gpointer _user_data_);
+static gboolean foo_real_bar_co (FooBarData* _data_);
+static void foo_real_manam_data_free (gpointer _data);
+static void foo_real_manam (IFoo* base,
+                     GAsyncReadyCallback _callback_,
+                     gpointer _user_data_);
+static gboolean foo_real_manam_co (FooManamData* _data_);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static void __lambda4_ (Block1Data* _data1_,
+                 GObject* o,
+                 GAsyncResult* r);
+static void ___lambda4__gasync_ready_callback (GObject* source_object,
+                                        GAsyncResult* res,
+                                        gpointer self);
+static void __lambda5_ (Block1Data* _data1_,
+                 GObject* o,
+                 GAsyncResult* r);
+static void ___lambda5__gasync_ready_callback (GObject* source_object,
+                                        GAsyncResult* res,
+                                        gpointer self);
+
+static void
+ifoo_default_init (IFooIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+ifoo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (IFooIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) ifoo_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType ifoo_type_id;
+       ifoo_type_id = g_type_register_static (G_TYPE_INTERFACE, "IFoo", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (ifoo_type_id, G_TYPE_OBJECT);
+       return ifoo_type_id;
+}
+
+GType
+ifoo_get_type (void)
+{
+       static volatile gsize ifoo_type_id__volatile = 0;
+       if (g_once_init_enter (&ifoo_type_id__volatile)) {
+               GType ifoo_type_id;
+               ifoo_type_id = ifoo_get_type_once ();
+               g_once_init_leave (&ifoo_type_id__volatile, ifoo_type_id);
+       }
+       return ifoo_type_id__volatile;
+}
+
+static void
+foo_real_bar_data_free (gpointer _data)
+{
+       FooBarData* _data_;
+       _data_ = _data;
+       _g_object_unref0 (_data_->self);
+       g_slice_free (FooBarData, _data_);
+}
+
+static gpointer
+_g_object_ref0 (gpointer self)
+{
+       return self ? g_object_ref (self) : NULL;
+}
+
+static void
+foo_real_bar (Foo* self,
+              GAsyncReadyCallback _callback_,
+              gpointer _user_data_)
+{
+       FooBarData* _data_;
+       Foo* _tmp0_;
+       _data_ = g_slice_new0 (FooBarData);
+       _data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, foo_real_bar_data_free);
+       _tmp0_ = _g_object_ref0 (self);
+       _data_->self = _tmp0_;
+       foo_real_bar_co (_data_);
+}
+
+static gint
+foo_real_bar_finish (Foo* self,
+                     GAsyncResult* _res_)
+{
+       gint result;
+       FooBarData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+       result = _data_->result;
+       return result;
+}
+
+static gboolean
+foo_real_bar_co (FooBarData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->result = 23;
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+foo_real_manam_data_free (gpointer _data)
+{
+       FooManamData* _data_;
+       _data_ = _data;
+       _g_object_unref0 (_data_->self);
+       g_slice_free (FooManamData, _data_);
+}
+
+static void
+foo_real_manam (IFoo* base,
+                GAsyncReadyCallback _callback_,
+                gpointer _user_data_)
+{
+       Foo * self;
+       FooManamData* _data_;
+       Foo* _tmp0_;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_FOO, Foo);
+       _data_ = g_slice_new0 (FooManamData);
+       _data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, foo_real_manam_data_free);
+       _tmp0_ = _g_object_ref0 (self);
+       _data_->self = _tmp0_;
+       foo_real_manam_co (_data_);
+}
+
+static gint
+foo_manam_finish (IFoo* base,
+                  GAsyncResult* _res_)
+{
+       gint result;
+       FooManamData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+       result = _data_->result;
+       return result;
+}
+
+static gboolean
+foo_real_manam_co (FooManamData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->result = 42;
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->bar = (void (*) (Foo*, GAsyncReadyCallback, gpointer)) foo_real_bar;
+       ((FooClass *) klass)->bar_finish = (gint (*) (Foo*, GAsyncResult*)) foo_real_bar_finish;
+}
+
+static void
+foo_ifoo_interface_init (IFooIface * iface,
+                         gpointer iface_data)
+{
+       foo_ifoo_parent_iface = g_type_interface_peek_parent (iface);
+       iface->manam = (void (*) (IFoo*, GAsyncReadyCallback, gpointer)) foo_real_manam;
+       iface->manam_finish = (gint (*) (IFoo*, GAsyncResult*)) foo_manam_finish;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       static const GInterfaceInfo ifoo_info = { (GInterfaceInitFunc) foo_ifoo_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       g_type_add_interface_static (foo_type_id, TYPE_IFOO, &ifoo_info);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               _g_object_unref0 (_data1_->foo);
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static void
+__lambda4_ (Block1Data* _data1_,
+            GObject* o,
+            GAsyncResult* r)
+{
+       g_return_if_fail ((o == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (o, G_TYPE_OBJECT));
+       g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (r, g_async_result_get_type ()));
+       _vala_assert (FOO_GET_CLASS (_data1_->foo)->bar_finish (_data1_->foo, r) == 23, "foo.bar.end (r) == 
23");
+}
+
+static void
+___lambda4__gasync_ready_callback (GObject* source_object,
+                                   GAsyncResult* res,
+                                   gpointer self)
+{
+       __lambda4_ (self, source_object, res);
+       block1_data_unref (self);
+}
+
+static void
+__lambda5_ (Block1Data* _data1_,
+            GObject* o,
+            GAsyncResult* r)
+{
+       GMainLoop* _tmp0_;
+       g_return_if_fail ((o == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (o, G_TYPE_OBJECT));
+       g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (r, g_async_result_get_type ()));
+       _vala_assert (IFOO_GET_INTERFACE (G_TYPE_CHECK_INSTANCE_CAST (_data1_->foo, TYPE_IFOO, 
IFoo))->manam_finish (G_TYPE_CHECK_INSTANCE_CAST (_data1_->foo, TYPE_IFOO, IFoo), r) == 42, "foo.manam.end 
(r) == 42");
+       _tmp0_ = loop;
+       g_main_loop_quit (_tmp0_);
+}
+
+static void
+___lambda5__gasync_ready_callback (GObject* source_object,
+                                   GAsyncResult* res,
+                                   gpointer self)
+{
+       __lambda5_ (self, source_object, res);
+       block1_data_unref (self);
+}
+
+static void
+_vala_main (void)
+{
+       Block1Data* _data1_;
+       GMainLoop* _tmp0_;
+       Foo* _tmp1_;
+       GMainLoop* _tmp2_;
+       _data1_ = g_slice_new0 (Block1Data);
+       _data1_->_ref_count_ = 1;
+       _tmp0_ = g_main_loop_new (NULL, FALSE);
+       _g_main_loop_unref0 (loop);
+       loop = _tmp0_;
+       _tmp1_ = foo_new ();
+       _data1_->foo = _tmp1_;
+       FOO_GET_CLASS (_data1_->foo)->bar (_data1_->foo, ___lambda4__gasync_ready_callback, block1_data_ref 
(_data1_));
+       IFOO_GET_INTERFACE (G_TYPE_CHECK_INSTANCE_CAST (_data1_->foo, TYPE_IFOO, IFoo))->manam 
(G_TYPE_CHECK_INSTANCE_CAST (_data1_->foo, TYPE_IFOO, IFoo), ___lambda5__gasync_ready_callback, 
block1_data_ref (_data1_));
+       _tmp2_ = loop;
+       g_main_loop_run (_tmp2_);
+       block1_data_unref (_data1_);
+       _data1_ = NULL;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/asynchronous/out-parameter-free-on-error.c-expected 
b/tests/asynchronous/out-parameter-free-on-error.c-expected
new file mode 100644
index 000000000..a23907d98
--- /dev/null
+++ b/tests/asynchronous/out-parameter-free-on-error.c-expected
@@ -0,0 +1,364 @@
+/* asynchronous_out_parameter_free_on_error.c generated by valac, the Vala compiler
+ * generated from asynchronous_out_parameter_free_on_error.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gio/gio.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_MANAM (manam_get_type ())
+#define MANAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MANAM, Manam))
+#define MANAM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MANAM, ManamClass))
+#define IS_MANAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MANAM))
+#define IS_MANAM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MANAM))
+#define MANAM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MANAM, ManamClass))
+
+typedef struct _Manam Manam;
+typedef struct _ManamClass ManamClass;
+typedef struct _ManamPrivate ManamPrivate;
+enum  {
+       MANAM_0_PROPERTY,
+       MANAM_NUM_PROPERTIES
+};
+static GParamSpec* manam_properties[MANAM_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+typedef struct _FooAsyncData FooAsyncData;
+typedef struct _RunData RunData;
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+typedef enum  {
+       FOO_ERROR_FAIL
+} FooError;
+#define FOO_ERROR foo_error_quark ()
+struct _Manam {
+       GObject parent_instance;
+       ManamPrivate * priv;
+};
+
+struct _ManamClass {
+       GObjectClass parent_class;
+};
+
+struct _FooAsyncData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Manam* i;
+       Manam* o;
+       Manam* _tmp0_;
+       GError* _tmp1_;
+       GError* _inner_error0_;
+};
+
+struct _RunData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Manam* manam;
+       Manam* _tmp0_;
+       Manam* minim;
+       Manam* _tmp1_;
+       GMainLoop* _tmp2_;
+       GError* _inner_error0_;
+};
+
+static gpointer manam_parent_class = NULL;
+VALA_EXTERN GMainLoop* loop;
+GMainLoop* loop = NULL;
+
+VALA_EXTERN GQuark foo_error_quark (void);
+VALA_EXTERN GType manam_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Manam, g_object_unref)
+VALA_EXTERN Manam* manam_new (void);
+VALA_EXTERN Manam* manam_construct (GType object_type);
+static GType manam_get_type_once (void);
+static void foo_async_data_free (gpointer _data);
+VALA_EXTERN void foo_async (Manam* i,
+                GAsyncReadyCallback _callback_,
+                gpointer _user_data_);
+VALA_EXTERN void foo_finish (GAsyncResult* _res_,
+                 Manam* * o,
+                 GError** error);
+static gboolean foo_async_co (FooAsyncData* _data_);
+static void run_data_free (gpointer _data);
+VALA_EXTERN void run (GAsyncReadyCallback _callback_,
+          gpointer _user_data_);
+VALA_EXTERN void run_finish (GAsyncResult* _res_);
+static gboolean run_co (RunData* _data_);
+static void run_ready (GObject* source_object,
+                GAsyncResult* _res_,
+                gpointer _user_data_);
+static void _vala_main (void);
+
+GQuark
+foo_error_quark (void)
+{
+       return g_quark_from_static_string ("foo-error-quark");
+}
+
+Manam*
+manam_construct (GType object_type)
+{
+       Manam * self = NULL;
+       self = (Manam*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Manam*
+manam_new (void)
+{
+       return manam_construct (TYPE_MANAM);
+}
+
+static void
+manam_class_init (ManamClass * klass,
+                  gpointer klass_data)
+{
+       manam_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+manam_instance_init (Manam * self,
+                     gpointer klass)
+{
+}
+
+static GType
+manam_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (ManamClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) manam_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Manam), 
0, (GInstanceInitFunc) manam_instance_init, NULL };
+       GType manam_type_id;
+       manam_type_id = g_type_register_static (G_TYPE_OBJECT, "Manam", &g_define_type_info, 0);
+       return manam_type_id;
+}
+
+GType
+manam_get_type (void)
+{
+       static volatile gsize manam_type_id__volatile = 0;
+       if (g_once_init_enter (&manam_type_id__volatile)) {
+               GType manam_type_id;
+               manam_type_id = manam_get_type_once ();
+               g_once_init_leave (&manam_type_id__volatile, manam_type_id);
+       }
+       return manam_type_id__volatile;
+}
+
+static void
+foo_async_data_free (gpointer _data)
+{
+       FooAsyncData* _data_;
+       _data_ = _data;
+       _g_object_unref0 (_data_->i);
+       g_slice_free (FooAsyncData, _data_);
+}
+
+static gpointer
+_g_object_ref0 (gpointer self)
+{
+       return self ? g_object_ref (self) : NULL;
+}
+
+void
+foo_async (Manam* i,
+           GAsyncReadyCallback _callback_,
+           gpointer _user_data_)
+{
+       FooAsyncData* _data_;
+       Manam* _tmp0_;
+       g_return_if_fail (IS_MANAM (i));
+       _data_ = g_slice_new0 (FooAsyncData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, foo_async_data_free);
+       _tmp0_ = _g_object_ref0 (i);
+       _g_object_unref0 (_data_->i);
+       _data_->i = _tmp0_;
+       foo_async_co (_data_);
+}
+
+void
+foo_finish (GAsyncResult* _res_,
+            Manam* * o,
+            GError** error)
+{
+       FooAsyncData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), error);
+       if (NULL == _data_) {
+               return;
+       }
+       if (o) {
+               *o = _data_->o;
+       } else {
+               _g_object_unref0 (_data_->o);
+       }
+       _data_->o = NULL;
+}
+
+static gboolean
+foo_async_co (FooAsyncData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->_tmp0_ = _g_object_ref0 (_data_->i);
+       _g_object_unref0 (_data_->o);
+       _data_->o = _data_->_tmp0_;
+       _data_->_tmp1_ = g_error_new_literal (FOO_ERROR, FOO_ERROR_FAIL, "foo");
+       _data_->_inner_error0_ = _data_->_tmp1_;
+       if (_data_->_inner_error0_->domain == FOO_ERROR) {
+               g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
+               _g_object_unref0 (_data_->o);
+               g_object_unref (_data_->_async_result);
+               return FALSE;
+       } else {
+               _g_object_unref0 (_data_->o);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), 
_data_->_inner_error0_->code);
+               g_clear_error (&_data_->_inner_error0_);
+               g_object_unref (_data_->_async_result);
+               return FALSE;
+       }
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+run_data_free (gpointer _data)
+{
+       RunData* _data_;
+       _data_ = _data;
+       g_slice_free (RunData, _data_);
+}
+
+void
+run (GAsyncReadyCallback _callback_,
+     gpointer _user_data_)
+{
+       RunData* _data_;
+       _data_ = g_slice_new0 (RunData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, run_data_free);
+       run_co (_data_);
+}
+
+void
+run_finish (GAsyncResult* _res_)
+{
+       RunData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static void
+run_ready (GObject* source_object,
+           GAsyncResult* _res_,
+           gpointer _user_data_)
+{
+       RunData* _data_;
+       _data_ = _user_data_;
+       _data_->_source_object_ = source_object;
+       _data_->_res_ = _res_;
+       run_co (_data_);
+}
+
+static gboolean
+run_co (RunData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               case 1:
+               goto _state_1;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->_tmp0_ = manam_new ();
+       _data_->manam = _data_->_tmp0_;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_data_->manam, G_TYPE_OBJECT, GObject)->ref_count == 
((guint) 1), "manam.ref_count == 1");
+       {
+               _data_->_tmp1_ = NULL;
+               _data_->_state_ = 1;
+               foo_async (_data_->manam, run_ready, _data_);
+               return FALSE;
+               _state_1:
+               foo_finish (_data_->_res_, &_data_->_tmp1_, &_data_->_inner_error0_);
+               _g_object_unref0 (_data_->minim);
+               _data_->minim = _data_->_tmp1_;
+               if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+                       _g_object_unref0 (_data_->minim);
+                       goto __catch0_g_error;
+               }
+               _g_object_unref0 (_data_->minim);
+       }
+       goto __finally0;
+       __catch0_g_error:
+       {
+               g_clear_error (&_data_->_inner_error0_);
+       }
+       __finally0:
+       if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+               _g_object_unref0 (_data_->manam);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), 
_data_->_inner_error0_->code);
+               g_clear_error (&_data_->_inner_error0_);
+               g_object_unref (_data_->_async_result);
+               return FALSE;
+       }
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_data_->manam, G_TYPE_OBJECT, GObject)->ref_count == 
((guint) 2), "manam.ref_count == 2");
+       _data_->_tmp2_ = loop;
+       g_main_loop_quit (_data_->_tmp2_);
+       _g_object_unref0 (_data_->manam);
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+_vala_main (void)
+{
+       GMainLoop* _tmp0_;
+       GMainLoop* _tmp1_;
+       _tmp0_ = g_main_loop_new (NULL, FALSE);
+       _g_main_loop_unref0 (loop);
+       loop = _tmp0_;
+       run (NULL, NULL);
+       _tmp1_ = loop;
+       g_main_loop_run (_tmp1_);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/asynchronous/result-pos.c-expected b/tests/asynchronous/result-pos.c-expected
new file mode 100644
index 000000000..0875b0cd8
--- /dev/null
+++ b/tests/asynchronous/result-pos.c-expected
@@ -0,0 +1,385 @@
+/* asynchronous_result_pos.c generated by valac, the Vala compiler
+ * generated from asynchronous_result_pos.vala, do not modify */
+
+#include <gio/gio.h>
+#include <glib.h>
+#include <glib-object.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef struct _FooData FooData;
+typedef struct _BarData BarData;
+typedef struct _RunData RunData;
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _FooData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       gint in_i;
+       gint out_i;
+};
+
+struct _BarData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       gint in_i;
+       gint out_i;
+};
+
+struct _RunData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       gint i;
+       gint _tmp0_;
+       gint _tmp1_;
+       GMainLoop* _tmp2_;
+       GError* _inner_error0_;
+};
+
+VALA_EXTERN GMainLoop* loop;
+GMainLoop* loop = NULL;
+
+static void foo_data_free (gpointer _data);
+VALA_EXTERN void foo (gint in_i,
+          GAsyncReadyCallback _callback_,
+          gpointer _user_data_);
+VALA_EXTERN void foo_finish (gint* out_i,
+                 GAsyncResult* _res_);
+static gboolean foo_co (FooData* _data_);
+static void bar_data_free (gpointer _data);
+VALA_EXTERN void bar (gint in_i,
+          GAsyncReadyCallback _callback_,
+          gpointer _user_data_);
+VALA_EXTERN void bar_finish (gint* out_i,
+                 GAsyncResult* _res_,
+                 GError** error);
+static gboolean bar_co (BarData* _data_);
+static void run_data_free (gpointer _data);
+VALA_EXTERN void run (GAsyncReadyCallback _callback_,
+          gpointer _user_data_);
+VALA_EXTERN void run_finish (GAsyncResult* _res_);
+static gboolean run_co (RunData* _data_);
+static void run_ready (GObject* source_object,
+                GAsyncResult* _res_,
+                gpointer _user_data_);
+static void _vala_main (void);
+static void __lambda4_ (GObject* o,
+                 GAsyncResult* r);
+static void ___lambda4__gasync_ready_callback (GObject* source_object,
+                                        GAsyncResult* res,
+                                        gpointer self);
+static void __lambda5_ (GObject* o,
+                 GAsyncResult* r);
+static void ___lambda5__gasync_ready_callback (GObject* source_object,
+                                        GAsyncResult* res,
+                                        gpointer self);
+
+static void
+foo_data_free (gpointer _data)
+{
+       FooData* _data_;
+       _data_ = _data;
+       g_slice_free (FooData, _data_);
+}
+
+void
+foo (gint in_i,
+     GAsyncReadyCallback _callback_,
+     gpointer _user_data_)
+{
+       FooData* _data_;
+       _data_ = g_slice_new0 (FooData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, foo_data_free);
+       _data_->in_i = in_i;
+       foo_co (_data_);
+}
+
+void
+foo_finish (gint* out_i,
+            GAsyncResult* _res_)
+{
+       FooData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+       if (out_i) {
+               *out_i = _data_->out_i;
+       }
+}
+
+static gboolean
+foo_co (FooData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->out_i = _data_->in_i;
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+bar_data_free (gpointer _data)
+{
+       BarData* _data_;
+       _data_ = _data;
+       g_slice_free (BarData, _data_);
+}
+
+void
+bar (gint in_i,
+     GAsyncReadyCallback _callback_,
+     gpointer _user_data_)
+{
+       BarData* _data_;
+       _data_ = g_slice_new0 (BarData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, bar_data_free);
+       _data_->in_i = in_i;
+       bar_co (_data_);
+}
+
+void
+bar_finish (gint* out_i,
+            GAsyncResult* _res_,
+            GError** error)
+{
+       BarData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), error);
+       if (NULL == _data_) {
+               return;
+       }
+       if (out_i) {
+               *out_i = _data_->out_i;
+       }
+}
+
+static gboolean
+bar_co (BarData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->out_i = _data_->in_i;
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+run_data_free (gpointer _data)
+{
+       RunData* _data_;
+       _data_ = _data;
+       g_slice_free (RunData, _data_);
+}
+
+void
+run (GAsyncReadyCallback _callback_,
+     gpointer _user_data_)
+{
+       RunData* _data_;
+       _data_ = g_slice_new0 (RunData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, run_data_free);
+       run_co (_data_);
+}
+
+void
+run_finish (GAsyncResult* _res_)
+{
+       RunData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static void
+run_ready (GObject* source_object,
+           GAsyncResult* _res_,
+           gpointer _user_data_)
+{
+       RunData* _data_;
+       _data_ = _user_data_;
+       _data_->_source_object_ = source_object;
+       _data_->_res_ = _res_;
+       run_co (_data_);
+}
+
+static gboolean
+run_co (RunData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               case 1:
+               goto _state_1;
+               case 2:
+               goto _state_2;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->_tmp0_ = 0;
+       _data_->_state_ = 1;
+       foo (323, run_ready, _data_);
+       return FALSE;
+       _state_1:
+       foo_finish (&_data_->_tmp0_, _data_->_res_);
+       _data_->i = _data_->_tmp0_;
+       _vala_assert (_data_->i == 323, "i == 323");
+       {
+               _data_->_tmp1_ = 0;
+               _data_->_state_ = 2;
+               bar (742, run_ready, _data_);
+               return FALSE;
+               _state_2:
+               bar_finish (&_data_->_tmp1_, _data_->_res_, &_data_->_inner_error0_);
+               _data_->i = _data_->_tmp1_;
+               if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+                       goto __catch0_g_error;
+               }
+               _vala_assert (_data_->i == 742, "i == 742");
+       }
+       goto __finally0;
+       __catch0_g_error:
+       {
+               g_clear_error (&_data_->_inner_error0_);
+               g_assert_not_reached ();
+       }
+       __finally0:
+       if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), 
_data_->_inner_error0_->code);
+               g_clear_error (&_data_->_inner_error0_);
+               g_object_unref (_data_->_async_result);
+               return FALSE;
+       }
+       _data_->_tmp2_ = loop;
+       g_main_loop_quit (_data_->_tmp2_);
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+__lambda4_ (GObject* o,
+            GAsyncResult* r)
+{
+       gint i = 0;
+       gint _tmp0_ = 0;
+       g_return_if_fail ((o == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (o, G_TYPE_OBJECT));
+       g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (r, g_async_result_get_type ()));
+       foo_finish (&_tmp0_, r);
+       i = _tmp0_;
+       _vala_assert (i == 23, "i == 23");
+}
+
+static void
+___lambda4__gasync_ready_callback (GObject* source_object,
+                                   GAsyncResult* res,
+                                   gpointer self)
+{
+       __lambda4_ (source_object, res);
+}
+
+static void
+__lambda5_ (GObject* o,
+            GAsyncResult* r)
+{
+       GError* _inner_error0_ = NULL;
+       g_return_if_fail ((o == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (o, G_TYPE_OBJECT));
+       g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (r, g_async_result_get_type ()));
+       {
+               gint i = 0;
+               gint _tmp0_ = 0;
+               bar_finish (&_tmp0_, r, &_inner_error0_);
+               i = _tmp0_;
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       goto __catch0_g_error;
+               }
+               _vala_assert (i == 42, "i == 42");
+       }
+       goto __finally0;
+       __catch0_g_error:
+       {
+               g_clear_error (&_inner_error0_);
+               g_assert_not_reached ();
+       }
+       __finally0:
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+}
+
+static void
+___lambda5__gasync_ready_callback (GObject* source_object,
+                                   GAsyncResult* res,
+                                   gpointer self)
+{
+       __lambda5_ (source_object, res);
+}
+
+static void
+_vala_main (void)
+{
+       GMainLoop* _tmp0_;
+       GMainLoop* _tmp1_;
+       _tmp0_ = g_main_loop_new (NULL, FALSE);
+       _g_main_loop_unref0 (loop);
+       loop = _tmp0_;
+       foo (23, ___lambda4__gasync_ready_callback, NULL);
+       bar (42, ___lambda5__gasync_ready_callback, NULL);
+       run (NULL, NULL);
+       _tmp1_ = loop;
+       g_main_loop_run (_tmp1_);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/asynchronous/yield.c-expected b/tests/asynchronous/yield.c-expected
new file mode 100644
index 000000000..993fdbc33
--- /dev/null
+++ b/tests/asynchronous/yield.c-expected
@@ -0,0 +1,98 @@
+/* asynchronous_yield.c generated by valac, the Vala compiler
+ * generated from asynchronous_yield.vala, do not modify */
+
+#include <gio/gio.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef struct _FooData FooData;
+
+struct _FooData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+};
+
+static void foo_data_free (gpointer _data);
+VALA_EXTERN void foo (GAsyncReadyCallback _callback_,
+          gpointer _user_data_);
+VALA_EXTERN void foo_finish (GAsyncResult* _res_);
+static gboolean foo_co (FooData* _data_);
+static void _vala_main (void);
+
+static void
+foo_data_free (gpointer _data)
+{
+       FooData* _data_;
+       _data_ = _data;
+       g_slice_free (FooData, _data_);
+}
+
+void
+foo (GAsyncReadyCallback _callback_,
+     gpointer _user_data_)
+{
+       FooData* _data_;
+       _data_ = g_slice_new0 (FooData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, foo_data_free);
+       foo_co (_data_);
+}
+
+void
+foo_finish (GAsyncResult* _res_)
+{
+       FooData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static gboolean
+foo_co (FooData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               case 1:
+               goto _state_1;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       while (TRUE) {
+               _data_->_state_ = 1;
+               return FALSE;
+               _state_1:
+               ;
+       }
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/basic-types/array-uint8-uchar-compat.c-expected 
b/tests/basic-types/array-uint8-uchar-compat.c-expected
new file mode 100644
index 000000000..1321a5c30
--- /dev/null
+++ b/tests/basic-types/array-uint8-uchar-compat.c-expected
@@ -0,0 +1,186 @@
+/* basic_types_array_uint8_uchar_compat.c generated by valac, the Vala compiler
+ * generated from basic_types_array_uint8_uchar_compat.vala, do not modify */
+
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN guchar* data;
+guchar* data = NULL;
+VALA_EXTERN guint8* data2;
+guint8* data2 = NULL;
+
+VALA_EXTERN guchar* get_buffer (void);
+VALA_EXTERN void change_buffer (guint8* data);
+VALA_EXTERN guint8* get_buffer2 (void);
+VALA_EXTERN void change_buffer2 (guchar* data);
+static void _vala_main (void);
+
+guchar*
+get_buffer (void)
+{
+       guchar* _tmp0_;
+       gint _tmp0__length1;
+       guchar* result = NULL;
+       _tmp0_ = data;
+       _tmp0__length1 = -1;
+       result = _tmp0_;
+       return result;
+}
+
+void
+change_buffer (guint8* data)
+{
+       data[0] = (guint8) 98;
+       data[1] = (guint8) 97;
+       data[2] = (guint8) 114;
+}
+
+guint8*
+get_buffer2 (void)
+{
+       guint8* _tmp0_;
+       gint _tmp0__length1;
+       guint8* result = NULL;
+       _tmp0_ = data2;
+       _tmp0__length1 = -1;
+       result = _tmp0_;
+       return result;
+}
+
+void
+change_buffer2 (guchar* data)
+{
+       data[0] = (guchar) 'b';
+       data[1] = (guchar) 'a';
+       data[2] = (guchar) 'z';
+}
+
+static void
+_vala_main (void)
+{
+       {
+               guchar* _tmp0_;
+               guint8* _tmp1_;
+               guchar* _tmp2_;
+               gint _tmp2__length1;
+               guchar* _tmp3_;
+               guchar* _tmp4_;
+               gint _tmp4__length1;
+               guint8* _tmp5_;
+               guint8* _tmp6_;
+               gint _tmp6__length1;
+               guchar* _tmp7_;
+               gint _tmp7__length1;
+               guint8* _tmp8_;
+               gint _tmp8__length1;
+               _tmp0_ = g_new0 (guchar, 5);
+               _tmp0_[0] = (guchar) 'f';
+               _tmp0_[1] = (guchar) 'o';
+               _tmp0_[2] = (guchar) 'o';
+               _tmp0_[3] = (guchar) '\n';
+               _tmp0_[4] = (guchar) '\0';
+               data = (g_free (data), NULL);
+               data = _tmp0_;
+               _tmp1_ = g_new0 (guint8, 5);
+               _tmp1_[0] = (guint8) 102;
+               _tmp1_[1] = (guint8) 111;
+               _tmp1_[2] = (guint8) 111;
+               _tmp1_[3] = (guint8) 10;
+               _tmp1_[4] = (guint8) 0;
+               data2 = (g_free (data2), NULL);
+               data2 = _tmp1_;
+               _tmp2_ = data;
+               _tmp2__length1 = -1;
+               _vala_assert (g_strcmp0 ("foo\n", (const gchar*) _tmp2_) == 0, "\"foo\\n\" == (string) data");
+               _tmp3_ = get_buffer ();
+               change_buffer (_tmp3_);
+               _tmp4_ = data;
+               _tmp4__length1 = -1;
+               _vala_assert (g_strcmp0 ("bar\n", (const gchar*) _tmp4_) == 0, "\"bar\\n\" == (string) data");
+               _tmp5_ = get_buffer2 ();
+               change_buffer (_tmp5_);
+               _tmp6_ = data2;
+               _tmp6__length1 = -1;
+               _vala_assert (g_strcmp0 ("bar\n", (const gchar*) _tmp6_) == 0, "\"bar\\n\" == (string) 
data2");
+               _tmp7_ = data;
+               _tmp7__length1 = -1;
+               _tmp8_ = data2;
+               _tmp8__length1 = -1;
+               _vala_assert (g_strcmp0 ((const gchar*) _tmp7_, (const gchar*) _tmp8_) == 0, "(string) data 
== (string) data2");
+       }
+       {
+               guchar* _tmp9_;
+               guint8* _tmp10_;
+               guint8* _tmp11_;
+               gint _tmp11__length1;
+               guint8* _tmp12_;
+               guint8* _tmp13_;
+               gint _tmp13__length1;
+               guchar* _tmp14_;
+               guchar* _tmp15_;
+               gint _tmp15__length1;
+               guchar* _tmp16_;
+               gint _tmp16__length1;
+               guint8* _tmp17_;
+               gint _tmp17__length1;
+               _tmp9_ = g_new0 (guchar, 5);
+               _tmp9_[0] = (guchar) 'f';
+               _tmp9_[1] = (guchar) 'o';
+               _tmp9_[2] = (guchar) 'o';
+               _tmp9_[3] = (guchar) '\n';
+               _tmp9_[4] = (guchar) '\0';
+               data = (g_free (data), NULL);
+               data = _tmp9_;
+               _tmp10_ = g_new0 (guint8, 5);
+               _tmp10_[0] = (guint8) 102;
+               _tmp10_[1] = (guint8) 111;
+               _tmp10_[2] = (guint8) 111;
+               _tmp10_[3] = (guint8) 10;
+               _tmp10_[4] = (guint8) 0;
+               data2 = (g_free (data2), NULL);
+               data2 = _tmp10_;
+               _tmp11_ = data2;
+               _tmp11__length1 = -1;
+               _vala_assert (g_strcmp0 ("foo\n", (const gchar*) _tmp11_) == 0, "\"foo\\n\" == (string) 
data2");
+               _tmp12_ = get_buffer2 ();
+               change_buffer2 (_tmp12_);
+               _tmp13_ = data2;
+               _tmp13__length1 = -1;
+               _vala_assert (g_strcmp0 ("baz\n", (const gchar*) _tmp13_) == 0, "\"baz\\n\" == (string) 
data2");
+               _tmp14_ = get_buffer ();
+               change_buffer2 (_tmp14_);
+               _tmp15_ = data;
+               _tmp15__length1 = -1;
+               _vala_assert (g_strcmp0 ("baz\n", (const gchar*) _tmp15_) == 0, "\"baz\\n\" == (string) 
data");
+               _tmp16_ = data;
+               _tmp16__length1 = -1;
+               _tmp17_ = data2;
+               _tmp17__length1 = -1;
+               _vala_assert (g_strcmp0 ((const gchar*) _tmp16_, (const gchar*) _tmp17_) == 0, "(string) data 
== (string) data2");
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/basic-types/arrays-fixed-assignment.c-expected 
b/tests/basic-types/arrays-fixed-assignment.c-expected
new file mode 100644
index 000000000..fac6d616f
--- /dev/null
+++ b/tests/basic-types/arrays-fixed-assignment.c-expected
@@ -0,0 +1,146 @@
+/* basic_types_arrays_fixed_assignment.c generated by valac, the Vala compiler
+ * generated from basic_types_arrays_fixed_assignment.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN gchar* foo[3];
+gchar* foo[3] = {0};
+
+static void _vala_main (void);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static void
+_vala_main (void)
+{
+       {
+       }
+       {
+               gchar* _tmp0_;
+               gchar* _tmp1_;
+               gchar* _tmp2_;
+               gchar* _tmp3_[3] = {0};
+               const gchar* _tmp4_;
+               _tmp0_ = g_strdup ("foo");
+               _tmp1_ = g_strdup ("bar");
+               _tmp2_ = g_strdup ("baz");
+               _tmp3_[0] = _tmp0_;
+               _tmp3_[1] = _tmp1_;
+               _tmp3_[2] = _tmp2_;
+               _vala_array_destroy (foo, 3, (GDestroyNotify) g_free);
+               memcpy (foo, _tmp3_, 3 * sizeof (gchar*));
+               _tmp4_ = foo[1];
+               _vala_assert (g_strcmp0 (_tmp4_, "bar") == 0, "foo[1] == \"bar\"");
+       }
+       {
+               gchar* _tmp5_;
+               gchar* _tmp6_;
+               gchar* _tmp7_;
+               gchar* _tmp8_[3] = {0};
+               const gchar* _tmp9_;
+               _tmp5_ = g_strdup ("foo");
+               _tmp6_ = g_strdup ("bar");
+               _tmp7_ = g_strdup ("baz");
+               _tmp8_[0] = _tmp5_;
+               _tmp8_[1] = _tmp6_;
+               _tmp8_[2] = _tmp7_;
+               _vala_array_destroy (foo, 3, (GDestroyNotify) g_free);
+               memcpy (foo, _tmp8_, 3 * sizeof (gchar*));
+               _tmp9_ = foo[1];
+               _vala_assert (g_strcmp0 (_tmp9_, "bar") == 0, "foo[1] == \"bar\"");
+       }
+       {
+               gchar* bar[3] = {0};
+               _vala_array_destroy (bar, 3, (GDestroyNotify) g_free);
+       }
+       {
+               gchar* bar[3] = {0};
+               gchar* _tmp10_;
+               gchar* _tmp11_;
+               gchar* _tmp12_;
+               gchar* _tmp13_[3] = {0};
+               const gchar* _tmp14_;
+               _tmp10_ = g_strdup ("foo");
+               _tmp11_ = g_strdup ("bar");
+               _tmp12_ = g_strdup ("baz");
+               _tmp13_[0] = _tmp10_;
+               _tmp13_[1] = _tmp11_;
+               _tmp13_[2] = _tmp12_;
+               memcpy (bar, _tmp13_, 3 * sizeof (gchar*));
+               _tmp14_ = bar[1];
+               _vala_assert (g_strcmp0 (_tmp14_, "bar") == 0, "bar[1] == \"bar\"");
+               _vala_array_destroy (bar, 3, (GDestroyNotify) g_free);
+       }
+       {
+               gchar* bar[3] = {0};
+               gchar* _tmp15_;
+               gchar* _tmp16_;
+               gchar* _tmp17_;
+               gchar* _tmp18_[3] = {0};
+               const gchar* _tmp19_;
+               _tmp15_ = g_strdup ("foo");
+               _tmp16_ = g_strdup ("bar");
+               _tmp17_ = g_strdup ("baz");
+               _tmp18_[0] = _tmp15_;
+               _tmp18_[1] = _tmp16_;
+               _tmp18_[2] = _tmp17_;
+               memcpy (bar, _tmp18_, 3 * sizeof (gchar*));
+               _tmp19_ = bar[1];
+               _vala_assert (g_strcmp0 (_tmp19_, "bar") == 0, "bar[1] == \"bar\"");
+               _vala_array_destroy (bar, 3, (GDestroyNotify) g_free);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/basic-types/arrays-generics.c-expected b/tests/basic-types/arrays-generics.c-expected
new file mode 100644
index 000000000..577faa096
--- /dev/null
+++ b/tests/basic-types/arrays-generics.c-expected
@@ -0,0 +1,489 @@
+/* basic_types_arrays_generics.c generated by valac, the Vala compiler
+ * generated from basic_types_arrays_generics.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_BAZ (baz_get_type ())
+#define BAZ(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAZ, Baz))
+#define BAZ_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAZ, BazClass))
+#define IS_BAZ(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAZ))
+#define IS_BAZ_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAZ))
+#define BAZ_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAZ, BazClass))
+
+typedef struct _Baz Baz;
+typedef struct _BazClass BazClass;
+typedef struct _BazPrivate BazPrivate;
+enum  {
+       BAZ_0_PROPERTY,
+       BAZ_NUM_PROPERTIES
+};
+static GParamSpec* baz_properties[BAZ_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Baz {
+       GObject parent_instance;
+       BazPrivate * priv;
+};
+
+struct _BazClass {
+       GObjectClass parent_class;
+};
+
+static gpointer baz_parent_class = NULL;
+
+VALA_EXTERN GType baz_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Baz, g_object_unref)
+VALA_EXTERN Baz* baz_new (void);
+VALA_EXTERN Baz* baz_construct (GType object_type);
+static Baz* baz_get_object (Baz* self);
+VALA_EXTERN Baz** baz_create_array (Baz* self,
+                        gint* result_length1);
+static gpointer* baz_get_array (Baz* self,
+                         GType t_type,
+                         GBoxedCopyFunc t_dup_func,
+                         GDestroyNotify t_destroy_func,
+                         gint* result_length1);
+static void _vala_array_add1 (Baz** * array,
+                       gint* length,
+                       gint* size,
+                       Baz* value);
+static gboolean _vala_baz_array_contains (Baz* * stack,
+                                   gssize stack_length,
+                                   const Baz* needle);
+VALA_EXTERN gpointer* baz_create_array2 (Baz* self,
+                             GType v_type,
+                             GBoxedCopyFunc v_dup_func,
+                             GDestroyNotify v_destroy_func,
+                             gint* result_length1);
+static gpointer* baz_get_array2 (Baz* self,
+                          GType g_type,
+                          GBoxedCopyFunc g_dup_func,
+                          GDestroyNotify g_destroy_func,
+                          gint* result_length1);
+static void _vala_array_add2 (gpointer* * array,
+                       gint* length,
+                       gint* size,
+                       gpointer value);
+static gboolean _vala_valageneric_array_contains (gpointer * stack,
+                                           gssize stack_length,
+                                           const gpointer needle);
+static void _vala_array_add3 (gpointer* * array,
+                       gint* length,
+                       gint* size,
+                       gpointer value);
+static void _vala_array_add4 (gpointer* * array,
+                       gint* length,
+                       gint* size,
+                       gpointer value);
+static void _vala_array_add5 (gpointer* * array,
+                       gint* length,
+                       gint* size,
+                       gpointer value);
+static GType baz_get_type_once (void);
+VALA_EXTERN void test_generics_array (void);
+static void _vala_main (void);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+Baz*
+baz_construct (GType object_type)
+{
+       Baz * self = NULL;
+       self = (Baz*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Baz*
+baz_new (void)
+{
+       return baz_construct (TYPE_BAZ);
+}
+
+static Baz*
+baz_get_object (Baz* self)
+{
+       Baz* _tmp0_;
+       Baz* result = NULL;
+       g_return_val_if_fail (IS_BAZ (self), NULL);
+       _tmp0_ = baz_new ();
+       result = _tmp0_;
+       return result;
+}
+
+static void
+_vala_array_add1 (Baz** * array,
+                  gint* length,
+                  gint* size,
+                  Baz* value)
+{
+       if ((*length) == (*size)) {
+               *size = (*size) ? (2 * (*size)) : 4;
+               *array = g_renew (Baz*, *array, (*size) + 1);
+       }
+       (*array)[(*length)++] = value;
+       (*array)[*length] = NULL;
+}
+
+static gboolean
+_vala_baz_array_contains (Baz* * stack,
+                          gssize stack_length,
+                          const Baz* needle)
+{
+       gssize i;
+       for (i = 0; i < stack_length; i++) {
+               if (needle == stack[i]) {
+                       return TRUE;
+               }
+       }
+       return FALSE;
+}
+
+Baz**
+baz_create_array (Baz* self,
+                  gint* result_length1)
+{
+       Baz** a = NULL;
+       gint _tmp0_ = 0;
+       gpointer* _tmp1_;
+       gint a_length1;
+       gint _a_size_;
+       Baz* _tmp2_;
+       Baz** _tmp3_;
+       gint _tmp3__length1;
+       Baz* _tmp4_;
+       Baz* _tmp5_;
+       Baz** _tmp6_;
+       gint _tmp6__length1;
+       Baz** _tmp7_;
+       gint _tmp7__length1;
+       Baz** result = NULL;
+       g_return_val_if_fail (IS_BAZ (self), NULL);
+       _tmp1_ = baz_get_array (self, TYPE_BAZ, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) 
g_object_unref, &_tmp0_);
+       a = _tmp1_;
+       a_length1 = _tmp0_;
+       _a_size_ = a_length1;
+       _tmp2_ = baz_get_object (self);
+       _vala_array_add1 (&a, &a_length1, &_a_size_, G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, TYPE_BAZ, Baz));
+       _tmp3_ = a;
+       _tmp3__length1 = a_length1;
+       _vala_assert (_tmp3__length1 == 2, "a.length == 2");
+       _tmp4_ = baz_get_object (self);
+       _tmp5_ = _tmp4_;
+       _tmp6_ = a;
+       _tmp6__length1 = a_length1;
+       _vala_assert (!_vala_baz_array_contains (_tmp6_, _tmp6__length1, _tmp5_), "!(get_object () in a)");
+       _g_object_unref0 (_tmp5_);
+       _tmp7_ = a;
+       _tmp7__length1 = a_length1;
+       if (result_length1) {
+               *result_length1 = _tmp7__length1;
+       }
+       result = _tmp7_;
+       return result;
+}
+
+static void
+_vala_array_add2 (gpointer* * array,
+                  gint* length,
+                  gint* size,
+                  gpointer value)
+{
+       if ((*length) == (*size)) {
+               *size = (*size) ? (2 * (*size)) : 4;
+               *array = g_renew (gpointer, *array, (*size) + 1);
+       }
+       (*array)[(*length)++] = value;
+       (*array)[*length] = NULL;
+}
+
+static gboolean
+_vala_valageneric_array_contains (gpointer * stack,
+                                  gssize stack_length,
+                                  const gpointer needle)
+{
+       gssize i;
+       for (i = 0; i < stack_length; i++) {
+               if (needle == stack[i]) {
+                       return TRUE;
+               }
+       }
+       return FALSE;
+}
+
+gpointer*
+baz_create_array2 (Baz* self,
+                   GType v_type,
+                   GBoxedCopyFunc v_dup_func,
+                   GDestroyNotify v_destroy_func,
+                   gint* result_length1)
+{
+       gpointer* a = NULL;
+       gint _tmp0_ = 0;
+       gpointer* _tmp1_;
+       gint a_length1;
+       gint _a_size_;
+       Baz* _tmp2_;
+       gpointer* _tmp3_;
+       gint _tmp3__length1;
+       Baz* _tmp4_;
+       Baz* _tmp5_;
+       gpointer* _tmp6_;
+       gint _tmp6__length1;
+       gpointer* _tmp7_;
+       gint _tmp7__length1;
+       gpointer* result = NULL;
+       g_return_val_if_fail (IS_BAZ (self), NULL);
+       _tmp1_ = baz_get_array2 (self, v_type, (GBoxedCopyFunc) v_dup_func, (GDestroyNotify) v_destroy_func, 
&_tmp0_);
+       a = _tmp1_;
+       a_length1 = _tmp0_;
+       _a_size_ = a_length1;
+       _tmp2_ = baz_get_object (self);
+       _vala_array_add2 (&a, &a_length1, &_a_size_, (gpointer) _tmp2_);
+       _tmp3_ = a;
+       _tmp3__length1 = a_length1;
+       _vala_assert (_tmp3__length1 == 3, "a.length == 3");
+       _tmp4_ = baz_get_object (self);
+       _tmp5_ = _tmp4_;
+       _tmp6_ = a;
+       _tmp6__length1 = a_length1;
+       _vala_assert (!_vala_valageneric_array_contains (_tmp6_, _tmp6__length1, _tmp5_), "!(get_object () in 
a)");
+       _g_object_unref0 (_tmp5_);
+       _tmp7_ = a;
+       _tmp7__length1 = a_length1;
+       if (result_length1) {
+               *result_length1 = _tmp7__length1;
+       }
+       result = _tmp7_;
+       return result;
+}
+
+static void
+_vala_array_add3 (gpointer* * array,
+                  gint* length,
+                  gint* size,
+                  gpointer value)
+{
+       if ((*length) == (*size)) {
+               *size = (*size) ? (2 * (*size)) : 4;
+               *array = g_renew (gpointer, *array, (*size) + 1);
+       }
+       (*array)[(*length)++] = value;
+       (*array)[*length] = NULL;
+}
+
+static gpointer*
+baz_get_array (Baz* self,
+               GType t_type,
+               GBoxedCopyFunc t_dup_func,
+               GDestroyNotify t_destroy_func,
+               gint* result_length1)
+{
+       gpointer* a = NULL;
+       gpointer* _tmp0_;
+       gint a_length1;
+       gint _a_size_;
+       Baz* _tmp1_;
+       gpointer* _tmp2_;
+       gint _tmp2__length1;
+       gpointer* result = NULL;
+       g_return_val_if_fail (IS_BAZ (self), NULL);
+       _tmp0_ = g_new0 (gpointer, 0);
+       a = _tmp0_;
+       a_length1 = 0;
+       _a_size_ = a_length1;
+       _tmp1_ = baz_get_object (self);
+       _vala_array_add3 (&a, &a_length1, &_a_size_, (gpointer) _tmp1_);
+       _tmp2_ = a;
+       _tmp2__length1 = a_length1;
+       if (result_length1) {
+               *result_length1 = _tmp2__length1;
+       }
+       result = _tmp2_;
+       return result;
+}
+
+static void
+_vala_array_add4 (gpointer* * array,
+                  gint* length,
+                  gint* size,
+                  gpointer value)
+{
+       if ((*length) == (*size)) {
+               *size = (*size) ? (2 * (*size)) : 4;
+               *array = g_renew (gpointer, *array, (*size) + 1);
+       }
+       (*array)[(*length)++] = value;
+       (*array)[*length] = NULL;
+}
+
+static void
+_vala_array_add5 (gpointer* * array,
+                  gint* length,
+                  gint* size,
+                  gpointer value)
+{
+       if ((*length) == (*size)) {
+               *size = (*size) ? (2 * (*size)) : 4;
+               *array = g_renew (gpointer, *array, (*size) + 1);
+       }
+       (*array)[(*length)++] = value;
+       (*array)[*length] = NULL;
+}
+
+static gpointer*
+baz_get_array2 (Baz* self,
+                GType g_type,
+                GBoxedCopyFunc g_dup_func,
+                GDestroyNotify g_destroy_func,
+                gint* result_length1)
+{
+       gpointer* a = NULL;
+       gpointer* _tmp0_;
+       gint a_length1;
+       gint _a_size_;
+       Baz* _tmp1_;
+       Baz* _tmp2_;
+       gpointer* _tmp3_;
+       gint _tmp3__length1;
+       gpointer* result = NULL;
+       g_return_val_if_fail (IS_BAZ (self), NULL);
+       _tmp0_ = g_new0 (gpointer, 0);
+       a = _tmp0_;
+       a_length1 = 0;
+       _a_size_ = a_length1;
+       _tmp1_ = baz_get_object (self);
+       _vala_array_add4 (&a, &a_length1, &_a_size_, (gpointer) _tmp1_);
+       _tmp2_ = baz_get_object (self);
+       _vala_array_add5 (&a, &a_length1, &_a_size_, (gpointer) _tmp2_);
+       _tmp3_ = a;
+       _tmp3__length1 = a_length1;
+       if (result_length1) {
+               *result_length1 = _tmp3__length1;
+       }
+       result = _tmp3_;
+       return result;
+}
+
+static void
+baz_class_init (BazClass * klass,
+                gpointer klass_data)
+{
+       baz_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+baz_instance_init (Baz * self,
+                   gpointer klass)
+{
+}
+
+static GType
+baz_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BazClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) baz_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Baz), 0, 
(GInstanceInitFunc) baz_instance_init, NULL };
+       GType baz_type_id;
+       baz_type_id = g_type_register_static (G_TYPE_OBJECT, "Baz", &g_define_type_info, 0);
+       return baz_type_id;
+}
+
+GType
+baz_get_type (void)
+{
+       static volatile gsize baz_type_id__volatile = 0;
+       if (g_once_init_enter (&baz_type_id__volatile)) {
+               GType baz_type_id;
+               baz_type_id = baz_get_type_once ();
+               g_once_init_leave (&baz_type_id__volatile, baz_type_id);
+       }
+       return baz_type_id__volatile;
+}
+
+void
+test_generics_array (void)
+{
+       Baz* g = NULL;
+       Baz* _tmp0_;
+       Baz** a = NULL;
+       gint _tmp1_ = 0;
+       Baz** _tmp2_;
+       gint a_length1;
+       gint _a_size_;
+       Baz** b = NULL;
+       gint _tmp3_ = 0;
+       gpointer* _tmp4_;
+       gint b_length1;
+       gint _b_size_;
+       _tmp0_ = baz_new ();
+       g = _tmp0_;
+       _tmp2_ = baz_create_array (g, &_tmp1_);
+       a = _tmp2_;
+       a_length1 = _tmp1_;
+       _a_size_ = a_length1;
+       _vala_assert (a_length1 == 2, "a.length == 2");
+       _tmp4_ = baz_create_array2 (g, TYPE_BAZ, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) 
g_object_unref, &_tmp3_);
+       b = _tmp4_;
+       b_length1 = _tmp3_;
+       _b_size_ = b_length1;
+       _vala_assert (b_length1 == 3, "b.length == 3");
+       b = (_vala_array_free (b, b_length1, (GDestroyNotify) g_object_unref), NULL);
+       a = (_vala_array_free (a, a_length1, (GDestroyNotify) g_object_unref), NULL);
+       _g_object_unref0 (g);
+}
+
+static void
+_vala_main (void)
+{
+       test_generics_array ();
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/basic-types/arrays.c-expected b/tests/basic-types/arrays.c-expected
new file mode 100644
index 000000000..e760db8c1
--- /dev/null
+++ b/tests/basic-types/arrays.c-expected
@@ -0,0 +1,1699 @@
+/* basic_types_arrays.c generated by valac, the Vala compiler
+ * generated from basic_types_arrays.vala, do not modify */
+
+#include <glib.h>
+#include <string.h>
+#include <stdlib.h>
+#include <glib-object.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _g_free0(var) ((var == NULL) ? NULL : (var = (g_free (var), NULL)))
+typedef gint (*SimpleFunc) (void);
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+
+#define TYPE_BAR (bar_get_type ())
+typedef struct _Bar Bar;
+
+#define TYPE_MANAM (manam_get_type ())
+typedef struct _Manam Manam;
+#define _manam_free0(var) ((var == NULL) ? NULL : (var = (manam_free (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       const gchar* array[2];
+       gint bar;
+};
+
+struct _Bar {
+       gint bar;
+};
+
+struct _Manam {
+       Bar array[1024];
+       Bar manam;
+};
+
+VALA_EXTERN gint* foo;
+gint* foo = NULL;
+VALA_EXTERN gint* bar;
+gint* bar = NULL;
+VALA_EXTERN SimpleFunc* simple_delegates;
+VALA_EXTERN gint simple_delegates_length1;
+SimpleFunc* simple_delegates = NULL;
+gint simple_delegates_length1 = 0;
+static gint _simple_delegates_size_ = 0;
+
+VALA_EXTERN void test_integer_array (void);
+static gint* _vala_array_dup1 (gint* self,
+                        gssize length);
+static void _vala_array_add1 (gint* * array,
+                       gint* length,
+                       gint* size,
+                       gint value);
+static gint* _vala_array_dup2 (gint* self,
+                        gssize length);
+static gint* _vala_array_dup3 (gint* self,
+                        gssize length);
+static gint* _vala_array_dup4 (gint* self,
+                        gssize length);
+static gint* _vala_array_dup5 (gint* self,
+                        gssize length);
+static gint* _vala_array_dup6 (gint* self,
+                        gssize length);
+static gboolean _vala_int_array_contains (gint * stack,
+                                   gssize stack_length,
+                                   const gint needle);
+static gint* _int_dup (gint* self);
+static gboolean _int_equal (const gint * s1,
+                     const gint * s2);
+VALA_EXTERN void test_string_array (void);
+static gchar** _vala_array_dup7 (gchar** self,
+                          gssize length);
+VALA_EXTERN gint* pass_helper (gint* a,
+                   gint a_length1,
+                   gint** b,
+                   gint* b_length1,
+                   gint* result_length1);
+static gint* _vala_array_dup8 (gint* self,
+                        gssize length);
+VALA_EXTERN void test_array_pass (void);
+#define FOO 2
+VALA_EXTERN void test_static_array (void);
+VALA_EXTERN void test_reference_transfer (void);
+VALA_EXTERN void test_length_assignment (void);
+VALA_EXTERN void test_inline_array (void);
+VALA_EXTERN gint* nd_array_pass (gint* a,
+                     gint a_length1,
+                     gint a_length2,
+                     gint a_length3,
+                     gint** b,
+                     gint* b_length1,
+                     gint* b_length2,
+                     gint* b_length3,
+                     gint* result_length1,
+                     gint* result_length2,
+                     gint* result_length3);
+static gint* _vala_array_dup9 (gint* self,
+                        gssize length);
+static gint* _vala_array_dup10 (gint* self,
+                         gssize length);
+VALA_EXTERN void test_nd_array (void);
+VALA_EXTERN gint simple_func (void);
+VALA_EXTERN void test_delegate_array (void);
+static void _vala_array_add2 (SimpleFunc* * array,
+                       gint* length,
+                       gint* size,
+                       SimpleFunc value);
+static gboolean _vala_simple_func_array_contains (SimpleFunc * stack,
+                                           gssize stack_length,
+                                           const SimpleFunc needle);
+VALA_EXTERN void test_void_array (void);
+static void _vala_array_add3 (void** * array,
+                       gint* length,
+                       gint* size,
+                       void* value);
+static void _vala_array_add4 (void** * array,
+                       gint* length,
+                       gint* size,
+                       void* value);
+static gboolean _vala_valavoid_array_contains (void* * stack,
+                                        gssize stack_length,
+                                        const void* needle);
+VALA_EXTERN void test_explicit_copying (void);
+static gint* _vala_array_dup11 (gint* self,
+                         gssize length);
+VALA_EXTERN void test_array_move (void);
+VALA_EXTERN void test_array_resize (void);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Bar* bar_dup (const Bar* self);
+VALA_EXTERN void bar_free (Bar* self);
+VALA_EXTERN GType manam_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Manam* manam_dup (const Manam* self);
+VALA_EXTERN void manam_free (Manam* self);
+VALA_EXTERN void test_struct_array (void);
+static gboolean _bar_equal (const Bar * s1,
+                     const Bar * s2);
+static gboolean _vala_bar_array_contains (Bar * stack,
+                                   gssize stack_length,
+                                   const Bar * needle);
+VALA_EXTERN void give_fixed_array (gint** i);
+VALA_EXTERN void take_fixed_array (gint* i);
+VALA_EXTERN void change_fixed_array (gint** i);
+VALA_EXTERN void test_fixed_array (void);
+static void _vala_main (void);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+static void _vala_array_move (gpointer array,
+                       gsize element_size,
+                       gssize src,
+                       gssize dest,
+                       gssize length);
+static gssize _vala_array_length (gpointer array);
+static inline gpointer _vala_memdup2 (gconstpointer mem,
+                        gsize byte_size);
+
+const Foo FOO_ARRAY_CONST[1] = {{{"foo", "bar"}, 42}};
+
+static gint*
+_vala_array_dup1 (gint* self,
+                  gssize length)
+{
+       if (length > 0) {
+               return _vala_memdup2 (self, length * sizeof (gint));
+       }
+       return NULL;
+}
+
+static void
+_vala_array_add1 (gint* * array,
+                  gint* length,
+                  gint* size,
+                  gint value)
+{
+       if ((*length) == (*size)) {
+               *size = (*size) ? (2 * (*size)) : 4;
+               *array = g_renew (gint, *array, *size);
+       }
+       (*array)[(*length)++] = value;
+}
+
+static gint*
+_vala_array_dup2 (gint* self,
+                  gssize length)
+{
+       if (length > 0) {
+               return _vala_memdup2 (self, length * sizeof (gint));
+       }
+       return NULL;
+}
+
+static gint*
+_vala_array_dup3 (gint* self,
+                  gssize length)
+{
+       if (length > 0) {
+               return _vala_memdup2 (self, length * sizeof (gint));
+       }
+       return NULL;
+}
+
+static gint*
+_vala_array_dup4 (gint* self,
+                  gssize length)
+{
+       if (length > 0) {
+               return _vala_memdup2 (self, length * sizeof (gint));
+       }
+       return NULL;
+}
+
+static gint*
+_vala_array_dup5 (gint* self,
+                  gssize length)
+{
+       if (length > 0) {
+               return _vala_memdup2 (self, length * sizeof (gint));
+       }
+       return NULL;
+}
+
+static gint*
+_vala_array_dup6 (gint* self,
+                  gssize length)
+{
+       if (length > 0) {
+               return _vala_memdup2 (self, length * sizeof (gint));
+       }
+       return NULL;
+}
+
+static gboolean
+_vala_int_array_contains (gint * stack,
+                          gssize stack_length,
+                          const gint needle)
+{
+       gssize i;
+       for (i = 0; i < stack_length; i++) {
+               if (needle == stack[i]) {
+                       return TRUE;
+               }
+       }
+       return FALSE;
+}
+
+static gint*
+_int_dup (gint* self)
+{
+       gint* dup;
+       dup = g_new0 (gint, 1);
+       memcpy (dup, self, sizeof (gint));
+       return dup;
+}
+
+static gpointer
+__int_dup0 (gpointer self)
+{
+       return self ? _int_dup (self) : NULL;
+}
+
+static gboolean
+_int_equal (const gint * s1,
+            const gint * s2)
+{
+       if (s1 == s2) {
+               return TRUE;
+       }
+       if (s1 == NULL) {
+               return FALSE;
+       }
+       if (s2 == NULL) {
+               return FALSE;
+       }
+       return (*s1) == (*s2);
+}
+
+void
+test_integer_array (void)
+{
+       gint* a = NULL;
+       gint* _tmp0_;
+       gint a_length1;
+       gint _a_size_;
+       gint* _tmp1_;
+       gint _tmp1__length1;
+       gint* _tmp2_;
+       gint _tmp2__length1;
+       gint _tmp3_;
+       gint* _tmp4_;
+       gint* _tmp5_;
+       gint _tmp5__length1;
+       gint* _tmp6_;
+       gint _tmp6__length1;
+       gint _tmp7_;
+       gint* _tmp8_;
+       gint _tmp8__length1;
+       gint _tmp9_;
+       gint* b = NULL;
+       gint* _tmp10_;
+       gint _tmp10__length1;
+       gint* _tmp11_;
+       gint _tmp11__length1;
+       gint b_length1;
+       gint _b_size_;
+       gint _tmp12_;
+       gint _tmp13_;
+       gint* _tmp14_;
+       gint _tmp14__length1;
+       gint* _tmp15_;
+       gint _tmp15__length1;
+       gint _tmp16_;
+       gint* _tmp17_;
+       gint _tmp17__length1;
+       gint _tmp18_;
+       gint* _tmp19_;
+       gint _tmp19__length1;
+       gint _tmp20_;
+       gint _tmp21_;
+       gint _tmp22_;
+       gint* c = NULL;
+       gint* _tmp23_;
+       gint _tmp23__length1;
+       gint* _tmp24_;
+       gint _tmp24__length1;
+       gint c_length1;
+       gint _c_size_;
+       gint _tmp25_;
+       gint _tmp26_;
+       gint* c0 = NULL;
+       gint* _tmp27_;
+       gint _tmp27__length1;
+       gint* _tmp28_;
+       gint _tmp28__length1;
+       gint c0_length1;
+       gint _c0_size_;
+       gint* c1 = NULL;
+       gint* _tmp29_;
+       gint _tmp29__length1;
+       gint* _tmp30_;
+       gint _tmp30__length1;
+       gint* _tmp31_;
+       gint _tmp31__length1;
+       gint c1_length1;
+       gint _c1_size_;
+       gint _tmp32_;
+       gint _tmp33_;
+       gint* c2 = NULL;
+       gint* _tmp34_;
+       gint _tmp34__length1;
+       gint* _tmp35_;
+       gint _tmp35__length1;
+       gint c2_length1;
+       gint _c2_size_;
+       gint _tmp36_;
+       gint _tmp37_;
+       gint* c3 = NULL;
+       gint* _tmp38_;
+       gint _tmp38__length1;
+       gint* _tmp39_;
+       gint _tmp39__length1;
+       gint* _tmp40_;
+       gint _tmp40__length1;
+       gint c3_length1;
+       gint _c3_size_;
+       gint _tmp41_;
+       gint _tmp42_;
+       gint _tmp43_;
+       gint* _tmp44_;
+       gint _tmp44__length1;
+       gint* _tmp45_;
+       gint _tmp45__length1;
+       gint** d = NULL;
+       gint** _tmp46_;
+       gint d_length1;
+       gint _d_size_;
+       gint _tmp47_;
+       gint* _tmp48_;
+       gint* _tmp49_;
+       gint _tmp50_;
+       gint* _tmp51_;
+       gint* e = NULL;
+       gint* _tmp52_;
+       gint e_length1;
+       gint _e_size_;
+       gint _tmp53_;
+       gint _tmp54_;
+       gint _tmp55_;
+       gint _tmp56_;
+       gint _tmp57_;
+       _tmp0_ = g_new0 (gint, 1);
+       _tmp0_[0] = 42;
+       a = _tmp0_;
+       a_length1 = 1;
+       _a_size_ = a_length1;
+       _tmp1_ = a;
+       _tmp1__length1 = a_length1;
+       _vala_assert (_tmp1__length1 == 1, "a.length == 1");
+       _tmp2_ = a;
+       _tmp2__length1 = a_length1;
+       _tmp3_ = _tmp2_[0];
+       _vala_assert (_tmp3_ == 42, "a[0] == 42");
+       _tmp4_ = g_new0 (gint, 2);
+       _tmp4_[0] = 42;
+       _tmp4_[1] = 23;
+       a = (g_free (a), NULL);
+       a = _tmp4_;
+       a_length1 = 2;
+       _a_size_ = a_length1;
+       _tmp5_ = a;
+       _tmp5__length1 = a_length1;
+       _vala_assert (_tmp5__length1 == 2, "a.length == 2");
+       _tmp6_ = a;
+       _tmp6__length1 = a_length1;
+       _tmp7_ = _tmp6_[0];
+       _vala_assert (_tmp7_ == 42, "a[0] == 42");
+       _tmp8_ = a;
+       _tmp8__length1 = a_length1;
+       _tmp9_ = _tmp8_[1];
+       _vala_assert (_tmp9_ == 23, "a[1] == 23");
+       _tmp10_ = a;
+       _tmp10__length1 = a_length1;
+       _tmp11_ = (_tmp10_ != NULL) ? _vala_array_dup1 (_tmp10_, _tmp10__length1) : _tmp10_;
+       _tmp11__length1 = _tmp10__length1;
+       b = _tmp11_;
+       b_length1 = _tmp11__length1;
+       _b_size_ = b_length1;
+       _vala_assert (b_length1 == 2, "b.length == 2");
+       _tmp12_ = b[0];
+       _vala_assert (_tmp12_ == 42, "b[0] == 42");
+       _tmp13_ = b[1];
+       _vala_assert (_tmp13_ == 23, "b[1] == 23");
+       _vala_array_add1 (&a, &a_length1, &_a_size_, 11);
+       _tmp14_ = a;
+       _tmp14__length1 = a_length1;
+       _vala_assert (_tmp14__length1 == 3, "a.length == 3");
+       _tmp15_ = a;
+       _tmp15__length1 = a_length1;
+       _tmp16_ = _tmp15_[0];
+       _vala_assert (_tmp16_ == 42, "a[0] == 42");
+       _tmp17_ = a;
+       _tmp17__length1 = a_length1;
+       _tmp18_ = _tmp17_[1];
+       _vala_assert (_tmp18_ == 23, "a[1] == 23");
+       _tmp19_ = a;
+       _tmp19__length1 = a_length1;
+       _tmp20_ = _tmp19_[2];
+       _vala_assert (_tmp20_ == 11, "a[2] == 11");
+       _vala_assert (b_length1 == 2, "b.length == 2");
+       _tmp21_ = b[0];
+       _vala_assert (_tmp21_ == 42, "b[0] == 42");
+       _tmp22_ = b[1];
+       _vala_assert (_tmp22_ == 23, "b[1] == 23");
+       _tmp23_ = a;
+       _tmp23__length1 = a_length1;
+       _tmp24_ = ((_tmp23_ + 1) != NULL) ? _vala_array_dup2 (_tmp23_ + 1, 3 - 1) : (_tmp23_ + 1);
+       _tmp24__length1 = 3 - 1;
+       c = _tmp24_;
+       c_length1 = _tmp24__length1;
+       _c_size_ = c_length1;
+       _vala_assert (c_length1 == 2, "c.length == 2");
+       _tmp25_ = c[0];
+       _vala_assert (_tmp25_ == 23, "c[0] == 23");
+       _tmp26_ = c[1];
+       _vala_assert (_tmp26_ == 11, "c[1] == 11");
+       _tmp27_ = a;
+       _tmp27__length1 = a_length1;
+       _tmp28_ = ((_tmp27_ + 0) != NULL) ? _vala_array_dup3 (_tmp27_ + 0, 0 - 0) : (_tmp27_ + 0);
+       _tmp28__length1 = 0 - 0;
+       c0 = _tmp28_;
+       c0_length1 = _tmp28__length1;
+       _c0_size_ = c0_length1;
+       _vala_assert (c0 == NULL, "c0 == null");
+       _vala_assert (c0_length1 == 0, "c0.length == 0");
+       _tmp29_ = a;
+       _tmp29__length1 = a_length1;
+       _tmp30_ = a;
+       _tmp30__length1 = a_length1;
+       _tmp31_ = ((_tmp30_ + 1) != NULL) ? _vala_array_dup4 (_tmp30_ + 1, _tmp30__length1 - 1) : (_tmp30_ + 
1);
+       _tmp31__length1 = _tmp30__length1 - 1;
+       c1 = _tmp31_;
+       c1_length1 = _tmp31__length1;
+       _c1_size_ = c1_length1;
+       _vala_assert (c1_length1 == 2, "c1.length == 2");
+       _tmp32_ = c1[0];
+       _vala_assert (_tmp32_ == 23, "c1[0] == 23");
+       _tmp33_ = c1[1];
+       _vala_assert (_tmp33_ == 11, "c1[1] == 11");
+       _tmp34_ = a;
+       _tmp34__length1 = a_length1;
+       _tmp35_ = ((_tmp34_ + 0) != NULL) ? _vala_array_dup5 (_tmp34_ + 0, 2 - 0) : (_tmp34_ + 0);
+       _tmp35__length1 = 2 - 0;
+       c2 = _tmp35_;
+       c2_length1 = _tmp35__length1;
+       _c2_size_ = c2_length1;
+       _vala_assert (c2_length1 == 2, "c2.length == 2");
+       _tmp36_ = c2[0];
+       _vala_assert (_tmp36_ == 42, "c2[0] == 42");
+       _tmp37_ = c2[1];
+       _vala_assert (_tmp37_ == 23, "c2[1] == 23");
+       _tmp38_ = a;
+       _tmp38__length1 = a_length1;
+       _tmp39_ = a;
+       _tmp39__length1 = a_length1;
+       _tmp40_ = ((_tmp39_ + 0) != NULL) ? _vala_array_dup6 (_tmp39_ + 0, _tmp39__length1 - 0) : (_tmp39_ + 
0);
+       _tmp40__length1 = _tmp39__length1 - 0;
+       c3 = _tmp40_;
+       c3_length1 = _tmp40__length1;
+       _c3_size_ = c3_length1;
+       _vala_assert (c3_length1 == 3, "c3.length == 3");
+       _tmp41_ = c3[0];
+       _vala_assert (_tmp41_ == 42, "c3[0] == 42");
+       _tmp42_ = c3[1];
+       _vala_assert (_tmp42_ == 23, "c3[1] == 23");
+       _tmp43_ = c3[2];
+       _vala_assert (_tmp43_ == 11, "c3[2] == 11");
+       _tmp44_ = a;
+       _tmp44__length1 = a_length1;
+       _vala_assert (_vala_int_array_contains (_tmp44_, _tmp44__length1, 23), "23 in a");
+       _tmp45_ = a;
+       _tmp45__length1 = a_length1;
+       _vala_assert (!_vala_int_array_contains (_tmp45_, _tmp45__length1, -1), "!(-1 in a)");
+       _tmp46_ = g_new0 (gint*, 2);
+       d = _tmp46_;
+       d_length1 = 2;
+       _d_size_ = d_length1;
+       _tmp47_ = 10;
+       _tmp48_ = __int_dup0 (&_tmp47_);
+       _g_free0 (d[0]);
+       d[0] = _tmp48_;
+       _g_free0 (d[1]);
+       d[1] = NULL;
+       _tmp49_ = d[0];
+       _tmp50_ = 10;
+       _vala_assert (_int_equal (_tmp49_, &_tmp50_) == TRUE, "d[0] == 10");
+       _tmp51_ = d[1];
+       _vala_assert (_tmp51_ == NULL, "d[1] == null");
+       _tmp52_ = g_new0 (gint, 2);
+       _tmp52_[0] = 13;
+       _tmp52_[1] = 47;
+       e = _tmp52_;
+       e_length1 = 2;
+       _e_size_ = e_length1;
+       e[0] = 96;
+       _tmp53_ = e[0];
+       _vala_assert (_tmp53_ == 96, "e[0] == 96");
+       e[0] /= 24;
+       _tmp54_ = e[0];
+       _vala_assert (_tmp54_ == 4, "e[0] == 4");
+       e[0] += 2;
+       _tmp55_ = e[0];
+       _vala_assert (_tmp55_ == 6, "e[0] == 6");
+       e[0] *= 4;
+       _tmp56_ = e[0];
+       _vala_assert (_tmp56_ == 24, "e[0] == 24");
+       e[0] -= 23;
+       _tmp57_ = e[0];
+       _vala_assert (_tmp57_ == 1, "e[0] == 1");
+       e = (g_free (e), NULL);
+       d = (_vala_array_free (d, d_length1, (GDestroyNotify) g_free), NULL);
+       c3 = (g_free (c3), NULL);
+       c2 = (g_free (c2), NULL);
+       c1 = (g_free (c1), NULL);
+       c0 = (g_free (c0), NULL);
+       c = (g_free (c), NULL);
+       b = (g_free (b), NULL);
+       a = (g_free (a), NULL);
+}
+
+static gchar**
+_vala_array_dup7 (gchar** self,
+                  gssize length)
+{
+       if (length >= 0) {
+               gchar** result;
+               gssize i;
+               result = g_new0 (gchar*, length + 1);
+               for (i = 0; i < length; i++) {
+                       gchar* _tmp0_;
+                       _tmp0_ = g_strdup (self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+void
+test_string_array (void)
+{
+       gchar** a = NULL;
+       gchar* _tmp0_;
+       gchar** _tmp1_;
+       gint a_length1;
+       gint _a_size_;
+       gchar** _tmp2_;
+       gint _tmp2__length1;
+       gchar** _tmp3_;
+       gint _tmp3__length1;
+       const gchar* _tmp4_;
+       gchar* _tmp5_;
+       gchar* _tmp6_;
+       gchar** _tmp7_;
+       gchar** _tmp8_;
+       gint _tmp8__length1;
+       gchar** _tmp9_;
+       gint _tmp9__length1;
+       const gchar* _tmp10_;
+       gchar** _tmp11_;
+       gint _tmp11__length1;
+       const gchar* _tmp12_;
+       gchar** b = NULL;
+       gchar** _tmp13_;
+       gint _tmp13__length1;
+       gchar** _tmp14_;
+       gint _tmp14__length1;
+       gint b_length1;
+       gint _b_size_;
+       const gchar* _tmp15_;
+       const gchar* _tmp16_;
+       _tmp0_ = g_strdup ("hello");
+       _tmp1_ = g_new0 (gchar*, 1 + 1);
+       _tmp1_[0] = _tmp0_;
+       a = _tmp1_;
+       a_length1 = 1;
+       _a_size_ = a_length1;
+       _tmp2_ = a;
+       _tmp2__length1 = a_length1;
+       _vala_assert (_tmp2__length1 == 1, "a.length == 1");
+       _tmp3_ = a;
+       _tmp3__length1 = a_length1;
+       _tmp4_ = _tmp3_[0];
+       _vala_assert (g_strcmp0 (_tmp4_, "hello") == 0, "a[0] == \"hello\"");
+       _tmp5_ = g_strdup ("hello");
+       _tmp6_ = g_strdup ("world");
+       _tmp7_ = g_new0 (gchar*, 2 + 1);
+       _tmp7_[0] = _tmp5_;
+       _tmp7_[1] = _tmp6_;
+       a = (_vala_array_free (a, a_length1, (GDestroyNotify) g_free), NULL);
+       a = _tmp7_;
+       a_length1 = 2;
+       _a_size_ = a_length1;
+       _tmp8_ = a;
+       _tmp8__length1 = a_length1;
+       _vala_assert (_tmp8__length1 == 2, "a.length == 2");
+       _tmp9_ = a;
+       _tmp9__length1 = a_length1;
+       _tmp10_ = _tmp9_[0];
+       _vala_assert (g_strcmp0 (_tmp10_, "hello") == 0, "a[0] == \"hello\"");
+       _tmp11_ = a;
+       _tmp11__length1 = a_length1;
+       _tmp12_ = _tmp11_[1];
+       _vala_assert (g_strcmp0 (_tmp12_, "world") == 0, "a[1] == \"world\"");
+       _tmp13_ = a;
+       _tmp13__length1 = a_length1;
+       _tmp14_ = (_tmp13_ != NULL) ? _vala_array_dup7 (_tmp13_, _tmp13__length1) : _tmp13_;
+       _tmp14__length1 = _tmp13__length1;
+       b = _tmp14_;
+       b_length1 = _tmp14__length1;
+       _b_size_ = b_length1;
+       _vala_assert (b_length1 == 2, "b.length == 2");
+       _tmp15_ = b[0];
+       _vala_assert (g_strcmp0 (_tmp15_, "hello") == 0, "b[0] == \"hello\"");
+       _tmp16_ = b[1];
+       _vala_assert (g_strcmp0 (_tmp16_, "world") == 0, "b[1] == \"world\"");
+       b = (_vala_array_free (b, b_length1, (GDestroyNotify) g_free), NULL);
+       a = (_vala_array_free (a, a_length1, (GDestroyNotify) g_free), NULL);
+}
+
+static gint*
+_vala_array_dup8 (gint* self,
+                  gssize length)
+{
+       if (length > 0) {
+               return _vala_memdup2 (self, length * sizeof (gint));
+       }
+       return NULL;
+}
+
+gint*
+pass_helper (gint* a,
+             gint a_length1,
+             gint** b,
+             gint* b_length1,
+             gint* result_length1)
+{
+       gint* _vala_b = NULL;
+       gint _vala_b_length1 = 0;
+       gint* _tmp0_;
+       gint _tmp0__length1;
+       gint* _tmp1_;
+       gint* _tmp2_;
+       gint _tmp2__length1;
+       gint* result = NULL;
+       _tmp0_ = (a != NULL) ? _vala_array_dup8 (a, a_length1) : a;
+       _tmp0__length1 = a_length1;
+       _vala_b = (g_free (_vala_b), NULL);
+       _vala_b = _tmp0_;
+       _vala_b_length1 = _tmp0__length1;
+       _tmp1_ = g_new0 (gint, 2);
+       _tmp1_[0] = 42;
+       _tmp1_[1] = 23;
+       _tmp2_ = _tmp1_;
+       _tmp2__length1 = 2;
+       if (result_length1) {
+               *result_length1 = _tmp2__length1;
+       }
+       result = _tmp2_;
+       if (b) {
+               *b = _vala_b;
+       } else {
+               _vala_b = (g_free (_vala_b), NULL);
+       }
+       if (b_length1) {
+               *b_length1 = _vala_b_length1;
+       }
+       return result;
+}
+
+void
+test_array_pass (void)
+{
+       gint* a = NULL;
+       gint a_length1 = 0;
+       gint _a_size_ = 0;
+       gint* b = NULL;
+       gint b_length1 = 0;
+       gint _b_size_ = 0;
+       gint* _tmp0_;
+       gint* _tmp1_;
+       gint _tmp1__length1;
+       gint* _tmp2_ = NULL;
+       gint _tmp3_ = 0;
+       gint _tmp4_ = 0;
+       gint* _tmp5_;
+       gint _tmp6_;
+       gint _tmp7_;
+       gint _tmp8_;
+       _tmp0_ = g_new0 (gint, 1);
+       _tmp0_[0] = 42;
+       _tmp1_ = _tmp0_;
+       _tmp1__length1 = 1;
+       _tmp5_ = pass_helper (_tmp1_, (gint) 1, &_tmp2_, &_tmp3_, &_tmp4_);
+       b = (g_free (b), NULL);
+       b = _tmp2_;
+       b_length1 = _tmp3_;
+       _b_size_ = b_length1;
+       a = (g_free (a), NULL);
+       a = _tmp5_;
+       a_length1 = _tmp4_;
+       _a_size_ = a_length1;
+       _tmp1_ = (g_free (_tmp1_), NULL);
+       _vala_assert (a_length1 == 2, "a.length == 2");
+       _tmp6_ = a[0];
+       _vala_assert (_tmp6_ == 42, "a[0] == 42");
+       _tmp7_ = a[1];
+       _vala_assert (_tmp7_ == 23, "a[1] == 23");
+       _vala_assert (b_length1 == 1, "b.length == 1");
+       _tmp8_ = b[0];
+       _vala_assert (_tmp8_ == 42, "b[0] == 42");
+       b = (g_free (b), NULL);
+       a = (g_free (a), NULL);
+}
+
+void
+test_static_array (void)
+{
+       gint a[2] = {0};
+       gint _tmp0_;
+       gint _tmp1_[2] = {0};
+       gboolean _tmp2_ = FALSE;
+       gint _tmp3_;
+       gint b[(FOO * 1) << 3];
+       _vala_assert (2 == 2, "a.length == 2");
+       a[1] = 23;
+       _tmp0_ = a[1];
+       _vala_assert (_tmp0_ == 23, "a[1] == 23");
+       _tmp1_[0] = 23;
+       _tmp1_[1] = 34;
+       memcpy (a, _tmp1_, 2 * sizeof (gint));
+       _tmp3_ = a[0];
+       if (_tmp3_ == 23) {
+               gint _tmp4_;
+               _tmp4_ = a[1];
+               _tmp2_ = _tmp4_ == 34;
+       } else {
+               _tmp2_ = FALSE;
+       }
+       _vala_assert (_tmp2_, "a[0] == 23 && a[1] == 34");
+       memset (b, 0, ((FOO * 1) << 3) * sizeof (gint));
+       _vala_assert (((FOO * 1) << 3) == ((FOO * 1) << 3), "b.length == FOO * 1 << 3");
+}
+
+void
+test_reference_transfer (void)
+{
+       gint* baz = NULL;
+       gint* _tmp0_;
+       gint _tmp0__length1;
+       gint baz_length1;
+       gint _baz_size_;
+       gint* _tmp1_;
+       gint _tmp1__length1;
+       gchar** data = NULL;
+       gchar* _tmp2_;
+       gchar** _tmp3_;
+       gint data_length1;
+       gint _data_size_;
+       gchar** data2 = NULL;
+       gchar** _tmp4_;
+       gint _tmp4__length1;
+       gint data2_length1;
+       gint _data2_size_;
+       gchar** _tmp5_;
+       gint _tmp5__length1;
+       _tmp0_ = foo;
+       _tmp0__length1 = _vala_array_length (foo);
+       foo = NULL;
+       baz = _tmp0_;
+       baz_length1 = _tmp0__length1;
+       _baz_size_ = baz_length1;
+       _tmp1_ = bar;
+       _tmp1__length1 = -1;
+       bar = NULL;
+       baz = (g_free (baz), NULL);
+       baz = _tmp1_;
+       baz_length1 = _tmp1__length1;
+       _baz_size_ = baz_length1;
+       _tmp2_ = g_strdup ("foo");
+       _tmp3_ = g_new0 (gchar*, 1 + 1);
+       _tmp3_[0] = _tmp2_;
+       data = _tmp3_;
+       data_length1 = 1;
+       _data_size_ = data_length1;
+       _tmp4_ = data;
+       _tmp4__length1 = data_length1;
+       data = NULL;
+       data_length1 = 0;
+       data2 = _tmp4_;
+       data2_length1 = _tmp4__length1;
+       _data2_size_ = data2_length1;
+       _tmp5_ = data;
+       _tmp5__length1 = data_length1;
+       _vala_assert (_tmp5__length1 == 0, "data.length == 0");
+       data2 = (_vala_array_free (data2, data2_length1, (GDestroyNotify) g_free), NULL);
+       data = (_vala_array_free (data, data_length1, (GDestroyNotify) g_free), NULL);
+       baz = (g_free (baz), NULL);
+}
+
+void
+test_length_assignment (void)
+{
+       gint* a = NULL;
+       gint* _tmp0_;
+       gint a_length1;
+       gint _a_size_;
+       gint* b = NULL;
+       gint* _tmp1_;
+       gint b_length1;
+       gint b_length2;
+       gint _tmp2_;
+       _tmp0_ = g_new0 (gint, 10);
+       a = _tmp0_;
+       a_length1 = 10;
+       _a_size_ = a_length1;
+       _tmp1_ = g_new0 (gint, 20 * 30);
+       b = _tmp1_;
+       b_length1 = 20;
+       b_length2 = 30;
+       a_length1 = 8;
+       b_length1 = 5;
+       _vala_assert (a_length1 == 8, "a.length == 8");
+       _tmp2_ = b_length1;
+       _vala_assert (_tmp2_ == 5, "b.length[0] == 5");
+       b = (g_free (b), NULL);
+       a = (g_free (a), NULL);
+}
+
+void
+test_inline_array (void)
+{
+       static const gint a[3] = {1, 2, 3};
+       _vala_assert (_vala_int_array_contains (a, G_N_ELEMENTS (a), 1), "1 in a");
+}
+
+static gint*
+_vala_array_dup9 (gint* self,
+                  gssize length)
+{
+       if (length > 0) {
+               return _vala_memdup2 (self, length * sizeof (gint));
+       }
+       return NULL;
+}
+
+static gint*
+_vala_array_dup10 (gint* self,
+                   gssize length)
+{
+       if (length > 0) {
+               return _vala_memdup2 (self, length * sizeof (gint));
+       }
+       return NULL;
+}
+
+gint*
+nd_array_pass (gint* a,
+               gint a_length1,
+               gint a_length2,
+               gint a_length3,
+               gint** b,
+               gint* b_length1,
+               gint* b_length2,
+               gint* b_length3,
+               gint* result_length1,
+               gint* result_length2,
+               gint* result_length3)
+{
+       gint* _vala_b = NULL;
+       gint _vala_b_length1 = 0;
+       gint _vala_b_length2 = 0;
+       gint _vala_b_length3 = 0;
+       gint _tmp0_;
+       gint _tmp1_;
+       gint _tmp2_;
+       gint _tmp3_;
+       gint* _tmp4_;
+       gint _tmp4__length1;
+       gint _tmp4__length2;
+       gint _tmp4__length3;
+       gint* _tmp5_;
+       gint _tmp5__length1;
+       gint _tmp5__length2;
+       gint _tmp5__length3;
+       gint* _tmp6_;
+       gint _tmp6__length1;
+       gint _tmp6__length2;
+       gint _tmp6__length3;
+       gint* result = NULL;
+       _tmp0_ = a_length1;
+       _vala_assert (_tmp0_ == 2, "a.length[0] == 2");
+       _tmp1_ = a_length2;
+       _vala_assert (_tmp1_ == 2, "a.length[1] == 2");
+       _tmp2_ = a_length3;
+       _vala_assert (_tmp2_ == 2, "a.length[2] == 2");
+       _tmp3_ = a[(((1 * a_length2) + 1) * a_length3) + 0];
+       _vala_assert (_tmp3_ == 7, "a[1,1,0] == 7");
+       _tmp4_ = (a != NULL) ? _vala_array_dup9 (a, (a_length1 * a_length2) * a_length3) : a;
+       _tmp4__length1 = a_length1;
+       _tmp4__length2 = a_length2;
+       _tmp4__length3 = a_length3;
+       _vala_b = (g_free (_vala_b), NULL);
+       _vala_b = _tmp4_;
+       _vala_b_length1 = _tmp4__length1;
+       _vala_b_length2 = _tmp4__length2;
+       _vala_b_length3 = _tmp4__length3;
+       _tmp5_ = (a != NULL) ? _vala_array_dup10 (a, (a_length1 * a_length2) * a_length3) : a;
+       _tmp5__length1 = a_length1;
+       _tmp5__length2 = a_length2;
+       _tmp5__length3 = a_length3;
+       _tmp6_ = _tmp5_;
+       _tmp6__length1 = _tmp5__length1;
+       _tmp6__length2 = _tmp5__length2;
+       _tmp6__length3 = _tmp5__length3;
+       if (result_length1) {
+               *result_length1 = _tmp6__length1;
+       }
+       if (result_length2) {
+               *result_length2 = _tmp6__length2;
+       }
+       if (result_length3) {
+               *result_length3 = _tmp6__length3;
+       }
+       result = _tmp6_;
+       if (b) {
+               *b = _vala_b;
+       } else {
+               _vala_b = (g_free (_vala_b), NULL);
+       }
+       if (b_length1) {
+               *b_length1 = _vala_b_length1;
+       }
+       if (b_length2) {
+               *b_length2 = _vala_b_length2;
+       }
+       if (b_length3) {
+               *b_length3 = _vala_b_length3;
+       }
+       return result;
+}
+
+void
+test_nd_array (void)
+{
+       gint* a = NULL;
+       gint* _tmp0_;
+       gint a_length1;
+       gint a_length2;
+       gint a_length3;
+       gint _tmp1_;
+       gint* b = NULL;
+       gint b_length1 = 0;
+       gint b_length2 = 0;
+       gint b_length3 = 0;
+       gint* c = NULL;
+       gint c_length1 = 0;
+       gint c_length2 = 0;
+       gint c_length3 = 0;
+       gint* _tmp2_ = NULL;
+       gint _tmp3_ = 0;
+       gint _tmp4_ = 0;
+       gint _tmp5_ = 0;
+       gint _tmp6_ = 0;
+       gint _tmp7_ = 0;
+       gint _tmp8_ = 0;
+       gint* _tmp9_;
+       gint _tmp10_;
+       gint _tmp11_;
+       gint _tmp12_;
+       gint _tmp13_;
+       gint _tmp14_;
+       gint _tmp15_;
+       gint _tmp16_;
+       gint _tmp17_;
+       gchar** s = NULL;
+       gchar* _tmp18_;
+       gchar* _tmp19_;
+       gchar* _tmp20_;
+       gchar* _tmp21_;
+       gchar* _tmp22_;
+       gchar* _tmp23_;
+       gchar** _tmp24_;
+       gint s_length1;
+       gint s_length2;
+       gint s_length3;
+       const gchar* _tmp25_;
+       _tmp0_ = g_new0 (gint, (2 * 2) * 2);
+       _tmp0_[0] = 1;
+       _tmp0_[1] = 2;
+       _tmp0_[2] = 3;
+       _tmp0_[3] = 4;
+       _tmp0_[4] = 5;
+       _tmp0_[5] = 6;
+       _tmp0_[6] = 7;
+       _tmp0_[7] = 8;
+       a = _tmp0_;
+       a_length1 = 2;
+       a_length2 = 2;
+       a_length3 = 2;
+       _tmp1_ = a[(((1 * a_length2) + 0) * a_length3) + 1];
+       _vala_assert (_tmp1_ == 6, "a[1,0,1] == 6");
+       _tmp9_ = nd_array_pass (a, (gint) a_length1, (gint) a_length2, (gint) a_length3, &_tmp2_, &_tmp3_, 
&_tmp4_, &_tmp5_, &_tmp6_, &_tmp7_, &_tmp8_);
+       b = (g_free (b), NULL);
+       b = _tmp2_;
+       b_length1 = _tmp3_;
+       b_length2 = _tmp4_;
+       b_length3 = _tmp5_;
+       c = (g_free (c), NULL);
+       c = _tmp9_;
+       c_length1 = _tmp6_;
+       c_length2 = _tmp7_;
+       c_length3 = _tmp8_;
+       _tmp10_ = b_length1;
+       _vala_assert (_tmp10_ == 2, "b.length[0] == 2");
+       _tmp11_ = b_length2;
+       _vala_assert (_tmp11_ == 2, "b.length[1] == 2");
+       _tmp12_ = b_length3;
+       _vala_assert (_tmp12_ == 2, "b.length[2] == 2");
+       _tmp13_ = b[(((0 * b_length2) + 1) * b_length3) + 0];
+       _vala_assert (_tmp13_ == 3, "b[0,1,0] == 3");
+       _tmp14_ = c_length1;
+       _vala_assert (_tmp14_ == 2, "c.length[0] == 2");
+       _tmp15_ = c_length2;
+       _vala_assert (_tmp15_ == 2, "c.length[1] == 2");
+       _tmp16_ = c_length3;
+       _vala_assert (_tmp16_ == 2, "c.length[2] == 2");
+       _tmp17_ = c[(((0 * c_length2) + 1) * c_length3) + 1];
+       _vala_assert (_tmp17_ == 4, "c[0,1,1] == 4");
+       _tmp18_ = g_strdup ("a");
+       _tmp19_ = g_strdup ("b");
+       _tmp20_ = g_strdup ("c");
+       _tmp21_ = g_strdup ("d");
+       _tmp22_ = g_strdup ("e");
+       _tmp23_ = g_strdup ("f");
+       _tmp24_ = g_new0 (gchar*, ((1 * 2) * 3) + 1);
+       _tmp24_[0] = _tmp18_;
+       _tmp24_[1] = _tmp19_;
+       _tmp24_[2] = _tmp20_;
+       _tmp24_[3] = _tmp21_;
+       _tmp24_[4] = _tmp22_;
+       _tmp24_[5] = _tmp23_;
+       s = _tmp24_;
+       s_length1 = 1;
+       s_length2 = 2;
+       s_length3 = 3;
+       _tmp25_ = s[(((0 * s_length2) + 0) * s_length3) + 2];
+       _vala_assert (g_strcmp0 (_tmp25_, "c") == 0, "s[0,0,2] == \"c\"");
+       s = (_vala_array_free (s, (s_length1 * s_length2) * s_length3, (GDestroyNotify) g_free), NULL);
+       c = (g_free (c), NULL);
+       b = (g_free (b), NULL);
+       a = (g_free (a), NULL);
+}
+
+gint
+simple_func (void)
+{
+       gint result = 0;
+       result = 0;
+       return result;
+}
+
+static void
+_vala_array_add2 (SimpleFunc* * array,
+                  gint* length,
+                  gint* size,
+                  SimpleFunc value)
+{
+       if ((*length) == (*size)) {
+               *size = (*size) ? (2 * (*size)) : 4;
+               *array = g_renew (SimpleFunc, *array, *size);
+       }
+       (*array)[(*length)++] = value;
+}
+
+static gboolean
+_vala_simple_func_array_contains (SimpleFunc * stack,
+                                  gssize stack_length,
+                                  const SimpleFunc needle)
+{
+       gssize i;
+       for (i = 0; i < stack_length; i++) {
+               if (needle == stack[i]) {
+                       return TRUE;
+               }
+       }
+       return FALSE;
+}
+
+void
+test_delegate_array (void)
+{
+       SimpleFunc* a = NULL;
+       SimpleFunc* _tmp0_;
+       gint a_length1;
+       gint _a_size_;
+       SimpleFunc* _tmp1_;
+       gint _tmp1__length1;
+       SimpleFunc* _tmp2_;
+       gint _tmp2__length1;
+       SimpleFunc* _tmp3_;
+       gint _tmp3__length1;
+       _tmp0_ = g_new0 (SimpleFunc, 0);
+       a = _tmp0_;
+       a_length1 = 0;
+       _a_size_ = a_length1;
+       _tmp1_ = simple_delegates;
+       _tmp1__length1 = simple_delegates_length1;
+       simple_delegates = NULL;
+       simple_delegates_length1 = 0;
+       a = (g_free (a), NULL);
+       a = _tmp1_;
+       a_length1 = _tmp1__length1;
+       _a_size_ = a_length1;
+       _vala_array_add2 (&a, &a_length1, &_a_size_, (SimpleFunc) simple_func);
+       _tmp2_ = a;
+       _tmp2__length1 = a_length1;
+       _vala_assert (_tmp2__length1 == 1, "a.length == 1");
+       _tmp3_ = a;
+       _tmp3__length1 = a_length1;
+       _vala_assert (_vala_simple_func_array_contains (_tmp3_, _tmp3__length1, simple_func), "simple_func in 
a");
+       a = (g_free (a), NULL);
+}
+
+static void
+_vala_array_add3 (void** * array,
+                  gint* length,
+                  gint* size,
+                  void* value)
+{
+       if ((*length) == (*size)) {
+               *size = (*size) ? (2 * (*size)) : 4;
+               *array = g_renew (void*, *array, *size);
+       }
+       (*array)[(*length)++] = value;
+}
+
+static void
+_vala_array_add4 (void** * array,
+                  gint* length,
+                  gint* size,
+                  void* value)
+{
+       if ((*length) == (*size)) {
+               *size = (*size) ? (2 * (*size)) : 4;
+               *array = g_renew (void*, *array, *size);
+       }
+       (*array)[(*length)++] = value;
+}
+
+static gboolean
+_vala_valavoid_array_contains (void* * stack,
+                               gssize stack_length,
+                               const void* needle)
+{
+       gssize i;
+       for (i = 0; i < stack_length; i++) {
+               if (needle == stack[i]) {
+                       return TRUE;
+               }
+       }
+       return FALSE;
+}
+
+void
+test_void_array (void)
+{
+       void** a = NULL;
+       void** _tmp0_;
+       gint a_length1;
+       gint _a_size_;
+       void** _tmp1_;
+       gint _tmp1__length1;
+       void** _tmp2_;
+       gint _tmp2__length1;
+       _tmp0_ = g_new0 (void*, 0);
+       a = _tmp0_;
+       a_length1 = 0;
+       _a_size_ = a_length1;
+       _vala_array_add3 (&a, &a_length1, &_a_size_, (void*) NULL);
+       _vala_array_add4 (&a, &a_length1, &_a_size_, (void*) NULL);
+       _tmp1_ = a;
+       _tmp1__length1 = a_length1;
+       _vala_assert (_tmp1__length1 == 2, "a.length == 2");
+       _tmp2_ = a;
+       _tmp2__length1 = a_length1;
+       _vala_assert (_vala_valavoid_array_contains (_tmp2_, _tmp2__length1, (void*) NULL), "(void*) null in 
a");
+       a = (g_free (a), NULL);
+}
+
+static gint*
+_vala_array_dup11 (gint* self,
+                   gssize length)
+{
+       if (length > 0) {
+               return _vala_memdup2 (self, length * sizeof (gint));
+       }
+       return NULL;
+}
+
+void
+test_explicit_copying (void)
+{
+       gint* a0 = NULL;
+       gint* _tmp0_;
+       gint a0_length1;
+       gint _a0_size_;
+       gint* a1 = NULL;
+       gint* _tmp1_;
+       gint _tmp1__length1;
+       gint a1_length1;
+       gint _a1_size_;
+       gint _tmp2_;
+       gint _tmp3_;
+       _tmp0_ = g_new0 (gint, 3);
+       _tmp0_[0] = 1;
+       _tmp0_[1] = 2;
+       _tmp0_[2] = 3;
+       a0 = _tmp0_;
+       a0_length1 = 3;
+       _a0_size_ = a0_length1;
+       _tmp1_ = (a0 != NULL) ? _vala_array_dup11 (a0, a0_length1) : a0;
+       _tmp1__length1 = a0_length1;
+       a1 = _tmp1_;
+       a1_length1 = _tmp1__length1;
+       _a1_size_ = a1_length1;
+       _vala_assert (a1_length1 == 3, "a1.length == 3");
+       _tmp2_ = a0[1];
+       _tmp3_ = a1[1];
+       _vala_assert (_tmp2_ == _tmp3_, "a0[1] == a1[1]");
+       a1 = (g_free (a1), NULL);
+       a0 = (g_free (a0), NULL);
+}
+
+void
+test_array_move (void)
+{
+       gint* a = NULL;
+       gint* _tmp0_;
+       gint a_length1;
+       gint _a_size_;
+       gint _tmp1_;
+       gint _tmp2_;
+       _tmp0_ = g_new0 (gint, 9);
+       _tmp0_[0] = 1;
+       _tmp0_[1] = 2;
+       _tmp0_[2] = 3;
+       _tmp0_[3] = 4;
+       _tmp0_[4] = 5;
+       _tmp0_[5] = 6;
+       _tmp0_[6] = 7;
+       _tmp0_[7] = 8;
+       _tmp0_[8] = 9;
+       a = _tmp0_;
+       a_length1 = 9;
+       _a_size_ = a_length1;
+       _tmp1_ = a[4];
+       _vala_assert (_tmp1_ == 5, "a[4] == 5");
+       _vala_array_move (a, sizeof (gint), 4, 0, 5);
+       _tmp2_ = a[4];
+       _vala_assert (_tmp2_ == 9, "a[4] == 9");
+       a = (g_free (a), NULL);
+}
+
+void
+test_array_resize (void)
+{
+       gint* a = NULL;
+       gint* _tmp0_;
+       gint a_length1;
+       gint _a_size_;
+       gint _tmp1_;
+       gint _tmp2_;
+       gint _tmp3_;
+       _tmp0_ = g_new0 (gint, 9);
+       _tmp0_[0] = 1;
+       _tmp0_[1] = 2;
+       _tmp0_[2] = 3;
+       _tmp0_[3] = 4;
+       _tmp0_[4] = 5;
+       _tmp0_[5] = 6;
+       _tmp0_[6] = 7;
+       _tmp0_[7] = 8;
+       _tmp0_[8] = 9;
+       a = _tmp0_;
+       a_length1 = 9;
+       _a_size_ = a_length1;
+       _tmp1_ = a[a_length1 - 1];
+       _vala_assert (_tmp1_ == 9, "a[a.length - 1] == 9");
+       _tmp2_ = 5;
+       a = g_renew (gint, a, 5);
+       (_tmp2_ > a_length1) ? memset (a + a_length1, 0, sizeof (gint) * (_tmp2_ - a_length1)) : NULL;
+       a_length1 = _tmp2_;
+       _a_size_ = _tmp2_;
+       _tmp3_ = a[a_length1 - 1];
+       _vala_assert (_tmp3_ == 5, "a[a.length - 1] == 5");
+       a = (g_free (a), NULL);
+}
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       memcpy (dup, self, sizeof (Foo));
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+Bar*
+bar_dup (const Bar* self)
+{
+       Bar* dup;
+       dup = g_new0 (Bar, 1);
+       memcpy (dup, self, sizeof (Bar));
+       return dup;
+}
+
+void
+bar_free (Bar* self)
+{
+       g_free (self);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       GType bar_type_id;
+       bar_type_id = g_boxed_type_register_static ("Bar", (GBoxedCopyFunc) bar_dup, (GBoxedFreeFunc) 
bar_free);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+Manam*
+manam_dup (const Manam* self)
+{
+       Manam* dup;
+       dup = g_new0 (Manam, 1);
+       memcpy (dup, self, sizeof (Manam));
+       return dup;
+}
+
+void
+manam_free (Manam* self)
+{
+       g_free (self);
+}
+
+static GType
+manam_get_type_once (void)
+{
+       GType manam_type_id;
+       manam_type_id = g_boxed_type_register_static ("Manam", (GBoxedCopyFunc) manam_dup, (GBoxedFreeFunc) 
manam_free);
+       return manam_type_id;
+}
+
+GType
+manam_get_type (void)
+{
+       static volatile gsize manam_type_id__volatile = 0;
+       if (g_once_init_enter (&manam_type_id__volatile)) {
+               GType manam_type_id;
+               manam_type_id = manam_get_type_once ();
+               g_once_init_leave (&manam_type_id__volatile, manam_type_id);
+       }
+       return manam_type_id__volatile;
+}
+
+static gboolean
+_bar_equal (const Bar * s1,
+            const Bar * s2)
+{
+       if (s1 == s2) {
+               return TRUE;
+       }
+       if (s1 == NULL) {
+               return FALSE;
+       }
+       if (s2 == NULL) {
+               return FALSE;
+       }
+       if (s1->bar != s2->bar) {
+               return FALSE;
+       }
+       return TRUE;
+}
+
+static gboolean
+_vala_bar_array_contains (Bar * stack,
+                          gssize stack_length,
+                          const Bar * needle)
+{
+       gssize i;
+       for (i = 0; i < stack_length; i++) {
+               if (_bar_equal (&stack[i], needle) == TRUE) {
+                       return TRUE;
+               }
+       }
+       return FALSE;
+}
+
+static gpointer
+_manam_dup0 (gpointer self)
+{
+       return self ? manam_dup (self) : NULL;
+}
+
+void
+test_struct_array (void)
+{
+       Foo _tmp0_;
+       Bar b = {0};
+       Bar _tmp1_ = {0};
+       Bar* bar = NULL;
+       Bar* _tmp2_;
+       gint bar_length1;
+       gint _bar_size_;
+       Bar _tmp3_;
+       Bar _tmp4_;
+       Manam* manam = NULL;
+       Manam _tmp5_ = {0};
+       Manam* _tmp6_;
+       Manam* manam_copy = NULL;
+       Manam* _tmp7_;
+       _tmp0_ = FOO_ARRAY_CONST[0];
+       _vala_assert (_tmp0_.bar == 42, "FOO_ARRAY_CONST[0].bar == 42");
+       _tmp1_.bar = 4711;
+       b = _tmp1_;
+       _tmp2_ = g_new0 (Bar, 23);
+       bar = _tmp2_;
+       bar_length1 = 23;
+       _bar_size_ = bar_length1;
+       _tmp3_ = b;
+       bar[7] = _tmp3_;
+       _tmp4_ = b;
+       _vala_assert (_vala_bar_array_contains (bar, bar_length1, &_tmp4_), "b in bar");
+       _tmp6_ = _manam_dup0 (&_tmp5_);
+       manam = _tmp6_;
+       _tmp7_ = _manam_dup0 (manam);
+       manam_copy = _tmp7_;
+       _manam_free0 (manam_copy);
+       _manam_free0 (manam);
+       bar = (g_free (bar), NULL);
+}
+
+void
+give_fixed_array (gint** i)
+{
+       gint _vala_i[3] = {0};
+       gint _tmp0_[3] = {0};
+       _tmp0_[0] = 3;
+       _tmp0_[1] = 4;
+       _tmp0_[2] = 5;
+       memcpy (_vala_i, _tmp0_, 3 * sizeof (gint));
+       if (i) {
+               *i = _vala_i;
+       }
+}
+
+void
+take_fixed_array (gint* i)
+{
+       gint _tmp0_;
+       _vala_assert (3 == 3, "i.length == 3");
+       _tmp0_ = i[1];
+       _vala_assert (_tmp0_ == 2, "i[1] == 2");
+}
+
+void
+change_fixed_array (gint** i)
+{
+       _vala_assert (3 == 3, "i.length == 3");
+}
+
+void
+test_fixed_array (void)
+{
+       gint i[3] = {0};
+       gint _tmp0_[3] = {0};
+       gint k[3] = {0};
+       gint _tmp1_[3] = {0};
+       gint j[3] = {0};
+       gint _tmp2_[3] = {0};
+       _tmp0_[0] = 1;
+       _tmp0_[1] = 2;
+       _tmp0_[2] = 3;
+       memcpy (i, _tmp0_, 3 * sizeof (gint));
+       _vala_assert (3 == 3, "i.length == 3");
+       take_fixed_array (i);
+       _tmp1_[0] = 6;
+       _tmp1_[1] = 7;
+       _tmp1_[2] = 8;
+       memcpy (k, _tmp1_, 3 * sizeof (gint));
+       change_fixed_array (&k);
+       _vala_assert (3 == 3, "k.length == 3");
+       give_fixed_array (&_tmp2_);
+       memcpy (j, _tmp2_, 3 * sizeof (gint));
+       _vala_assert (3 == 3, "j.length == 3");
+}
+
+static void
+_vala_main (void)
+{
+       test_integer_array ();
+       test_string_array ();
+       test_array_pass ();
+       test_static_array ();
+       test_reference_transfer ();
+       test_length_assignment ();
+       test_inline_array ();
+       test_nd_array ();
+       test_delegate_array ();
+       test_void_array ();
+       test_explicit_copying ();
+       test_array_move ();
+       test_array_resize ();
+       test_struct_array ();
+       test_fixed_array ();
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
+static void
+_vala_array_move (gpointer array,
+                  gsize element_size,
+                  gssize src,
+                  gssize dest,
+                  gssize length)
+{
+       memmove (((char*) array) + (dest * element_size), ((char*) array) + (src * element_size), length * 
element_size);
+       if ((src < dest) && ((src + length) > dest)) {
+               memset (((char*) array) + (src * element_size), 0, (dest - src) * element_size);
+       } else if ((src > dest) && (src < (dest + length))) {
+               memset (((char*) array) + ((dest + length) * element_size), 0, (src - dest) * element_size);
+       } else if (src != dest) {
+               memset (((char*) array) + (src * element_size), 0, length * element_size);
+       }
+}
+
+static gssize
+_vala_array_length (gpointer array)
+{
+       gssize length;
+       length = 0;
+       if (array) {
+               while (((gpointer*) array)[length]) {
+                       length++;
+               }
+       }
+       return length;
+}
+
+static inline gpointer
+_vala_memdup2 (gconstpointer mem,
+               gsize byte_size)
+{
+       gpointer new_mem;
+       if (mem && byte_size != 0) {
+               new_mem = g_malloc (byte_size);
+               memcpy (new_mem, mem, byte_size);
+       } else {
+               new_mem = NULL;
+       }
+       return new_mem;
+}
+
diff --git a/tests/basic-types/boolean.c-expected b/tests/basic-types/boolean.c-expected
new file mode 100644
index 000000000..75de4a5bd
--- /dev/null
+++ b/tests/basic-types/boolean.c-expected
@@ -0,0 +1,53 @@
+/* basic_types_boolean.c generated by valac, the Vala compiler
+ * generated from basic_types_boolean.vala, do not modify */
+
+#include <stdbool.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef bool Foo;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN void foo_check (Foo self);
+static void _vala_main (void);
+
+void
+foo_check (Foo self)
+{
+       if ((gboolean) self) {
+               return;
+       }
+       _vala_assert (TRUE, "true");
+}
+
+static void
+_vala_main (void)
+{
+       Foo foo = {0};
+       foo = (Foo) TRUE;
+       foo_check (foo);
+       if ((gboolean) (!foo)) {
+               _vala_assert (TRUE, "true");
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/basic-types/bug571486.c-expected b/tests/basic-types/bug571486.c-expected
new file mode 100644
index 000000000..c641e7aef
--- /dev/null
+++ b/tests/basic-types/bug571486.c-expected
@@ -0,0 +1,440 @@
+/* basic_types_bug571486.c generated by valac, the Vala compiler
+ * generated from basic_types_bug571486.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+#include <glib-object.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+       const gchar** var3;
+       gint var3_length1;
+       gint _var3_size_;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+VALA_EXTERN const gchar** var1;
+VALA_EXTERN gint var1_length1;
+const gchar** var1 = NULL;
+gint var1_length1 = 0;
+VALA_EXTERN const gchar** var2;
+VALA_EXTERN gint var2_length1;
+const gchar** var2 = NULL;
+gint var2_length1 = 0;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN const gchar** foo_meth (Foo* self,
+                        const gchar** var4,
+                        gint var4_length1,
+                        gint* result_length1);
+static const gchar** _vala_array_dup1 (const gchar** self,
+                                gssize length);
+static const gchar** _vala_array_dup2 (const gchar** self,
+                                gssize length);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+static inline gpointer _vala_memdup2 (gconstpointer mem,
+                        gsize byte_size);
+
+static const gchar**
+_vala_array_dup1 (const gchar** self,
+                  gssize length)
+{
+       if (length > 0) {
+               return _vala_memdup2 (self, length * sizeof (const gchar*));
+       }
+       return NULL;
+}
+
+static const gchar**
+_vala_array_dup2 (const gchar** self,
+                  gssize length)
+{
+       if (length > 0) {
+               return _vala_memdup2 (self, length * sizeof (const gchar*));
+       }
+       return NULL;
+}
+
+const gchar**
+foo_meth (Foo* self,
+          const gchar** var4,
+          gint var4_length1,
+          gint* result_length1)
+{
+       const gchar** _tmp0_;
+       gint _tmp0__length1;
+       const gchar** _tmp1_;
+       gint _tmp1__length1;
+       const gchar** _tmp2_;
+       gint _tmp2__length1;
+       const gchar** _tmp3_;
+       gint _tmp3__length1;
+       const gchar** result = NULL;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = (((const gchar**) var4) != NULL) ? _vala_array_dup1 ((const gchar**) var4, (var4_length1 * 
sizeof (const gchar*)) / sizeof (const gchar*)) : ((const gchar**) var4);
+       _tmp0__length1 = (var4_length1 * sizeof (const gchar*)) / sizeof (const gchar*);
+       self->var3 = (g_free (self->var3), NULL);
+       self->var3 = _tmp0_;
+       self->var3_length1 = _tmp0__length1;
+       self->_var3_size_ = self->var3_length1;
+       _tmp1_ = self->var3;
+       _tmp1__length1 = self->var3_length1;
+       _tmp2_ = (((const gchar**) _tmp1_) != NULL) ? _vala_array_dup2 ((const gchar**) _tmp1_, 
(_tmp1__length1 * sizeof (const gchar*)) / sizeof (const gchar*)) : ((const gchar**) _tmp1_);
+       _tmp2__length1 = (_tmp1__length1 * sizeof (const gchar*)) / sizeof (const gchar*);
+       _tmp3_ = _tmp2_;
+       _tmp3__length1 = _tmp2__length1;
+       if (result_length1) {
+               *result_length1 = _tmp3__length1;
+       }
+       result = _tmp3_;
+       return result;
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->var3 = NULL;
+       self->var3_length1 = 0;
+       self->_var3_size_ = self->var3_length1;
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+       self->var3 = (g_free (self->var3), NULL);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       GObject* o1 = NULL;
+       GObject* _tmp0_;
+       GObject* o2 = NULL;
+       GObject* _tmp1_;
+       GObject** test = NULL;
+       GObject** _tmp2_;
+       gint test_length1;
+       gint _test_size_;
+       GObject** _tmp3_;
+       gint _tmp3__length1;
+       gint* i = NULL;
+       gint* _tmp4_;
+       gint i_length1;
+       gint _i_size_;
+       gint j = 0;
+       gint _tmp5_;
+       _tmp0_ = g_object_new (G_TYPE_OBJECT, NULL);
+       o1 = _tmp0_;
+       _tmp1_ = g_object_new (G_TYPE_OBJECT, NULL);
+       o2 = _tmp1_;
+       _tmp2_ = g_new0 (GObject*, 1 + 1);
+       _tmp2_[0] = o1;
+       test = _tmp2_;
+       test_length1 = 1;
+       _test_size_ = test_length1;
+       _vala_assert (o1->ref_count == ((guint) 1), "o1.ref_count == 1");
+       _tmp3_ = test;
+       _tmp3__length1 = test_length1;
+       _tmp3_[0] = o2;
+       _vala_assert (o1->ref_count == ((guint) 1), "o1.ref_count == 1");
+       _vala_assert (o2->ref_count == ((guint) 1), "o2.ref_count == 1");
+       test = (g_free (test), NULL);
+       test = NULL;
+       test_length1 = 0;
+       _test_size_ = test_length1;
+       _vala_assert (o1->ref_count == ((guint) 1), "o1.ref_count == 1");
+       _vala_assert (o2->ref_count == ((guint) 1), "o2.ref_count == 1");
+       _tmp4_ = g_new0 (gint, 42);
+       i = _tmp4_;
+       i_length1 = 42;
+       _i_size_ = i_length1;
+       _tmp5_ = ((gint*) i)[4];
+       j = _tmp5_ + 5;
+       i = (g_free (i), NULL);
+       test = (g_free (test), NULL);
+       _g_object_unref0 (o2);
+       _g_object_unref0 (o1);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static inline gpointer
+_vala_memdup2 (gconstpointer mem,
+               gsize byte_size)
+{
+       gpointer new_mem;
+       if (mem && byte_size != 0) {
+               new_mem = g_malloc (byte_size);
+               memcpy (new_mem, mem, byte_size);
+       } else {
+               new_mem = NULL;
+       }
+       return new_mem;
+}
+
diff --git a/tests/basic-types/bug591552.c-expected b/tests/basic-types/bug591552.c-expected
new file mode 100644
index 000000000..a61a51c7a
--- /dev/null
+++ b/tests/basic-types/bug591552.c-expected
@@ -0,0 +1,231 @@
+/* basic_types_bug591552.c generated by valac, the Vala compiler
+ * generated from basic_types_bug591552.vala, do not modify */
+
+#include <glib.h>
+#include <string.h>
+
+#define _g_free0(var) ((var == NULL) ? NULL : (var = (g_free (var), NULL)))
+
+static void _vala_main (void);
+static gint* _int_dup (gint* self);
+static gboolean* _bool_dup (gboolean* self);
+static gboolean _int_equal (const gint * s1,
+                     const gint * s2);
+
+static gint*
+_int_dup (gint* self)
+{
+       gint* dup;
+       dup = g_new0 (gint, 1);
+       memcpy (dup, self, sizeof (gint));
+       return dup;
+}
+
+static gpointer
+__int_dup0 (gpointer self)
+{
+       return self ? _int_dup (self) : NULL;
+}
+
+static gboolean*
+_bool_dup (gboolean* self)
+{
+       gboolean* dup;
+       dup = g_new0 (gboolean, 1);
+       memcpy (dup, self, sizeof (gboolean));
+       return dup;
+}
+
+static gpointer
+__bool_dup0 (gpointer self)
+{
+       return self ? _bool_dup (self) : NULL;
+}
+
+static gboolean
+_int_equal (const gint * s1,
+            const gint * s2)
+{
+       if (s1 == s2) {
+               return TRUE;
+       }
+       if (s1 == NULL) {
+               return FALSE;
+       }
+       if (s2 == NULL) {
+               return FALSE;
+       }
+       return (*s1) == (*s2);
+}
+
+static void
+_vala_main (void)
+{
+       gint a = 0;
+       gint b = 0;
+       gint* c = NULL;
+       gint _tmp0_;
+       gint* _tmp1_;
+       gint* d = NULL;
+       gint _tmp2_;
+       gint* _tmp3_;
+       gboolean* test = NULL;
+       gint _tmp4_;
+       gint* _tmp5_;
+       gint _tmp6_;
+       gint* _tmp7_;
+       gboolean _tmp8_;
+       gboolean* _tmp9_;
+       gint* _tmp10_;
+       gint* _tmp11_;
+       gint* _tmp12_;
+       gint _tmp13_;
+       gint* _tmp14_;
+       gint* _tmp15_;
+       gint _tmp16_;
+       gint* _tmp17_;
+       gint* _tmp18_;
+       gint* _tmp19_;
+       gint _tmp20_;
+       gint* _tmp21_;
+       gint* _tmp22_;
+       gint* _tmp23_;
+       gint _tmp24_;
+       gint* _tmp25_;
+       gint* _tmp26_;
+       gint* _tmp27_;
+       gint _tmp28_;
+       gint* _tmp29_;
+       gint* _tmp30_;
+       gint* _tmp31_;
+       gboolean _tmp32_;
+       gboolean* _tmp33_;
+       gint* _tmp34_;
+       gboolean _tmp35_;
+       gboolean* _tmp36_;
+       gboolean _tmp37_ = FALSE;
+       gboolean* _tmp38_;
+       gboolean* _tmp40_;
+       gint* _tmp41_;
+       gint* _tmp42_;
+       gint _tmp43_;
+       gint _tmp44_;
+       gboolean _tmp45_;
+       gboolean* _tmp46_;
+       gint* _tmp47_;
+       gboolean _tmp48_;
+       gboolean* _tmp49_;
+       gint* _tmp50_;
+       gint* _tmp51_;
+       gboolean _tmp52_;
+       gboolean* _tmp53_;
+       a = 1;
+       b = 2;
+       _tmp0_ = 3;
+       _tmp1_ = __int_dup0 (&_tmp0_);
+       c = _tmp1_;
+       _tmp2_ = 4;
+       _tmp3_ = __int_dup0 (&_tmp2_);
+       d = _tmp3_;
+       test = NULL;
+       a = 1;
+       b = 2;
+       _tmp4_ = 3;
+       _tmp5_ = __int_dup0 (&_tmp4_);
+       _g_free0 (c);
+       c = _tmp5_;
+       _tmp6_ = 4;
+       _tmp7_ = __int_dup0 (&_tmp6_);
+       _g_free0 (d);
+       d = _tmp7_;
+       _tmp8_ = FALSE;
+       _tmp9_ = __bool_dup0 (&_tmp8_);
+       _g_free0 (test);
+       test = _tmp9_;
+       a = a + b;
+       _tmp10_ = c;
+       a = b - (*_tmp10_);
+       _tmp11_ = c;
+       _tmp12_ = d;
+       a = (*_tmp11_) & (*_tmp12_);
+       _tmp13_ = a ^ b;
+       _tmp14_ = __int_dup0 (&_tmp13_);
+       _g_free0 (c);
+       c = _tmp14_;
+       _tmp15_ = c;
+       _tmp16_ = b | (*_tmp15_);
+       _tmp17_ = __int_dup0 (&_tmp16_);
+       _g_free0 (c);
+       c = _tmp17_;
+       _tmp18_ = c;
+       _tmp19_ = d;
+       _tmp20_ = (*_tmp18_) % (*_tmp19_);
+       _tmp21_ = __int_dup0 (&_tmp20_);
+       _g_free0 (c);
+       c = _tmp21_;
+       _tmp22_ = d;
+       _tmp23_ = c;
+       _tmp24_ = (*_tmp22_) % (*_tmp23_);
+       _tmp25_ = __int_dup0 (&_tmp24_);
+       _g_free0 (d);
+       d = _tmp25_;
+       _tmp26_ = c;
+       _tmp27_ = d;
+       _tmp28_ = (*_tmp26_) | (a & (*_tmp27_));
+       _tmp29_ = __int_dup0 (&_tmp28_);
+       _g_free0 (c);
+       c = _tmp29_;
+       _tmp30_ = c;
+       _tmp31_ = d;
+       _tmp32_ = ((*_tmp31_) & (*_tmp30_)) == (*_tmp30_);
+       _tmp33_ = __bool_dup0 (&_tmp32_);
+       _g_free0 (test);
+       test = _tmp33_;
+       _tmp34_ = d;
+       _tmp35_ = b > (*_tmp34_);
+       _tmp36_ = __bool_dup0 (&_tmp35_);
+       _g_free0 (test);
+       test = _tmp36_;
+       _tmp38_ = test;
+       if (*_tmp38_) {
+               _tmp37_ = TRUE;
+       } else {
+               gboolean* _tmp39_;
+               _tmp39_ = test;
+               _tmp37_ = *_tmp39_;
+       }
+       _tmp40_ = __bool_dup0 (&_tmp37_);
+       _g_free0 (test);
+       test = _tmp40_;
+       _tmp41_ = c;
+       _tmp42_ = d;
+       _tmp43_ = *_tmp41_;
+       _tmp44_ = *_tmp42_;
+       _tmp45_ = ((b > _tmp43_) && (_tmp43_ > _tmp44_)) && (_tmp44_ < a);
+       _tmp46_ = __bool_dup0 (&_tmp45_);
+       _g_free0 (test);
+       test = _tmp46_;
+       _tmp47_ = c;
+       _tmp48_ = _int_equal (&a, _tmp47_) == TRUE;
+       _tmp49_ = __bool_dup0 (&_tmp48_);
+       _g_free0 (test);
+       test = _tmp49_;
+       _tmp50_ = c;
+       _tmp51_ = d;
+       _tmp52_ = _int_equal (_tmp50_, _tmp51_) == TRUE;
+       _tmp53_ = __bool_dup0 (&_tmp52_);
+       _g_free0 (test);
+       test = _tmp53_;
+       _g_free0 (test);
+       _g_free0 (d);
+       _g_free0 (c);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/basic-types/bug595751.c-expected b/tests/basic-types/bug595751.c-expected
new file mode 100644
index 000000000..7f02e1871
--- /dev/null
+++ b/tests/basic-types/bug595751.c-expected
@@ -0,0 +1,21 @@
+/* basic_types_bug595751.c generated by valac, the Vala compiler
+ * generated from basic_types_bug595751.vala, do not modify */
+
+#include <glib.h>
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+       gint a[2] = {0};
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/basic-types/bug596637.c-expected b/tests/basic-types/bug596637.c-expected
new file mode 100644
index 000000000..5d29263b7
--- /dev/null
+++ b/tests/basic-types/bug596637.c-expected
@@ -0,0 +1,44 @@
+/* basic_types_bug596637.c generated by valac, the Vala compiler
+ * generated from basic_types_bug596637.vala, do not modify */
+
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+       gint* a = NULL;
+       gint* _tmp0_;
+       gint a_length1;
+       gint _a_size_;
+       gint* _tmp1_;
+       gint _tmp1__length1;
+       gint _tmp2_;
+       gint _tmp3_;
+       _tmp0_ = g_new0 (gint, 1);
+       a = _tmp0_;
+       a_length1 = 1;
+       _a_size_ = a_length1;
+       _tmp1_ = a;
+       _tmp1__length1 = a_length1;
+       _tmp2_ = _tmp1_[0];
+       _tmp1_[0] = _tmp2_ + 1;
+       _tmp3_ = a[0];
+       _vala_assert (_tmp3_ == 1, "a[0] == 1");
+       a = (g_free (a), NULL);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/basic-types/bug596785.c-expected b/tests/basic-types/bug596785.c-expected
new file mode 100644
index 000000000..f950f5325
--- /dev/null
+++ b/tests/basic-types/bug596785.c-expected
@@ -0,0 +1,28 @@
+/* basic_types_bug596785.c generated by valac, the Vala compiler
+ * generated from basic_types_bug596785.vala, do not modify */
+
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+       gunichar c = 0U;
+       c = 8364U;
+       _vala_assert (c == 8364U, "c == '\342\202\254'");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/basic-types/bug604371.c-expected b/tests/basic-types/bug604371.c-expected
new file mode 100644
index 000000000..3f1ee88b5
--- /dev/null
+++ b/tests/basic-types/bug604371.c-expected
@@ -0,0 +1,192 @@
+/* basic_types_bug604371.c generated by valac, the Vala compiler
+ * generated from basic_types_bug604371.vala, do not modify */
+
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (void);
+static gint* _vala_array_dup1 (gint* self,
+                        gssize length);
+static gchar** _vala_array_dup2 (gchar** self,
+                          gssize length);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+static inline gpointer _vala_memdup2 (gconstpointer mem,
+                        gsize byte_size);
+
+const gint FOO[5][3] = {{1, 2}, {3, 4}, {5, 6}, {6, 7, 8}, {9}};
+const gchar* BAR[5][3] = {{"a", "b"}, {"c", "d"}, {"e", "f"}, {"g", "h", "i"}, {"j"}};
+
+static gint*
+_vala_array_dup1 (gint* self,
+                  gssize length)
+{
+       if (length > 0) {
+               return _vala_memdup2 (self, length * sizeof (gint));
+       }
+       return NULL;
+}
+
+static gchar**
+_vala_array_dup2 (gchar** self,
+                  gssize length)
+{
+       if (length >= 0) {
+               gchar** result;
+               gssize i;
+               result = g_new0 (gchar*, length + 1);
+               for (i = 0; i < length; i++) {
+                       gchar* _tmp0_;
+                       _tmp0_ = g_strdup (self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+static void
+_vala_main (void)
+{
+       gint _tmp0_;
+       gint _tmp1_;
+       gint _tmp2_;
+       gint _tmp3_;
+       gint* foo = NULL;
+       gint* _tmp4_;
+       gint _tmp4__length1;
+       gint _tmp4__length2;
+       gint foo_length1;
+       gint foo_length2;
+       gint _tmp5_;
+       gint _tmp6_;
+       gint _tmp7_;
+       gint _tmp8_;
+       gint _tmp9_;
+       gint _tmp10_;
+       const gchar* _tmp11_;
+       const gchar* _tmp12_;
+       gchar** bar = NULL;
+       gchar** _tmp13_;
+       gint _tmp13__length1;
+       gint _tmp13__length2;
+       gint bar_length1;
+       gint bar_length2;
+       gint _tmp14_;
+       gint _tmp15_;
+       const gchar* _tmp16_;
+       const gchar* _tmp17_;
+       _tmp0_ = G_N_ELEMENTS (FOO);
+       _vala_assert (_tmp0_ == 5, "FOO.length[0] == 5");
+       _tmp1_ = G_N_ELEMENTS (FOO[0]);
+       _vala_assert (_tmp1_ == 3, "FOO.length[1] == 3");
+       _tmp2_ = FOO[0][1];
+       _vala_assert (_tmp2_ == 2, "FOO[0,1] == 2");
+       _tmp3_ = FOO[3][2];
+       _vala_assert (_tmp3_ == 8, "FOO[3,2] == 8");
+       _tmp4_ = _vala_array_dup1 (FOO, G_N_ELEMENTS (FOO) * G_N_ELEMENTS (FOO[0]));
+       _tmp4__length1 = G_N_ELEMENTS (FOO);
+       _tmp4__length2 = G_N_ELEMENTS (FOO[0]);
+       foo = _tmp4_;
+       foo_length1 = _tmp4__length1;
+       foo_length2 = _tmp4__length2;
+       _tmp5_ = foo_length1;
+       _vala_assert (_tmp5_ == 5, "foo.length[0] == 5");
+       _tmp6_ = foo_length2;
+       _vala_assert (_tmp6_ == 3, "foo.length[1] == 3");
+       _tmp7_ = foo[(0 * foo_length2) + 1];
+       _vala_assert (_tmp7_ == 2, "foo[0,1] == 2");
+       _tmp8_ = foo[(3 * foo_length2) + 2];
+       _vala_assert (_tmp8_ == 8, "foo[3,2] == 8");
+       _tmp9_ = G_N_ELEMENTS (BAR);
+       _vala_assert (_tmp9_ == 5, "BAR.length[0] == 5");
+       _tmp10_ = G_N_ELEMENTS (BAR[0]);
+       _vala_assert (_tmp10_ == 3, "BAR.length[1] == 3");
+       _tmp11_ = BAR[0][1];
+       _vala_assert (g_strcmp0 (_tmp11_, "b") == 0, "BAR[0,1] == \"b\"");
+       _tmp12_ = BAR[3][2];
+       _vala_assert (g_strcmp0 (_tmp12_, "i") == 0, "BAR[3,2] == \"i\"");
+       _tmp13_ = _vala_array_dup2 (BAR, G_N_ELEMENTS (BAR) * G_N_ELEMENTS (BAR[0]));
+       _tmp13__length1 = G_N_ELEMENTS (BAR);
+       _tmp13__length2 = G_N_ELEMENTS (BAR[0]);
+       bar = _tmp13_;
+       bar_length1 = _tmp13__length1;
+       bar_length2 = _tmp13__length2;
+       _tmp14_ = bar_length1;
+       _vala_assert (_tmp14_ == 5, "bar.length[0] == 5");
+       _tmp15_ = bar_length2;
+       _vala_assert (_tmp15_ == 3, "bar.length[1] == 3");
+       _tmp16_ = bar[(0 * bar_length2) + 1];
+       _vala_assert (g_strcmp0 (_tmp16_, "b") == 0, "bar[0,1] == \"b\"");
+       _tmp17_ = bar[(3 * bar_length2) + 2];
+       _vala_assert (g_strcmp0 (_tmp17_, "i") == 0, "bar[3,2] == \"i\"");
+       bar = (_vala_array_free (bar, bar_length1 * bar_length2, (GDestroyNotify) g_free), NULL);
+       foo = (g_free (foo), NULL);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
+static inline gpointer
+_vala_memdup2 (gconstpointer mem,
+               gsize byte_size)
+{
+       gpointer new_mem;
+       if (mem && byte_size != 0) {
+               new_mem = g_malloc (byte_size);
+               memcpy (new_mem, mem, byte_size);
+       } else {
+               new_mem = NULL;
+       }
+       return new_mem;
+}
+
diff --git a/tests/basic-types/bug610660.c-expected b/tests/basic-types/bug610660.c-expected
new file mode 100644
index 000000000..164232e75
--- /dev/null
+++ b/tests/basic-types/bug610660.c-expected
@@ -0,0 +1,51 @@
+/* basic_types_bug610660.c generated by valac, the Vala compiler
+ * generated from basic_types_bug610660.vala, do not modify */
+
+#include <glib.h>
+#include <float.h>
+#include <math.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+       {
+               gdouble d = 0.0;
+               d = 42.0;
+               d = fmod (d, 42.0);
+               _vala_assert (d == 0.0, "d == 0.0");
+       }
+       {
+               gdouble d = 0.0;
+               d = 23.0;
+               d = fmod (d, 23.0);
+               _vala_assert (d == 0.0, "d == 0.0");
+       }
+       {
+               gfloat f = 0.0F;
+               f = 42.0f;
+               f = fmodf (f, 42.0f);
+               _vala_assert (f == 0.0f, "f == 0.0f");
+       }
+       {
+               gfloat f = 0.0F;
+               f = 23.0f;
+               f = fmodf (f, 23.0f);
+               _vala_assert (f == 0.0f, "f == 0.0f");
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/basic-types/bug622178.c-expected b/tests/basic-types/bug622178.c-expected
new file mode 100644
index 000000000..53be6b514
--- /dev/null
+++ b/tests/basic-types/bug622178.c-expected
@@ -0,0 +1,441 @@
+/* basic_types_bug622178.c generated by valac, the Vala compiler
+ * generated from basic_types_bug622178.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+
+#define TYPE_BAR (bar_get_type ())
+typedef struct _Bar Bar;
+
+#define TYPE_MANAM (manam_get_type ())
+typedef struct _Manam Manam;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       gint bar;
+       guint8* data;
+       gint data_length1;
+       gint _data_size_;
+       gint baz;
+};
+
+struct _Bar {
+       gint bar;
+       guint8* data;
+       gint data_length1;
+       gint data_length2;
+       gint baz;
+};
+
+struct _Manam {
+       const gchar* data[2];
+       gint idata[2];
+       gint bar;
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN void foo_copy (const Foo* self,
+               Foo* dest);
+VALA_EXTERN void foo_destroy (Foo* self);
+static guint8* _vala_array_dup1 (guint8* self,
+                          gssize length);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Bar* bar_dup (const Bar* self);
+VALA_EXTERN void bar_free (Bar* self);
+VALA_EXTERN void bar_copy (const Bar* self,
+               Bar* dest);
+VALA_EXTERN void bar_destroy (Bar* self);
+static guint8* _vala_array_dup2 (guint8* self,
+                          gssize length);
+VALA_EXTERN GType manam_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Manam* manam_dup (const Manam* self);
+VALA_EXTERN void manam_free (Manam* self);
+static void _vala_main (void);
+static inline gpointer _vala_memdup2 (gconstpointer mem,
+                        gsize byte_size);
+
+const Manam MANAM[1] = {{{"foo", "bar"}, {4711, 23}, 42}};
+
+static guint8*
+_vala_array_dup1 (guint8* self,
+                  gssize length)
+{
+       if (length > 0) {
+               return _vala_memdup2 (self, length * sizeof (guint8));
+       }
+       return NULL;
+}
+
+void
+foo_copy (const Foo* self,
+          Foo* dest)
+{
+       guint8* _tmp0_;
+       gint _tmp0__length1;
+       guint8* _tmp1_;
+       gint _tmp1__length1;
+       (*dest).bar = (*self).bar;
+       _tmp0_ = (*self).data;
+       _tmp0__length1 = (*self).data_length1;
+       _tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup1 (_tmp0_, _tmp0__length1) : _tmp0_;
+       _tmp1__length1 = _tmp0__length1;
+       (*dest).data = (g_free ((*dest).data), NULL);
+       (*dest).data = _tmp1_;
+       (*dest).data_length1 = _tmp1__length1;
+       (*dest)._data_size_ = (*dest).data_length1;
+       (*dest).baz = (*self).baz;
+}
+
+void
+foo_destroy (Foo* self)
+{
+       (*self).data = (g_free ((*self).data), NULL);
+}
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       foo_copy (self, dup);
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       foo_destroy (self);
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static guint8*
+_vala_array_dup2 (guint8* self,
+                  gssize length)
+{
+       if (length > 0) {
+               return _vala_memdup2 (self, length * sizeof (guint8));
+       }
+       return NULL;
+}
+
+void
+bar_copy (const Bar* self,
+          Bar* dest)
+{
+       guint8* _tmp0_;
+       gint _tmp0__length1;
+       gint _tmp0__length2;
+       guint8* _tmp1_;
+       gint _tmp1__length1;
+       gint _tmp1__length2;
+       (*dest).bar = (*self).bar;
+       _tmp0_ = (*self).data;
+       _tmp0__length1 = (*self).data_length1;
+       _tmp0__length2 = (*self).data_length2;
+       _tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup2 (_tmp0_, _tmp0__length1 * _tmp0__length2) : _tmp0_;
+       _tmp1__length1 = _tmp0__length1;
+       _tmp1__length2 = _tmp0__length2;
+       (*dest).data = (g_free ((*dest).data), NULL);
+       (*dest).data = _tmp1_;
+       (*dest).data_length1 = _tmp1__length1;
+       (*dest).data_length2 = _tmp1__length2;
+       (*dest).baz = (*self).baz;
+}
+
+void
+bar_destroy (Bar* self)
+{
+       (*self).data = (g_free ((*self).data), NULL);
+}
+
+Bar*
+bar_dup (const Bar* self)
+{
+       Bar* dup;
+       dup = g_new0 (Bar, 1);
+       bar_copy (self, dup);
+       return dup;
+}
+
+void
+bar_free (Bar* self)
+{
+       bar_destroy (self);
+       g_free (self);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       GType bar_type_id;
+       bar_type_id = g_boxed_type_register_static ("Bar", (GBoxedCopyFunc) bar_dup, (GBoxedFreeFunc) 
bar_free);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+Manam*
+manam_dup (const Manam* self)
+{
+       Manam* dup;
+       dup = g_new0 (Manam, 1);
+       memcpy (dup, self, sizeof (Manam));
+       return dup;
+}
+
+void
+manam_free (Manam* self)
+{
+       g_free (self);
+}
+
+static GType
+manam_get_type_once (void)
+{
+       GType manam_type_id;
+       manam_type_id = g_boxed_type_register_static ("Manam", (GBoxedCopyFunc) manam_dup, (GBoxedFreeFunc) 
manam_free);
+       return manam_type_id;
+}
+
+GType
+manam_get_type (void)
+{
+       static volatile gsize manam_type_id__volatile = 0;
+       if (g_once_init_enter (&manam_type_id__volatile)) {
+               GType manam_type_id;
+               manam_type_id = manam_get_type_once ();
+               g_once_init_leave (&manam_type_id__volatile, manam_type_id);
+       }
+       return manam_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Foo foo = {0};
+       guint8* _tmp0_;
+       Foo _tmp1_ = {0};
+       Foo _tmp2_;
+       Foo _tmp3_;
+       Foo _tmp4_;
+       guint8* _tmp5_;
+       gint _tmp5__length1;
+       Foo _tmp6_;
+       guint8* _tmp7_;
+       gint _tmp7__length1;
+       guint8 _tmp8_;
+       Bar bar = {0};
+       guint8* _tmp9_;
+       Bar _tmp10_ = {0};
+       Bar _tmp11_;
+       Bar _tmp12_;
+       Bar _tmp13_;
+       guint8* _tmp14_;
+       gint _tmp14__length1;
+       gint _tmp14__length2;
+       gint _tmp15_;
+       Bar _tmp16_;
+       guint8* _tmp17_;
+       gint _tmp17__length1;
+       gint _tmp17__length2;
+       gint _tmp18_;
+       Bar _tmp19_;
+       guint8* _tmp20_;
+       gint _tmp20__length1;
+       gint _tmp20__length2;
+       guint8 _tmp21_;
+       const gchar** sa = NULL;
+       const gchar** _tmp22_;
+       gint sa_length1;
+       gint _sa_size_;
+       Manam manam = {0};
+       gint _tmp23_[2] = {0};
+       Manam _tmp24_ = {0};
+       Manam _tmp25_;
+       Manam _tmp26_;
+       const gchar* _tmp27_;
+       Manam _tmp28_;
+       Manam _tmp29_;
+       gint _tmp30_;
+       Manam _tmp31_;
+       Manam _tmp32_;
+       Manam _tmp33_;
+       const gchar* _tmp34_;
+       Manam _tmp35_;
+       Manam _tmp36_;
+       gint _tmp37_;
+       Manam _tmp38_;
+       _tmp0_ = g_new0 (guint8, 4);
+       _tmp0_[0] = (guint8) 0;
+       _tmp0_[1] = (guint8) 1;
+       _tmp0_[2] = (guint8) 2;
+       _tmp0_[3] = (guint8) 3;
+       _tmp1_.bar = 23;
+       _tmp1_.data = (g_free (_tmp1_.data), NULL);
+       _tmp1_.data = _tmp0_;
+       _tmp1_.data_length1 = 4;
+       _tmp1_._data_size_ = _tmp1_.data_length1;
+       _tmp1_.baz = 42;
+       foo = _tmp1_;
+       _tmp2_ = foo;
+       _vala_assert (_tmp2_.bar == 23, "foo.bar == 23");
+       _tmp3_ = foo;
+       _vala_assert (_tmp3_.baz == 42, "foo.baz == 42");
+       _tmp4_ = foo;
+       _tmp5_ = _tmp4_.data;
+       _tmp5__length1 = _tmp4_.data_length1;
+       _vala_assert (_tmp5__length1 == 4, "foo.data.length == 4");
+       _tmp6_ = foo;
+       _tmp7_ = _tmp6_.data;
+       _tmp7__length1 = _tmp6_.data_length1;
+       _tmp8_ = _tmp7_[3];
+       _vala_assert (((gint) _tmp8_) == 3, "foo.data[3] == 3");
+       _tmp9_ = g_new0 (guint8, 3 * 2);
+       _tmp9_[0] = (guint8) 1;
+       _tmp9_[1] = (guint8) 2;
+       _tmp9_[2] = (guint8) 3;
+       _tmp9_[3] = (guint8) 4;
+       _tmp9_[4] = (guint8) 5;
+       _tmp9_[5] = (guint8) 6;
+       _tmp10_.bar = 23;
+       _tmp10_.data = (g_free (_tmp10_.data), NULL);
+       _tmp10_.data = _tmp9_;
+       _tmp10_.data_length1 = 3;
+       _tmp10_.data_length2 = 2;
+       _tmp10_.baz = 42;
+       bar = _tmp10_;
+       _tmp11_ = bar;
+       _vala_assert (_tmp11_.bar == 23, "bar.bar == 23");
+       _tmp12_ = bar;
+       _vala_assert (_tmp12_.baz == 42, "bar.baz == 42");
+       _tmp13_ = bar;
+       _tmp14_ = _tmp13_.data;
+       _tmp14__length1 = _tmp13_.data_length1;
+       _tmp14__length2 = _tmp13_.data_length2;
+       _tmp15_ = _tmp14__length1;
+       _vala_assert (_tmp15_ == 3, "bar.data.length[0] == 3");
+       _tmp16_ = bar;
+       _tmp17_ = _tmp16_.data;
+       _tmp17__length1 = _tmp16_.data_length1;
+       _tmp17__length2 = _tmp16_.data_length2;
+       _tmp18_ = _tmp17__length2;
+       _vala_assert (_tmp18_ == 2, "bar.data.length[1] == 2");
+       _tmp19_ = bar;
+       _tmp20_ = _tmp19_.data;
+       _tmp20__length1 = _tmp19_.data_length1;
+       _tmp20__length2 = _tmp19_.data_length2;
+       _tmp21_ = _tmp20_[(2 * _tmp20__length2) + 0];
+       _vala_assert (((gint) _tmp21_) == 5, "bar.data[2,0] == 5");
+       _tmp22_ = g_new0 (const gchar*, 2 + 1);
+       _tmp22_[0] = "foo";
+       _tmp22_[1] = "bar";
+       sa = _tmp22_;
+       sa_length1 = 2;
+       _sa_size_ = sa_length1;
+       _tmp23_[0] = 4711;
+       _tmp23_[1] = 23;
+       memcpy (_tmp24_.data, sa, 2 * sizeof (const gchar*));
+       memcpy (_tmp24_.idata, _tmp23_, 2 * sizeof (gint));
+       _tmp24_.bar = 42;
+       manam = _tmp24_;
+       _tmp25_ = manam;
+       _vala_assert (2 == 2, "manam.data.length == 2");
+       _tmp26_ = manam;
+       _tmp27_ = _tmp26_.data[1];
+       _vala_assert (g_strcmp0 (_tmp27_, "bar") == 0, "manam.data[1] == \"bar\"");
+       _tmp28_ = manam;
+       _vala_assert (2 == 2, "manam.idata.length == 2");
+       _tmp29_ = manam;
+       _tmp30_ = _tmp29_.idata[1];
+       _vala_assert (_tmp30_ == 23, "manam.idata[1] == 23");
+       _tmp31_ = manam;
+       _vala_assert (_tmp31_.bar == 42, "manam.bar == 42");
+       _tmp32_ = MANAM[0];
+       _vala_assert (2 == 2, "MANAM[0].data.length == 2");
+       _tmp33_ = MANAM[0];
+       _tmp34_ = _tmp33_.data[1];
+       _vala_assert (g_strcmp0 (_tmp34_, "bar") == 0, "MANAM[0].data[1] == \"bar\"");
+       _tmp35_ = MANAM[0];
+       _vala_assert (2 == 2, "MANAM[0].idata.length == 2");
+       _tmp36_ = MANAM[0];
+       _tmp37_ = _tmp36_.idata[1];
+       _vala_assert (_tmp37_ == 23, "MANAM[0].idata[1] == 23");
+       _tmp38_ = MANAM[0];
+       _vala_assert (_tmp38_.bar == 42, "MANAM[0].bar == 42");
+       sa = (g_free (sa), NULL);
+       bar_destroy (&bar);
+       foo_destroy (&foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static inline gpointer
+_vala_memdup2 (gconstpointer mem,
+               gsize byte_size)
+{
+       gpointer new_mem;
+       if (mem && byte_size != 0) {
+               new_mem = g_malloc (byte_size);
+               memcpy (new_mem, mem, byte_size);
+       } else {
+               new_mem = NULL;
+       }
+       return new_mem;
+}
+
diff --git a/tests/basic-types/bug632322.c-expected b/tests/basic-types/bug632322.c-expected
new file mode 100644
index 000000000..5fba8e5db
--- /dev/null
+++ b/tests/basic-types/bug632322.c-expected
@@ -0,0 +1,39 @@
+/* basic_types_bug632322.c generated by valac, the Vala compiler
+ * generated from basic_types_bug632322.vala, do not modify */
+
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+       gint* foo = NULL;
+       gint* _tmp0_;
+       gint foo_length1;
+       gint _foo_size_;
+       gint i = 0;
+       _tmp0_ = g_new0 (gint, 42);
+       foo = _tmp0_;
+       foo_length1 = 42;
+       _foo_size_ = foo_length1;
+       i = 1;
+       i = i - 1;
+       foo[i] = 23;
+       _vala_assert (i == 0, "i == 0");
+       foo = (g_free (foo), NULL);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/basic-types/bug643612.c-expected b/tests/basic-types/bug643612.c-expected
new file mode 100644
index 000000000..e6312a702
--- /dev/null
+++ b/tests/basic-types/bug643612.c-expected
@@ -0,0 +1,31 @@
+/* basic_types_bug643612.c generated by valac, the Vala compiler
+ * generated from basic_types_bug643612.vala, do not modify */
+
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+       gint8 test1 = 0;
+       gint8 test2 = 0;
+       test1 = (gint8) -128;
+       test2 = (gint8) 127;
+       _vala_assert (0x80000000LL == 0x80000000LL, "0x80000000 == 0x80000000ll");
+       _vala_assert (-0x80000001LL == -0x80000001LL, "-0x80000001 == -0x80000001ll");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/basic-types/bug644046.c-expected b/tests/basic-types/bug644046.c-expected
new file mode 100644
index 000000000..21672aab2
--- /dev/null
+++ b/tests/basic-types/bug644046.c-expected
@@ -0,0 +1,52 @@
+/* basic_types_bug644046.c generated by valac, the Vala compiler
+ * generated from basic_types_bug644046.vala, do not modify */
+
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (void);
+
+const gint foo[3] = {1, 2, 3};
+
+static void
+_vala_main (void)
+{
+       gint baz[3] = {0};
+       gint _tmp0_[3] = {0};
+       gint _tmp1_;
+       gint _tmp2_;
+       _tmp0_[0] = 3;
+       _tmp0_[1] = 4;
+       _tmp0_[2] = 5;
+       memcpy (baz, _tmp0_, 3 * sizeof (gint));
+       _vala_assert (G_N_ELEMENTS (foo) == 3, "foo.length == 3");
+       _tmp1_ = foo[1];
+       _vala_assert (_tmp1_ == 2, "foo[1] == 2");
+       _vala_assert (3 == 3, "baz.length == 3");
+       _tmp2_ = baz[1];
+       _vala_assert (_tmp2_ == 4, "baz[1] == 4");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/basic-types/bug647222.c-expected b/tests/basic-types/bug647222.c-expected
new file mode 100644
index 000000000..ac7a23a32
--- /dev/null
+++ b/tests/basic-types/bug647222.c-expected
@@ -0,0 +1,30 @@
+/* basic_types_bug647222.c generated by valac, the Vala compiler
+ * generated from basic_types_bug647222.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+       GValue** v = NULL;
+       GValue** _tmp0_;
+       gint v_length1;
+       gint _v_size_;
+       _tmp0_ = g_new0 (GValue*, 10);
+       v = _tmp0_;
+       v_length1 = 10;
+       _v_size_ = v_length1;
+       v = (g_free (v), NULL);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/basic-types/bug648364.c-expected b/tests/basic-types/bug648364.c-expected
new file mode 100644
index 000000000..9e295633c
--- /dev/null
+++ b/tests/basic-types/bug648364.c-expected
@@ -0,0 +1,47 @@
+/* basic_types_bug648364.c generated by valac, the Vala compiler
+ * generated from basic_types_bug648364.vala, do not modify */
+
+#include <glib.h>
+#include <string.h>
+
+#define _g_free0(var) ((var == NULL) ? NULL : (var = (g_free (var), NULL)))
+
+#define foo 3
+static void _vala_main (void);
+static gint* _int_dup (gint* self);
+
+static gint*
+_int_dup (gint* self)
+{
+       gint* dup;
+       dup = g_new0 (gint, 1);
+       memcpy (dup, self, sizeof (gint));
+       return dup;
+}
+
+static gpointer
+__int_dup0 (gpointer self)
+{
+       return self ? _int_dup (self) : NULL;
+}
+
+static void
+_vala_main (void)
+{
+       gint* bar = NULL;
+       gint _tmp0_;
+       gint* _tmp1_;
+       _tmp0_ = foo;
+       _tmp1_ = __int_dup0 (&_tmp0_);
+       bar = _tmp1_;
+       _g_free0 (bar);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/basic-types/bug650993.c-expected b/tests/basic-types/bug650993.c-expected
new file mode 100644
index 000000000..94e09084e
--- /dev/null
+++ b/tests/basic-types/bug650993.c-expected
@@ -0,0 +1,47 @@
+/* basic_types_bug650993.c generated by valac, the Vala compiler
+ * generated from basic_types_bug650993.vala, do not modify */
+
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+VALA_EXTERN void* test (void);
+static void _vala_main (void);
+
+void*
+test (void)
+{
+       void* result = NULL;
+       result = NULL;
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       gint* o = NULL;
+       void* _tmp0_;
+       gint o_length1;
+       gint _o_size_;
+       _tmp0_ = test ();
+       o = (gint*) _tmp0_;
+       o_length1 = -1;
+       _o_size_ = o_length1;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/basic-types/bug652380.c-expected b/tests/basic-types/bug652380.c-expected
new file mode 100644
index 000000000..00e5740f6
--- /dev/null
+++ b/tests/basic-types/bug652380.c-expected
@@ -0,0 +1,61 @@
+/* basic_types_bug652380.c generated by valac, the Vala compiler
+ * generated from basic_types_bug652380.vala, do not modify */
+
+#include <glib.h>
+#include <string.h>
+
+static void _vala_main (void);
+static gint* _vala_array_dup1 (gint* self,
+                        gssize length);
+static inline gpointer _vala_memdup2 (gconstpointer mem,
+                        gsize byte_size);
+
+static gint*
+_vala_array_dup1 (gint* self,
+                  gssize length)
+{
+       if (length > 0) {
+               return _vala_memdup2 (self, length * sizeof (gint));
+       }
+       return NULL;
+}
+
+static void
+_vala_main (void)
+{
+       gint foo[3] = {0};
+       gint* bar = NULL;
+       gint* _tmp0_;
+       gint _tmp0__length1;
+       gint bar_length1;
+       gint _bar_size_;
+       _tmp0_ = _vala_array_dup1 (foo, 3);
+       _tmp0__length1 = 3;
+       bar = _tmp0_;
+       bar_length1 = _tmp0__length1;
+       _bar_size_ = bar_length1;
+       bar = (g_free (bar), NULL);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static inline gpointer
+_vala_memdup2 (gconstpointer mem,
+               gsize byte_size)
+{
+       gpointer new_mem;
+       if (mem && byte_size != 0) {
+               new_mem = g_malloc (byte_size);
+               memcpy (new_mem, mem, byte_size);
+       } else {
+               new_mem = NULL;
+       }
+       return new_mem;
+}
+
diff --git a/tests/basic-types/bug655908.c-expected b/tests/basic-types/bug655908.c-expected
new file mode 100644
index 000000000..cc8d61546
--- /dev/null
+++ b/tests/basic-types/bug655908.c-expected
@@ -0,0 +1,50 @@
+/* basic_types_bug655908.c generated by valac, the Vala compiler
+ * generated from basic_types_bug655908.vala, do not modify */
+
+#include <glib.h>
+#include <string.h>
+
+#define _g_free0(var) ((var == NULL) ? NULL : (var = (g_free (var), NULL)))
+
+static void _vala_main (void);
+static gint* _int_dup (gint* self);
+
+static gint*
+_int_dup (gint* self)
+{
+       gint* dup;
+       dup = g_new0 (gint, 1);
+       memcpy (dup, self, sizeof (gint));
+       return dup;
+}
+
+static gpointer
+__int_dup0 (gpointer self)
+{
+       return self ? _int_dup (self) : NULL;
+}
+
+static void
+_vala_main (void)
+{
+       gint* a = NULL;
+       gint _tmp0_;
+       gint* _tmp1_;
+       _tmp0_ = 2;
+       _tmp1_ = __int_dup0 (&_tmp0_);
+       a = _tmp1_;
+       switch (*a) {
+               default:
+               break;
+       }
+       _g_free0 (a);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/basic-types/bug659975.c-expected b/tests/basic-types/bug659975.c-expected
new file mode 100644
index 000000000..27c3250ec
--- /dev/null
+++ b/tests/basic-types/bug659975.c-expected
@@ -0,0 +1,55 @@
+/* basic_types_bug659975.c generated by valac, the Vala compiler
+ * generated from basic_types_bug659975.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+
+VALA_EXTERN void foo (void* bar);
+static void _vala_main (void);
+
+void
+foo (void* bar)
+{
+       gchar* baz = NULL;
+       void* _tmp0_;
+       _tmp0_ = bar;
+       bar = NULL;
+       baz = (gchar*) _tmp0_;
+       _g_free0 (baz);
+}
+
+static void
+_vala_main (void)
+{
+       gchar* bar = NULL;
+       gchar* _tmp0_;
+       gchar* _tmp1_;
+       _tmp0_ = g_strdup ("bar");
+       bar = _tmp0_;
+       _tmp1_ = bar;
+       bar = NULL;
+       foo (_tmp1_);
+       _g_free0 (bar);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/basic-types/bug678791.c-expected b/tests/basic-types/bug678791.c-expected
new file mode 100644
index 000000000..a26bf9a1c
--- /dev/null
+++ b/tests/basic-types/bug678791.c-expected
@@ -0,0 +1,114 @@
+/* basic_types_bug678791.c generated by valac, the Vala compiler
+ * generated from basic_types_bug678791.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef enum  {
+       FOO_BAR
+} Foo;
+
+#define TYPE_FOO (foo_get_type ())
+#define _g_free0(var) ((var == NULL) ? NULL : (var = (g_free (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+static void _vala_main (void);
+static gboolean _int_equal (const gint * s1,
+                     const gint * s2);
+static gboolean _foo_equal (const Foo * s1,
+                     const Foo * s2);
+
+static GType
+foo_get_type_once (void)
+{
+       static const GEnumValue values[] = {{FOO_BAR, "FOO_BAR", "bar"}, {0, NULL, NULL}};
+       GType foo_type_id;
+       foo_type_id = g_enum_register_static ("Foo", values);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static gboolean
+_int_equal (const gint * s1,
+            const gint * s2)
+{
+       if (s1 == s2) {
+               return TRUE;
+       }
+       if (s1 == NULL) {
+               return FALSE;
+       }
+       if (s2 == NULL) {
+               return FALSE;
+       }
+       return (*s1) == (*s2);
+}
+
+static gboolean
+_foo_equal (const Foo * s1,
+            const Foo * s2)
+{
+       if (s1 == s2) {
+               return TRUE;
+       }
+       if (s1 == NULL) {
+               return FALSE;
+       }
+       if (s2 == NULL) {
+               return FALSE;
+       }
+       return (*s1) == (*s2);
+}
+
+static void
+_vala_main (void)
+{
+       gint* a = NULL;
+       gint b = 0;
+       Foo* f = NULL;
+       Foo g = 0;
+       a = NULL;
+       b = 1;
+       _vala_assert (_int_equal (a, &b) != TRUE, "a != b");
+       _vala_assert (_int_equal (&b, a) != TRUE, "b != a");
+       f = NULL;
+       g = FOO_BAR;
+       _vala_assert (_foo_equal (f, &g) != TRUE, "f != g");
+       _vala_assert (_foo_equal (&g, f) != TRUE, "g != f");
+       _g_free0 (f);
+       _g_free0 (a);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/basic-types/bug686336.c-expected b/tests/basic-types/bug686336.c-expected
new file mode 100644
index 000000000..32473b8bb
--- /dev/null
+++ b/tests/basic-types/bug686336.c-expected
@@ -0,0 +1,408 @@
+/* basic_types_bug686336.c generated by valac, the Vala compiler
+ * generated from basic_types_bug686336.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _FooPrivate {
+       gint* bar;
+       gint bar_length1;
+       gint _bar_size_;
+       gint* baz;
+       gint baz_length1;
+       gint _baz_size_;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+static gint* foo_static_bar;
+static gint foo_static_bar_length1;
+static gint* foo_static_bar = NULL;
+static gint foo_static_bar_length1 = 0;
+static gint _foo_static_bar_size_ = 0;
+static gint* foo_static_baz;
+static gint foo_static_baz_length1;
+static gint* foo_static_baz = NULL;
+static gint foo_static_baz_length1 = 0;
+static gint _foo_static_baz_size_ = 0;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+static gint* foo_create_array (gint* result_length1);
+VALA_EXTERN void foo_test (Foo* self);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+static gint*
+foo_create_array (gint* result_length1)
+{
+       gint* _tmp0_;
+       gint* _tmp1_;
+       gint _tmp1__length1;
+       gint* result = NULL;
+       _tmp0_ = g_new0 (gint, 3);
+       _tmp0_[0] = 1;
+       _tmp0_[1] = 2;
+       _tmp0_[2] = 3;
+       _tmp1_ = _tmp0_;
+       _tmp1__length1 = 3;
+       if (result_length1) {
+               *result_length1 = _tmp1__length1;
+       }
+       result = _tmp1_;
+       return result;
+}
+
+void
+foo_test (Foo* self)
+{
+       gint* _tmp0_;
+       gint _tmp0__length1;
+       gint* _tmp1_;
+       gint _tmp1__length1;
+       gint* _tmp2_;
+       gint _tmp2__length1;
+       gint* _tmp3_;
+       gint _tmp3__length1;
+       g_return_if_fail (IS_FOO (self));
+       _tmp0_ = foo_static_bar;
+       _tmp0__length1 = foo_static_bar_length1;
+       _vala_assert (_tmp0__length1 == 3, "static_bar.length == 3");
+       _tmp1_ = foo_static_baz;
+       _tmp1__length1 = foo_static_baz_length1;
+       _vala_assert (_tmp1__length1 == 3, "static_baz.length == 3");
+       _tmp2_ = self->priv->bar;
+       _tmp2__length1 = self->priv->bar_length1;
+       _vala_assert (_tmp2__length1 == 3, "bar.length == 3");
+       _tmp3_ = self->priv->baz;
+       _tmp3__length1 = self->priv->baz_length1;
+       _vala_assert (_tmp3__length1 == 3, "baz.length == 3");
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       gint* _tmp0_;
+       gint _tmp1_ = 0;
+       gint* _tmp2_;
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+       _tmp0_ = g_new0 (gint, 3);
+       _tmp0_[0] = 1;
+       _tmp0_[1] = 2;
+       _tmp0_[2] = 3;
+       foo_static_bar = _tmp0_;
+       foo_static_bar_length1 = 3;
+       _tmp2_ = foo_create_array (&_tmp1_);
+       foo_static_baz = _tmp2_;
+       foo_static_baz_length1 = _tmp1_;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       gint* _tmp0_;
+       gint _tmp1_ = 0;
+       gint* _tmp2_;
+       self->priv = foo_get_instance_private (self);
+       _tmp0_ = g_new0 (gint, 3);
+       _tmp0_[0] = 1;
+       _tmp0_[1] = 2;
+       _tmp0_[2] = 3;
+       self->priv->bar = _tmp0_;
+       self->priv->bar_length1 = 3;
+       self->priv->_bar_size_ = self->priv->bar_length1;
+       _tmp2_ = foo_create_array (&_tmp1_);
+       self->priv->baz = _tmp2_;
+       self->priv->baz_length1 = _tmp1_;
+       self->priv->_baz_size_ = self->priv->baz_length1;
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+       self->priv->bar = (g_free (self->priv->bar), NULL);
+       self->priv->baz = (g_free (self->priv->baz), NULL);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       foo_test (foo);
+       _foo_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/basic-types/bug729907.c-expected b/tests/basic-types/bug729907.c-expected
new file mode 100644
index 000000000..efe52397a
--- /dev/null
+++ b/tests/basic-types/bug729907.c-expected
@@ -0,0 +1,28 @@
+/* basic_types_bug729907.c generated by valac, the Vala compiler
+ * generated from basic_types_bug729907.vala, do not modify */
+
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+       _vala_assert (FALSE ^ (TRUE == TRUE), "false ^ true == true");
+       _vala_assert (TRUE ^ (TRUE == FALSE), "true ^ true == false");
+       _vala_assert (FALSE ^ (FALSE == FALSE), "false ^ false == false");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/basic-types/bug731017.c-expected b/tests/basic-types/bug731017.c-expected
new file mode 100644
index 000000000..64b18d37c
--- /dev/null
+++ b/tests/basic-types/bug731017.c-expected
@@ -0,0 +1,160 @@
+/* basic_types_bug731017.c generated by valac, the Vala compiler
+ * generated from basic_types_bug731017.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN gchar* foo;
+gchar* foo = NULL;
+
+VALA_EXTERN const gchar** bar (gint* result_length1);
+static void _vala_main (void);
+static gchar** _vala_array_dup1 (gchar** self,
+                          gssize length);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+const gchar**
+bar (gint* result_length1)
+{
+       const gchar** ret = NULL;
+       const gchar** _tmp0_;
+       gint ret_length1;
+       gint _ret_size_;
+       const gchar* _tmp1_;
+       const gchar** _tmp2_;
+       gint _tmp2__length1;
+       const gchar** result = NULL;
+       _tmp0_ = g_new0 (const gchar*, 1 + 1);
+       ret = _tmp0_;
+       ret_length1 = 1;
+       _ret_size_ = ret_length1;
+       _tmp1_ = foo;
+       ret[0] = _tmp1_;
+       _tmp2_ = ret;
+       _tmp2__length1 = ret_length1;
+       if (result_length1) {
+               *result_length1 = _tmp2__length1;
+       }
+       result = _tmp2_;
+       return result;
+}
+
+static gchar**
+_vala_array_dup1 (gchar** self,
+                  gssize length)
+{
+       if (length >= 0) {
+               gchar** result;
+               gssize i;
+               result = g_new0 (gchar*, length + 1);
+               for (i = 0; i < length; i++) {
+                       gchar* _tmp0_;
+                       _tmp0_ = g_strdup (self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+static void
+_vala_main (void)
+{
+       gchar* _tmp0_;
+       gchar** keys = NULL;
+       gint _tmp1_ = 0;
+       const gchar** _tmp2_;
+       gchar** _tmp3_;
+       gint _tmp3__length1;
+       gint keys_length1;
+       gint _keys_size_;
+       gchar** _tmp4_;
+       gint _tmp4__length1;
+       _tmp0_ = g_strdup ("foo");
+       _g_free0 (foo);
+       foo = _tmp0_;
+       _tmp2_ = bar (&_tmp1_);
+       _tmp3_ = (_tmp2_ != NULL) ? _vala_array_dup1 (_tmp2_, _tmp1_) : _tmp2_;
+       _tmp3__length1 = _tmp1_;
+       _tmp2_ = (g_free (_tmp2_), NULL);
+       keys = _tmp3_;
+       keys_length1 = _tmp3__length1;
+       _keys_size_ = keys_length1;
+       _g_free0 (foo);
+       foo = NULL;
+       _tmp4_ = keys;
+       _tmp4__length1 = keys_length1;
+       {
+               gchar** k_collection = NULL;
+               gint k_collection_length1 = 0;
+               gint _k_collection_size_ = 0;
+               gint k_it = 0;
+               k_collection = _tmp4_;
+               k_collection_length1 = _tmp4__length1;
+               for (k_it = 0; k_it < k_collection_length1; k_it = k_it + 1) {
+                       const gchar* k = NULL;
+                       k = k_collection[k_it];
+                       {
+                               const gchar* _tmp5_;
+                               _tmp5_ = k;
+                               _vala_assert (g_strcmp0 (_tmp5_, "foo") == 0, "k == \"foo\"");
+                       }
+               }
+       }
+       keys = (_vala_array_free (keys, keys_length1, (GDestroyNotify) g_free), NULL);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/basic-types/bug756376.c-expected b/tests/basic-types/bug756376.c-expected
new file mode 100644
index 000000000..8403cbcaf
--- /dev/null
+++ b/tests/basic-types/bug756376.c-expected
@@ -0,0 +1,41 @@
+/* basic_types_bug756376.c generated by valac, the Vala compiler
+ * generated from basic_types_bug756376.vala, do not modify */
+
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define FOO_BAR 5
+VALA_EXTERN void bar (gint* a,
+          gint a_length1);
+static void _vala_main (void);
+
+void
+bar (gint* a,
+     gint a_length1)
+{
+}
+
+static void
+_vala_main (void)
+{
+       gint arr[FOO_BAR] = {0};
+       bar (arr, (gint) FOO_BAR);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/basic-types/bug761307.c-expected b/tests/basic-types/bug761307.c-expected
new file mode 100644
index 000000000..8fe2e9962
--- /dev/null
+++ b/tests/basic-types/bug761307.c-expected
@@ -0,0 +1,68 @@
+/* basic_types_bug761307.c generated by valac, the Vala compiler
+ * generated from basic_types_bug761307.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+
+VALA_EXTERN void bar (const gchar** str,
+          gint str_length1);
+VALA_EXTERN void foo (void);
+static void _vala_main (void);
+
+void
+bar (const gchar** str,
+     gint str_length1)
+{
+}
+
+void
+foo (void)
+{
+       const gchar* s1 = NULL;
+       const gchar* s2 = NULL;
+       const gchar** _tmp0_;
+       const gchar** _tmp1_;
+       gint _tmp1__length1;
+       gchar* s3 = NULL;
+       gchar* _tmp2_;
+       s1 = "ABC";
+       s2 = "CDE";
+       _tmp0_ = g_new0 (const gchar*, 2 + 1);
+       _tmp0_[0] = s1;
+       _tmp0_[1] = s2;
+       _tmp1_ = _tmp0_;
+       _tmp1__length1 = 2;
+       bar (_tmp1_, (gint) 2);
+       _tmp1_ = (g_free (_tmp1_), NULL);
+       _tmp2_ = g_strdup_printf ("%s%s", s1, s2);
+       s3 = _tmp2_;
+       _g_free0 (s3);
+}
+
+static void
+_vala_main (void)
+{
+       foo ();
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/basic-types/bug761736.c-expected b/tests/basic-types/bug761736.c-expected
new file mode 100644
index 000000000..5a164dd6a
--- /dev/null
+++ b/tests/basic-types/bug761736.c-expected
@@ -0,0 +1,385 @@
+/* basic_types_bug761736.c generated by valac, the Vala compiler
+ * generated from basic_types_bug761736.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN gchar** transfer_none (gint* result_length1);
+VALA_EXTERN const gchar** transfer_container (gint* result_length1);
+static const gchar** _vala_array_dup1 (const gchar** self,
+                                gssize length);
+VALA_EXTERN gchar** transfer_full (gint* result_length1);
+static gchar** _vala_array_dup2 (gchar** self,
+                          gssize length);
+static void _vala_main (void);
+static const gchar** _vala_array_dup3 (const gchar** self,
+                                gssize length);
+static gchar** _vala_array_dup4 (gchar** self,
+                          gssize length);
+static gboolean _vala_string_array_contains (gchar* * stack,
+                                      gssize stack_length,
+                                      const gchar* needle);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+static inline gpointer _vala_memdup2 (gconstpointer mem,
+                        gsize byte_size);
+
+const gchar* FOO[2] = {"foo", "bar"};
+
+gchar**
+transfer_none (gint* result_length1)
+{
+       gchar** _tmp0_;
+       gint _tmp0__length1;
+       gchar** result = NULL;
+       _tmp0_ = FOO;
+       _tmp0__length1 = G_N_ELEMENTS (FOO);
+       if (result_length1) {
+               *result_length1 = _tmp0__length1;
+       }
+       result = _tmp0_;
+       return result;
+}
+
+static const gchar**
+_vala_array_dup1 (const gchar** self,
+                  gssize length)
+{
+       if (length > 0) {
+               return _vala_memdup2 (self, length * sizeof (const gchar*));
+       }
+       return NULL;
+}
+
+const gchar**
+transfer_container (gint* result_length1)
+{
+       const gchar** _tmp0_;
+       gint _tmp0__length1;
+       const gchar** _tmp1_;
+       gint _tmp1__length1;
+       const gchar** result = NULL;
+       _tmp0_ = _vala_array_dup1 (FOO, G_N_ELEMENTS (FOO));
+       _tmp0__length1 = G_N_ELEMENTS (FOO);
+       _tmp1_ = _tmp0_;
+       _tmp1__length1 = _tmp0__length1;
+       if (result_length1) {
+               *result_length1 = _tmp1__length1;
+       }
+       result = _tmp1_;
+       return result;
+}
+
+static gchar**
+_vala_array_dup2 (gchar** self,
+                  gssize length)
+{
+       if (length >= 0) {
+               gchar** result;
+               gssize i;
+               result = g_new0 (gchar*, length + 1);
+               for (i = 0; i < length; i++) {
+                       gchar* _tmp0_;
+                       _tmp0_ = g_strdup (self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+gchar**
+transfer_full (gint* result_length1)
+{
+       gchar** _tmp0_;
+       gint _tmp0__length1;
+       gchar** _tmp1_;
+       gint _tmp1__length1;
+       gchar** result = NULL;
+       _tmp0_ = _vala_array_dup2 (FOO, G_N_ELEMENTS (FOO));
+       _tmp0__length1 = G_N_ELEMENTS (FOO);
+       _tmp1_ = _tmp0_;
+       _tmp1__length1 = _tmp0__length1;
+       if (result_length1) {
+               *result_length1 = _tmp1__length1;
+       }
+       result = _tmp1_;
+       return result;
+}
+
+static const gchar**
+_vala_array_dup3 (const gchar** self,
+                  gssize length)
+{
+       if (length > 0) {
+               return _vala_memdup2 (self, length * sizeof (const gchar*));
+       }
+       return NULL;
+}
+
+static gchar**
+_vala_array_dup4 (gchar** self,
+                  gssize length)
+{
+       if (length >= 0) {
+               gchar** result;
+               gssize i;
+               result = g_new0 (gchar*, length + 1);
+               for (i = 0; i < length; i++) {
+                       gchar* _tmp0_;
+                       _tmp0_ = g_strdup (self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+static gboolean
+_vala_string_array_contains (gchar* * stack,
+                             gssize stack_length,
+                             const gchar* needle)
+{
+       gssize i;
+       for (i = 0; i < stack_length; i++) {
+               if (g_strcmp0 (stack[i], needle) == 0) {
+                       return TRUE;
+               }
+       }
+       return FALSE;
+}
+
+static void
+_vala_main (void)
+{
+       const gchar** bar = NULL;
+       const gchar** _tmp0_;
+       gint _tmp0__length1;
+       gint bar_length1;
+       gint _bar_size_;
+       _tmp0_ = _vala_array_dup3 (FOO, G_N_ELEMENTS (FOO));
+       _tmp0__length1 = G_N_ELEMENTS (FOO);
+       bar = _tmp0_;
+       bar_length1 = _tmp0__length1;
+       _bar_size_ = bar_length1;
+       {
+               gint i = 0;
+               i = 0;
+               {
+                       gboolean _tmp1_ = FALSE;
+                       _tmp1_ = TRUE;
+                       while (TRUE) {
+                               gchar** baz = NULL;
+                               const gchar** _tmp3_;
+                               gint _tmp3__length1;
+                               gchar** _tmp4_;
+                               gint _tmp4__length1;
+                               gint baz_length1;
+                               gint _baz_size_;
+                               if (!_tmp1_) {
+                                       gint _tmp2_;
+                                       _tmp2_ = i;
+                                       i = _tmp2_ + 1;
+                               }
+                               _tmp1_ = FALSE;
+                               if (!(i < 42)) {
+                                       break;
+                               }
+                               _tmp3_ = bar;
+                               _tmp3__length1 = bar_length1;
+                               _tmp4_ = (_tmp3_ != NULL) ? _vala_array_dup4 (_tmp3_, _tmp3__length1) : 
_tmp3_;
+                               _tmp4__length1 = _tmp3__length1;
+                               baz = _tmp4_;
+                               baz_length1 = _tmp4__length1;
+                               _baz_size_ = baz_length1;
+                               baz = (_vala_array_free (baz, baz_length1, (GDestroyNotify) g_free), NULL);
+                       }
+               }
+       }
+       {
+               gint i = 0;
+               i = 0;
+               {
+                       gboolean _tmp5_ = FALSE;
+                       _tmp5_ = TRUE;
+                       while (TRUE) {
+                               gchar** a = NULL;
+                               gint _tmp7_ = 0;
+                               gchar** _tmp8_;
+                               gint a_length1;
+                               gint _a_size_;
+                               gchar** _tmp9_;
+                               gint _tmp9__length1;
+                               gchar** _tmp10_;
+                               gint _tmp10__length1;
+                               if (!_tmp5_) {
+                                       gint _tmp6_;
+                                       _tmp6_ = i;
+                                       i = _tmp6_ + 1;
+                               }
+                               _tmp5_ = FALSE;
+                               if (!(i < 42)) {
+                                       break;
+                               }
+                               _tmp8_ = transfer_none (&_tmp7_);
+                               a = _tmp8_;
+                               a_length1 = _tmp7_;
+                               _a_size_ = a_length1;
+                               _tmp9_ = a;
+                               _tmp9__length1 = a_length1;
+                               _vala_assert (_vala_string_array_contains (_tmp9_, _tmp9__length1, "foo"), 
"\"foo\" in a");
+                               _tmp10_ = a;
+                               _tmp10__length1 = a_length1;
+                               _vala_assert (_vala_string_array_contains (_tmp10_, _tmp10__length1, "bar"), 
"\"bar\" in a");
+                       }
+               }
+       }
+       {
+               gint i = 0;
+               i = 0;
+               {
+                       gboolean _tmp11_ = FALSE;
+                       _tmp11_ = TRUE;
+                       while (TRUE) {
+                               const gchar** a = NULL;
+                               gint _tmp13_ = 0;
+                               const gchar** _tmp14_;
+                               gint a_length1;
+                               gint _a_size_;
+                               const gchar** _tmp15_;
+                               gint _tmp15__length1;
+                               const gchar** _tmp16_;
+                               gint _tmp16__length1;
+                               if (!_tmp11_) {
+                                       gint _tmp12_;
+                                       _tmp12_ = i;
+                                       i = _tmp12_ + 1;
+                               }
+                               _tmp11_ = FALSE;
+                               if (!(i < 42)) {
+                                       break;
+                               }
+                               _tmp14_ = transfer_container (&_tmp13_);
+                               a = _tmp14_;
+                               a_length1 = _tmp13_;
+                               _a_size_ = a_length1;
+                               _tmp15_ = a;
+                               _tmp15__length1 = a_length1;
+                               _vala_assert (_vala_string_array_contains (_tmp15_, _tmp15__length1, "foo"), 
"\"foo\" in a");
+                               _tmp16_ = a;
+                               _tmp16__length1 = a_length1;
+                               _vala_assert (_vala_string_array_contains (_tmp16_, _tmp16__length1, "bar"), 
"\"bar\" in a");
+                               a = (g_free (a), NULL);
+                       }
+               }
+       }
+       {
+               gint i = 0;
+               i = 0;
+               {
+                       gboolean _tmp17_ = FALSE;
+                       _tmp17_ = TRUE;
+                       while (TRUE) {
+                               gchar** a = NULL;
+                               gint _tmp19_ = 0;
+                               gchar** _tmp20_;
+                               gint a_length1;
+                               gint _a_size_;
+                               gchar** _tmp21_;
+                               gint _tmp21__length1;
+                               gchar** _tmp22_;
+                               gint _tmp22__length1;
+                               if (!_tmp17_) {
+                                       gint _tmp18_;
+                                       _tmp18_ = i;
+                                       i = _tmp18_ + 1;
+                               }
+                               _tmp17_ = FALSE;
+                               if (!(i < 42)) {
+                                       break;
+                               }
+                               _tmp20_ = transfer_full (&_tmp19_);
+                               a = _tmp20_;
+                               a_length1 = _tmp19_;
+                               _a_size_ = a_length1;
+                               _tmp21_ = a;
+                               _tmp21__length1 = a_length1;
+                               _vala_assert (_vala_string_array_contains (_tmp21_, _tmp21__length1, "foo"), 
"\"foo\" in a");
+                               _tmp22_ = a;
+                               _tmp22__length1 = a_length1;
+                               _vala_assert (_vala_string_array_contains (_tmp22_, _tmp22__length1, "bar"), 
"\"bar\" in a");
+                               a = (_vala_array_free (a, a_length1, (GDestroyNotify) g_free), NULL);
+                       }
+               }
+       }
+       _vala_assert (_vala_string_array_contains (FOO, G_N_ELEMENTS (FOO), "foo"), "\"foo\" in FOO");
+       _vala_assert (_vala_string_array_contains (FOO, G_N_ELEMENTS (FOO), "bar"), "\"bar\" in FOO");
+       bar = (g_free (bar), NULL);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
+static inline gpointer
+_vala_memdup2 (gconstpointer mem,
+               gsize byte_size)
+{
+       gpointer new_mem;
+       if (mem && byte_size != 0) {
+               new_mem = g_malloc (byte_size);
+               memcpy (new_mem, mem, byte_size);
+       } else {
+               new_mem = NULL;
+       }
+       return new_mem;
+}
+
diff --git a/tests/basic-types/bug772426.c-expected b/tests/basic-types/bug772426.c-expected
new file mode 100644
index 000000000..c9f08aa2a
--- /dev/null
+++ b/tests/basic-types/bug772426.c-expected
@@ -0,0 +1,110 @@
+/* basic_types_bug772426.c generated by valac, the Vala compiler
+ * generated from basic_types_bug772426.vala, do not modify */
+
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN gint BUFFER_LENGTH;
+gint BUFFER_LENGTH = 1048576;
+
+static void _vala_main (void);
+static GVariant* _variant_new1 (guint8* value,
+                         gint value_length1);
+static guint8* _variant_get1 (GVariant* value,
+                       gint* result_length1);
+static inline gpointer _vala_memdup2 (gconstpointer mem,
+                        gsize byte_size);
+
+static GVariant*
+_variant_new1 (guint8* value,
+               gint value_length1)
+{
+       guint8* _tmp1_;
+       _tmp1_ = _vala_memdup2 (value, value_length1);
+       return g_variant_ref_sink (g_variant_new_from_data (G_VARIANT_TYPE ("ay"), _tmp1_, value_length1, 
TRUE, g_free, _tmp1_));
+}
+
+static guint8*
+_variant_get1 (GVariant* value,
+               gint* result_length1)
+{
+       gsize _tmp4__length;
+       guint8* _tmp4_;
+       _tmp4__length = g_variant_get_size (value);
+       _tmp4_ = _vala_memdup2 (g_variant_get_data (value), _tmp4__length);
+       *result_length1 = _tmp4__length;
+       return _tmp4_;
+}
+
+static void
+_vala_main (void)
+{
+       void* buffer_p = NULL;
+       void* _tmp0_;
+       guint8* buffer = NULL;
+       gint buffer_length1;
+       gint _buffer_size_;
+       GVariant* v = NULL;
+       GVariant* _tmp2_;
+       guint8* _result_ = NULL;
+       guint8* _tmp3_ = NULL;
+       gint _tmp3__length1 = 0;
+       gint _result__length1;
+       gint __result__size_;
+       _tmp0_ = g_malloc ((gsize) BUFFER_LENGTH);
+       buffer_p = _tmp0_;
+       memset (buffer_p, 0x55555555, (gsize) BUFFER_LENGTH);
+       buffer = (guint8*) buffer_p;
+       buffer_length1 = -1;
+       _buffer_size_ = buffer_length1;
+       buffer_length1 = BUFFER_LENGTH;
+       _tmp2_ = _variant_new1 (buffer, buffer_length1);
+       v = _tmp2_;
+       _tmp3_ = _variant_get1 (v, &_tmp3__length1);
+       _result_ = _tmp3_;
+       _result__length1 = _tmp3__length1;
+       __result__size_ = _result__length1;
+       _vala_assert (memcmp (buffer, _result_, (gsize) BUFFER_LENGTH) == 0, "Memory.cmp (buffer, result, 
BUFFER_LENGTH) == 0");
+       g_free (buffer_p);
+       _result_ = (g_free (_result_), NULL);
+       _g_variant_unref0 (v);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static inline gpointer
+_vala_memdup2 (gconstpointer mem,
+               gsize byte_size)
+{
+       gpointer new_mem;
+       if (mem && byte_size != 0) {
+               new_mem = g_malloc (byte_size);
+               memcpy (new_mem, mem, byte_size);
+       } else {
+               new_mem = NULL;
+       }
+       return new_mem;
+}
+
diff --git a/tests/basic-types/bug787152.c-expected b/tests/basic-types/bug787152.c-expected
new file mode 100644
index 000000000..f06e3ddbb
--- /dev/null
+++ b/tests/basic-types/bug787152.c-expected
@@ -0,0 +1,46 @@
+/* basic_types_bug787152.c generated by valac, the Vala compiler
+ * generated from basic_types_bug787152.vala, do not modify */
+
+#include <glib.h>
+#include <string.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+       gint test[6] = {0};
+       gint _tmp0_[6] = {0};
+       gint _tmp1_;
+       gint _tmp2_;
+       gint test2[6] = {0};
+       gint _tmp3_;
+       gint _tmp4_;
+       _tmp0_[0] = 23;
+       _tmp0_[1] = 4711;
+       _tmp0_[2] = 42;
+       memcpy (test, _tmp0_, 6 * sizeof (gint));
+       _tmp1_ = test[4];
+       _vala_assert (_tmp1_ == 0, "test[4] == 0");
+       _tmp2_ = test[5];
+       _vala_assert (_tmp2_ == 0, "test[5] == 0");
+       memcpy (test2, test, 6 * sizeof (gint));
+       _tmp3_ = test2[4];
+       _vala_assert (_tmp3_ == 0, "test2[4] == 0");
+       _tmp4_ = test2[5];
+       _vala_assert (_tmp4_ == 0, "test2[5] == 0");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/basic-types/bug788775.c-expected b/tests/basic-types/bug788775.c-expected
new file mode 100644
index 000000000..f0f5c33b6
--- /dev/null
+++ b/tests/basic-types/bug788775.c-expected
@@ -0,0 +1,108 @@
+/* basic_types_bug788775.c generated by valac, the Vala compiler
+ * generated from basic_types_bug788775.vala, do not modify */
+
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _g_key_file_unref0(var) ((var == NULL) ? NULL : (var = (g_key_file_unref (var), NULL)))
+
+VALA_EXTERN void test_compile_only (void);
+static void _vala_main (void);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+void
+test_compile_only (void)
+{
+       GError* _inner_error0_ = NULL;
+       {
+               GKeyFile* file = NULL;
+               GKeyFile* _tmp0_;
+               gchar** list = NULL;
+               gsize _tmp1_ = 0;
+               gchar** _tmp2_;
+               gint list_length1;
+               gint _list_size_;
+               _tmp0_ = g_key_file_new ();
+               file = _tmp0_;
+               _tmp2_ = g_key_file_get_string_list (file, "foo", "bar", &_tmp1_, &_inner_error0_);
+               list = _tmp2_;
+               list_length1 = _tmp1_;
+               _list_size_ = list_length1;
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       _g_key_file_unref0 (file);
+                       if (_inner_error0_->domain == G_KEY_FILE_ERROR) {
+                               goto __catch0_g_key_file_error;
+                       }
+                       g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+               list = (_vala_array_free (list, list_length1, (GDestroyNotify) g_free), NULL);
+               _g_key_file_unref0 (file);
+       }
+       goto __finally0;
+       __catch0_g_key_file_error:
+       {
+               g_clear_error (&_inner_error0_);
+       }
+       __finally0:
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/basic-types/custom-types.c-expected b/tests/basic-types/custom-types.c-expected
new file mode 100644
index 000000000..2e053ab4e
--- /dev/null
+++ b/tests/basic-types/custom-types.c-expected
@@ -0,0 +1,59 @@
+/* basic_types_custom_types.c generated by valac, the Vala compiler
+ * generated from basic_types_custom_types.vala, do not modify */
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <glib.h>
+#include <float.h>
+#include <math.h>
+
+typedef int32_t foo_t;
+typedef uint64_t faz_t;
+typedef float bar_t;
+typedef double baz_t;
+typedef bool manam_t;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+       {
+               foo_t foo = {0};
+               foo = (foo_t) G_MAXINT32;
+               _vala_assert (foo == ((foo_t) G_MAXINT32), "foo == int32.MAX");
+       }
+       {
+               faz_t faz = {0};
+               faz = (faz_t) G_MAXUINT64;
+               _vala_assert (faz == ((faz_t) G_MAXUINT64), "faz == uint64.MAX");
+       }
+       {
+               bar_t bar = {0};
+               bar = (bar_t) FLT_MAX;
+               _vala_assert (bar == ((bar_t) FLT_MAX), "bar == float.MAX");
+       }
+       {
+               baz_t baz = {0};
+               baz = (baz_t) DBL_MAX;
+               _vala_assert (baz == ((baz_t) DBL_MAX), "baz == double.MAX");
+       }
+       {
+               manam_t manam = {0};
+               manam = (manam_t) TRUE;
+               _vala_assert ((gboolean) manam, "manam");
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/basic-types/default-gtype.c-expected b/tests/basic-types/default-gtype.c-expected
new file mode 100644
index 000000000..e634cf441
--- /dev/null
+++ b/tests/basic-types/default-gtype.c-expected
@@ -0,0 +1,252 @@
+/* basic_types_default_gtype.c generated by valac, the Vala compiler
+ * generated from basic_types_default_gtype.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+#include <float.h>
+#include <math.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_IFOO (ifoo_get_type ())
+#define IFOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IFOO, IFoo))
+#define IS_IFOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IFOO))
+#define IFOO_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_IFOO, IFooIface))
+
+typedef struct _IFoo IFoo;
+typedef struct _IFooIface IFooIface;
+typedef enum  {
+       FOO_ENUM_FOO
+} FooEnum;
+
+#define TYPE_FOO_ENUM (foo_enum_get_type ())
+typedef enum  {
+       FOO_FLAG_FOO = 1 << 0
+} FooFlag;
+
+#define TYPE_FOO_FLAG (foo_flag_get_type ())
+
+#define TYPE_FOO_STRUCT (foo_struct_get_type ())
+typedef struct _FooStruct FooStruct;
+typedef enum  {
+       BAR_ENUM_BAR
+} BarEnum;
+
+typedef enum  {
+       BAR_FLAG_BAR = 1 << 0
+} BarFlag;
+
+typedef struct _BarStruct BarStruct;
+typedef struct _ManamStruct ManamStruct;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _IFooIface {
+       GTypeInterface parent_iface;
+};
+
+typedef enum  {
+       FOO_ERROR_FAIL
+} FooError;
+#define FOO_ERROR foo_error_quark ()
+struct _FooStruct {
+       gint i;
+};
+
+struct _BarStruct {
+       gint i;
+};
+
+struct _ManamStruct {
+       gint i;
+};
+
+VALA_EXTERN GType ifoo_get_type (void) G_GNUC_CONST ;
+static GType ifoo_get_type_once (void);
+VALA_EXTERN GType foo_enum_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN GType foo_flag_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN GQuark foo_error_quark (void);
+VALA_EXTERN GType foo_struct_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN FooStruct* foo_struct_dup (const FooStruct* self);
+VALA_EXTERN void foo_struct_free (FooStruct* self);
+VALA_EXTERN BarStruct* bar_struct_dup (const BarStruct* self);
+VALA_EXTERN void bar_struct_free (BarStruct* self);
+static void _vala_main (void);
+
+static void
+ifoo_default_init (IFooIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+ifoo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (IFooIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) ifoo_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType ifoo_type_id;
+       ifoo_type_id = g_type_register_static (G_TYPE_INTERFACE, "IFoo", &g_define_type_info, 0);
+       return ifoo_type_id;
+}
+
+GType
+ifoo_get_type (void)
+{
+       static volatile gsize ifoo_type_id__volatile = 0;
+       if (g_once_init_enter (&ifoo_type_id__volatile)) {
+               GType ifoo_type_id;
+               ifoo_type_id = ifoo_get_type_once ();
+               g_once_init_leave (&ifoo_type_id__volatile, ifoo_type_id);
+       }
+       return ifoo_type_id__volatile;
+}
+
+static GType
+foo_enum_get_type_once (void)
+{
+       static const GEnumValue values[] = {{FOO_ENUM_FOO, "FOO_ENUM_FOO", "foo"}, {0, NULL, NULL}};
+       GType foo_enum_type_id;
+       foo_enum_type_id = g_enum_register_static ("FooEnum", values);
+       return foo_enum_type_id;
+}
+
+GType
+foo_enum_get_type (void)
+{
+       static volatile gsize foo_enum_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_enum_type_id__volatile)) {
+               GType foo_enum_type_id;
+               foo_enum_type_id = foo_enum_get_type_once ();
+               g_once_init_leave (&foo_enum_type_id__volatile, foo_enum_type_id);
+       }
+       return foo_enum_type_id__volatile;
+}
+
+static GType
+foo_flag_get_type_once (void)
+{
+       static const GFlagsValue values[] = {{FOO_FLAG_FOO, "FOO_FLAG_FOO", "foo"}, {0, NULL, NULL}};
+       GType foo_flag_type_id;
+       foo_flag_type_id = g_flags_register_static ("FooFlag", values);
+       return foo_flag_type_id;
+}
+
+GType
+foo_flag_get_type (void)
+{
+       static volatile gsize foo_flag_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_flag_type_id__volatile)) {
+               GType foo_flag_type_id;
+               foo_flag_type_id = foo_flag_get_type_once ();
+               g_once_init_leave (&foo_flag_type_id__volatile, foo_flag_type_id);
+       }
+       return foo_flag_type_id__volatile;
+}
+
+GQuark
+foo_error_quark (void)
+{
+       return g_quark_from_static_string ("foo-error-quark");
+}
+
+FooStruct*
+foo_struct_dup (const FooStruct* self)
+{
+       FooStruct* dup;
+       dup = g_new0 (FooStruct, 1);
+       memcpy (dup, self, sizeof (FooStruct));
+       return dup;
+}
+
+void
+foo_struct_free (FooStruct* self)
+{
+       g_free (self);
+}
+
+static GType
+foo_struct_get_type_once (void)
+{
+       GType foo_struct_type_id;
+       foo_struct_type_id = g_boxed_type_register_static ("FooStruct", (GBoxedCopyFunc) foo_struct_dup, 
(GBoxedFreeFunc) foo_struct_free);
+       return foo_struct_type_id;
+}
+
+GType
+foo_struct_get_type (void)
+{
+       static volatile gsize foo_struct_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_struct_type_id__volatile)) {
+               GType foo_struct_type_id;
+               foo_struct_type_id = foo_struct_get_type_once ();
+               g_once_init_leave (&foo_struct_type_id__volatile, foo_struct_type_id);
+       }
+       return foo_struct_type_id__volatile;
+}
+
+BarStruct*
+bar_struct_dup (const BarStruct* self)
+{
+       BarStruct* dup;
+       dup = g_new0 (BarStruct, 1);
+       memcpy (dup, self, sizeof (BarStruct));
+       return dup;
+}
+
+void
+bar_struct_free (BarStruct* self)
+{
+       g_free (self);
+}
+
+static void
+_vala_main (void)
+{
+       _vala_assert (G_TYPE_BOOLEAN == G_TYPE_BOOLEAN, "typeof (bool) == GLib.Type.BOOLEAN");
+       _vala_assert (g_type_is_a (TYPE_FOO_STRUCT, G_TYPE_BOXED), "typeof (FooStruct).is_a 
(GLib.Type.BOXED)");
+       _vala_assert (G_TYPE_CHAR == G_TYPE_CHAR, "typeof (char) == GLib.Type.CHAR");
+       _vala_assert (G_TYPE_DOUBLE == G_TYPE_DOUBLE, "typeof (double) == GLib.Type.DOUBLE");
+       _vala_assert (g_type_is_a (TYPE_FOO_ENUM, G_TYPE_ENUM), "typeof (FooEnum).is_a (GLib.Type.ENUM)");
+       _vala_assert (G_TYPE_ERROR == G_TYPE_ERROR, "typeof (FooError) == G_TYPE_ERROR");
+       _vala_assert (g_type_is_a (TYPE_FOO_FLAG, G_TYPE_FLAGS), "typeof (FooFlag).is_a (GLib.Type.FLAGS)");
+       _vala_assert (G_TYPE_FLOAT == G_TYPE_FLOAT, "typeof (float) == GLib.Type.FLOAT");
+       _vala_assert (G_TYPE_INT == G_TYPE_INT, "typeof (int) == GLib.Type.INT");
+       _vala_assert (G_TYPE_INT64 == G_TYPE_INT64, "typeof (int64) == GLib.Type.INT64");
+       _vala_assert (g_type_is_a (TYPE_IFOO, G_TYPE_INTERFACE), "typeof (IFoo).is_a (GLib.Type.INTERFACE)");
+       _vala_assert (G_TYPE_INVALID == G_TYPE_INVALID, "typeof (IFoo[]) == GLib.Type.INVALID");
+       _vala_assert (G_TYPE_LONG == G_TYPE_LONG, "typeof (long) == GLib.Type.LONG");
+       _vala_assert (G_TYPE_NONE == G_TYPE_NONE, "typeof (void) == GLib.Type.NONE");
+       _vala_assert (G_TYPE_OBJECT == G_TYPE_OBJECT, "typeof (Object) == GLib.Type.OBJECT");
+       _vala_assert (G_TYPE_PARAM == G_TYPE_PARAM, "typeof (ParamSpec) == GLib.Type.PARAM");
+       _vala_assert (G_TYPE_POINTER == G_TYPE_POINTER, "typeof (void*) == GLib.Type.POINTER");
+       _vala_assert (G_TYPE_STRING == G_TYPE_STRING, "typeof (string) == GLib.Type.STRING");
+       _vala_assert (G_TYPE_STRV == G_TYPE_STRV, "typeof (string[]) == G_TYPE_STRV");
+       _vala_assert (G_TYPE_UCHAR == G_TYPE_UCHAR, "typeof (uchar) == GLib.Type.UCHAR");
+       _vala_assert (G_TYPE_UINT == G_TYPE_UINT, "typeof (uint) == GLib.Type.UINT");
+       _vala_assert (G_TYPE_UINT64 == G_TYPE_UINT64, "typeof (uint64) == GLib.Type.UINT64");
+       _vala_assert (G_TYPE_ULONG == G_TYPE_ULONG, "typeof (ulong) == GLib.Type.ULONG");
+       _vala_assert (G_TYPE_VARIANT == G_TYPE_VARIANT, "typeof (Variant) == GLib.Type.VARIANT");
+       _vala_assert (G_TYPE_INT == G_TYPE_INT, "typeof (BarEnum) == GLib.Type.INT");
+       _vala_assert (G_TYPE_UINT == G_TYPE_UINT, "typeof (BarFlag) == GLib.Type.UINT");
+       _vala_assert (G_TYPE_POINTER == G_TYPE_POINTER, "typeof (BarStruct) == GLib.Type.POINTER");
+       _vala_assert (G_TYPE_INVALID == G_TYPE_INVALID, "typeof (ManamStruct) == GLib.Type.INVALID");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/basic-types/escape-chars.c-expected b/tests/basic-types/escape-chars.c-expected
new file mode 100644
index 000000000..2bb8e148d
--- /dev/null
+++ b/tests/basic-types/escape-chars.c-expected
@@ -0,0 +1,99 @@
+/* basic_types_escape_chars.c generated by valac, the Vala compiler
+ * generated from basic_types_escape_chars.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN void test_x_escape_chars (void);
+VALA_EXTERN void test_u_escape_chars (void);
+VALA_EXTERN void test_simple_escape_chars (void);
+static void _vala_main (void);
+
+void
+test_x_escape_chars (void)
+{
+       gchar* s = NULL;
+       gchar* _tmp0_;
+       gchar* s1 = NULL;
+       gchar* _tmp1_;
+       _tmp0_ = g_strdup ("Copyright \xc2\xa9");
+       s = _tmp0_;
+       _vala_assert (g_strcmp0 (s, "Copyright ©") == 0, "s == \"Copyright \302\251\"");
+       _tmp1_ = g_strdup ("\x9q");
+       s1 = _tmp1_;
+       _vala_assert (g_strcmp0 (s1, "\x09q") == 0, "s1 == \"\\x09q\"");
+       _g_free0 (s1);
+       _g_free0 (s);
+}
+
+void
+test_u_escape_chars (void)
+{
+       gchar* s = NULL;
+       gchar* _tmp0_;
+       _tmp0_ = g_strdup ("Copyright \u00a9");
+       s = _tmp0_;
+       _vala_assert (g_strcmp0 (s, "Copyright ©") == 0, "s == \"Copyright \302\251\"");
+       _g_free0 (s);
+}
+
+void
+test_simple_escape_chars (void)
+{
+       gchar* s = NULL;
+       gchar* _tmp0_;
+       const gchar* _tmp1_;
+       gchar* _tmp2_;
+       const gchar* _tmp3_;
+       const gchar* _tmp4_;
+       gchar* _tmp5_;
+       gchar* _tmp6_;
+       _tmp0_ = g_strdup ("\b\f\n\r\t\v");
+       s = _tmp0_;
+       _tmp1_ = s;
+       _tmp2_ = g_strescape (_tmp1_, NULL);
+       _g_free0 (s);
+       s = _tmp2_;
+       _tmp3_ = s;
+       _vala_assert (g_strcmp0 (_tmp3_, "\\b\\f\\n\\r\\t\\v") == 0, "s == 
\"\\\\b\\\\f\\\\n\\\\r\\\\t\\\\v\"");
+       _tmp4_ = s;
+       _tmp5_ = g_strcompress (_tmp4_);
+       _tmp6_ = _tmp5_;
+       _vala_assert (g_strcmp0 (_tmp6_, "\b\f\n\r\t\v") == 0, "s.compress () == \"\\b\\f\\n\\r\\t\\v\"");
+       _g_free0 (_tmp6_);
+       _g_free0 (s);
+}
+
+static void
+_vala_main (void)
+{
+       test_x_escape_chars ();
+       test_u_escape_chars ();
+       test_simple_escape_chars ();
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/basic-types/floats-boxed-cast.c-expected b/tests/basic-types/floats-boxed-cast.c-expected
new file mode 100644
index 000000000..b5d331fd0
--- /dev/null
+++ b/tests/basic-types/floats-boxed-cast.c-expected
@@ -0,0 +1,129 @@
+/* basic_types_floats_boxed_cast.c generated by valac, the Vala compiler
+ * generated from basic_types_floats_boxed_cast.vala, do not modify */
+
+#include <glib.h>
+#include <float.h>
+#include <math.h>
+#include <string.h>
+
+#define _g_free0(var) ((var == NULL) ? NULL : (var = (g_free (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (void);
+static gfloat* _float_dup (gfloat* self);
+static gboolean _float_equal (const gfloat * s1,
+                       const gfloat * s2);
+static gdouble* _double_dup (gdouble* self);
+static gboolean _double_equal (const gdouble * s1,
+                        const gdouble * s2);
+
+static gfloat*
+_float_dup (gfloat* self)
+{
+       gfloat* dup;
+       dup = g_new0 (gfloat, 1);
+       memcpy (dup, self, sizeof (gfloat));
+       return dup;
+}
+
+static gpointer
+__float_dup0 (gpointer self)
+{
+       return self ? _float_dup (self) : NULL;
+}
+
+static gboolean
+_float_equal (const gfloat * s1,
+              const gfloat * s2)
+{
+       if (s1 == s2) {
+               return TRUE;
+       }
+       if (s1 == NULL) {
+               return FALSE;
+       }
+       if (s2 == NULL) {
+               return FALSE;
+       }
+       return (*s1) == (*s2);
+}
+
+static gdouble*
+_double_dup (gdouble* self)
+{
+       gdouble* dup;
+       dup = g_new0 (gdouble, 1);
+       memcpy (dup, self, sizeof (gdouble));
+       return dup;
+}
+
+static gpointer
+__double_dup0 (gpointer self)
+{
+       return self ? _double_dup (self) : NULL;
+}
+
+static gboolean
+_double_equal (const gdouble * s1,
+               const gdouble * s2)
+{
+       if (s1 == s2) {
+               return TRUE;
+       }
+       if (s1 == NULL) {
+               return FALSE;
+       }
+       if (s2 == NULL) {
+               return FALSE;
+       }
+       return (*s1) == (*s2);
+}
+
+static void
+_vala_main (void)
+{
+       gfloat* _tmp0_ = NULL;
+       gfloat _tmp1_;
+       gfloat* _tmp2_;
+       gfloat* f = NULL;
+       gfloat* _tmp3_;
+       gfloat _tmp4_;
+       gdouble* _tmp5_ = NULL;
+       gdouble _tmp6_;
+       gdouble* _tmp7_;
+       gdouble* d = NULL;
+       gdouble* _tmp8_;
+       gdouble _tmp9_;
+       _tmp1_ = 23.0f;
+       _tmp2_ = __float_dup0 (&_tmp1_);
+       _tmp0_ = _tmp2_;
+       _tmp3_ = _tmp0_;
+       _tmp0_ = NULL;
+       f = _tmp3_;
+       _tmp4_ = 23.0f;
+       _vala_assert (_float_equal (f, &_tmp4_) == TRUE, "f == 23.0f");
+       _tmp6_ = 42.0;
+       _tmp7_ = __double_dup0 (&_tmp6_);
+       _tmp5_ = _tmp7_;
+       _tmp8_ = _tmp5_;
+       _tmp5_ = NULL;
+       d = _tmp8_;
+       _tmp9_ = 42.0;
+       _vala_assert (_double_equal (d, &_tmp9_) == TRUE, "d == 42.0");
+       _g_free0 (d);
+       _g_free0 (_tmp5_);
+       _g_free0 (f);
+       _g_free0 (_tmp0_);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/basic-types/floats.c-expected b/tests/basic-types/floats.c-expected
new file mode 100644
index 000000000..fd88fb4e0
--- /dev/null
+++ b/tests/basic-types/floats.c-expected
@@ -0,0 +1,380 @@
+/* basic_types_floats.c generated by valac, the Vala compiler
+ * generated from basic_types_floats.vala, do not modify */
+
+#include <glib.h>
+#include <float.h>
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _g_free0(var) ((var == NULL) ? NULL : (var = (g_free (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN void test_double (void);
+static gdouble* _double_dup (gdouble* self);
+static gboolean _double_equal (const gdouble * s1,
+                        const gdouble * s2);
+VALA_EXTERN void test_float (void);
+static gfloat* _float_dup (gfloat* self);
+static gboolean _float_equal (const gfloat * s1,
+                       const gfloat * s2);
+static void _vala_main (void);
+
+static gchar*
+double_to_string (gdouble self)
+{
+       gchar* _tmp0_;
+       gchar* _tmp1_;
+       gint _tmp1__length1;
+       const gchar* _tmp2_;
+       gchar* _tmp3_;
+       gchar* _tmp4_;
+       gchar* result = NULL;
+       _tmp0_ = g_new0 (gchar, G_ASCII_DTOSTR_BUF_SIZE);
+       _tmp1_ = _tmp0_;
+       _tmp1__length1 = G_ASCII_DTOSTR_BUF_SIZE;
+       _tmp2_ = g_ascii_dtostr (_tmp1_, (gint) G_ASCII_DTOSTR_BUF_SIZE, self);
+       _tmp3_ = g_strdup (_tmp2_);
+       _tmp4_ = _tmp3_;
+       _tmp1_ = (g_free (_tmp1_), NULL);
+       result = _tmp4_;
+       return result;
+}
+
+static gdouble
+double_parse (const gchar* str)
+{
+       gdouble result = 0.0;
+       g_return_val_if_fail (str != NULL, 0.0);
+       result = g_ascii_strtod (str, NULL);
+       return result;
+}
+
+static gboolean
+double_try_parse (const gchar* str,
+                  gdouble* _result_,
+                  const gchar* * unparsed)
+{
+       gdouble _vala__result_ = 0.0;
+       const gchar* _vala_unparsed = NULL;
+       gchar* endptr = NULL;
+       gchar* _tmp0_ = NULL;
+       gdouble _tmp1_;
+       gchar* _tmp2_;
+       gint _tmp3_;
+       gint _tmp4_;
+       gboolean result = FALSE;
+       g_return_val_if_fail (str != NULL, FALSE);
+       errno = 0;
+       _tmp1_ = g_ascii_strtod (str, &_tmp0_);
+       endptr = _tmp0_;
+       _vala__result_ = _tmp1_;
+       _tmp2_ = endptr;
+       _tmp3_ = strlen (str);
+       _tmp4_ = _tmp3_;
+       if (_tmp2_ == (((gchar*) str) + _tmp4_)) {
+               _vala_unparsed = "";
+               result = errno != ERANGE;
+               if (_result_) {
+                       *_result_ = _vala__result_;
+               }
+               if (unparsed) {
+                       *unparsed = _vala_unparsed;
+               }
+               return result;
+       } else {
+               gchar* _tmp5_;
+               _tmp5_ = endptr;
+               _vala_unparsed = (const gchar*) _tmp5_;
+               result = FALSE;
+               if (_result_) {
+                       *_result_ = _vala__result_;
+               }
+               if (unparsed) {
+                       *unparsed = _vala_unparsed;
+               }
+               return result;
+       }
+}
+
+static gdouble*
+_double_dup (gdouble* self)
+{
+       gdouble* dup;
+       dup = g_new0 (gdouble, 1);
+       memcpy (dup, self, sizeof (gdouble));
+       return dup;
+}
+
+static gpointer
+__double_dup0 (gpointer self)
+{
+       return self ? _double_dup (self) : NULL;
+}
+
+static gboolean
+_double_equal (const gdouble * s1,
+               const gdouble * s2)
+{
+       if (s1 == s2) {
+               return TRUE;
+       }
+       if (s1 == NULL) {
+               return FALSE;
+       }
+       if (s2 == NULL) {
+               return FALSE;
+       }
+       return (*s1) == (*s2);
+}
+
+void
+test_double (void)
+{
+       gdouble d = 0.0;
+       gdouble e = 0.0;
+       gchar* s = NULL;
+       gchar* _tmp0_;
+       const gchar* unparsed = NULL;
+       gdouble _tmp1_ = 0.0;
+       const gchar* _tmp2_ = NULL;
+       gdouble* d2 = NULL;
+       gdouble _tmp3_;
+       gdouble* _tmp4_;
+       gdouble _tmp5_;
+       d = 42.;
+       _vala_assert (d == 42., "d == 42d");
+       d = 23.;
+       _vala_assert (d == 23., "d == 23d");
+       e = d;
+       _vala_assert (e == 23., "e == 23d");
+       d = 1.0E-5;
+       _vala_assert (d == 0.00001, "d == 0.00001");
+       d = 1.0E+4;
+       _vala_assert (d == 10000.0, "d == 10000.0");
+       d = 42. + 23.;
+       _vala_assert (d == 65., "d == 65d");
+       d = 42. - 23.;
+       _vala_assert (d == 19., "d == 19d");
+       d = 42. * 23.;
+       _vala_assert (d == 966., "d == 966d");
+       d = 42. / 23.;
+       _vala_assert (d > 1.8, "d > 1.8");
+       _vala_assert (d < 1.9, "d < 1.9");
+       d = 42.;
+       _vala_assert (d == 42., "d == 42d");
+       _vala_assert (d != 50., "d != 50d");
+       _vala_assert (d < 42.5, "d < 42.5");
+       _vala_assert (!(d < 41.5), "!(d < 41.5)");
+       _vala_assert (d <= 42., "d <= 42d");
+       _vala_assert (!(d <= 41.5), "!(d <= 41.5)");
+       _vala_assert (d >= 42., "d >= 42d");
+       _vala_assert (!(d >= 42.5), "!(d >= 42.5)");
+       _vala_assert (d > 41.5, "d > 41.5");
+       _vala_assert (!(d > 42.5), "!(d > 42.5)");
+       _tmp0_ = double_to_string (d);
+       s = _tmp0_;
+       _vala_assert (g_strcmp0 (s, "42") == 0, "s == \"42\"");
+       d = double_parse ("47.11mm");
+       _vala_assert (d == 47.11, "d == 47.11");
+       double_try_parse ("3.45mm", &_tmp1_, &_tmp2_);
+       d = _tmp1_;
+       unparsed = _tmp2_;
+       _vala_assert (d == 3.45, "d == 3.45");
+       _vala_assert (g_strcmp0 (unparsed, "mm") == 0, "unparsed == \"mm\"");
+       d = DBL_MIN;
+       _vala_assert (d == DBL_MIN, "d == double.MIN");
+       _vala_assert (d < DBL_MAX, "d < double.MAX");
+       d = DBL_MAX;
+       _vala_assert (d == DBL_MAX, "d == double.MAX");
+       _vala_assert (d > DBL_MIN, "d > double.MIN");
+       _tmp3_ = (gdouble) 10;
+       _tmp4_ = __double_dup0 (&_tmp3_);
+       d2 = _tmp4_;
+       _tmp5_ = (gdouble) 10;
+       _vala_assert (_double_equal (d2, &_tmp5_) == TRUE, "d2 == 10");
+       _g_free0 (d2);
+       _g_free0 (s);
+}
+
+static gfloat
+float_parse (const gchar* str)
+{
+       gfloat result = 0.0F;
+       g_return_val_if_fail (str != NULL, 0.0F);
+       result = strtof (str, NULL);
+       return result;
+}
+
+static gboolean
+float_try_parse (const gchar* str,
+                 gfloat* _result_,
+                 const gchar* * unparsed)
+{
+       gfloat _vala__result_ = 0.0F;
+       const gchar* _vala_unparsed = NULL;
+       gchar* endptr = NULL;
+       gchar* _tmp0_ = NULL;
+       gfloat _tmp1_;
+       gchar* _tmp2_;
+       gint _tmp3_;
+       gint _tmp4_;
+       gboolean result = FALSE;
+       g_return_val_if_fail (str != NULL, FALSE);
+       errno = 0;
+       _tmp1_ = strtof (str, &_tmp0_);
+       endptr = _tmp0_;
+       _vala__result_ = _tmp1_;
+       _tmp2_ = endptr;
+       _tmp3_ = strlen (str);
+       _tmp4_ = _tmp3_;
+       if (_tmp2_ == (((gchar*) str) + _tmp4_)) {
+               _vala_unparsed = "";
+               result = errno != ERANGE;
+               if (_result_) {
+                       *_result_ = _vala__result_;
+               }
+               if (unparsed) {
+                       *unparsed = _vala_unparsed;
+               }
+               return result;
+       } else {
+               gchar* _tmp5_;
+               _tmp5_ = endptr;
+               _vala_unparsed = (const gchar*) _tmp5_;
+               result = FALSE;
+               if (_result_) {
+                       *_result_ = _vala__result_;
+               }
+               if (unparsed) {
+                       *unparsed = _vala_unparsed;
+               }
+               return result;
+       }
+}
+
+static gfloat*
+_float_dup (gfloat* self)
+{
+       gfloat* dup;
+       dup = g_new0 (gfloat, 1);
+       memcpy (dup, self, sizeof (gfloat));
+       return dup;
+}
+
+static gpointer
+__float_dup0 (gpointer self)
+{
+       return self ? _float_dup (self) : NULL;
+}
+
+static gboolean
+_float_equal (const gfloat * s1,
+              const gfloat * s2)
+{
+       if (s1 == s2) {
+               return TRUE;
+       }
+       if (s1 == NULL) {
+               return FALSE;
+       }
+       if (s2 == NULL) {
+               return FALSE;
+       }
+       return (*s1) == (*s2);
+}
+
+void
+test_float (void)
+{
+       gfloat f = 0.0F;
+       gfloat g = 0.0F;
+       gchar* s = NULL;
+       gchar* _tmp0_;
+       const gchar* unparsed = NULL;
+       gfloat _tmp1_ = 0.0F;
+       const gchar* _tmp2_ = NULL;
+       gfloat* f2 = NULL;
+       gfloat _tmp3_;
+       gfloat* _tmp4_;
+       gfloat _tmp5_;
+       f = 42.f;
+       _vala_assert (f == 42.f, "f == 42f");
+       f = 23.f;
+       _vala_assert (f == 23.f, "f == 23f");
+       g = f;
+       _vala_assert (g == 23.f, "g == 23f");
+       f = 42.f + 23.f;
+       _vala_assert (f == 65.f, "f == 65f");
+       f = 42.f - 23.f;
+       _vala_assert (f == 19.f, "f == 19f");
+       f = 42.f * 23.f;
+       _vala_assert (f == 966.f, "f == 966f");
+       f = 42.f / 23.f;
+       _vala_assert (((gdouble) f) > 1.8, "f > 1.8");
+       _vala_assert (((gdouble) f) < 1.9, "f < 1.9");
+       f = 42.f;
+       _vala_assert (f == 42.f, "f == 42f");
+       _vala_assert (f != 50.f, "f != 50f");
+       _vala_assert (f < 42.5f, "f < 42.5f");
+       _vala_assert (!(f < 41.5f), "!(f < 41.5f)");
+       _vala_assert (f <= 42.f, "f <= 42f");
+       _vala_assert (!(f <= 41.5f), "!(f <= 41.5f)");
+       _vala_assert (f >= 42.f, "f >= 42f");
+       _vala_assert (!(f >= 42.5f), "!(f >= 42.5f)");
+       _vala_assert (f > 41.5f, "f > 41.5f");
+       _vala_assert (!(f > 42.5f), "!(f > 42.5f)");
+       _tmp0_ = g_strdup_printf ("%g", f);
+       s = _tmp0_;
+       _vala_assert (g_strcmp0 (s, "42") == 0, "s == \"42\"");
+       f = float_parse ("47.11mm");
+       _vala_assert (f == 47.11f, "f == 47.11f");
+       float_try_parse ("3.45mm", &_tmp1_, &_tmp2_);
+       f = _tmp1_;
+       unparsed = _tmp2_;
+       _vala_assert (f == 3.45f, "f == 3.45f");
+       _vala_assert (g_strcmp0 (unparsed, "mm") == 0, "unparsed == \"mm\"");
+       f = FLT_MIN;
+       _vala_assert (f == FLT_MIN, "f == float.MIN");
+       _vala_assert (f < FLT_MAX, "f < float.MAX");
+       f = FLT_MAX;
+       _vala_assert (f == FLT_MAX, "f == float.MAX");
+       _vala_assert (f > FLT_MIN, "f > float.MIN");
+       _tmp3_ = 10.f;
+       _tmp4_ = __float_dup0 (&_tmp3_);
+       f2 = _tmp4_;
+       _tmp5_ = 10.f;
+       _vala_assert (_float_equal (f2, &_tmp5_) == TRUE, "f2 == 10f");
+       _g_free0 (f2);
+       _g_free0 (s);
+}
+
+static void
+_vala_main (void)
+{
+       test_double ();
+       test_float ();
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/basic-types/garray.c-expected b/tests/basic-types/garray.c-expected
new file mode 100644
index 000000000..b98ad9021
--- /dev/null
+++ b/tests/basic-types/garray.c-expected
@@ -0,0 +1,608 @@
+/* basic_types_garray.c generated by valac, the Vala compiler
+ * generated from basic_types_garray.vala, do not modify */
+
+#include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+
+#define TYPE_FOO_STRUCT (foo_struct_get_type ())
+typedef struct _FooStruct FooStruct;
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _g_array_unref0(var) ((var == NULL) ? NULL : (var = (g_array_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _FooStruct {
+       gchar* content;
+       Foo* object;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static GType foo_get_type_once (void);
+VALA_EXTERN GType foo_struct_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN FooStruct* foo_struct_dup (const FooStruct* self);
+VALA_EXTERN void foo_struct_free (FooStruct* self);
+VALA_EXTERN void foo_struct_copy (const FooStruct* self,
+                      FooStruct* dest);
+VALA_EXTERN void foo_struct_destroy (FooStruct* self);
+VALA_EXTERN void test_garray (void);
+static void _g_object_unref0_ (gpointer var);
+static void _vala_Foo_free_function_content_of (gpointer data);
+VALA_EXTERN void test_int_garray (void);
+VALA_EXTERN GArray* create_struct_garray (void);
+static void _foo_struct_free0_ (gpointer var);
+static void _vala_FooStruct_free_function_content_of (gpointer data);
+VALA_EXTERN void test_struct_garray (void);
+VALA_EXTERN void test_object_garray (void);
+static void _vala_main (void);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static gpointer
+_g_object_ref0 (gpointer self)
+{
+       return self ? g_object_ref (self) : NULL;
+}
+
+void
+foo_struct_copy (const FooStruct* self,
+                 FooStruct* dest)
+{
+       const gchar* _tmp0_;
+       gchar* _tmp1_;
+       Foo* _tmp2_;
+       Foo* _tmp3_;
+       _tmp0_ = (*self).content;
+       _tmp1_ = g_strdup (_tmp0_);
+       _g_free0 ((*dest).content);
+       (*dest).content = _tmp1_;
+       _tmp2_ = (*self).object;
+       _tmp3_ = _g_object_ref0 (_tmp2_);
+       _g_object_unref0 ((*dest).object);
+       (*dest).object = _tmp3_;
+}
+
+void
+foo_struct_destroy (FooStruct* self)
+{
+       _g_free0 ((*self).content);
+       _g_object_unref0 ((*self).object);
+}
+
+FooStruct*
+foo_struct_dup (const FooStruct* self)
+{
+       FooStruct* dup;
+       dup = g_new0 (FooStruct, 1);
+       foo_struct_copy (self, dup);
+       return dup;
+}
+
+void
+foo_struct_free (FooStruct* self)
+{
+       foo_struct_destroy (self);
+       g_free (self);
+}
+
+static GType
+foo_struct_get_type_once (void)
+{
+       GType foo_struct_type_id;
+       foo_struct_type_id = g_boxed_type_register_static ("FooStruct", (GBoxedCopyFunc) foo_struct_dup, 
(GBoxedFreeFunc) foo_struct_free);
+       return foo_struct_type_id;
+}
+
+GType
+foo_struct_get_type (void)
+{
+       static volatile gsize foo_struct_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_struct_type_id__volatile)) {
+               GType foo_struct_type_id;
+               foo_struct_type_id = foo_struct_get_type_once ();
+               g_once_init_leave (&foo_struct_type_id__volatile, foo_struct_type_id);
+       }
+       return foo_struct_type_id__volatile;
+}
+
+static void
+_g_object_unref0_ (gpointer var)
+{
+       (var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
+}
+
+static void
+_vala_Foo_free_function_content_of (gpointer data)
+{
+       Foo* self;
+       self = *((Foo**) data);
+       _g_object_unref0_ (self);
+}
+
+static gpointer
+vala_g_array_remove_index (GArray* self,
+                           guint index)
+{
+       gpointer g = NULL;
+       gpointer* _tmp0_;
+       gint _tmp0__length1;
+       gpointer _tmp1_;
+       gpointer result = NULL;
+       g_return_val_if_fail (self != NULL, NULL);
+       _vala_assert (self->len > index, "length > index");
+       _tmp0_ = self->data;
+       _tmp0__length1 = self->len;
+       _tmp1_ = _tmp0_[index];
+       _tmp0_[index] = NULL;
+       g = _tmp1_;
+       g_array_remove_index (self, index);
+       result = g;
+       return result;
+}
+
+static gpointer
+vala_g_array_remove_index_fast (GArray* self,
+                                guint index)
+{
+       gpointer g = NULL;
+       gpointer* _tmp0_;
+       gint _tmp0__length1;
+       gpointer _tmp1_;
+       gpointer result = NULL;
+       g_return_val_if_fail (self != NULL, NULL);
+       _vala_assert (self->len > index, "length > index");
+       _tmp0_ = self->data;
+       _tmp0__length1 = self->len;
+       _tmp1_ = _tmp0_[index];
+       _tmp0_[index] = NULL;
+       g = _tmp1_;
+       g_array_remove_index_fast (self, index);
+       result = g;
+       return result;
+}
+
+static gpointer*
+vala_g_array_remove_range (GArray* self,
+                           guint index,
+                           guint length,
+                           gint* result_length1)
+{
+       gpointer* ga = NULL;
+       gpointer* _tmp0_;
+       gint ga_length1;
+       gint _ga_size_;
+       gpointer* _tmp6_;
+       gint _tmp6__length1;
+       gpointer* result = NULL;
+       g_return_val_if_fail (self != NULL, NULL);
+       _vala_assert (self->len >= (index + length), "this.length >= index + length");
+       _tmp0_ = g_new0 (gpointer, length);
+       ga = _tmp0_;
+       ga_length1 = length;
+       _ga_size_ = ga_length1;
+       {
+               guint i = 0U;
+               i = (guint) 0;
+               {
+                       gboolean _tmp1_ = FALSE;
+                       _tmp1_ = TRUE;
+                       while (TRUE) {
+                               gpointer* _tmp3_;
+                               gint _tmp3__length1;
+                               gpointer* _tmp4_;
+                               gint _tmp4__length1;
+                               gpointer _tmp5_;
+                               if (!_tmp1_) {
+                                       guint _tmp2_;
+                                       _tmp2_ = i;
+                                       i = _tmp2_ + 1;
+                               }
+                               _tmp1_ = FALSE;
+                               if (!(i < length)) {
+                                       break;
+                               }
+                               _tmp3_ = ga;
+                               _tmp3__length1 = ga_length1;
+                               _tmp4_ = self->data;
+                               _tmp4__length1 = self->len;
+                               _tmp5_ = _tmp4_[i + index];
+                               _tmp4_[i + index] = NULL;
+                               _tmp3_[i] = _tmp5_;
+                       }
+               }
+       }
+       g_array_remove_range (self, index, length);
+       _tmp6_ = ga;
+       _tmp6__length1 = ga_length1;
+       if (result_length1) {
+               *result_length1 = _tmp6__length1;
+       }
+       result = _tmp6_;
+       return result;
+}
+
+void
+test_garray (void)
+{
+       GArray* array = NULL;
+       GArray* _tmp0_;
+       Foo* foo = NULL;
+       Foo* _tmp1_;
+       Foo* _tmp2_;
+       Foo* _tmp3_;
+       Foo* _tmp4_;
+       Foo* _tmp5_;
+       Foo* _tmp6_;
+       Foo* _tmp7_;
+       Foo* _tmp8_;
+       Foo* _tmp9_;
+       Foo* _tmp10_;
+       Foo* _tmp11_;
+       Foo* _tmp12_;
+       Foo* _tmp13_;
+       gint _tmp14_ = 0;
+       gpointer* _tmp15_;
+       Foo** _tmp16_;
+       gint _tmp16__length1;
+       _tmp0_ = g_array_new (TRUE, TRUE, sizeof (Foo*));
+       g_array_set_clear_func (_tmp0_, (GDestroyNotify) _vala_Foo_free_function_content_of);
+       array = _tmp0_;
+       _tmp1_ = foo_new ();
+       foo = _tmp1_;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"foo.ref_count == 1");
+       _tmp2_ = _g_object_ref0 (foo);
+       g_array_append_val (array, _tmp2_);
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 2), 
"foo.ref_count == 2");
+       _tmp3_ = g_array_index (array, Foo*, (guint) 0);
+       _vala_assert (_tmp3_ == foo, "array.index (0) == foo");
+       _tmp4_ = vala_g_array_remove_index (array, (guint) 0);
+       _tmp5_ = _tmp4_;
+       _g_object_unref0 (_tmp5_);
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"foo.ref_count == 1");
+       _tmp6_ = _g_object_ref0 (foo);
+       g_array_append_val (array, _tmp6_);
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 2), 
"foo.ref_count == 2");
+       _tmp7_ = g_array_index (array, Foo*, (guint) 0);
+       _vala_assert (_tmp7_ == foo, "array.index (0) == foo");
+       _tmp8_ = vala_g_array_remove_index_fast (array, (guint) 0);
+       _tmp9_ = _tmp8_;
+       _g_object_unref0 (_tmp9_);
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"foo.ref_count == 1");
+       _tmp10_ = _g_object_ref0 (foo);
+       g_array_append_val (array, _tmp10_);
+       _tmp11_ = _g_object_ref0 (foo);
+       g_array_append_val (array, _tmp11_);
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 3), 
"foo.ref_count == 3");
+       _tmp12_ = g_array_index (array, Foo*, (guint) 0);
+       _vala_assert (_tmp12_ == foo, "array.index (0) == foo");
+       _tmp13_ = g_array_index (array, Foo*, (guint) 1);
+       _vala_assert (_tmp13_ == foo, "array.index (1) == foo");
+       _tmp15_ = vala_g_array_remove_range (array, (guint) 0, (guint) 2, &_tmp14_);
+       _tmp16_ = _tmp15_;
+       _tmp16__length1 = _tmp14_;
+       _tmp16_ = (_vala_array_free (_tmp16_, _tmp16__length1, (GDestroyNotify) g_object_unref), NULL);
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"foo.ref_count == 1");
+       _g_object_unref0 (foo);
+       _g_array_unref0 (array);
+}
+
+void
+test_int_garray (void)
+{
+       GArray* array = NULL;
+       GArray* _tmp0_;
+       gint val = 0;
+       gint _tmp1_;
+       gint _tmp2_;
+       _tmp0_ = g_array_new (TRUE, TRUE, sizeof (gint));
+       array = _tmp0_;
+       val = 1;
+       g_array_prepend_val (array, val);
+       _tmp1_ = val;
+       val = _tmp1_ + 1;
+       g_array_append_val (array, val);
+       _tmp2_ = val;
+       val = _tmp2_ + 1;
+       g_array_insert_val (array, (guint) 2, val);
+       _vala_assert (g_array_index (array, gint, (guint) 0) == 1, "array.index (0) == 1");
+       _vala_assert (g_array_index (array, gint, (guint) 1) == 2, "array.index (1) == 2");
+       _vala_assert (g_array_index (array, gint, (guint) 2) == 3, "array.index (2) == 3");
+       _vala_assert (array->len == ((guint) 3), "array.length == 3");
+       _g_array_unref0 (array);
+}
+
+static void
+_foo_struct_free0_ (gpointer var)
+{
+       (var == NULL) ? NULL : (var = (foo_struct_free (var), NULL));
+}
+
+static void
+_vala_FooStruct_free_function_content_of (gpointer data)
+{
+       FooStruct* self;
+       self = *((FooStruct**) data);
+       _foo_struct_free0_ (self);
+}
+
+static gpointer
+_foo_struct_dup0 (gpointer self)
+{
+       return self ? foo_struct_dup (self) : NULL;
+}
+
+GArray*
+create_struct_garray (void)
+{
+       GArray* array = NULL;
+       GArray* _tmp0_;
+       FooStruct foo1 = {0};
+       gchar* _tmp1_;
+       Foo* _tmp2_;
+       FooStruct _tmp3_ = {0};
+       FooStruct _tmp4_;
+       FooStruct _tmp5_;
+       FooStruct* _tmp6_;
+       FooStruct foo2 = {0};
+       gchar* _tmp7_;
+       Foo* _tmp8_;
+       FooStruct _tmp9_ = {0};
+       FooStruct _tmp10_;
+       FooStruct _tmp11_;
+       FooStruct* _tmp12_;
+       GArray* result = NULL;
+       _tmp0_ = g_array_new (TRUE, TRUE, sizeof (FooStruct*));
+       g_array_set_clear_func (_tmp0_, (GDestroyNotify) _vala_FooStruct_free_function_content_of);
+       array = _tmp0_;
+       _tmp1_ = g_strdup ("foo");
+       _tmp2_ = foo_new ();
+       _g_free0 (_tmp3_.content);
+       _tmp3_.content = _tmp1_;
+       _g_object_unref0 (_tmp3_.object);
+       _tmp3_.object = _tmp2_;
+       foo1 = _tmp3_;
+       _tmp4_ = foo1;
+       _tmp5_ = _tmp4_;
+       _tmp6_ = _foo_struct_dup0 (&_tmp5_);
+       g_array_append_val (array, _tmp6_);
+       _tmp7_ = g_strdup ("bar");
+       _tmp8_ = foo_new ();
+       _g_free0 (_tmp9_.content);
+       _tmp9_.content = _tmp7_;
+       _g_object_unref0 (_tmp9_.object);
+       _tmp9_.object = _tmp8_;
+       foo2 = _tmp9_;
+       _tmp10_ = foo2;
+       _tmp11_ = _tmp10_;
+       _tmp12_ = _foo_struct_dup0 (&_tmp11_);
+       g_array_append_val (array, _tmp12_);
+       result = array;
+       foo_struct_destroy (&foo2);
+       foo_struct_destroy (&foo1);
+       return result;
+}
+
+void
+test_struct_garray (void)
+{
+       GArray* array = NULL;
+       GArray* _tmp0_;
+       GArray* _tmp1_;
+       GArray* _tmp2_;
+       const gchar* _tmp3_;
+       GArray* _tmp4_;
+       Foo* _tmp5_;
+       GArray* _tmp6_;
+       const gchar* _tmp7_;
+       GArray* _tmp8_;
+       Foo* _tmp9_;
+       Foo* f = NULL;
+       GArray* _tmp10_;
+       Foo* _tmp11_;
+       Foo* _tmp12_;
+       _tmp0_ = create_struct_garray ();
+       array = _tmp0_;
+       _tmp1_ = array;
+       _vala_assert (_tmp1_->len == ((guint) 2), "array.length == 2");
+       _tmp2_ = array;
+       _tmp3_ = (*g_array_index (_tmp2_, FooStruct*, (guint) 0)).content;
+       _vala_assert (g_strcmp0 (_tmp3_, "foo") == 0, "array.index (0).content == \"foo\"");
+       _tmp4_ = array;
+       _tmp5_ = (*g_array_index (_tmp4_, FooStruct*, (guint) 0)).object;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"array.index (0).object.ref_count == 1");
+       _tmp6_ = array;
+       _tmp7_ = (*g_array_index (_tmp6_, FooStruct*, (guint) 1)).content;
+       _vala_assert (g_strcmp0 (_tmp7_, "bar") == 0, "array.index (1).content == \"bar\"");
+       _tmp8_ = array;
+       _tmp9_ = (*g_array_index (_tmp8_, FooStruct*, (guint) 1)).object;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp9_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"array.index (1).object.ref_count == 1");
+       _tmp10_ = array;
+       _tmp11_ = (*g_array_index (_tmp10_, FooStruct*, (guint) 0)).object;
+       _tmp12_ = _g_object_ref0 (_tmp11_);
+       f = _tmp12_;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (f, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 2), 
"f.ref_count == 2");
+       _g_array_unref0 (array);
+       array = NULL;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (f, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"f.ref_count == 1");
+       _g_object_unref0 (f);
+       _g_array_unref0 (array);
+}
+
+void
+test_object_garray (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       {
+               GArray* array = NULL;
+               GArray* _tmp1_;
+               GArray* _tmp2_;
+               Foo* _tmp3_;
+               _tmp1_ = g_array_new (TRUE, TRUE, sizeof (Foo*));
+               g_array_set_clear_func (_tmp1_, (GDestroyNotify) _vala_Foo_free_function_content_of);
+               array = _tmp1_;
+               _tmp2_ = array;
+               _tmp3_ = _g_object_ref0 (foo);
+               g_array_append_val (_tmp2_, _tmp3_);
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 
2), "foo.ref_count == 2");
+               _g_array_unref0 (array);
+               array = NULL;
+               _g_array_unref0 (array);
+       }
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"foo.ref_count == 1");
+       {
+               GArray* array = NULL;
+               GArray* _tmp4_;
+               GArray* _tmp5_;
+               _tmp4_ = g_array_new (TRUE, TRUE, sizeof (Foo*));
+               array = _tmp4_;
+               _tmp5_ = array;
+               g_array_append_val (_tmp5_, foo);
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 
1), "foo.ref_count == 1");
+               _g_array_unref0 (array);
+               array = NULL;
+               _g_array_unref0 (array);
+       }
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"foo.ref_count == 1");
+       _g_object_unref0 (foo);
+}
+
+static void
+_vala_main (void)
+{
+       test_garray ();
+       test_int_garray ();
+       test_struct_garray ();
+       test_object_garray ();
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/basic-types/gassert.c-expected b/tests/basic-types/gassert.c-expected
new file mode 100644
index 000000000..f73315a56
--- /dev/null
+++ b/tests/basic-types/gassert.c-expected
@@ -0,0 +1,147 @@
+/* basic_types_gassert.c generated by valac, the Vala compiler
+ * generated from basic_types_gassert.vala, do not modify */
+
+#include <glib.h>
+#include <float.h>
+#include <math.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+VALA_EXTERN void test_assert_cmpstr (void);
+VALA_EXTERN void test_assert_cmpint (void);
+VALA_EXTERN void test_assert_cmpuint (void);
+VALA_EXTERN void test_assert_cmphex (void);
+VALA_EXTERN void test_assert_cmpfloat (void);
+static void _vala_main (void);
+
+void
+test_assert_cmpstr (void)
+{
+       g_assert_cmpstr (NULL, ==, NULL);
+       g_assert_cmpstr ("", >, NULL);
+       g_assert_cmpstr (NULL, <, "");
+       g_assert_cmpstr (NULL, <, "");
+       g_assert_cmpstr (NULL, !=, "some non-null, non-empty string");
+       g_assert_cmpstr (NULL, <, "some non-null, non-empty string");
+       g_assert_cmpstr (NULL, <=, "some non-null, non-empty string");
+       g_assert_cmpstr ("some non-null, non-empty string", !=, NULL);
+       g_assert_cmpstr ("some non-null, non-empty string", >, NULL);
+       g_assert_cmpstr ("some non-null, non-empty string", >=, NULL);
+       g_assert_cmpstr ("0", <, "1");
+       g_assert_cmpstr ("0", <=, "1");
+       g_assert_cmpstr ("1", <=, "1");
+       g_assert_cmpstr ("2", ==, "2");
+       g_assert_cmpstr ("3", >=, "3");
+       g_assert_cmpstr ("4", >=, "3");
+       g_assert_cmpstr ("4", >, "3");
+       g_assert_cmpstr ("4", !=, "3");
+}
+
+void
+test_assert_cmpint (void)
+{
+       g_assert_cmpint (0, <, 1);
+       g_assert_cmpint (0, !=, 1);
+       g_assert_cmpint (0, <=, 1);
+       g_assert_cmpint (1, <=, 1);
+       g_assert_cmpint (1, ==, 1);
+       g_assert_cmpint (1, >=, 1);
+       g_assert_cmpint (2, >=, 1);
+       g_assert_cmpint (2, >, 1);
+       g_assert_cmpint (-1, >, -2);
+       g_assert_cmpint (-1, !=, -2);
+       g_assert_cmpint (-1, >=, -2);
+       g_assert_cmpint (-2, >=, -2);
+       g_assert_cmpint (-2, ==, -2);
+       g_assert_cmpint (-2, <=, -2);
+       g_assert_cmpint (-3, <=, -2);
+       g_assert_cmpint (-3, <, -2);
+       g_assert_cmpint (-100, <, 101);
+       g_assert_cmpint (-100, !=, 101);
+       g_assert_cmpint (-100, <=, 101);
+       g_assert_cmpint (-101, <=, 101);
+       g_assert_cmpint (101, >=, -101);
+       g_assert_cmpint (102, >=, -101);
+       g_assert_cmpint (102, >, -101);
+}
+
+void
+test_assert_cmpuint (void)
+{
+       g_assert_cmpuint (0U, <, 1U);
+       g_assert_cmpuint (0U, !=, 1U);
+       g_assert_cmpuint (0U, <=, 1U);
+       g_assert_cmpuint (1U, <=, 1U);
+       g_assert_cmpuint (1U, ==, 1U);
+       g_assert_cmpuint (1U, >=, 1U);
+       g_assert_cmpuint (2U, >=, 1U);
+       g_assert_cmpuint (2U, >, 1U);
+}
+
+void
+test_assert_cmphex (void)
+{
+       g_assert_cmphex ((guint) 0x0, <, (guint) 0x1);
+       g_assert_cmphex ((guint) 0x0, !=, (guint) 0x1);
+       g_assert_cmphex ((guint) 0x0, <=, (guint) 0x1);
+       g_assert_cmphex ((guint) 0x1, <=, (guint) 0x1);
+       g_assert_cmphex ((guint) 0x1, ==, (guint) 0x1);
+       g_assert_cmphex ((guint) 0x1, >=, (guint) 0x1);
+       g_assert_cmphex ((guint) 0x2, >=, (guint) 0x1);
+       g_assert_cmphex ((guint) 0x2, >, (guint) 0x1);
+}
+
+void
+test_assert_cmpfloat (void)
+{
+       g_assert_cmpfloat ((gdouble) 0.0f, <, (gdouble) 1.0f);
+       g_assert_cmpfloat ((gdouble) 0.0f, !=, (gdouble) 1.0f);
+       g_assert_cmpfloat ((gdouble) 0.0f, <=, (gdouble) 1.0f);
+       g_assert_cmpfloat ((gdouble) 1.0f, <=, (gdouble) 1.0f);
+       g_assert_cmpfloat ((gdouble) 1.0f, ==, (gdouble) 1.0f);
+       g_assert_cmpfloat ((gdouble) 1.0f, >=, (gdouble) 1.0f);
+       g_assert_cmpfloat ((gdouble) 2.0f, >=, (gdouble) 1.0f);
+       g_assert_cmpfloat ((gdouble) 2.0f, >, (gdouble) 1.0f);
+       g_assert_cmpfloat ((gdouble) (-1.0f), >, (gdouble) (-2.0f));
+       g_assert_cmpfloat ((gdouble) (-1.0f), !=, (gdouble) (-2.0f));
+       g_assert_cmpfloat ((gdouble) (-1.0f), >=, (gdouble) (-2.0f));
+       g_assert_cmpfloat ((gdouble) (-2.0f), >=, (gdouble) (-2.0f));
+       g_assert_cmpfloat ((gdouble) (-2.0f), ==, (gdouble) (-2.0f));
+       g_assert_cmpfloat ((gdouble) (-2.0f), <=, (gdouble) (-2.0f));
+       g_assert_cmpfloat ((gdouble) (-3.0f), <=, (gdouble) (-2.0f));
+       g_assert_cmpfloat ((gdouble) (-3.0f), <, (gdouble) (-2.0f));
+       g_assert_cmpfloat ((gdouble) (-100.0f), <, (gdouble) 101.0f);
+       g_assert_cmpfloat ((gdouble) (-100.0f), !=, (gdouble) 101.0f);
+       g_assert_cmpfloat ((gdouble) (-100.0f), <=, (gdouble) 101.0f);
+       g_assert_cmpfloat ((gdouble) (-101.0f), <=, (gdouble) 101.0f);
+       g_assert_cmpfloat ((gdouble) 101.0f, >=, (gdouble) (-101.0f));
+       g_assert_cmpfloat ((gdouble) 102.0f, >=, (gdouble) (-101.0f));
+       g_assert_cmpfloat ((gdouble) 102.0f, >, (gdouble) (-101.0f));
+}
+
+static void
+_vala_main (void)
+{
+       test_assert_cmpstr ();
+       test_assert_cmpint ();
+       test_assert_cmpuint ();
+       test_assert_cmphex ();
+       test_assert_cmpfloat ();
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/basic-types/glists.c-expected b/tests/basic-types/glists.c-expected
new file mode 100644
index 000000000..327abea09
--- /dev/null
+++ b/tests/basic-types/glists.c-expected
@@ -0,0 +1,294 @@
+/* basic_types_glists.c generated by valac, the Vala compiler
+ * generated from basic_types_glists.vala, do not modify */
+
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN void test_glist (void);
+static void _g_free0_ (gpointer var);
+static inline void _g_list_free__g_free0_ (GList* self);
+VALA_EXTERN void test_gslist (void);
+static inline void _g_slist_free__g_free0_ (GSList* self);
+VALA_EXTERN void test_gqueue (void);
+static inline void _g_queue_free__g_free0_ (GQueue* self);
+VALA_EXTERN void test_gnode (void);
+static gboolean _g_node_free_all_node (GNode* node,
+                                GDestroyNotify free_func);
+static void _g_node_free_all (GNode* self,
+                       GDestroyNotify free_func);
+static inline void _g_node_destroy__g_free0_ (GNode* self);
+static void _vala_main (void);
+
+static inline gboolean
+vala_g_list_is_empty (GList* self)
+{
+       gboolean result = FALSE;
+       result = ((GList*) self) == NULL;
+       return result;
+}
+
+static void
+_g_free0_ (gpointer var)
+{
+       var = (g_free (var), NULL);
+}
+
+static inline void
+_g_list_free__g_free0_ (GList* self)
+{
+       g_list_free_full (self, (GDestroyNotify) _g_free0_);
+}
+
+void
+test_glist (void)
+{
+       GList* list = NULL;
+       GList* _tmp0_;
+       gchar* _tmp1_;
+       gchar* _tmp2_;
+       GList* _tmp3_;
+       GList* _tmp4_;
+       gconstpointer _tmp5_;
+       GList* list2 = NULL;
+       GList* _tmp6_;
+       gconstpointer _tmp7_;
+       list = NULL;
+       _tmp0_ = list;
+       _vala_assert (vala_g_list_is_empty (_tmp0_), "list.is_empty ()");
+       _tmp1_ = g_strdup ("foo");
+       list = g_list_prepend (list, _tmp1_);
+       _tmp2_ = g_strdup ("bar");
+       list = g_list_prepend (list, _tmp2_);
+       _tmp3_ = list;
+       _vala_assert (!vala_g_list_is_empty (_tmp3_), "!list.is_empty ()");
+       _tmp4_ = list;
+       _tmp5_ = g_list_nth_data (_tmp4_, (guint) 1);
+       _vala_assert (g_strcmp0 ((const gchar*) _tmp5_, "foo") == 0, "list.nth_data (1) == \"foo\"");
+       (list == NULL) ? NULL : (list = (_g_list_free__g_free0_ (list), NULL));
+       list = NULL;
+       list2 = NULL;
+       list2 = g_list_prepend (list2, "foo");
+       list2 = g_list_prepend (list2, "bar");
+       _tmp6_ = list2;
+       _tmp7_ = g_list_nth_data (_tmp6_, (guint) 1);
+       _vala_assert (g_strcmp0 ((const gchar*) _tmp7_, "foo") == 0, "list2.nth_data (1) == \"foo\"");
+       (list2 == NULL) ? NULL : (list2 = (g_list_free (list2), NULL));
+       list2 = NULL;
+       (list2 == NULL) ? NULL : (list2 = (g_list_free (list2), NULL));
+       (list == NULL) ? NULL : (list = (_g_list_free__g_free0_ (list), NULL));
+}
+
+static inline gboolean
+vala_g_slist_is_empty (GSList* self)
+{
+       gboolean result = FALSE;
+       result = ((GSList*) self) == NULL;
+       return result;
+}
+
+static inline void
+_g_slist_free__g_free0_ (GSList* self)
+{
+       g_slist_free_full (self, (GDestroyNotify) _g_free0_);
+}
+
+void
+test_gslist (void)
+{
+       GSList* list = NULL;
+       GSList* _tmp0_;
+       gchar* _tmp1_;
+       gchar* _tmp2_;
+       GSList* _tmp3_;
+       GSList* _tmp4_;
+       gconstpointer _tmp5_;
+       GSList* list2 = NULL;
+       GSList* _tmp6_;
+       gconstpointer _tmp7_;
+       list = NULL;
+       _tmp0_ = list;
+       _vala_assert (vala_g_slist_is_empty (_tmp0_), "list.is_empty ()");
+       _tmp1_ = g_strdup ("foo");
+       list = g_slist_prepend (list, _tmp1_);
+       _tmp2_ = g_strdup ("bar");
+       list = g_slist_prepend (list, _tmp2_);
+       _tmp3_ = list;
+       _vala_assert (!vala_g_slist_is_empty (_tmp3_), "!list.is_empty ()");
+       _tmp4_ = list;
+       _tmp5_ = g_slist_nth_data (_tmp4_, (guint) 1);
+       _vala_assert (g_strcmp0 ((const gchar*) _tmp5_, "foo") == 0, "list.nth_data (1) == \"foo\"");
+       (list == NULL) ? NULL : (list = (_g_slist_free__g_free0_ (list), NULL));
+       list = NULL;
+       list2 = NULL;
+       list2 = g_slist_prepend (list2, "foo");
+       list2 = g_slist_prepend (list2, "bar");
+       _tmp6_ = list2;
+       _tmp7_ = g_slist_nth_data (_tmp6_, (guint) 1);
+       _vala_assert (g_strcmp0 ((const gchar*) _tmp7_, "foo") == 0, "list2.nth_data (1) == \"foo\"");
+       (list2 == NULL) ? NULL : (list2 = (g_slist_free (list2), NULL));
+       list2 = NULL;
+       (list2 == NULL) ? NULL : (list2 = (g_slist_free (list2), NULL));
+       (list == NULL) ? NULL : (list = (_g_slist_free__g_free0_ (list), NULL));
+}
+
+static inline void
+_g_queue_free__g_free0_ (GQueue* self)
+{
+       g_queue_free_full (self, (GDestroyNotify) _g_free0_);
+}
+
+void
+test_gqueue (void)
+{
+       GQueue* queue = NULL;
+       GQueue* _tmp0_;
+       GQueue* _tmp1_;
+       GQueue* _tmp2_;
+       gchar* _tmp3_;
+       GQueue* _tmp4_;
+       gchar* _tmp5_;
+       GQueue* _tmp6_;
+       GQueue* _tmp7_;
+       gconstpointer _tmp8_;
+       GQueue* queue2 = NULL;
+       GQueue* _tmp9_;
+       GQueue* _tmp10_;
+       GQueue* _tmp11_;
+       GQueue* _tmp12_;
+       gconstpointer _tmp13_;
+       _tmp0_ = g_queue_new ();
+       queue = _tmp0_;
+       _tmp1_ = queue;
+       _vala_assert (g_queue_is_empty (_tmp1_), "queue.is_empty ()");
+       _tmp2_ = queue;
+       _tmp3_ = g_strdup ("foo");
+       g_queue_push_head (_tmp2_, _tmp3_);
+       _tmp4_ = queue;
+       _tmp5_ = g_strdup ("bar");
+       g_queue_push_head (_tmp4_, _tmp5_);
+       _tmp6_ = queue;
+       _vala_assert (!g_queue_is_empty (_tmp6_), "!queue.is_empty ()");
+       _tmp7_ = queue;
+       _tmp8_ = g_queue_peek_nth (_tmp7_, (guint) 1);
+       _vala_assert (g_strcmp0 ((const gchar*) _tmp8_, "foo") == 0, "queue.peek_nth (1) == \"foo\"");
+       (queue == NULL) ? NULL : (queue = (_g_queue_free__g_free0_ (queue), NULL));
+       queue = NULL;
+       _tmp9_ = g_queue_new ();
+       queue2 = _tmp9_;
+       _tmp10_ = queue2;
+       g_queue_push_head (_tmp10_, "foo");
+       _tmp11_ = queue2;
+       g_queue_push_head (_tmp11_, "bar");
+       _tmp12_ = queue2;
+       _tmp13_ = g_queue_peek_nth (_tmp12_, (guint) 1);
+       _vala_assert (g_strcmp0 ((const gchar*) _tmp13_, "foo") == 0, "queue2.peek_nth (1) == \"foo\"");
+       (queue2 == NULL) ? NULL : (queue2 = (g_queue_free (queue2), NULL));
+       queue2 = NULL;
+       (queue2 == NULL) ? NULL : (queue2 = (g_queue_free (queue2), NULL));
+       (queue == NULL) ? NULL : (queue = (_g_queue_free__g_free0_ (queue), NULL));
+}
+
+static gboolean
+_g_node_free_all_node (GNode* node,
+                       GDestroyNotify free_func)
+{
+       (node->data == NULL) ? NULL : free_func (node->data);
+       return FALSE;
+}
+
+static void
+_g_node_free_all (GNode* self,
+                  GDestroyNotify free_func)
+{
+       (free_func == NULL) ? NULL : g_node_traverse (self, G_POST_ORDER, G_TRAVERSE_ALL, -1, 
(GNodeTraverseFunc) _g_node_free_all_node, free_func);
+       g_node_destroy (self);
+}
+
+static inline void
+_g_node_destroy__g_free0_ (GNode* self)
+{
+       _g_node_free_all (self, (GDestroyNotify) _g_free0_);
+}
+
+void
+test_gnode (void)
+{
+       GNode* nodes = NULL;
+       GNode* _tmp0_;
+       GNode* _tmp1_;
+       gchar* _tmp2_;
+       GNode* _tmp3_;
+       gchar* _tmp4_;
+       GNode* _tmp5_;
+       GNode* _tmp6_;
+       gconstpointer _tmp7_;
+       GNode* nodes2 = NULL;
+       GNode* _tmp8_;
+       GNode* _tmp9_;
+       GNode* _tmp10_;
+       GNode* _tmp11_;
+       GNode* _tmp12_;
+       gconstpointer _tmp13_;
+       _tmp0_ = g_node_new (NULL);
+       nodes = _tmp0_;
+       _tmp1_ = nodes;
+       _tmp2_ = g_strdup ("foo");
+       g_node_append_data (_tmp1_, _tmp2_);
+       _tmp3_ = nodes;
+       _tmp4_ = g_strdup ("bar");
+       g_node_append_data (_tmp3_, _tmp4_);
+       _tmp5_ = nodes;
+       _tmp6_ = g_node_nth_child (_tmp5_, (guint) 1);
+       _tmp7_ = _tmp6_->data;
+       _vala_assert (g_strcmp0 ((const gchar*) _tmp7_, "bar") == 0, "nodes.nth_child (1).data == \"bar\"");
+       (nodes == NULL) ? NULL : (nodes = (_g_node_destroy__g_free0_ (nodes), NULL));
+       nodes = NULL;
+       _tmp8_ = g_node_new (NULL);
+       nodes2 = _tmp8_;
+       _tmp9_ = nodes2;
+       g_node_append_data (_tmp9_, "foo");
+       _tmp10_ = nodes2;
+       g_node_append_data (_tmp10_, "bar");
+       _tmp11_ = nodes2;
+       _tmp12_ = g_node_nth_child (_tmp11_, (guint) 1);
+       _tmp13_ = _tmp12_->data;
+       _vala_assert (g_strcmp0 ((const gchar*) _tmp13_, "bar") == 0, "nodes2.nth_child (1).data == \"bar\"");
+       (nodes2 == NULL) ? NULL : (nodes2 = (g_node_destroy (nodes2), NULL));
+       nodes2 = NULL;
+       (nodes2 == NULL) ? NULL : (nodes2 = (g_node_destroy (nodes2), NULL));
+       (nodes == NULL) ? NULL : (nodes = (_g_node_destroy__g_free0_ (nodes), NULL));
+}
+
+static void
+_vala_main (void)
+{
+       test_glist ();
+       test_gslist ();
+       test_gqueue ();
+       test_gnode ();
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/basic-types/gptrarray.c-expected b/tests/basic-types/gptrarray.c-expected
new file mode 100644
index 000000000..031ff7c14
--- /dev/null
+++ b/tests/basic-types/gptrarray.c-expected
@@ -0,0 +1,871 @@
+/* basic_types_gptrarray.c generated by valac, the Vala compiler
+ * generated from basic_types_gptrarray.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+typedef struct _Block1Data Block1Data;
+#define _g_ptr_array_unref0(var) ((var == NULL) ? NULL : (var = (g_ptr_array_unref (var), NULL)))
+typedef struct _Block2Data Block2Data;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+       gint i;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _Block1Data {
+       int _ref_count_;
+       GPtrArray* self;
+       GCompareFunc compare_func;
+};
+
+struct _Block2Data {
+       int _ref_count_;
+       GPtrArray* self;
+       GCompareDataFunc compare_func;
+       gpointer compare_func_target;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (gint i);
+VALA_EXTERN Foo* foo_construct (GType object_type,
+                    gint i);
+static void foo_finalize (GObject * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN gint compare_foo (Foo* a,
+                  Foo* b);
+static void _vala_main (void);
+static void _g_object_unref0_ (gpointer var);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static gint ___lambda1__gcompare_data_func (gconstpointer a,
+                                     gconstpointer b,
+                                     gpointer self);
+static gint _compare_foo_gcompare_func (gconstpointer a,
+                                 gconstpointer b);
+static Block2Data* block2_data_ref (Block2Data* _data2_);
+static void block2_data_unref (void * _userdata_);
+static gint ___lambda2__gcompare_data_func (gconstpointer a,
+                                     gconstpointer b,
+                                     gpointer self);
+static gint _compare_foo_gcompare_data_func (gconstpointer a,
+                                      gconstpointer b,
+                                      gpointer self);
+
+Foo*
+foo_construct (GType object_type,
+               gint i)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       self->i = i;
+       return self;
+}
+
+Foo*
+foo_new (gint i)
+{
+       return foo_construct (TYPE_FOO, i);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       G_OBJECT_CLASS (klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static void
+foo_finalize (GObject * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       G_OBJECT_CLASS (foo_parent_class)->finalize (obj);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gint
+compare_foo (Foo* a,
+             Foo* b)
+{
+       gint result = 0;
+       g_return_val_if_fail (IS_FOO (a), 0);
+       g_return_val_if_fail (IS_FOO (b), 0);
+       result = b->i - a->i;
+       return result;
+}
+
+static void
+_g_object_unref0_ (gpointer var)
+{
+       (var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
+}
+
+static gpointer
+_g_object_ref0 (gpointer self)
+{
+       return self ? g_object_ref (self) : NULL;
+}
+
+static gint
+vala_g_ptr_array_get_length (GPtrArray* self)
+{
+       gint result;
+       g_return_val_if_fail (self != NULL, 0);
+       result = (gint) self->len;
+       return result;
+}
+
+static void
+g_ptr_array_set (GPtrArray* self,
+                 guint index,
+                 gpointer data)
+{
+       gpointer _tmp0_;
+       g_return_if_fail (self != NULL);
+       _tmp0_ = data;
+       data = NULL;
+       g_ptr_array_add (self, _tmp0_);
+       g_ptr_array_remove_index_fast (self, index);
+}
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               GPtrArray* self;
+               self = _data1_->self;
+               _g_ptr_array_unref0 (self);
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static gint
+__lambda1_ (Block1Data* _data1_,
+            gconstpointer** a,
+            gconstpointer** b)
+{
+       GPtrArray* self;
+       gint result = 0;
+       self = _data1_->self;
+       result = _data1_->compare_func ((gconstpointer**) (*a), (gconstpointer**) (*b));
+       return result;
+}
+
+static gint
+___lambda1__gcompare_data_func (gconstpointer a,
+                                gconstpointer b,
+                                gpointer self)
+{
+       gint result;
+       result = __lambda1_ (self, a, b);
+       return result;
+}
+
+static void
+vala_g_ptr_array_sort (GPtrArray* self,
+                       GCompareFunc compare_func)
+{
+       Block1Data* _data1_;
+       g_return_if_fail (self != NULL);
+       _data1_ = g_slice_new0 (Block1Data);
+       _data1_->_ref_count_ = 1;
+       _data1_->self = g_ptr_array_ref (self);
+       _data1_->compare_func = compare_func;
+       g_ptr_array_sort_with_data (self, ___lambda1__gcompare_data_func, _data1_);
+       block1_data_unref (_data1_);
+       _data1_ = NULL;
+}
+
+static gint
+_compare_foo_gcompare_func (gconstpointer a,
+                            gconstpointer b)
+{
+       gint result;
+       result = compare_foo ((Foo*) a, (Foo*) b);
+       return result;
+}
+
+static Block2Data*
+block2_data_ref (Block2Data* _data2_)
+{
+       g_atomic_int_inc (&_data2_->_ref_count_);
+       return _data2_;
+}
+
+static void
+block2_data_unref (void * _userdata_)
+{
+       Block2Data* _data2_;
+       _data2_ = (Block2Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data2_->_ref_count_)) {
+               GPtrArray* self;
+               self = _data2_->self;
+               _g_ptr_array_unref0 (self);
+               g_slice_free (Block2Data, _data2_);
+       }
+}
+
+static gint
+__lambda2_ (Block2Data* _data2_,
+            gconstpointer** a,
+            gconstpointer** b)
+{
+       GPtrArray* self;
+       gint result = 0;
+       self = _data2_->self;
+       result = _data2_->compare_func ((gconstpointer**) (*a), (gconstpointer**) (*b), 
_data2_->compare_func_target);
+       return result;
+}
+
+static gint
+___lambda2__gcompare_data_func (gconstpointer a,
+                                gconstpointer b,
+                                gpointer self)
+{
+       gint result;
+       result = __lambda2_ (self, a, b);
+       return result;
+}
+
+static void
+vala_g_ptr_array_sort_with_data (GPtrArray* self,
+                                 GCompareDataFunc compare_func,
+                                 gpointer compare_func_target)
+{
+       Block2Data* _data2_;
+       g_return_if_fail (self != NULL);
+       _data2_ = g_slice_new0 (Block2Data);
+       _data2_->_ref_count_ = 1;
+       _data2_->self = g_ptr_array_ref (self);
+       _data2_->compare_func = compare_func;
+       _data2_->compare_func_target = compare_func_target;
+       g_ptr_array_sort_with_data (self, ___lambda2__gcompare_data_func, _data2_);
+       block2_data_unref (_data2_);
+       _data2_ = NULL;
+}
+
+static gint
+_compare_foo_gcompare_data_func (gconstpointer a,
+                                 gconstpointer b,
+                                 gpointer self)
+{
+       gint result;
+       result = compare_foo ((Foo*) a, (Foo*) b);
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo1 = NULL;
+       Foo* _tmp0_;
+       Foo* foo2 = NULL;
+       Foo* _tmp1_;
+       Foo* foo3 = NULL;
+       Foo* _tmp2_;
+       Foo* foo4 = NULL;
+       Foo* _tmp3_;
+       Foo* foo5 = NULL;
+       Foo* _tmp4_;
+       Foo* _tmp76_;
+       Foo* _tmp77_;
+       Foo* _tmp78_;
+       Foo* _tmp79_;
+       Foo* _tmp80_;
+       Foo* _tmp147_;
+       Foo* _tmp148_;
+       Foo* _tmp149_;
+       Foo* _tmp150_;
+       Foo* _tmp151_;
+       _tmp0_ = foo_new (5);
+       foo1 = _tmp0_;
+       _tmp1_ = foo_new (4);
+       foo2 = _tmp1_;
+       _tmp2_ = foo_new (3);
+       foo3 = _tmp2_;
+       _tmp3_ = foo_new (2);
+       foo4 = _tmp3_;
+       _tmp4_ = foo_new (1);
+       foo5 = _tmp4_;
+       {
+               GPtrArray* array = NULL;
+               GPtrArray* _tmp5_;
+               GPtrArray* _tmp6_;
+               Foo* _tmp7_;
+               Foo* _tmp8_;
+               Foo* _tmp9_;
+               GPtrArray* _tmp10_;
+               Foo* _tmp11_;
+               Foo* _tmp12_;
+               Foo* _tmp13_;
+               GPtrArray* _tmp14_;
+               Foo* _tmp15_;
+               Foo* _tmp16_;
+               Foo* _tmp17_;
+               GPtrArray* _tmp18_;
+               gint _tmp19_;
+               gint _tmp20_;
+               gint loop_size = 0;
+               GPtrArray* _tmp21_;
+               GPtrArray* _tmp30_;
+               Foo* _tmp40_;
+               GPtrArray* _tmp41_;
+               gconstpointer _tmp42_;
+               GPtrArray* _tmp43_;
+               Foo* _tmp44_;
+               Foo* _tmp45_;
+               Foo* _tmp46_;
+               GPtrArray* _tmp47_;
+               gconstpointer _tmp48_;
+               Foo* _tmp49_;
+               Foo* _tmp50_;
+               GPtrArray* _tmp51_;
+               gint _tmp52_;
+               gint _tmp53_;
+               GPtrArray* _tmp54_;
+               Foo* _tmp55_;
+               Foo* _tmp56_;
+               Foo* _tmp57_;
+               GPtrArray* _tmp58_;
+               gint _tmp59_;
+               gint _tmp60_;
+               GPtrArray* _tmp61_;
+               Foo* _tmp62_;
+               Foo* _tmp63_;
+               GPtrArray* _tmp64_;
+               gint _tmp65_;
+               gint _tmp66_;
+               GPtrArray* _tmp67_;
+               GPtrArray* _tmp68_;
+               GPtrArray* _tmp69_;
+               gint _tmp70_;
+               gint _tmp71_;
+               GPtrArray* _tmp72_;
+               GPtrArray* _tmp73_;
+               gint _tmp74_;
+               gint _tmp75_;
+               _tmp5_ = g_ptr_array_new_full ((guint) 8, _g_object_unref0_);
+               array = _tmp5_;
+               _tmp6_ = array;
+               _tmp7_ = foo1;
+               _tmp8_ = _g_object_ref0 (_tmp7_);
+               g_ptr_array_add (_tmp6_, _tmp8_);
+               _tmp9_ = foo1;
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp9_, G_TYPE_OBJECT, GObject)->ref_count == 
((guint) 2), "foo1.ref_count == 2");
+               _tmp10_ = array;
+               _tmp11_ = foo2;
+               _tmp12_ = _g_object_ref0 (_tmp11_);
+               g_ptr_array_add (_tmp10_, _tmp12_);
+               _tmp13_ = foo2;
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp13_, G_TYPE_OBJECT, GObject)->ref_count == 
((guint) 2), "foo2.ref_count == 2");
+               _tmp14_ = array;
+               _tmp15_ = foo3;
+               _tmp16_ = _g_object_ref0 (_tmp15_);
+               g_ptr_array_add (_tmp14_, _tmp16_);
+               _tmp17_ = foo3;
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp17_, G_TYPE_OBJECT, GObject)->ref_count == 
((guint) 2), "foo3.ref_count == 2");
+               _tmp18_ = array;
+               _tmp19_ = vala_g_ptr_array_get_length (_tmp18_);
+               _tmp20_ = _tmp19_;
+               _vala_assert (_tmp20_ == 3, "array.length == 3");
+               loop_size = 0;
+               _tmp21_ = array;
+               {
+                       GPtrArray* element_collection = NULL;
+                       guint element_index = 0U;
+                       element_collection = _tmp21_;
+                       for (element_index = 0; element_index < element_collection->len; element_index = 
element_index + 1) {
+                               Foo* element = NULL;
+                               element = g_ptr_array_index (element_collection, element_index);
+                               {
+                                       gint _tmp22_;
+                                       Foo* _tmp23_;
+                                       _tmp22_ = loop_size;
+                                       loop_size = _tmp22_ + 1;
+                                       _tmp23_ = element;
+                                       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp23_, G_TYPE_OBJECT, 
GObject)->ref_count == ((guint) 2), "element.ref_count == 2");
+                                       switch (loop_size) {
+                                               case 1:
+                                               {
+                                                       Foo* _tmp24_;
+                                                       Foo* _tmp25_;
+                                                       _tmp24_ = element;
+                                                       _tmp25_ = foo1;
+                                                       _vala_assert (_tmp24_ == _tmp25_, "element == foo1");
+                                                       break;
+                                               }
+                                               case 2:
+                                               {
+                                                       Foo* _tmp26_;
+                                                       Foo* _tmp27_;
+                                                       _tmp26_ = element;
+                                                       _tmp27_ = foo2;
+                                                       _vala_assert (_tmp26_ == _tmp27_, "element == foo2");
+                                                       break;
+                                               }
+                                               case 3:
+                                               {
+                                                       Foo* _tmp28_;
+                                                       Foo* _tmp29_;
+                                                       _tmp28_ = element;
+                                                       _tmp29_ = foo3;
+                                                       _vala_assert (_tmp28_ == _tmp29_, "element == foo3");
+                                                       break;
+                                               }
+                                               default:
+                                               break;
+                                       }
+                               }
+                       }
+               }
+               _vala_assert (loop_size == 3, "loop_size == 3");
+               loop_size = 0;
+               _tmp30_ = array;
+               {
+                       GPtrArray* element_collection = NULL;
+                       guint element_index = 0U;
+                       element_collection = _tmp30_;
+                       for (element_index = 0; element_index < element_collection->len; element_index = 
element_index + 1) {
+                               Foo* _tmp31_;
+                               Foo* element = NULL;
+                               _tmp31_ = _g_object_ref0 (g_ptr_array_index (element_collection, 
element_index));
+                               element = _tmp31_;
+                               {
+                                       gint _tmp32_;
+                                       Foo* _tmp33_;
+                                       _tmp32_ = loop_size;
+                                       loop_size = _tmp32_ + 1;
+                                       _tmp33_ = element;
+                                       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp33_, G_TYPE_OBJECT, 
GObject)->ref_count == ((guint) 3), "element.ref_count == 3");
+                                       switch (loop_size) {
+                                               case 1:
+                                               {
+                                                       Foo* _tmp34_;
+                                                       Foo* _tmp35_;
+                                                       _tmp34_ = element;
+                                                       _tmp35_ = foo1;
+                                                       _vala_assert (_tmp34_ == _tmp35_, "element == foo1");
+                                                       break;
+                                               }
+                                               case 2:
+                                               {
+                                                       Foo* _tmp36_;
+                                                       Foo* _tmp37_;
+                                                       _tmp36_ = element;
+                                                       _tmp37_ = foo2;
+                                                       _vala_assert (_tmp36_ == _tmp37_, "element == foo2");
+                                                       break;
+                                               }
+                                               case 3:
+                                               {
+                                                       Foo* _tmp38_;
+                                                       Foo* _tmp39_;
+                                                       _tmp38_ = element;
+                                                       _tmp39_ = foo3;
+                                                       _vala_assert (_tmp38_ == _tmp39_, "element == foo3");
+                                                       break;
+                                               }
+                                               default:
+                                               break;
+                                       }
+                                       _g_object_unref0 (element);
+                               }
+                       }
+               }
+               _vala_assert (loop_size == 3, "loop_size == 3");
+               _tmp40_ = foo2;
+               _tmp41_ = array;
+               _tmp42_ = g_ptr_array_index (_tmp41_, (guint) 1);
+               _vala_assert (_tmp40_ == ((Foo*) _tmp42_), "foo2 == array.get (1)");
+               _tmp43_ = array;
+               _tmp44_ = foo4;
+               _tmp45_ = _g_object_ref0 (_tmp44_);
+               g_ptr_array_set (_tmp43_, (guint) 1, _tmp45_);
+               _tmp46_ = foo4;
+               _tmp47_ = array;
+               _tmp48_ = g_ptr_array_index (_tmp47_, (guint) 1);
+               _vala_assert (_tmp46_ == ((Foo*) _tmp48_), "foo4 == array.get (1)");
+               _tmp49_ = foo2;
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp49_, G_TYPE_OBJECT, GObject)->ref_count == 
((guint) 1), "foo2.ref_count == 1");
+               _tmp50_ = foo4;
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp50_, G_TYPE_OBJECT, GObject)->ref_count == 
((guint) 2), "foo4.ref_count == 2");
+               _tmp51_ = array;
+               _tmp52_ = vala_g_ptr_array_get_length (_tmp51_);
+               _tmp53_ = _tmp52_;
+               _vala_assert (_tmp53_ == 3, "array.length == 3");
+               _tmp54_ = array;
+               _tmp55_ = foo5;
+               _tmp56_ = _g_object_ref0 (_tmp55_);
+               g_ptr_array_insert (_tmp54_, 2, _tmp56_);
+               _tmp57_ = foo5;
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp57_, G_TYPE_OBJECT, GObject)->ref_count == 
((guint) 2), "foo5.ref_count == 2");
+               _tmp58_ = array;
+               _tmp59_ = vala_g_ptr_array_get_length (_tmp58_);
+               _tmp60_ = _tmp59_;
+               _vala_assert (_tmp60_ == 4, "array.length == 4");
+               _tmp61_ = array;
+               _tmp62_ = foo4;
+               _vala_assert (g_ptr_array_remove (_tmp61_, _tmp62_), "array.remove (foo4)");
+               _tmp63_ = foo4;
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp63_, G_TYPE_OBJECT, GObject)->ref_count == 
((guint) 1), "foo4.ref_count == 1");
+               _tmp64_ = array;
+               _tmp65_ = vala_g_ptr_array_get_length (_tmp64_);
+               _tmp66_ = _tmp65_;
+               _vala_assert (_tmp66_ == 3, "array.length == 3");
+               _tmp67_ = array;
+               vala_g_ptr_array_sort (_tmp67_, _compare_foo_gcompare_func);
+               _tmp68_ = array;
+               vala_g_ptr_array_sort_with_data (_tmp68_, _compare_foo_gcompare_data_func, NULL);
+               _tmp69_ = array;
+               _tmp70_ = vala_g_ptr_array_get_length (_tmp69_);
+               _tmp71_ = _tmp70_;
+               _vala_assert (_tmp71_ == 3, "array.length == 3");
+               _tmp72_ = array;
+               g_ptr_array_set_size (_tmp72_, 0);
+               _tmp73_ = array;
+               _tmp74_ = vala_g_ptr_array_get_length (_tmp73_);
+               _tmp75_ = _tmp74_;
+               _vala_assert (_tmp75_ == 0, "array.length == 0");
+               _g_ptr_array_unref0 (array);
+       }
+       _tmp76_ = foo1;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp76_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"foo1.ref_count == 1");
+       _tmp77_ = foo2;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp77_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"foo2.ref_count == 1");
+       _tmp78_ = foo3;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp78_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"foo3.ref_count == 1");
+       _tmp79_ = foo4;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp79_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"foo4.ref_count == 1");
+       _tmp80_ = foo5;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp80_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"foo5.ref_count == 1");
+       {
+               GPtrArray* array = NULL;
+               GPtrArray* _tmp81_;
+               GPtrArray* _tmp82_;
+               Foo* _tmp83_;
+               Foo* _tmp84_;
+               GPtrArray* _tmp85_;
+               Foo* _tmp86_;
+               Foo* _tmp87_;
+               GPtrArray* _tmp88_;
+               Foo* _tmp89_;
+               Foo* _tmp90_;
+               GPtrArray* _tmp91_;
+               gint _tmp92_;
+               gint _tmp93_;
+               gint loop_size = 0;
+               GPtrArray* _tmp94_;
+               GPtrArray* _tmp103_;
+               Foo* _tmp113_;
+               GPtrArray* _tmp114_;
+               gconstpointer _tmp115_;
+               GPtrArray* _tmp116_;
+               Foo* _tmp117_;
+               Foo* _tmp118_;
+               GPtrArray* _tmp119_;
+               gconstpointer _tmp120_;
+               Foo* _tmp121_;
+               Foo* _tmp122_;
+               GPtrArray* _tmp123_;
+               gint _tmp124_;
+               gint _tmp125_;
+               GPtrArray* _tmp126_;
+               Foo* _tmp127_;
+               Foo* _tmp128_;
+               GPtrArray* _tmp129_;
+               gint _tmp130_;
+               gint _tmp131_;
+               GPtrArray* _tmp132_;
+               Foo* _tmp133_;
+               Foo* _tmp134_;
+               GPtrArray* _tmp135_;
+               gint _tmp136_;
+               gint _tmp137_;
+               GPtrArray* _tmp138_;
+               GPtrArray* _tmp139_;
+               GPtrArray* _tmp140_;
+               gint _tmp141_;
+               gint _tmp142_;
+               GPtrArray* _tmp143_;
+               GPtrArray* _tmp144_;
+               gint _tmp145_;
+               gint _tmp146_;
+               _tmp81_ = g_ptr_array_new_full ((guint) 8, NULL);
+               array = _tmp81_;
+               _tmp82_ = array;
+               _tmp83_ = foo1;
+               g_ptr_array_add (_tmp82_, _tmp83_);
+               _tmp84_ = foo1;
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp84_, G_TYPE_OBJECT, GObject)->ref_count == 
((guint) 1), "foo1.ref_count == 1");
+               _tmp85_ = array;
+               _tmp86_ = foo2;
+               g_ptr_array_add (_tmp85_, _tmp86_);
+               _tmp87_ = foo2;
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp87_, G_TYPE_OBJECT, GObject)->ref_count == 
((guint) 1), "foo2.ref_count == 1");
+               _tmp88_ = array;
+               _tmp89_ = foo3;
+               g_ptr_array_add (_tmp88_, _tmp89_);
+               _tmp90_ = foo3;
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp90_, G_TYPE_OBJECT, GObject)->ref_count == 
((guint) 1), "foo3.ref_count == 1");
+               _tmp91_ = array;
+               _tmp92_ = vala_g_ptr_array_get_length (_tmp91_);
+               _tmp93_ = _tmp92_;
+               _vala_assert (_tmp93_ == 3, "array.length == 3");
+               loop_size = 0;
+               _tmp94_ = array;
+               {
+                       GPtrArray* element_collection = NULL;
+                       guint element_index = 0U;
+                       element_collection = _tmp94_;
+                       for (element_index = 0; element_index < element_collection->len; element_index = 
element_index + 1) {
+                               Foo* element = NULL;
+                               element = g_ptr_array_index (element_collection, element_index);
+                               {
+                                       gint _tmp95_;
+                                       Foo* _tmp96_;
+                                       _tmp95_ = loop_size;
+                                       loop_size = _tmp95_ + 1;
+                                       _tmp96_ = element;
+                                       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp96_, G_TYPE_OBJECT, 
GObject)->ref_count == ((guint) 1), "element.ref_count == 1");
+                                       switch (loop_size) {
+                                               case 1:
+                                               {
+                                                       Foo* _tmp97_;
+                                                       Foo* _tmp98_;
+                                                       _tmp97_ = element;
+                                                       _tmp98_ = foo1;
+                                                       _vala_assert (_tmp97_ == _tmp98_, "element == foo1");
+                                                       break;
+                                               }
+                                               case 2:
+                                               {
+                                                       Foo* _tmp99_;
+                                                       Foo* _tmp100_;
+                                                       _tmp99_ = element;
+                                                       _tmp100_ = foo2;
+                                                       _vala_assert (_tmp99_ == _tmp100_, "element == foo2");
+                                                       break;
+                                               }
+                                               case 3:
+                                               {
+                                                       Foo* _tmp101_;
+                                                       Foo* _tmp102_;
+                                                       _tmp101_ = element;
+                                                       _tmp102_ = foo3;
+                                                       _vala_assert (_tmp101_ == _tmp102_, "element == 
foo3");
+                                                       break;
+                                               }
+                                               default:
+                                               break;
+                                       }
+                               }
+                       }
+               }
+               _vala_assert (loop_size == 3, "loop_size == 3");
+               loop_size = 0;
+               _tmp103_ = array;
+               {
+                       GPtrArray* element_collection = NULL;
+                       guint element_index = 0U;
+                       element_collection = _tmp103_;
+                       for (element_index = 0; element_index < element_collection->len; element_index = 
element_index + 1) {
+                               Foo* _tmp104_;
+                               Foo* element = NULL;
+                               _tmp104_ = _g_object_ref0 (g_ptr_array_index (element_collection, 
element_index));
+                               element = _tmp104_;
+                               {
+                                       gint _tmp105_;
+                                       Foo* _tmp106_;
+                                       _tmp105_ = loop_size;
+                                       loop_size = _tmp105_ + 1;
+                                       _tmp106_ = element;
+                                       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp106_, G_TYPE_OBJECT, 
GObject)->ref_count == ((guint) 2), "element.ref_count == 2");
+                                       switch (loop_size) {
+                                               case 1:
+                                               {
+                                                       Foo* _tmp107_;
+                                                       Foo* _tmp108_;
+                                                       _tmp107_ = element;
+                                                       _tmp108_ = foo1;
+                                                       _vala_assert (_tmp107_ == _tmp108_, "element == 
foo1");
+                                                       break;
+                                               }
+                                               case 2:
+                                               {
+                                                       Foo* _tmp109_;
+                                                       Foo* _tmp110_;
+                                                       _tmp109_ = element;
+                                                       _tmp110_ = foo2;
+                                                       _vala_assert (_tmp109_ == _tmp110_, "element == 
foo2");
+                                                       break;
+                                               }
+                                               case 3:
+                                               {
+                                                       Foo* _tmp111_;
+                                                       Foo* _tmp112_;
+                                                       _tmp111_ = element;
+                                                       _tmp112_ = foo3;
+                                                       _vala_assert (_tmp111_ == _tmp112_, "element == 
foo3");
+                                                       break;
+                                               }
+                                               default:
+                                               break;
+                                       }
+                                       _g_object_unref0 (element);
+                               }
+                       }
+               }
+               _vala_assert (loop_size == 3, "loop_size == 3");
+               _tmp113_ = foo2;
+               _tmp114_ = array;
+               _tmp115_ = g_ptr_array_index (_tmp114_, (guint) 1);
+               _vala_assert (_tmp113_ == ((Foo*) _tmp115_), "foo2 == array.get (1)");
+               _tmp116_ = array;
+               _tmp117_ = foo4;
+               g_ptr_array_set (_tmp116_, (guint) 1, _tmp117_);
+               _tmp118_ = foo4;
+               _tmp119_ = array;
+               _tmp120_ = g_ptr_array_index (_tmp119_, (guint) 1);
+               _vala_assert (_tmp118_ == ((Foo*) _tmp120_), "foo4 == array.get (1)");
+               _tmp121_ = foo2;
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp121_, G_TYPE_OBJECT, GObject)->ref_count == 
((guint) 1), "foo2.ref_count == 1");
+               _tmp122_ = foo4;
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp122_, G_TYPE_OBJECT, GObject)->ref_count == 
((guint) 1), "foo4.ref_count == 1");
+               _tmp123_ = array;
+               _tmp124_ = vala_g_ptr_array_get_length (_tmp123_);
+               _tmp125_ = _tmp124_;
+               _vala_assert (_tmp125_ == 3, "array.length == 3");
+               _tmp126_ = array;
+               _tmp127_ = foo5;
+               g_ptr_array_insert (_tmp126_, 2, _tmp127_);
+               _tmp128_ = foo5;
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp128_, G_TYPE_OBJECT, GObject)->ref_count == 
((guint) 1), "foo5.ref_count == 1");
+               _tmp129_ = array;
+               _tmp130_ = vala_g_ptr_array_get_length (_tmp129_);
+               _tmp131_ = _tmp130_;
+               _vala_assert (_tmp131_ == 4, "array.length == 4");
+               _tmp132_ = array;
+               _tmp133_ = foo4;
+               _vala_assert (g_ptr_array_remove (_tmp132_, _tmp133_), "array.remove (foo4)");
+               _tmp134_ = foo4;
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp134_, G_TYPE_OBJECT, GObject)->ref_count == 
((guint) 1), "foo4.ref_count == 1");
+               _tmp135_ = array;
+               _tmp136_ = vala_g_ptr_array_get_length (_tmp135_);
+               _tmp137_ = _tmp136_;
+               _vala_assert (_tmp137_ == 3, "array.length == 3");
+               _tmp138_ = array;
+               vala_g_ptr_array_sort (_tmp138_, _compare_foo_gcompare_func);
+               _tmp139_ = array;
+               vala_g_ptr_array_sort_with_data (_tmp139_, _compare_foo_gcompare_data_func, NULL);
+               _tmp140_ = array;
+               _tmp141_ = vala_g_ptr_array_get_length (_tmp140_);
+               _tmp142_ = _tmp141_;
+               _vala_assert (_tmp142_ == 3, "array.length == 3");
+               _tmp143_ = array;
+               g_ptr_array_set_size (_tmp143_, 0);
+               _tmp144_ = array;
+               _tmp145_ = vala_g_ptr_array_get_length (_tmp144_);
+               _tmp146_ = _tmp145_;
+               _vala_assert (_tmp146_ == 0, "array.length == 0");
+               _g_ptr_array_unref0 (array);
+       }
+       _tmp147_ = foo1;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp147_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 
1), "foo1.ref_count == 1");
+       _tmp148_ = foo2;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp148_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 
1), "foo2.ref_count == 1");
+       _tmp149_ = foo3;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp149_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 
1), "foo3.ref_count == 1");
+       _tmp150_ = foo4;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp150_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 
1), "foo4.ref_count == 1");
+       _tmp151_ = foo5;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp151_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 
1), "foo5.ref_count == 1");
+       _g_object_unref0 (foo5);
+       _g_object_unref0 (foo4);
+       _g_object_unref0 (foo3);
+       _g_object_unref0 (foo2);
+       _g_object_unref0 (foo1);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/basic-types/gvariants-unboxing-safe.c-expected 
b/tests/basic-types/gvariants-unboxing-safe.c-expected
new file mode 100644
index 000000000..d7ce38f8c
--- /dev/null
+++ b/tests/basic-types/gvariants-unboxing-safe.c-expected
@@ -0,0 +1,734 @@
+/* basic_types_gvariants_unboxing_safe.c generated by valac, the Vala compiler
+ * generated from basic_types_gvariants_unboxing_safe.vala, do not modify */
+
+#include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
+#define _foo_free0(var) ((var == NULL) ? NULL : (var = (foo_free (var), NULL)))
+#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       gchar* s;
+       guint64 u64;
+       gboolean b;
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN void foo_copy (const Foo* self,
+               Foo* dest);
+VALA_EXTERN void foo_destroy (Foo* self);
+static void _vala_main (void);
+static gboolean* _bool_dup (gboolean* self);
+static gboolean* _variant_get1 (GVariant* value);
+static gint16* _int16_dup (gint16* self);
+static gint16* _variant_get2 (GVariant* value);
+static gint32* _int32_dup (gint32* self);
+static gint32* _variant_get3 (GVariant* value);
+static gboolean _int32_equal (const gint32 * s1,
+                       const gint32 * s2);
+static gchar* _variant_get4 (GVariant* value);
+static gboolean* _variant_get5 (GVariant* value);
+static gboolean _bool_equal (const gboolean * s1,
+                      const gboolean * s2);
+static gint32* _variant_get6 (GVariant* value);
+static gchar** _variant_get7 (GVariant* value,
+                       gint* result_length1);
+static GVariant* _variant_new1 (Foo value);
+static void _variant_get8 (GVariant* value,
+                    Foo * result);
+static Foo* _variant_get9 (GVariant* value);
+static void _g_free0_ (gpointer var);
+static GVariant* _variant_new2 (GHashTable* value);
+static GHashTable* _variant_get10 (GVariant* value);
+static GHashTable* _variant_get11 (GVariant* value);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+static inline gpointer _vala_memdup2 (gconstpointer mem,
+                        gsize byte_size);
+
+void
+foo_copy (const Foo* self,
+          Foo* dest)
+{
+       const gchar* _tmp0_;
+       gchar* _tmp1_;
+       _tmp0_ = (*self).s;
+       _tmp1_ = g_strdup (_tmp0_);
+       _g_free0 ((*dest).s);
+       (*dest).s = _tmp1_;
+       (*dest).u64 = (*self).u64;
+       (*dest).b = (*self).b;
+}
+
+void
+foo_destroy (Foo* self)
+{
+       _g_free0 ((*self).s);
+}
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       foo_copy (self, dup);
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       foo_destroy (self);
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static gboolean*
+_bool_dup (gboolean* self)
+{
+       gboolean* dup;
+       dup = g_new0 (gboolean, 1);
+       memcpy (dup, self, sizeof (gboolean));
+       return dup;
+}
+
+static gpointer
+__bool_dup0 (gpointer self)
+{
+       return self ? _bool_dup (self) : NULL;
+}
+
+static gboolean*
+_variant_get1 (GVariant* value)
+{
+       if (value && g_variant_is_of_type (value, G_VARIANT_TYPE_BOOLEAN)) {
+               gboolean _tmp3_;
+               gboolean* _tmp4_;
+               _tmp3_ = g_variant_get_boolean (value);
+               _tmp4_ = __bool_dup0 (&_tmp3_);
+               return _tmp4_;
+       } else {
+               return NULL;
+       }
+}
+
+static gint16*
+_int16_dup (gint16* self)
+{
+       gint16* dup;
+       dup = g_new0 (gint16, 1);
+       memcpy (dup, self, sizeof (gint16));
+       return dup;
+}
+
+static gpointer
+__int16_dup0 (gpointer self)
+{
+       return self ? _int16_dup (self) : NULL;
+}
+
+static gint16*
+_variant_get2 (GVariant* value)
+{
+       if (value && g_variant_is_of_type (value, G_VARIANT_TYPE_INT16)) {
+               gint16 _tmp7_;
+               gint16* _tmp8_;
+               _tmp7_ = g_variant_get_int16 (value);
+               _tmp8_ = __int16_dup0 (&_tmp7_);
+               return _tmp8_;
+       } else {
+               return NULL;
+       }
+}
+
+static gint32*
+_int32_dup (gint32* self)
+{
+       gint32* dup;
+       dup = g_new0 (gint32, 1);
+       memcpy (dup, self, sizeof (gint32));
+       return dup;
+}
+
+static gpointer
+__int32_dup0 (gpointer self)
+{
+       return self ? _int32_dup (self) : NULL;
+}
+
+static gint32*
+_variant_get3 (GVariant* value)
+{
+       if (value && g_variant_is_of_type (value, G_VARIANT_TYPE_INT32)) {
+               gint32 _tmp11_;
+               gint32* _tmp12_;
+               _tmp11_ = g_variant_get_int32 (value);
+               _tmp12_ = __int32_dup0 (&_tmp11_);
+               return _tmp12_;
+       } else {
+               return NULL;
+       }
+}
+
+static gboolean
+_int32_equal (const gint32 * s1,
+              const gint32 * s2)
+{
+       if (s1 == s2) {
+               return TRUE;
+       }
+       if (s1 == NULL) {
+               return FALSE;
+       }
+       if (s2 == NULL) {
+               return FALSE;
+       }
+       return (*s1) == (*s2);
+}
+
+static gchar*
+_variant_get4 (GVariant* value)
+{
+       if (value && g_variant_is_of_type (value, G_VARIANT_TYPE_STRING)) {
+               return g_variant_dup_string (value, NULL);
+       } else {
+               return NULL;
+       }
+}
+
+static gboolean*
+_variant_get5 (GVariant* value)
+{
+       if (value && g_variant_is_of_type (value, G_VARIANT_TYPE_BOOLEAN)) {
+               gboolean _tmp19_;
+               gboolean* _tmp20_;
+               _tmp19_ = g_variant_get_boolean (value);
+               _tmp20_ = __bool_dup0 (&_tmp19_);
+               return _tmp20_;
+       } else {
+               return NULL;
+       }
+}
+
+static gboolean
+_bool_equal (const gboolean * s1,
+             const gboolean * s2)
+{
+       if (s1 == s2) {
+               return TRUE;
+       }
+       if (s1 == NULL) {
+               return FALSE;
+       }
+       if (s2 == NULL) {
+               return FALSE;
+       }
+       return (*s1) == (*s2);
+}
+
+static gint32*
+_variant_get6 (GVariant* value)
+{
+       if (value && g_variant_is_of_type (value, G_VARIANT_TYPE_INT32)) {
+               gint32 _tmp24_;
+               gint32* _tmp25_;
+               _tmp24_ = g_variant_get_int32 (value);
+               _tmp25_ = __int32_dup0 (&_tmp24_);
+               return _tmp25_;
+       } else {
+               return NULL;
+       }
+}
+
+static gchar**
+_variant_get7 (GVariant* value,
+               gint* result_length1)
+{
+       GVariantType* _tmp34_ = NULL;
+       _tmp34_ = g_variant_type_new ("as");
+       if (value && g_variant_is_of_type (value, _tmp34_)) {
+               gchar** _tmp35_;
+               gint _tmp35__length;
+               gint _tmp35__size;
+               gint _tmp35__length1;
+               GVariantIter _tmp36_;
+               GVariant* _tmp37_;
+               gchar** _tmp38_;
+               gint _tmp38__length1;
+               _tmp35_ = g_new (gchar*, 5);
+               _tmp35__length = 0;
+               _tmp35__size = 4;
+               _tmp35__length1 = 0;
+               g_variant_iter_init (&_tmp36_, value);
+               for (; (_tmp37_ = g_variant_iter_next_value (&_tmp36_)) != NULL; _tmp35__length1++) {
+                       if (_tmp35__size == _tmp35__length) {
+                               _tmp35__size = 2 * _tmp35__size;
+                               _tmp35_ = g_renew (gchar*, _tmp35_, _tmp35__size + 1);
+                       }
+                       _tmp35_[_tmp35__length++] = g_variant_dup_string (_tmp37_, NULL);
+                       g_variant_unref (_tmp37_);
+               }
+               *result_length1 = _tmp35__length1;
+               _tmp35_[_tmp35__length] = NULL;
+               g_variant_type_free (_tmp34_);
+               _tmp38_ = _tmp35_;
+               _tmp38__length1 = -1;
+               return _tmp38_;
+       } else {
+               g_variant_type_free (_tmp34_);
+               return NULL;
+       }
+}
+
+static GVariant*
+_variant_new1 (Foo value)
+{
+       GVariantBuilder _tmp43_;
+       g_variant_builder_init (&_tmp43_, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_tmp43_, g_variant_new_string (value.s));
+       g_variant_builder_add_value (&_tmp43_, g_variant_new_uint64 (value.u64));
+       g_variant_builder_add_value (&_tmp43_, g_variant_new_boolean (value.b));
+       return g_variant_ref_sink (g_variant_builder_end (&_tmp43_));
+}
+
+static void
+_variant_get8 (GVariant* value,
+               Foo * result)
+{
+       Foo _tmp49_;
+       GVariantIter _tmp50_;
+       GVariant* _tmp51_;
+       GVariant* _tmp52_;
+       GVariant* _tmp53_;
+       g_variant_iter_init (&_tmp50_, value);
+       _tmp51_ = g_variant_iter_next_value (&_tmp50_);
+       _tmp49_.s = g_variant_dup_string (_tmp51_, NULL);
+       g_variant_unref (_tmp51_);
+       _tmp52_ = g_variant_iter_next_value (&_tmp50_);
+       _tmp49_.u64 = g_variant_get_uint64 (_tmp52_);
+       g_variant_unref (_tmp52_);
+       _tmp53_ = g_variant_iter_next_value (&_tmp50_);
+       _tmp49_.b = g_variant_get_boolean (_tmp53_);
+       g_variant_unref (_tmp53_);
+       *result = _tmp49_;
+}
+
+static Foo*
+_variant_get9 (GVariant* value)
+{
+       GVariantType* _tmp60_ = NULL;
+       _tmp60_ = g_variant_type_new ("(stb)");
+       if (value && g_variant_is_of_type (value, _tmp60_)) {
+               Foo _tmp61_;
+               GVariantIter _tmp62_;
+               GVariant* _tmp63_;
+               GVariant* _tmp64_;
+               GVariant* _tmp65_;
+               Foo* _tmp66_;
+               g_variant_iter_init (&_tmp62_, value);
+               _tmp63_ = g_variant_iter_next_value (&_tmp62_);
+               _tmp61_.s = g_variant_dup_string (_tmp63_, NULL);
+               g_variant_unref (_tmp63_);
+               _tmp64_ = g_variant_iter_next_value (&_tmp62_);
+               _tmp61_.u64 = g_variant_get_uint64 (_tmp64_);
+               g_variant_unref (_tmp64_);
+               _tmp65_ = g_variant_iter_next_value (&_tmp62_);
+               _tmp61_.b = g_variant_get_boolean (_tmp65_);
+               g_variant_unref (_tmp65_);
+               g_variant_type_free (_tmp60_);
+               _tmp66_ = _vala_memdup2 (&_tmp61_, sizeof (Foo));
+               return _tmp66_;
+       } else {
+               g_variant_type_free (_tmp60_);
+               return NULL;
+       }
+}
+
+static void
+_g_free0_ (gpointer var)
+{
+       var = (g_free (var), NULL);
+}
+
+static GVariant*
+_variant_new2 (GHashTable* value)
+{
+       GVariantBuilder _tmp75_;
+       GHashTableIter _tmp76_;
+       gpointer _tmp77_;
+       gpointer _tmp78_;
+       g_hash_table_iter_init (&_tmp76_, value);
+       g_variant_builder_init (&_tmp75_, G_VARIANT_TYPE ("a{ss}"));
+       while (g_hash_table_iter_next (&_tmp76_, &_tmp77_, &_tmp78_)) {
+               gchar* _key;
+               gchar* _value;
+               _key = (gchar*) _tmp77_;
+               _value = (gchar*) _tmp78_;
+               g_variant_builder_add (&_tmp75_, "{?*}", g_variant_new_string (_key), g_variant_new_string 
(_value));
+       }
+       return g_variant_ref_sink (g_variant_builder_end (&_tmp75_));
+}
+
+static GHashTable*
+_variant_get10 (GVariant* value)
+{
+       GVariantType* _tmp82_ = NULL;
+       _tmp82_ = g_variant_type_new ("a{ss}");
+       if (value && g_variant_is_of_type (value, _tmp82_)) {
+               GHashTable* _tmp83_;
+               GVariantIter _tmp84_;
+               GVariant* _tmp85_;
+               GVariant* _tmp86_;
+               GHashTable* _tmp87_;
+               _tmp83_ = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
+               g_variant_iter_init (&_tmp84_, value);
+               while (g_variant_iter_loop (&_tmp84_, "{?*}", &_tmp85_, &_tmp86_)) {
+                       g_hash_table_insert (_tmp83_, g_variant_dup_string (_tmp85_, NULL), 
g_variant_dup_string (_tmp86_, NULL));
+               }
+               g_variant_type_free (_tmp82_);
+               _tmp87_ = _tmp83_;
+               return _tmp87_;
+       } else {
+               g_variant_type_free (_tmp82_);
+               return NULL;
+       }
+}
+
+static GHashTable*
+_variant_get11 (GVariant* value)
+{
+       GVariantType* _tmp92_ = NULL;
+       _tmp92_ = g_variant_type_new ("a{is}");
+       if (value && g_variant_is_of_type (value, _tmp92_)) {
+               GHashTable* _tmp93_;
+               GVariantIter _tmp94_;
+               GVariant* _tmp95_;
+               GVariant* _tmp96_;
+               GHashTable* _tmp97_;
+               _tmp93_ = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_free);
+               g_variant_iter_init (&_tmp94_, value);
+               while (g_variant_iter_loop (&_tmp94_, "{?*}", &_tmp95_, &_tmp96_)) {
+                       g_hash_table_insert (_tmp93_, (gpointer) ((gintptr) g_variant_get_int32 (_tmp95_)), 
g_variant_dup_string (_tmp96_, NULL));
+               }
+               g_variant_type_free (_tmp92_);
+               _tmp97_ = _tmp93_;
+               return _tmp97_;
+       } else {
+               g_variant_type_free (_tmp92_);
+               return NULL;
+       }
+}
+
+static void
+_vala_main (void)
+{
+       GVariant* v = NULL;
+       GVariant* _tmp0_;
+       GVariant* _tmp16_;
+       gchar* _tmp26_;
+       gchar* _tmp27_;
+       gchar* _tmp28_;
+       gchar** _tmp29_;
+       gchar** _tmp30_;
+       gint _tmp30__length1;
+       GVariant* _tmp31_;
+       Foo vsrc = {0};
+       gchar* _tmp40_;
+       Foo _tmp41_ = {0};
+       Foo _tmp42_;
+       GVariant* _tmp44_;
+       GVariant* _tmp45_;
+       const gchar* _tmp46_;
+       GHashTable* vsrc2 = NULL;
+       GHashFunc _tmp68_;
+       GEqualFunc _tmp69_;
+       GHashTable* _tmp70_;
+       gchar* _tmp71_;
+       gchar* _tmp72_;
+       gchar* _tmp73_;
+       gchar* _tmp74_;
+       GVariant* _tmp79_;
+       _tmp0_ = g_variant_new_int32 ((gint32) 4711);
+       g_variant_ref_sink (_tmp0_);
+       _g_variant_unref0 (v);
+       v = _tmp0_;
+       {
+               gboolean* b = NULL;
+               GVariant* _tmp1_;
+               gboolean* _tmp2_;
+               _tmp1_ = v;
+               _tmp2_ = _variant_get1 (_tmp1_);
+               b = _tmp2_;
+               _vala_assert (b == NULL, "b == null");
+               _g_free0 (b);
+       }
+       {
+               gint16* i16 = NULL;
+               GVariant* _tmp5_;
+               gint16* _tmp6_;
+               _tmp5_ = v;
+               _tmp6_ = _variant_get2 (_tmp5_);
+               i16 = _tmp6_;
+               _vala_assert (i16 == NULL, "i16 == null");
+               _g_free0 (i16);
+       }
+       {
+               gint32* i32 = NULL;
+               GVariant* _tmp9_;
+               gint32* _tmp10_;
+               gint32 _tmp13_;
+               _tmp9_ = v;
+               _tmp10_ = _variant_get3 (_tmp9_);
+               i32 = _tmp10_;
+               _tmp13_ = (gint32) 4711;
+               _vala_assert (_int32_equal (i32, &_tmp13_) == TRUE, "i32 == 4711");
+               _g_free0 (i32);
+       }
+       {
+               gchar* s = NULL;
+               GVariant* _tmp14_;
+               gchar* _tmp15_;
+               _tmp14_ = v;
+               _tmp15_ = _variant_get4 (_tmp14_);
+               s = _tmp15_;
+               _vala_assert (s == NULL, "s == null");
+               _g_free0 (s);
+       }
+       _tmp16_ = g_variant_new_boolean (TRUE);
+       g_variant_ref_sink (_tmp16_);
+       _g_variant_unref0 (v);
+       v = _tmp16_;
+       {
+               gboolean* b = NULL;
+               GVariant* _tmp17_;
+               gboolean* _tmp18_;
+               gboolean _tmp21_;
+               _tmp17_ = v;
+               _tmp18_ = _variant_get5 (_tmp17_);
+               b = _tmp18_;
+               _tmp21_ = TRUE;
+               _vala_assert (_bool_equal (b, &_tmp21_) == TRUE, "b == true");
+               _g_free0 (b);
+       }
+       {
+               gint32* i32 = NULL;
+               GVariant* _tmp22_;
+               gint32* _tmp23_;
+               _tmp22_ = v;
+               _tmp23_ = _variant_get6 (_tmp22_);
+               i32 = _tmp23_;
+               _vala_assert (i32 == NULL, "i32 == null");
+               _g_free0 (i32);
+       }
+       _tmp26_ = g_strdup ("foo");
+       _tmp27_ = g_strdup ("bar");
+       _tmp28_ = g_strdup ("manam");
+       _tmp29_ = g_new0 (gchar*, 3 + 1);
+       _tmp29_[0] = _tmp26_;
+       _tmp29_[1] = _tmp27_;
+       _tmp29_[2] = _tmp28_;
+       _tmp30_ = _tmp29_;
+       _tmp30__length1 = 3;
+       _tmp31_ = g_variant_new_strv (_tmp30_, 3);
+       g_variant_ref_sink (_tmp31_);
+       _g_variant_unref0 (v);
+       v = _tmp31_;
+       _tmp30_ = (_vala_array_free (_tmp30_, _tmp30__length1, (GDestroyNotify) g_free), NULL);
+       {
+               gchar** sa = NULL;
+               GVariant* _tmp32_;
+               gchar** _tmp33_ = NULL;
+               gint _tmp33__length1 = 0;
+               gint sa_length1;
+               gint _sa_size_;
+               const gchar* _tmp39_;
+               _tmp32_ = v;
+               _tmp33_ = _variant_get7 (_tmp32_, &_tmp33__length1);
+               sa = _tmp33_;
+               sa_length1 = _tmp33__length1;
+               _sa_size_ = sa_length1;
+               _vala_assert (sa != NULL, "sa != null");
+               _tmp39_ = sa[2];
+               _vala_assert (g_strcmp0 (_tmp39_, "manam") == 0, "sa[2] == \"manam\"");
+               sa = (_vala_array_free (sa, sa_length1, (GDestroyNotify) g_free), NULL);
+       }
+       _tmp40_ = g_strdup ("foo");
+       _g_free0 (_tmp41_.s);
+       _tmp41_.s = _tmp40_;
+       _tmp41_.u64 = G_MAXUINT64;
+       _tmp41_.b = TRUE;
+       vsrc = _tmp41_;
+       _tmp42_ = vsrc;
+       _tmp44_ = _variant_new1 (_tmp42_);
+       _g_variant_unref0 (v);
+       v = _tmp44_;
+       _tmp45_ = v;
+       _tmp46_ = g_variant_get_type_string (_tmp45_);
+       _vala_assert (g_strcmp0 ("(stb)", _tmp46_) == 0, "\"(stb)\" == v.get_type_string ()");
+       {
+               Foo real_st = {0};
+               GVariant* _tmp47_;
+               Foo _tmp48_;
+               Foo _tmp54_;
+               const gchar* _tmp55_;
+               Foo _tmp56_;
+               Foo _tmp57_;
+               Foo* st = NULL;
+               GVariant* _tmp58_;
+               Foo* _tmp59_;
+               const gchar* _tmp67_;
+               _tmp47_ = v;
+               _variant_get8 (_tmp47_, &_tmp48_);
+               real_st = _tmp48_;
+               _tmp54_ = real_st;
+               _tmp55_ = _tmp54_.s;
+               _vala_assert (g_strcmp0 (_tmp55_, "foo") == 0, "real_st.s == \"foo\"");
+               _tmp56_ = real_st;
+               _vala_assert (_tmp56_.u64 == G_MAXUINT64, "real_st.u64 == uint64.MAX");
+               _tmp57_ = real_st;
+               _vala_assert (_tmp57_.b == TRUE, "real_st.b == true");
+               _tmp58_ = v;
+               _tmp59_ = _variant_get9 (_tmp58_);
+               st = _tmp59_;
+               _vala_assert (st != NULL, "st != null");
+               _tmp67_ = (*st).s;
+               _vala_assert (g_strcmp0 (_tmp67_, "foo") == 0, "st.s == \"foo\"");
+               _vala_assert ((*st).u64 == G_MAXUINT64, "st.u64 == uint64.MAX");
+               _vala_assert ((*st).b == TRUE, "st.b == true");
+               _foo_free0 (st);
+               foo_destroy (&real_st);
+       }
+       _tmp68_ = g_str_hash;
+       _tmp69_ = g_str_equal;
+       _tmp70_ = g_hash_table_new_full (_tmp68_, _tmp69_, _g_free0_, _g_free0_);
+       vsrc2 = _tmp70_;
+       _tmp71_ = g_strdup ("foo");
+       _tmp72_ = g_strdup ("bar");
+       g_hash_table_insert (vsrc2, _tmp71_, _tmp72_);
+       _tmp73_ = g_strdup ("bar");
+       _tmp74_ = g_strdup ("manam");
+       g_hash_table_insert (vsrc2, _tmp73_, _tmp74_);
+       _tmp79_ = _variant_new2 (vsrc2);
+       _g_variant_unref0 (v);
+       v = _tmp79_;
+       {
+               GHashTable* dict = NULL;
+               GVariant* _tmp80_;
+               GHashTable* _tmp81_;
+               gconstpointer _tmp88_;
+               gconstpointer _tmp89_;
+               _tmp80_ = v;
+               _tmp81_ = _variant_get10 (_tmp80_);
+               dict = _tmp81_;
+               _tmp88_ = g_hash_table_lookup (dict, "foo");
+               _vala_assert (g_strcmp0 ((const gchar*) _tmp88_, "bar") == 0, "dict.lookup (\"foo\") == 
\"bar\"");
+               _tmp89_ = g_hash_table_lookup (dict, "bar");
+               _vala_assert (g_strcmp0 ((const gchar*) _tmp89_, "manam") == 0, "dict.lookup (\"bar\") == 
\"manam\"");
+               _g_hash_table_unref0 (dict);
+       }
+       {
+               GHashTable* dict = NULL;
+               GVariant* _tmp90_;
+               GHashTable* _tmp91_;
+               _tmp90_ = v;
+               _tmp91_ = _variant_get11 (_tmp90_);
+               dict = _tmp91_;
+               _vala_assert (dict == NULL, "dict == null");
+               _g_hash_table_unref0 (dict);
+       }
+       _g_hash_table_unref0 (vsrc2);
+       foo_destroy (&vsrc);
+       _g_variant_unref0 (v);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
+static inline gpointer
+_vala_memdup2 (gconstpointer mem,
+               gsize byte_size)
+{
+       gpointer new_mem;
+       if (mem && byte_size != 0) {
+               new_mem = g_malloc (byte_size);
+               memcpy (new_mem, mem, byte_size);
+       } else {
+               new_mem = NULL;
+       }
+       return new_mem;
+}
+
diff --git a/tests/basic-types/gvariants.c-expected b/tests/basic-types/gvariants.c-expected
new file mode 100644
index 000000000..dc037ded2
--- /dev/null
+++ b/tests/basic-types/gvariants.c-expected
@@ -0,0 +1,860 @@
+/* basic_types_gvariants.c generated by valac, the Vala compiler
+ * generated from basic_types_gvariants.vala, do not modify */
+
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+#include <float.h>
+#include <math.h>
+#include <glib-object.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       gchar* s;
+       guint64 u64;
+       gboolean b;
+};
+
+VALA_EXTERN void string_conversion (void);
+static GVariant* _variant_new1 (const gchar* value);
+static gchar* _variant_get1 (GVariant* value);
+VALA_EXTERN void string_array_conversion (void);
+static GVariant* _variant_new2 (gchar** value,
+                         gint value_length1);
+static gchar** _variant_get2 (GVariant* value,
+                       gint* result_length1);
+VALA_EXTERN void string_array_2d_conversion (void);
+static GVariant* _variant_new3 (gchar** value,
+                         gint value_length1,
+                         gint value_length2);
+static gchar** _variant_get3 (GVariant* value,
+                       gint* result_length1,
+                       gint* result_length2);
+VALA_EXTERN void string_array_3d_conversion (void);
+static GVariant* _variant_new4 (gchar** value,
+                         gint value_length1,
+                         gint value_length2,
+                         gint value_length3);
+static gchar** _variant_get4 (GVariant* value,
+                       gint* result_length1,
+                       gint* result_length2,
+                       gint* result_length3);
+VALA_EXTERN void double_conversion (void);
+static GVariant* _variant_new5 (gdouble value);
+static gdouble _variant_get5 (GVariant* value);
+VALA_EXTERN void double_array_conversion (void);
+static GVariant* _variant_new6 (gdouble* value,
+                         gint value_length1);
+static gdouble* _variant_get6 (GVariant* value,
+                        gint* result_length1);
+VALA_EXTERN void double_array_2d_conversion (void);
+static GVariant* _variant_new7 (gdouble* value,
+                         gint value_length1,
+                         gint value_length2);
+static gdouble* _variant_get7 (GVariant* value,
+                        gint* result_length1,
+                        gint* result_length2);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN void foo_copy (const Foo* self,
+               Foo* dest);
+VALA_EXTERN void foo_destroy (Foo* self);
+VALA_EXTERN void struct_conversion (void);
+static GVariant* _variant_new8 (Foo value);
+static void _variant_get8 (GVariant* value,
+                    Foo * result);
+static void _vala_main (void);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static GVariant*
+_variant_new1 (const gchar* value)
+{
+       return g_variant_ref_sink (g_variant_new_string (value));
+}
+
+static gchar*
+_variant_get1 (GVariant* value)
+{
+       return g_variant_dup_string (value, NULL);
+}
+
+void
+string_conversion (void)
+{
+       GVariant* v = NULL;
+       GVariant* _tmp0_;
+       gchar* s = NULL;
+       gchar* _tmp1_;
+       _tmp0_ = _variant_new1 ("foo");
+       v = _tmp0_;
+       _tmp1_ = _variant_get1 (v);
+       s = _tmp1_;
+       _vala_assert (g_strcmp0 (s, "foo") == 0, "s == \"foo\"");
+       _g_free0 (s);
+       _g_variant_unref0 (v);
+}
+
+static GVariant*
+_variant_new2 (gchar** value,
+               gint value_length1)
+{
+       gchar** _tmp4_;
+       GVariantBuilder _tmp5_;
+       gint _tmp6_;
+       _tmp4_ = value;
+       g_variant_builder_init (&_tmp5_, G_VARIANT_TYPE ("as"));
+       for (_tmp6_ = 0; _tmp6_ < value_length1; _tmp6_++) {
+               g_variant_builder_add_value (&_tmp5_, g_variant_new_string (*_tmp4_));
+               _tmp4_++;
+       }
+       return g_variant_ref_sink (g_variant_builder_end (&_tmp5_));
+}
+
+static gchar**
+_variant_get2 (GVariant* value,
+               gint* result_length1)
+{
+       gchar** _tmp10_;
+       gint _tmp10__length;
+       gint _tmp10__size;
+       gint _tmp10__length1;
+       GVariantIter _tmp11_;
+       GVariant* _tmp12_;
+       _tmp10_ = g_new (gchar*, 5);
+       _tmp10__length = 0;
+       _tmp10__size = 4;
+       _tmp10__length1 = 0;
+       g_variant_iter_init (&_tmp11_, value);
+       for (; (_tmp12_ = g_variant_iter_next_value (&_tmp11_)) != NULL; _tmp10__length1++) {
+               if (_tmp10__size == _tmp10__length) {
+                       _tmp10__size = 2 * _tmp10__size;
+                       _tmp10_ = g_renew (gchar*, _tmp10_, _tmp10__size + 1);
+               }
+               _tmp10_[_tmp10__length++] = g_variant_dup_string (_tmp12_, NULL);
+               g_variant_unref (_tmp12_);
+       }
+       *result_length1 = _tmp10__length1;
+       _tmp10_[_tmp10__length] = NULL;
+       return _tmp10_;
+}
+
+void
+string_array_conversion (void)
+{
+       GVariant* v = NULL;
+       gchar* _tmp0_;
+       gchar* _tmp1_;
+       gchar** _tmp2_;
+       gchar** _tmp3_;
+       gint _tmp3__length1;
+       GVariant* _tmp7_;
+       GVariant* _tmp8_;
+       gchar** sa = NULL;
+       gchar** _tmp9_ = NULL;
+       gint _tmp9__length1 = 0;
+       gint sa_length1;
+       gint _sa_size_;
+       const gchar* _tmp13_;
+       _tmp0_ = g_strdup ("foo");
+       _tmp1_ = g_strdup ("bar");
+       _tmp2_ = g_new0 (gchar*, 2 + 1);
+       _tmp2_[0] = _tmp0_;
+       _tmp2_[1] = _tmp1_;
+       _tmp3_ = _tmp2_;
+       _tmp3__length1 = 2;
+       _tmp7_ = _variant_new2 (_tmp3_, 2);
+       _tmp8_ = _tmp7_;
+       _tmp3_ = (_vala_array_free (_tmp3_, _tmp3__length1, (GDestroyNotify) g_free), NULL);
+       v = _tmp8_;
+       _tmp9_ = _variant_get2 (v, &_tmp9__length1);
+       sa = _tmp9_;
+       sa_length1 = _tmp9__length1;
+       _sa_size_ = sa_length1;
+       _vala_assert (sa_length1 == 2, "sa.length == 2");
+       _tmp13_ = sa[1];
+       _vala_assert (g_strcmp0 (_tmp13_, "bar") == 0, "sa[1] == \"bar\"");
+       sa = (_vala_array_free (sa, sa_length1, (GDestroyNotify) g_free), NULL);
+       _g_variant_unref0 (v);
+}
+
+static GVariant*
+_variant_new3 (gchar** value,
+               gint value_length1,
+               gint value_length2)
+{
+       gchar** _tmp6_;
+       GVariantBuilder _tmp7_;
+       gint _tmp8_;
+       _tmp6_ = value;
+       g_variant_builder_init (&_tmp7_, G_VARIANT_TYPE ("aas"));
+       for (_tmp8_ = 0; _tmp8_ < value_length1; _tmp8_++) {
+               GVariantBuilder _tmp9_;
+               gint _tmp10_;
+               g_variant_builder_init (&_tmp9_, G_VARIANT_TYPE ("as"));
+               for (_tmp10_ = 0; _tmp10_ < value_length2; _tmp10_++) {
+                       g_variant_builder_add_value (&_tmp9_, g_variant_new_string (*_tmp6_));
+                       _tmp6_++;
+               }
+               g_variant_builder_add_value (&_tmp7_, g_variant_builder_end (&_tmp9_));
+       }
+       return g_variant_ref_sink (g_variant_builder_end (&_tmp7_));
+}
+
+static gchar**
+_variant_get3 (GVariant* value,
+               gint* result_length1,
+               gint* result_length2)
+{
+       gchar** _tmp14_;
+       gint _tmp14__length;
+       gint _tmp14__size;
+       gint _tmp14__length1;
+       GVariantIter _tmp15_;
+       GVariant* _tmp16_;
+       _tmp14_ = g_new (gchar*, 5);
+       _tmp14__length = 0;
+       _tmp14__size = 4;
+       _tmp14__length1 = 0;
+       g_variant_iter_init (&_tmp15_, value);
+       for (; (_tmp16_ = g_variant_iter_next_value (&_tmp15_)) != NULL; _tmp14__length1++) {
+               gint _tmp14__length2;
+               GVariantIter _tmp17_;
+               GVariant* _tmp18_;
+               _tmp14__length2 = 0;
+               g_variant_iter_init (&_tmp17_, _tmp16_);
+               for (; (_tmp18_ = g_variant_iter_next_value (&_tmp17_)) != NULL; _tmp14__length2++) {
+                       if (_tmp14__size == _tmp14__length) {
+                               _tmp14__size = 2 * _tmp14__size;
+                               _tmp14_ = g_renew (gchar*, _tmp14_, _tmp14__size + 1);
+                       }
+                       _tmp14_[_tmp14__length++] = g_variant_dup_string (_tmp18_, NULL);
+                       g_variant_unref (_tmp18_);
+               }
+               *result_length2 = _tmp14__length2;
+               g_variant_unref (_tmp16_);
+       }
+       *result_length1 = _tmp14__length1;
+       _tmp14_[_tmp14__length] = NULL;
+       return _tmp14_;
+}
+
+void
+string_array_2d_conversion (void)
+{
+       GVariant* v = NULL;
+       gchar* _tmp0_;
+       gchar* _tmp1_;
+       gchar* _tmp2_;
+       gchar* _tmp3_;
+       gchar** _tmp4_;
+       gchar** _tmp5_;
+       gint _tmp5__length1;
+       gint _tmp5__length2;
+       GVariant* _tmp11_;
+       GVariant* _tmp12_;
+       gchar** sa = NULL;
+       gchar** _tmp13_ = NULL;
+       gint _tmp13__length1 = 0;
+       gint _tmp13__length2 = 0;
+       gint sa_length1;
+       gint sa_length2;
+       gint _tmp19_;
+       gint _tmp20_;
+       const gchar* _tmp21_;
+       _tmp0_ = g_strdup ("foo");
+       _tmp1_ = g_strdup ("faz");
+       _tmp2_ = g_strdup ("bar");
+       _tmp3_ = g_strdup ("baz");
+       _tmp4_ = g_new0 (gchar*, (2 * 2) + 1);
+       _tmp4_[0] = _tmp0_;
+       _tmp4_[1] = _tmp1_;
+       _tmp4_[2] = _tmp2_;
+       _tmp4_[3] = _tmp3_;
+       _tmp5_ = _tmp4_;
+       _tmp5__length1 = 2;
+       _tmp5__length2 = 2;
+       _tmp11_ = _variant_new3 (_tmp5_, 2, 2);
+       _tmp12_ = _tmp11_;
+       _tmp5_ = (_vala_array_free (_tmp5_, _tmp5__length1 * _tmp5__length2, (GDestroyNotify) g_free), NULL);
+       v = _tmp12_;
+       _tmp13_ = _variant_get3 (v, &_tmp13__length1, &_tmp13__length2);
+       sa = _tmp13_;
+       sa_length1 = _tmp13__length1;
+       sa_length2 = _tmp13__length2;
+       _tmp19_ = sa_length1;
+       _vala_assert (_tmp19_ == 2, "sa.length[0] == 2");
+       _tmp20_ = sa_length2;
+       _vala_assert (_tmp20_ == 2, "sa.length[1] == 2");
+       _tmp21_ = sa[(1 * sa_length2) + 1];
+       _vala_assert (g_strcmp0 (_tmp21_, "baz") == 0, "sa[1,1] == \"baz\"");
+       sa = (_vala_array_free (sa, sa_length1 * sa_length2, (GDestroyNotify) g_free), NULL);
+       _g_variant_unref0 (v);
+}
+
+static GVariant*
+_variant_new4 (gchar** value,
+               gint value_length1,
+               gint value_length2,
+               gint value_length3)
+{
+       gchar** _tmp10_;
+       GVariantBuilder _tmp11_;
+       gint _tmp12_;
+       _tmp10_ = value;
+       g_variant_builder_init (&_tmp11_, G_VARIANT_TYPE ("aaas"));
+       for (_tmp12_ = 0; _tmp12_ < value_length1; _tmp12_++) {
+               GVariantBuilder _tmp13_;
+               gint _tmp14_;
+               g_variant_builder_init (&_tmp13_, G_VARIANT_TYPE ("aas"));
+               for (_tmp14_ = 0; _tmp14_ < value_length2; _tmp14_++) {
+                       GVariantBuilder _tmp15_;
+                       gint _tmp16_;
+                       g_variant_builder_init (&_tmp15_, G_VARIANT_TYPE ("as"));
+                       for (_tmp16_ = 0; _tmp16_ < value_length3; _tmp16_++) {
+                               g_variant_builder_add_value (&_tmp15_, g_variant_new_string (*_tmp10_));
+                               _tmp10_++;
+                       }
+                       g_variant_builder_add_value (&_tmp13_, g_variant_builder_end (&_tmp15_));
+               }
+               g_variant_builder_add_value (&_tmp11_, g_variant_builder_end (&_tmp13_));
+       }
+       return g_variant_ref_sink (g_variant_builder_end (&_tmp11_));
+}
+
+static gchar**
+_variant_get4 (GVariant* value,
+               gint* result_length1,
+               gint* result_length2,
+               gint* result_length3)
+{
+       gchar** _tmp20_;
+       gint _tmp20__length;
+       gint _tmp20__size;
+       gint _tmp20__length1;
+       GVariantIter _tmp21_;
+       GVariant* _tmp22_;
+       _tmp20_ = g_new (gchar*, 5);
+       _tmp20__length = 0;
+       _tmp20__size = 4;
+       _tmp20__length1 = 0;
+       g_variant_iter_init (&_tmp21_, value);
+       for (; (_tmp22_ = g_variant_iter_next_value (&_tmp21_)) != NULL; _tmp20__length1++) {
+               gint _tmp20__length2;
+               GVariantIter _tmp23_;
+               GVariant* _tmp24_;
+               _tmp20__length2 = 0;
+               g_variant_iter_init (&_tmp23_, _tmp22_);
+               for (; (_tmp24_ = g_variant_iter_next_value (&_tmp23_)) != NULL; _tmp20__length2++) {
+                       gint _tmp20__length3;
+                       GVariantIter _tmp25_;
+                       GVariant* _tmp26_;
+                       _tmp20__length3 = 0;
+                       g_variant_iter_init (&_tmp25_, _tmp24_);
+                       for (; (_tmp26_ = g_variant_iter_next_value (&_tmp25_)) != NULL; _tmp20__length3++) {
+                               if (_tmp20__size == _tmp20__length) {
+                                       _tmp20__size = 2 * _tmp20__size;
+                                       _tmp20_ = g_renew (gchar*, _tmp20_, _tmp20__size + 1);
+                               }
+                               _tmp20_[_tmp20__length++] = g_variant_dup_string (_tmp26_, NULL);
+                               g_variant_unref (_tmp26_);
+                       }
+                       *result_length3 = _tmp20__length3;
+                       g_variant_unref (_tmp24_);
+               }
+               *result_length2 = _tmp20__length2;
+               g_variant_unref (_tmp22_);
+       }
+       *result_length1 = _tmp20__length1;
+       _tmp20_[_tmp20__length] = NULL;
+       return _tmp20_;
+}
+
+void
+string_array_3d_conversion (void)
+{
+       GVariant* v = NULL;
+       gchar* _tmp0_;
+       gchar* _tmp1_;
+       gchar* _tmp2_;
+       gchar* _tmp3_;
+       gchar* _tmp4_;
+       gchar* _tmp5_;
+       gchar* _tmp6_;
+       gchar* _tmp7_;
+       gchar** _tmp8_;
+       gchar** _tmp9_;
+       gint _tmp9__length1;
+       gint _tmp9__length2;
+       gint _tmp9__length3;
+       GVariant* _tmp17_;
+       GVariant* _tmp18_;
+       gchar** sa = NULL;
+       gchar** _tmp19_ = NULL;
+       gint _tmp19__length1 = 0;
+       gint _tmp19__length2 = 0;
+       gint _tmp19__length3 = 0;
+       gint sa_length1;
+       gint sa_length2;
+       gint sa_length3;
+       gint _tmp27_;
+       gint _tmp28_;
+       gint _tmp29_;
+       const gchar* _tmp30_;
+       const gchar* _tmp31_;
+       const gchar* _tmp32_;
+       const gchar* _tmp33_;
+       _tmp0_ = g_strdup ("foo");
+       _tmp1_ = g_strdup ("bar");
+       _tmp2_ = g_strdup ("baz");
+       _tmp3_ = g_strdup ("man");
+       _tmp4_ = g_strdup ("foo2");
+       _tmp5_ = g_strdup ("bar2");
+       _tmp6_ = g_strdup ("baz2");
+       _tmp7_ = g_strdup ("man2");
+       _tmp8_ = g_new0 (gchar*, ((2 * 2) * 2) + 1);
+       _tmp8_[0] = _tmp0_;
+       _tmp8_[1] = _tmp1_;
+       _tmp8_[2] = _tmp2_;
+       _tmp8_[3] = _tmp3_;
+       _tmp8_[4] = _tmp4_;
+       _tmp8_[5] = _tmp5_;
+       _tmp8_[6] = _tmp6_;
+       _tmp8_[7] = _tmp7_;
+       _tmp9_ = _tmp8_;
+       _tmp9__length1 = 2;
+       _tmp9__length2 = 2;
+       _tmp9__length3 = 2;
+       _tmp17_ = _variant_new4 (_tmp9_, 2, 2, 2);
+       _tmp18_ = _tmp17_;
+       _tmp9_ = (_vala_array_free (_tmp9_, (_tmp9__length1 * _tmp9__length2) * _tmp9__length3, 
(GDestroyNotify) g_free), NULL);
+       v = _tmp18_;
+       _tmp19_ = _variant_get4 (v, &_tmp19__length1, &_tmp19__length2, &_tmp19__length3);
+       sa = _tmp19_;
+       sa_length1 = _tmp19__length1;
+       sa_length2 = _tmp19__length2;
+       sa_length3 = _tmp19__length3;
+       _tmp27_ = sa_length1;
+       _vala_assert (_tmp27_ == 2, "sa.length[0] == 2");
+       _tmp28_ = sa_length2;
+       _vala_assert (_tmp28_ == 2, "sa.length[1] == 2");
+       _tmp29_ = sa_length3;
+       _vala_assert (_tmp29_ == 2, "sa.length[2] == 2");
+       _tmp30_ = sa[(((0 * sa_length2) + 1) * sa_length3) + 0];
+       _vala_assert (g_strcmp0 (_tmp30_, "baz") == 0, "sa[0,1,0] == \"baz\"");
+       _tmp31_ = sa[(((0 * sa_length2) + 1) * sa_length3) + 1];
+       _vala_assert (g_strcmp0 (_tmp31_, "man") == 0, "sa[0,1,1] == \"man\"");
+       _tmp32_ = sa[(((1 * sa_length2) + 1) * sa_length3) + 0];
+       _vala_assert (g_strcmp0 (_tmp32_, "baz2") == 0, "sa[1,1,0] == \"baz2\"");
+       _tmp33_ = sa[(((1 * sa_length2) + 1) * sa_length3) + 1];
+       _vala_assert (g_strcmp0 (_tmp33_, "man2") == 0, "sa[1,1,1] == \"man2\"");
+       sa = (_vala_array_free (sa, (sa_length1 * sa_length2) * sa_length3, (GDestroyNotify) g_free), NULL);
+       _g_variant_unref0 (v);
+}
+
+static GVariant*
+_variant_new5 (gdouble value)
+{
+       return g_variant_ref_sink (g_variant_new_double (value));
+}
+
+static gdouble
+_variant_get5 (GVariant* value)
+{
+       return g_variant_get_double (value);
+}
+
+void
+double_conversion (void)
+{
+       GVariant* v = NULL;
+       GVariant* _tmp0_;
+       gdouble d = 0.0;
+       gdouble _tmp1_;
+       _tmp0_ = _variant_new5 (42.23);
+       v = _tmp0_;
+       _tmp1_ = _variant_get5 (v);
+       d = _tmp1_;
+       _vala_assert (d == 42.23, "d == 42.23");
+       _g_variant_unref0 (v);
+}
+
+static GVariant*
+_variant_new6 (gdouble* value,
+               gint value_length1)
+{
+       gdouble* _tmp2_;
+       GVariantBuilder _tmp3_;
+       gint _tmp4_;
+       _tmp2_ = value;
+       g_variant_builder_init (&_tmp3_, G_VARIANT_TYPE ("ad"));
+       for (_tmp4_ = 0; _tmp4_ < value_length1; _tmp4_++) {
+               g_variant_builder_add_value (&_tmp3_, g_variant_new_double (*_tmp2_));
+               _tmp2_++;
+       }
+       return g_variant_ref_sink (g_variant_builder_end (&_tmp3_));
+}
+
+static gdouble*
+_variant_get6 (GVariant* value,
+               gint* result_length1)
+{
+       gdouble* _tmp8_;
+       gint _tmp8__length;
+       gint _tmp8__size;
+       gint _tmp8__length1;
+       GVariantIter _tmp9_;
+       GVariant* _tmp10_;
+       _tmp8_ = g_new (gdouble, 5);
+       _tmp8__length = 0;
+       _tmp8__size = 4;
+       _tmp8__length1 = 0;
+       g_variant_iter_init (&_tmp9_, value);
+       for (; (_tmp10_ = g_variant_iter_next_value (&_tmp9_)) != NULL; _tmp8__length1++) {
+               if (_tmp8__size == _tmp8__length) {
+                       _tmp8__size = 2 * _tmp8__size;
+                       _tmp8_ = g_renew (gdouble, _tmp8_, _tmp8__size + 1);
+               }
+               _tmp8_[_tmp8__length++] = g_variant_get_double (_tmp10_);
+               g_variant_unref (_tmp10_);
+       }
+       *result_length1 = _tmp8__length1;
+       return _tmp8_;
+}
+
+void
+double_array_conversion (void)
+{
+       GVariant* v = NULL;
+       gdouble* _tmp0_;
+       gdouble* _tmp1_;
+       gint _tmp1__length1;
+       GVariant* _tmp5_;
+       GVariant* _tmp6_;
+       gdouble* da = NULL;
+       gdouble* _tmp7_ = NULL;
+       gint _tmp7__length1 = 0;
+       gint da_length1;
+       gint _da_size_;
+       gdouble _tmp11_;
+       _tmp0_ = g_new0 (gdouble, 2);
+       _tmp0_[0] = 42.23;
+       _tmp0_[1] = 47.11;
+       _tmp1_ = _tmp0_;
+       _tmp1__length1 = 2;
+       _tmp5_ = _variant_new6 (_tmp1_, 2);
+       _tmp6_ = _tmp5_;
+       _tmp1_ = (g_free (_tmp1_), NULL);
+       v = _tmp6_;
+       _tmp7_ = _variant_get6 (v, &_tmp7__length1);
+       da = _tmp7_;
+       da_length1 = _tmp7__length1;
+       _da_size_ = da_length1;
+       _vala_assert (da_length1 == 2, "da.length == 2");
+       _tmp11_ = da[1];
+       _vala_assert (_tmp11_ == 47.11, "da[1] == 47.11");
+       da = (g_free (da), NULL);
+       _g_variant_unref0 (v);
+}
+
+static GVariant*
+_variant_new7 (gdouble* value,
+               gint value_length1,
+               gint value_length2)
+{
+       gdouble* _tmp2_;
+       GVariantBuilder _tmp3_;
+       gint _tmp4_;
+       _tmp2_ = value;
+       g_variant_builder_init (&_tmp3_, G_VARIANT_TYPE ("aad"));
+       for (_tmp4_ = 0; _tmp4_ < value_length1; _tmp4_++) {
+               GVariantBuilder _tmp5_;
+               gint _tmp6_;
+               g_variant_builder_init (&_tmp5_, G_VARIANT_TYPE ("ad"));
+               for (_tmp6_ = 0; _tmp6_ < value_length2; _tmp6_++) {
+                       g_variant_builder_add_value (&_tmp5_, g_variant_new_double (*_tmp2_));
+                       _tmp2_++;
+               }
+               g_variant_builder_add_value (&_tmp3_, g_variant_builder_end (&_tmp5_));
+       }
+       return g_variant_ref_sink (g_variant_builder_end (&_tmp3_));
+}
+
+static gdouble*
+_variant_get7 (GVariant* value,
+               gint* result_length1,
+               gint* result_length2)
+{
+       gdouble* _tmp10_;
+       gint _tmp10__length;
+       gint _tmp10__size;
+       gint _tmp10__length1;
+       GVariantIter _tmp11_;
+       GVariant* _tmp12_;
+       _tmp10_ = g_new (gdouble, 5);
+       _tmp10__length = 0;
+       _tmp10__size = 4;
+       _tmp10__length1 = 0;
+       g_variant_iter_init (&_tmp11_, value);
+       for (; (_tmp12_ = g_variant_iter_next_value (&_tmp11_)) != NULL; _tmp10__length1++) {
+               gint _tmp10__length2;
+               GVariantIter _tmp13_;
+               GVariant* _tmp14_;
+               _tmp10__length2 = 0;
+               g_variant_iter_init (&_tmp13_, _tmp12_);
+               for (; (_tmp14_ = g_variant_iter_next_value (&_tmp13_)) != NULL; _tmp10__length2++) {
+                       if (_tmp10__size == _tmp10__length) {
+                               _tmp10__size = 2 * _tmp10__size;
+                               _tmp10_ = g_renew (gdouble, _tmp10_, _tmp10__size + 1);
+                       }
+                       _tmp10_[_tmp10__length++] = g_variant_get_double (_tmp14_);
+                       g_variant_unref (_tmp14_);
+               }
+               *result_length2 = _tmp10__length2;
+               g_variant_unref (_tmp12_);
+       }
+       *result_length1 = _tmp10__length1;
+       return _tmp10_;
+}
+
+void
+double_array_2d_conversion (void)
+{
+       GVariant* v = NULL;
+       gdouble* _tmp0_;
+       gdouble* _tmp1_;
+       gint _tmp1__length1;
+       gint _tmp1__length2;
+       GVariant* _tmp7_;
+       GVariant* _tmp8_;
+       gdouble* da = NULL;
+       gdouble* _tmp9_ = NULL;
+       gint _tmp9__length1 = 0;
+       gint _tmp9__length2 = 0;
+       gint da_length1;
+       gint da_length2;
+       gint _tmp15_;
+       gint _tmp16_;
+       gdouble _tmp17_;
+       _tmp0_ = g_new0 (gdouble, 2 * 2);
+       _tmp0_[0] = 42.23;
+       _tmp0_[1] = 11.47;
+       _tmp0_[2] = 47.11;
+       _tmp0_[3] = 23.42;
+       _tmp1_ = _tmp0_;
+       _tmp1__length1 = 2;
+       _tmp1__length2 = 2;
+       _tmp7_ = _variant_new7 (_tmp1_, 2, 2);
+       _tmp8_ = _tmp7_;
+       _tmp1_ = (g_free (_tmp1_), NULL);
+       v = _tmp8_;
+       _tmp9_ = _variant_get7 (v, &_tmp9__length1, &_tmp9__length2);
+       da = _tmp9_;
+       da_length1 = _tmp9__length1;
+       da_length2 = _tmp9__length2;
+       _tmp15_ = da_length1;
+       _vala_assert (_tmp15_ == 2, "da.length[0] == 2");
+       _tmp16_ = da_length2;
+       _vala_assert (_tmp16_ == 2, "da.length[1] == 2");
+       _tmp17_ = da[(1 * da_length2) + 1];
+       _vala_assert (_tmp17_ == 23.42, "da[1,1] == 23.42");
+       da = (g_free (da), NULL);
+       _g_variant_unref0 (v);
+}
+
+void
+foo_copy (const Foo* self,
+          Foo* dest)
+{
+       const gchar* _tmp0_;
+       gchar* _tmp1_;
+       _tmp0_ = (*self).s;
+       _tmp1_ = g_strdup (_tmp0_);
+       _g_free0 ((*dest).s);
+       (*dest).s = _tmp1_;
+       (*dest).u64 = (*self).u64;
+       (*dest).b = (*self).b;
+}
+
+void
+foo_destroy (Foo* self)
+{
+       _g_free0 ((*self).s);
+}
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       foo_copy (self, dup);
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       foo_destroy (self);
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static GVariant*
+_variant_new8 (Foo value)
+{
+       GVariantBuilder _tmp3_;
+       g_variant_builder_init (&_tmp3_, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_tmp3_, g_variant_new_string (value.s));
+       g_variant_builder_add_value (&_tmp3_, g_variant_new_uint64 (value.u64));
+       g_variant_builder_add_value (&_tmp3_, g_variant_new_boolean (value.b));
+       return g_variant_ref_sink (g_variant_builder_end (&_tmp3_));
+}
+
+static void
+_variant_get8 (GVariant* value,
+               Foo * result)
+{
+       Foo _tmp6_;
+       GVariantIter _tmp7_;
+       GVariant* _tmp8_;
+       GVariant* _tmp9_;
+       GVariant* _tmp10_;
+       g_variant_iter_init (&_tmp7_, value);
+       _tmp8_ = g_variant_iter_next_value (&_tmp7_);
+       _tmp6_.s = g_variant_dup_string (_tmp8_, NULL);
+       g_variant_unref (_tmp8_);
+       _tmp9_ = g_variant_iter_next_value (&_tmp7_);
+       _tmp6_.u64 = g_variant_get_uint64 (_tmp9_);
+       g_variant_unref (_tmp9_);
+       _tmp10_ = g_variant_iter_next_value (&_tmp7_);
+       _tmp6_.b = g_variant_get_boolean (_tmp10_);
+       g_variant_unref (_tmp10_);
+       *result = _tmp6_;
+}
+
+void
+struct_conversion (void)
+{
+       Foo s = {0};
+       gchar* _tmp0_;
+       Foo _tmp1_ = {0};
+       GVariant* v = NULL;
+       Foo _tmp2_;
+       GVariant* _tmp4_;
+       Foo st = {0};
+       Foo _tmp5_;
+       Foo _tmp11_;
+       const gchar* _tmp12_;
+       Foo _tmp13_;
+       Foo _tmp14_;
+       _tmp0_ = g_strdup ("foo");
+       _g_free0 (_tmp1_.s);
+       _tmp1_.s = _tmp0_;
+       _tmp1_.u64 = G_MAXUINT64;
+       _tmp1_.b = TRUE;
+       s = _tmp1_;
+       _tmp2_ = s;
+       _tmp4_ = _variant_new8 (_tmp2_);
+       v = _tmp4_;
+       _variant_get8 (v, &_tmp5_);
+       st = _tmp5_;
+       _tmp11_ = st;
+       _tmp12_ = _tmp11_.s;
+       _vala_assert (g_strcmp0 (_tmp12_, "foo") == 0, "st.s == \"foo\"");
+       _tmp13_ = st;
+       _vala_assert (_tmp13_.u64 == G_MAXUINT64, "st.u64 == uint64.MAX");
+       _tmp14_ = st;
+       _vala_assert (_tmp14_.b == TRUE, "st.b == true");
+       foo_destroy (&st);
+       _g_variant_unref0 (v);
+       foo_destroy (&s);
+}
+
+static void
+_vala_main (void)
+{
+       string_conversion ();
+       string_array_conversion ();
+       double_conversion ();
+       double_array_conversion ();
+       struct_conversion ();
+       string_array_2d_conversion ();
+       double_array_2d_conversion ();
+       string_array_3d_conversion ();
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/basic-types/integers-boxed-cast.c-expected 
b/tests/basic-types/integers-boxed-cast.c-expected
new file mode 100644
index 000000000..e13d9a94d
--- /dev/null
+++ b/tests/basic-types/integers-boxed-cast.c-expected
@@ -0,0 +1,227 @@
+/* basic_types_integers_boxed_cast.c generated by valac, the Vala compiler
+ * generated from basic_types_integers_boxed_cast.vala, do not modify */
+
+#include <glib.h>
+#include <string.h>
+
+#define _g_free0(var) ((var == NULL) ? NULL : (var = (g_free (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (void);
+static gint* _int_dup (gint* self);
+static gboolean _int_equal (const gint * s1,
+                     const gint * s2);
+static guint* _uint_dup (guint* self);
+static gboolean _uint_equal (const guint * s1,
+                      const guint * s2);
+static gint64* _int64_dup (gint64* self);
+static gboolean _int64_equal (const gint64 * s1,
+                       const gint64 * s2);
+static guint64* _uint64_dup (guint64* self);
+static gboolean _uint64_equal (const guint64 * s1,
+                        const guint64 * s2);
+
+static gint*
+_int_dup (gint* self)
+{
+       gint* dup;
+       dup = g_new0 (gint, 1);
+       memcpy (dup, self, sizeof (gint));
+       return dup;
+}
+
+static gpointer
+__int_dup0 (gpointer self)
+{
+       return self ? _int_dup (self) : NULL;
+}
+
+static gboolean
+_int_equal (const gint * s1,
+            const gint * s2)
+{
+       if (s1 == s2) {
+               return TRUE;
+       }
+       if (s1 == NULL) {
+               return FALSE;
+       }
+       if (s2 == NULL) {
+               return FALSE;
+       }
+       return (*s1) == (*s2);
+}
+
+static guint*
+_uint_dup (guint* self)
+{
+       guint* dup;
+       dup = g_new0 (guint, 1);
+       memcpy (dup, self, sizeof (guint));
+       return dup;
+}
+
+static gpointer
+__uint_dup0 (gpointer self)
+{
+       return self ? _uint_dup (self) : NULL;
+}
+
+static gboolean
+_uint_equal (const guint * s1,
+             const guint * s2)
+{
+       if (s1 == s2) {
+               return TRUE;
+       }
+       if (s1 == NULL) {
+               return FALSE;
+       }
+       if (s2 == NULL) {
+               return FALSE;
+       }
+       return (*s1) == (*s2);
+}
+
+static gint64*
+_int64_dup (gint64* self)
+{
+       gint64* dup;
+       dup = g_new0 (gint64, 1);
+       memcpy (dup, self, sizeof (gint64));
+       return dup;
+}
+
+static gpointer
+__int64_dup0 (gpointer self)
+{
+       return self ? _int64_dup (self) : NULL;
+}
+
+static gboolean
+_int64_equal (const gint64 * s1,
+              const gint64 * s2)
+{
+       if (s1 == s2) {
+               return TRUE;
+       }
+       if (s1 == NULL) {
+               return FALSE;
+       }
+       if (s2 == NULL) {
+               return FALSE;
+       }
+       return (*s1) == (*s2);
+}
+
+static guint64*
+_uint64_dup (guint64* self)
+{
+       guint64* dup;
+       dup = g_new0 (guint64, 1);
+       memcpy (dup, self, sizeof (guint64));
+       return dup;
+}
+
+static gpointer
+__uint64_dup0 (gpointer self)
+{
+       return self ? _uint64_dup (self) : NULL;
+}
+
+static gboolean
+_uint64_equal (const guint64 * s1,
+               const guint64 * s2)
+{
+       if (s1 == s2) {
+               return TRUE;
+       }
+       if (s1 == NULL) {
+               return FALSE;
+       }
+       if (s2 == NULL) {
+               return FALSE;
+       }
+       return (*s1) == (*s2);
+}
+
+static void
+_vala_main (void)
+{
+       gint* _tmp0_ = NULL;
+       gint _tmp1_;
+       gint* _tmp2_;
+       gint* i = NULL;
+       gint* _tmp3_;
+       gint _tmp4_;
+       guint* _tmp5_ = NULL;
+       guint _tmp6_;
+       guint* _tmp7_;
+       guint* u = NULL;
+       guint* _tmp8_;
+       guint _tmp9_;
+       gint64* _tmp10_ = NULL;
+       gint64 _tmp11_;
+       gint64* _tmp12_;
+       gint64* i64 = NULL;
+       gint64* _tmp13_;
+       gint64 _tmp14_;
+       guint64* _tmp15_ = NULL;
+       guint64 _tmp16_;
+       guint64* _tmp17_;
+       guint64* u64 = NULL;
+       guint64* _tmp18_;
+       guint64 _tmp19_;
+       _tmp1_ = G_MININT;
+       _tmp2_ = __int_dup0 (&_tmp1_);
+       _tmp0_ = _tmp2_;
+       _tmp3_ = _tmp0_;
+       _tmp0_ = NULL;
+       i = _tmp3_;
+       _tmp4_ = G_MININT;
+       _vala_assert (_int_equal (i, &_tmp4_) == TRUE, "i == int.MIN");
+       _tmp6_ = G_MAXUINT;
+       _tmp7_ = __uint_dup0 (&_tmp6_);
+       _tmp5_ = _tmp7_;
+       _tmp8_ = _tmp5_;
+       _tmp5_ = NULL;
+       u = _tmp8_;
+       _tmp9_ = G_MAXUINT;
+       _vala_assert (_uint_equal (u, &_tmp9_) == TRUE, "u == uint.MAX");
+       _tmp11_ = G_MININT64;
+       _tmp12_ = __int64_dup0 (&_tmp11_);
+       _tmp10_ = _tmp12_;
+       _tmp13_ = _tmp10_;
+       _tmp10_ = NULL;
+       i64 = _tmp13_;
+       _tmp14_ = G_MININT64;
+       _vala_assert (_int64_equal (i64, &_tmp14_) == TRUE, "i64 == int64.MIN");
+       _tmp16_ = G_MAXUINT64;
+       _tmp17_ = __uint64_dup0 (&_tmp16_);
+       _tmp15_ = _tmp17_;
+       _tmp18_ = _tmp15_;
+       _tmp15_ = NULL;
+       u64 = _tmp18_;
+       _tmp19_ = G_MAXUINT64;
+       _vala_assert (_uint64_equal (u64, &_tmp19_) == TRUE, "u64 == uint64.MAX");
+       _g_free0 (u64);
+       _g_free0 (_tmp15_);
+       _g_free0 (i64);
+       _g_free0 (_tmp10_);
+       _g_free0 (u);
+       _g_free0 (_tmp5_);
+       _g_free0 (i);
+       _g_free0 (_tmp0_);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/basic-types/integers.c-expected b/tests/basic-types/integers.c-expected
new file mode 100644
index 000000000..eefe0db05
--- /dev/null
+++ b/tests/basic-types/integers.c-expected
@@ -0,0 +1,618 @@
+/* basic_types_integers.c generated by valac, the Vala compiler
+ * generated from basic_types_integers.vala, do not modify */
+
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN gint static_negative_int;
+gint static_negative_int = -1;
+
+VALA_EXTERN void test_int (void);
+static void _vala_main (void);
+
+static gboolean
+int_try_parse (const gchar* str,
+               gint* _result_,
+               const gchar* * unparsed,
+               guint _base)
+{
+       gint _vala__result_ = 0;
+       const gchar* _vala_unparsed = NULL;
+       gchar* endptr = NULL;
+       glong long_result = 0L;
+       gchar* _tmp0_ = NULL;
+       glong _tmp1_;
+       gchar* _tmp2_;
+       gint _tmp3_;
+       gint _tmp4_;
+       glong _tmp6_;
+       gboolean result = FALSE;
+       g_return_val_if_fail (str != NULL, FALSE);
+       errno = 0;
+       _tmp1_ = strtol (str, &_tmp0_, (gint) _base);
+       endptr = _tmp0_;
+       long_result = _tmp1_;
+       _tmp2_ = endptr;
+       _tmp3_ = strlen (str);
+       _tmp4_ = _tmp3_;
+       if (_tmp2_ == (((gchar*) str) + _tmp4_)) {
+               _vala_unparsed = "";
+       } else {
+               gchar* _tmp5_;
+               _tmp5_ = endptr;
+               _vala_unparsed = (const gchar*) _tmp5_;
+       }
+       _tmp6_ = long_result;
+       if ((((glong) G_MININT) <= _tmp6_) && (_tmp6_ <= ((glong) G_MAXINT))) {
+               gboolean _tmp7_ = FALSE;
+               gboolean _tmp8_ = FALSE;
+               _vala__result_ = (gint) long_result;
+               if (errno != ERANGE) {
+                       _tmp8_ = errno != EINVAL;
+               } else {
+                       _tmp8_ = FALSE;
+               }
+               if (_tmp8_) {
+                       const gchar* _tmp9_;
+                       gchar* _tmp10_;
+                       _tmp9_ = _vala_unparsed;
+                       _tmp10_ = endptr;
+                       _tmp7_ = _tmp9_ != _tmp10_;
+               } else {
+                       _tmp7_ = FALSE;
+               }
+               result = _tmp7_;
+               if (_result_) {
+                       *_result_ = _vala__result_;
+               }
+               if (unparsed) {
+                       *unparsed = _vala_unparsed;
+               }
+               return result;
+       } else {
+               _vala__result_ = G_MAXINT;
+               result = FALSE;
+               if (_result_) {
+                       *_result_ = _vala__result_;
+               }
+               if (unparsed) {
+                       *unparsed = _vala_unparsed;
+               }
+               return result;
+       }
+}
+
+static gboolean
+long_try_parse (const gchar* str,
+                glong* _result_,
+                const gchar* * unparsed,
+                guint _base)
+{
+       glong _vala__result_ = 0L;
+       const gchar* _vala_unparsed = NULL;
+       gchar* endptr = NULL;
+       gchar* _tmp0_ = NULL;
+       glong _tmp1_;
+       gchar* _tmp2_;
+       gint _tmp3_;
+       gint _tmp4_;
+       gboolean result = FALSE;
+       g_return_val_if_fail (str != NULL, FALSE);
+       errno = 0;
+       _tmp1_ = strtol (str, &_tmp0_, (gint) _base);
+       endptr = _tmp0_;
+       _vala__result_ = _tmp1_;
+       _tmp2_ = endptr;
+       _tmp3_ = strlen (str);
+       _tmp4_ = _tmp3_;
+       if (_tmp2_ == (((gchar*) str) + _tmp4_)) {
+               gboolean _tmp5_ = FALSE;
+               _vala_unparsed = "";
+               if (errno != ERANGE) {
+                       _tmp5_ = errno != EINVAL;
+               } else {
+                       _tmp5_ = FALSE;
+               }
+               result = _tmp5_;
+               if (_result_) {
+                       *_result_ = _vala__result_;
+               }
+               if (unparsed) {
+                       *unparsed = _vala_unparsed;
+               }
+               return result;
+       } else {
+               gchar* _tmp6_;
+               _tmp6_ = endptr;
+               _vala_unparsed = (const gchar*) _tmp6_;
+               result = FALSE;
+               if (_result_) {
+                       *_result_ = _vala__result_;
+               }
+               if (unparsed) {
+                       *unparsed = _vala_unparsed;
+               }
+               return result;
+       }
+}
+
+static gboolean
+uint_try_parse (const gchar* str,
+                guint* _result_,
+                const gchar* * unparsed,
+                guint _base)
+{
+       guint _vala__result_ = 0U;
+       const gchar* _vala_unparsed = NULL;
+       gchar* endptr = NULL;
+       gulong ulong_result = 0UL;
+       gchar* _tmp0_ = NULL;
+       gulong _tmp1_;
+       gchar* _tmp2_;
+       gint _tmp3_;
+       gint _tmp4_;
+       gulong _tmp6_;
+       gboolean result = FALSE;
+       g_return_val_if_fail (str != NULL, FALSE);
+       errno = 0;
+       _tmp1_ = strtoul (str, &_tmp0_, (gint) _base);
+       endptr = _tmp0_;
+       ulong_result = _tmp1_;
+       _tmp2_ = endptr;
+       _tmp3_ = strlen (str);
+       _tmp4_ = _tmp3_;
+       if (_tmp2_ == (((gchar*) str) + _tmp4_)) {
+               _vala_unparsed = "";
+       } else {
+               gchar* _tmp5_;
+               _tmp5_ = endptr;
+               _vala_unparsed = (const gchar*) _tmp5_;
+       }
+       _tmp6_ = ulong_result;
+       if ((((gulong) 0) <= _tmp6_) && (_tmp6_ <= ((gulong) G_MAXUINT))) {
+               gboolean _tmp7_ = FALSE;
+               gboolean _tmp8_ = FALSE;
+               _vala__result_ = (guint) ulong_result;
+               if (errno != ERANGE) {
+                       _tmp8_ = errno != EINVAL;
+               } else {
+                       _tmp8_ = FALSE;
+               }
+               if (_tmp8_) {
+                       const gchar* _tmp9_;
+                       gchar* _tmp10_;
+                       _tmp9_ = _vala_unparsed;
+                       _tmp10_ = endptr;
+                       _tmp7_ = _tmp9_ != _tmp10_;
+               } else {
+                       _tmp7_ = FALSE;
+               }
+               result = _tmp7_;
+               if (_result_) {
+                       *_result_ = _vala__result_;
+               }
+               if (unparsed) {
+                       *unparsed = _vala_unparsed;
+               }
+               return result;
+       } else {
+               _vala__result_ = G_MAXUINT;
+               result = FALSE;
+               if (_result_) {
+                       *_result_ = _vala__result_;
+               }
+               if (unparsed) {
+                       *unparsed = _vala_unparsed;
+               }
+               return result;
+       }
+}
+
+static gboolean
+ulong_try_parse (const gchar* str,
+                 gulong* _result_,
+                 const gchar* * unparsed,
+                 guint _base)
+{
+       gulong _vala__result_ = 0UL;
+       const gchar* _vala_unparsed = NULL;
+       gchar* endptr = NULL;
+       gchar* _tmp0_ = NULL;
+       gulong _tmp1_;
+       gchar* _tmp2_;
+       gint _tmp3_;
+       gint _tmp4_;
+       gboolean result = FALSE;
+       g_return_val_if_fail (str != NULL, FALSE);
+       errno = 0;
+       _tmp1_ = strtoul (str, &_tmp0_, (gint) _base);
+       endptr = _tmp0_;
+       _vala__result_ = _tmp1_;
+       _tmp2_ = endptr;
+       _tmp3_ = strlen (str);
+       _tmp4_ = _tmp3_;
+       if (_tmp2_ == (((gchar*) str) + _tmp4_)) {
+               gboolean _tmp5_ = FALSE;
+               _vala_unparsed = "";
+               if (errno != ERANGE) {
+                       _tmp5_ = errno != EINVAL;
+               } else {
+                       _tmp5_ = FALSE;
+               }
+               result = _tmp5_;
+               if (_result_) {
+                       *_result_ = _vala__result_;
+               }
+               if (unparsed) {
+                       *unparsed = _vala_unparsed;
+               }
+               return result;
+       } else {
+               gchar* _tmp6_;
+               _tmp6_ = endptr;
+               _vala_unparsed = (const gchar*) _tmp6_;
+               result = FALSE;
+               if (_result_) {
+                       *_result_ = _vala__result_;
+               }
+               if (unparsed) {
+                       *unparsed = _vala_unparsed;
+               }
+               return result;
+       }
+}
+
+static gboolean
+int64_try_parse (const gchar* str,
+                 gint64* _result_,
+                 const gchar* * unparsed,
+                 guint _base)
+{
+       gint64 _vala__result_ = 0LL;
+       const gchar* _vala_unparsed = NULL;
+       gchar* endptr = NULL;
+       gchar* _tmp0_ = NULL;
+       gint64 _tmp1_;
+       gchar* _tmp2_;
+       gint _tmp3_;
+       gint _tmp4_;
+       gboolean result = FALSE;
+       g_return_val_if_fail (str != NULL, FALSE);
+       errno = 0;
+       _tmp1_ = g_ascii_strtoll (str, &_tmp0_, _base);
+       endptr = _tmp0_;
+       _vala__result_ = _tmp1_;
+       _tmp2_ = endptr;
+       _tmp3_ = strlen (str);
+       _tmp4_ = _tmp3_;
+       if (_tmp2_ == (((gchar*) str) + _tmp4_)) {
+               gboolean _tmp5_ = FALSE;
+               _vala_unparsed = "";
+               if (errno != ERANGE) {
+                       _tmp5_ = errno != EINVAL;
+               } else {
+                       _tmp5_ = FALSE;
+               }
+               result = _tmp5_;
+               if (_result_) {
+                       *_result_ = _vala__result_;
+               }
+               if (unparsed) {
+                       *unparsed = _vala_unparsed;
+               }
+               return result;
+       } else {
+               gchar* _tmp6_;
+               _tmp6_ = endptr;
+               _vala_unparsed = (const gchar*) _tmp6_;
+               result = FALSE;
+               if (_result_) {
+                       *_result_ = _vala__result_;
+               }
+               if (unparsed) {
+                       *unparsed = _vala_unparsed;
+               }
+               return result;
+       }
+}
+
+static gboolean
+uint64_try_parse (const gchar* str,
+                  guint64* _result_,
+                  const gchar* * unparsed,
+                  guint _base)
+{
+       guint64 _vala__result_ = 0ULL;
+       const gchar* _vala_unparsed = NULL;
+       gchar* endptr = NULL;
+       gchar* _tmp0_ = NULL;
+       guint64 _tmp1_;
+       gchar* _tmp2_;
+       gint _tmp3_;
+       gint _tmp4_;
+       gboolean result = FALSE;
+       g_return_val_if_fail (str != NULL, FALSE);
+       errno = 0;
+       _tmp1_ = g_ascii_strtoull (str, &_tmp0_, _base);
+       endptr = _tmp0_;
+       _vala__result_ = _tmp1_;
+       _tmp2_ = endptr;
+       _tmp3_ = strlen (str);
+       _tmp4_ = _tmp3_;
+       if (_tmp2_ == (((gchar*) str) + _tmp4_)) {
+               gboolean _tmp5_ = FALSE;
+               _vala_unparsed = "";
+               if (errno != ERANGE) {
+                       _tmp5_ = errno != EINVAL;
+               } else {
+                       _tmp5_ = FALSE;
+               }
+               result = _tmp5_;
+               if (_result_) {
+                       *_result_ = _vala__result_;
+               }
+               if (unparsed) {
+                       *unparsed = _vala_unparsed;
+               }
+               return result;
+       } else {
+               gchar* _tmp6_;
+               _tmp6_ = endptr;
+               _vala_unparsed = (const gchar*) _tmp6_;
+               result = FALSE;
+               if (_result_) {
+                       *_result_ = _vala__result_;
+               }
+               if (unparsed) {
+                       *unparsed = _vala_unparsed;
+               }
+               return result;
+       }
+}
+
+void
+test_int (void)
+{
+       gint i = 0;
+       gint j = 0;
+       gchar* s = NULL;
+       gchar* _tmp0_;
+       const gchar* _tmp1_;
+       const gchar* unparsed = NULL;
+       gchar* _tmp2_;
+       const gchar* _tmp3_;
+       gint _tmp4_ = 0;
+       const gchar* _tmp5_ = NULL;
+       const gchar* _tmp6_;
+       gchar* _tmp7_;
+       const gchar* _tmp8_;
+       gint _tmp9_ = 0;
+       gboolean _tmp10_;
+       gchar* _tmp11_;
+       glong l = 0L;
+       const gchar* _tmp12_;
+       glong _tmp13_ = 0L;
+       const gchar* _tmp14_ = NULL;
+       const gchar* _tmp15_;
+       gchar* _tmp16_;
+       const gchar* _tmp17_;
+       glong _tmp18_ = 0L;
+       gboolean _tmp19_;
+       gchar* _tmp20_;
+       guint u = 0U;
+       const gchar* _tmp21_;
+       guint _tmp22_ = 0U;
+       const gchar* _tmp23_ = NULL;
+       const gchar* _tmp24_;
+       gchar* _tmp25_;
+       const gchar* _tmp26_;
+       guint _tmp27_ = 0U;
+       gboolean _tmp28_;
+       gchar* _tmp29_;
+       gulong ul = 0UL;
+       const gchar* _tmp30_;
+       gulong _tmp31_ = 0UL;
+       const gchar* _tmp32_ = NULL;
+       const gchar* _tmp33_;
+       gchar* _tmp34_;
+       const gchar* _tmp35_;
+       gulong _tmp36_ = 0UL;
+       gboolean _tmp37_;
+       gint64 i64 = 0LL;
+       gint64 _tmp38_ = 0LL;
+       const gchar* _tmp39_ = NULL;
+       const gchar* _tmp40_;
+       gint64 _tmp41_ = 0LL;
+       guint64 ui64 = 0ULL;
+       guint64 _tmp42_ = 0ULL;
+       const gchar* _tmp43_ = NULL;
+       const gchar* _tmp44_;
+       guint64 _tmp45_ = 0ULL;
+       i = 42;
+       _vala_assert (i == 42, "i == 42");
+       i = 23;
+       _vala_assert (i == 23, "i == 23");
+       j = i;
+       _vala_assert (j == 23, "j == 23");
+       i = 42 + 23;
+       _vala_assert (i == 65, "i == 65");
+       i += 7;
+       _vala_assert (i == 72, "i == 72");
+       i = 42 - 23;
+       _vala_assert (i == 19, "i == 19");
+       i -= 7;
+       _vala_assert (i == 12, "i == 12");
+       i = 42 * 23;
+       _vala_assert (i == 966, "i == 966");
+       i *= 7;
+       _vala_assert (i == 6762, "i == 6762");
+       i = 42 / 23;
+       _vala_assert (i == 1, "i == 1");
+       i /= 1;
+       _vala_assert (i == 1, "i == 1");
+       i = 42 % 23;
+       _vala_assert (i == 19, "i == 19");
+       i %= 7;
+       _vala_assert (i == 5, "i == 5");
+       i = 42 << 3;
+       _vala_assert (i == 336, "i == 336");
+       i <<= 7;
+       _vala_assert (i == 43008, "i == 43008");
+       i = 42 >> 3;
+       _vala_assert (i == 5, "i == 5");
+       i >>= 2;
+       _vala_assert (i == 1, "i == 1");
+       i = 42 & 23;
+       _vala_assert (i == 2, "i == 2");
+       i &= 1;
+       _vala_assert (i == 0, "i == 0");
+       i = 42 | 23;
+       _vala_assert (i == 63, "i == 63");
+       i |= 128;
+       _vala_assert (i == 191, "i == 191");
+       i = 42 ^ 23;
+       _vala_assert (i == 61, "i == 61");
+       i ^= 23;
+       _vala_assert (i == 42, "i == 42");
+       i = 42;
+       _vala_assert (i == 42, "i == 42");
+       _vala_assert (i != 50, "i != 50");
+       _vala_assert (i < 50, "i < 50");
+       _vala_assert (!(i < 40), "!(i < 40)");
+       _vala_assert (i <= 42, "i <= 42");
+       _vala_assert (!(i <= 41), "!(i <= 41)");
+       _vala_assert (i >= 42, "i >= 42");
+       _vala_assert (!(i >= 43), "!(i >= 43)");
+       _vala_assert (i > 40, "i > 40");
+       _vala_assert (!(i > 50), "!(i > 50)");
+       _tmp0_ = g_strdup_printf ("%i", i);
+       s = _tmp0_;
+       _tmp1_ = s;
+       _vala_assert (g_strcmp0 (_tmp1_, "42") == 0, "s == \"42\"");
+       _tmp2_ = g_strdup_printf ("%im", G_MININT);
+       _g_free0 (s);
+       s = _tmp2_;
+       _tmp3_ = s;
+       int_try_parse (_tmp3_, &_tmp4_, &_tmp5_, (guint) 0);
+       i = _tmp4_;
+       unparsed = _tmp5_;
+       _vala_assert (i == G_MININT, "i == int.MIN");
+       _tmp6_ = unparsed;
+       _vala_assert (g_strcmp0 (_tmp6_, "m") == 0, "unparsed == \"m\"");
+       _tmp7_ = g_strdup_printf ("%um", G_MAXUINT);
+       _g_free0 (s);
+       s = _tmp7_;
+       _tmp8_ = s;
+       _tmp10_ = int_try_parse (_tmp8_, &_tmp9_, NULL, (guint) 0);
+       i = _tmp9_;
+       _vala_assert (!_tmp10_, "!int.try_parse (s, out i)");
+       _tmp11_ = g_strdup_printf ("%lim", G_MINLONG);
+       _g_free0 (s);
+       s = _tmp11_;
+       _tmp12_ = s;
+       long_try_parse (_tmp12_, &_tmp13_, &_tmp14_, (guint) 0);
+       l = _tmp13_;
+       unparsed = _tmp14_;
+       _vala_assert (l == G_MINLONG, "l == long.MIN");
+       _tmp15_ = unparsed;
+       _vala_assert (g_strcmp0 (_tmp15_, "m") == 0, "unparsed == \"m\"");
+       _tmp16_ = g_strdup_printf ("%lum", G_MAXULONG);
+       _g_free0 (s);
+       s = _tmp16_;
+       _tmp17_ = s;
+       _tmp19_ = long_try_parse (_tmp17_, &_tmp18_, NULL, (guint) 0);
+       l = _tmp18_;
+       _vala_assert (!_tmp19_, "!long.try_parse (s, out l)");
+       _tmp20_ = g_strdup_printf ("%um", G_MAXUINT);
+       _g_free0 (s);
+       s = _tmp20_;
+       _tmp21_ = s;
+       uint_try_parse (_tmp21_, &_tmp22_, &_tmp23_, (guint) 0);
+       u = _tmp22_;
+       unparsed = _tmp23_;
+       _vala_assert (u == G_MAXUINT, "u == uint.MAX");
+       _tmp24_ = unparsed;
+       _vala_assert (g_strcmp0 (_tmp24_, "m") == 0, "unparsed == \"m\"");
+       _tmp25_ = g_strdup_printf ("%im", G_MININT);
+       _g_free0 (s);
+       s = _tmp25_;
+       _tmp26_ = s;
+       _tmp28_ = uint_try_parse (_tmp26_, &_tmp27_, NULL, (guint) 0);
+       u = _tmp27_;
+       _vala_assert (!_tmp28_, "!uint.try_parse (s, out u)");
+       _tmp29_ = g_strdup_printf ("%lum", G_MAXULONG);
+       _g_free0 (s);
+       s = _tmp29_;
+       _tmp30_ = s;
+       ulong_try_parse (_tmp30_, &_tmp31_, &_tmp32_, (guint) 0);
+       ul = _tmp31_;
+       unparsed = _tmp32_;
+       _vala_assert (ul == G_MAXULONG, "ul == ulong.MAX");
+       _tmp33_ = unparsed;
+       _vala_assert (g_strcmp0 (_tmp33_, "m") == 0, "unparsed == \"m\"");
+       _tmp34_ = g_strdup_printf ("%lim", G_MINLONG);
+       _g_free0 (s);
+       s = _tmp34_;
+       _tmp35_ = s;
+       _tmp37_ = ulong_try_parse (_tmp35_, &_tmp36_, NULL, (guint) 0);
+       ul = _tmp36_;
+       _vala_assert (!_tmp37_, "!ulong.try_parse (s, out ul)");
+       int64_try_parse ("-4711inch", &_tmp38_, &_tmp39_, (guint) 0);
+       i64 = _tmp38_;
+       unparsed = _tmp39_;
+       _vala_assert (i64 == -4711LL, "i64 == -4711LL");
+       _tmp40_ = unparsed;
+       _vala_assert (g_strcmp0 (_tmp40_, "inch") == 0, "unparsed == \"inch\"");
+       int64_try_parse ("-31415km", &_tmp41_, NULL, (guint) 0);
+       i64 = _tmp41_;
+       _vala_assert (i64 == ((gint64) -31415), "i64 == -31415");
+       uint64_try_parse ("4711yards", &_tmp42_, &_tmp43_, (guint) 0);
+       ui64 = _tmp42_;
+       unparsed = _tmp43_;
+       _vala_assert (ui64 == 4711ULL, "ui64 == 4711ULL");
+       _tmp44_ = unparsed;
+       _vala_assert (g_strcmp0 (_tmp44_, "yards") == 0, "unparsed == \"yards\"");
+       uint64_try_parse ("31415yards", &_tmp45_, NULL, (guint) 0);
+       ui64 = _tmp45_;
+       _vala_assert (ui64 == ((guint64) 31415), "ui64 == 31415");
+       i = G_MININT;
+       _vala_assert (i == G_MININT, "i == int.MIN");
+       _vala_assert (i < G_MAXINT, "i < int.MAX");
+       i = G_MAXINT;
+       _vala_assert (i == G_MAXINT, "i == int.MAX");
+       _vala_assert (i > G_MININT, "i > int.MIN");
+       _g_free0 (s);
+}
+
+static void
+_vala_main (void)
+{
+       test_int ();
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/basic-types/null.c-expected b/tests/basic-types/null.c-expected
new file mode 100644
index 000000000..8aaf78b18
--- /dev/null
+++ b/tests/basic-types/null.c-expected
@@ -0,0 +1,22 @@
+/* basic_types_null.c generated by valac, the Vala compiler
+ * generated from basic_types_null.vala, do not modify */
+
+#include <glib.h>
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+       void* foo = NULL;
+       foo = NULL;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/basic-types/pointers-arithmetic.c-expected 
b/tests/basic-types/pointers-arithmetic.c-expected
new file mode 100644
index 000000000..848f092a4
--- /dev/null
+++ b/tests/basic-types/pointers-arithmetic.c-expected
@@ -0,0 +1,83 @@
+/* basic_types_pointers_arithmetic.c generated by valac, the Vala compiler
+ * generated from basic_types_pointers_arithmetic.vala, do not modify */
+
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN void test_chars (void);
+VALA_EXTERN void test_strings (void);
+static void _vala_main (void);
+
+void
+test_chars (void)
+{
+       gchar* s = NULL;
+       gchar* begin = NULL;
+       gchar* end = NULL;
+       gchar _tmp0_;
+       gchar _tmp1_;
+       s = "foo";
+       begin = s;
+       end = begin + 2;
+       _tmp0_ = begin[0];
+       _vala_assert (_tmp0_ == 'f', "begin[0] == 'f'");
+       _tmp1_ = end[0];
+       _vala_assert (_tmp1_ == 'o', "end[0] == 'o'");
+}
+
+void
+test_strings (void)
+{
+       gchar* s = NULL;
+       gchar* _tmp0_;
+       const gchar* begin = NULL;
+       const gchar* end = NULL;
+       gint _tmp1_;
+       gint _tmp2_;
+       gchar _tmp3_;
+       gchar _tmp4_;
+       _tmp0_ = g_strdup ("foo");
+       s = _tmp0_;
+       begin = s;
+       _tmp1_ = strlen (s);
+       _tmp2_ = _tmp1_;
+       end = (begin + _tmp2_) - 1;
+       _tmp3_ = ((gchar*) begin)[0];
+       _vala_assert (_tmp3_ == 'f', "((char*) begin)[0] == 'f'");
+       _tmp4_ = ((gchar*) end)[0];
+       _vala_assert (_tmp4_ == 'o', "((char*) end)[0] == 'o'");
+       _g_free0 (s);
+}
+
+static void
+_vala_main (void)
+{
+       test_chars ();
+       test_strings ();
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/basic-types/pointers.c-expected b/tests/basic-types/pointers.c-expected
new file mode 100644
index 000000000..bd4314869
--- /dev/null
+++ b/tests/basic-types/pointers.c-expected
@@ -0,0 +1,139 @@
+/* basic_types_pointers.c generated by valac, the Vala compiler
+ * generated from basic_types_pointers.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_SIMPLE_STRUCT (simple_struct_get_type ())
+typedef struct _SimpleStruct SimpleStruct;
+#define _g_free0(var) ((var == NULL) ? NULL : (var = (g_free (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _SimpleStruct {
+       gint field;
+};
+
+VALA_EXTERN GType simple_struct_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN SimpleStruct* simple_struct_dup (const SimpleStruct* self);
+VALA_EXTERN void simple_struct_free (SimpleStruct* self);
+VALA_EXTERN gint simple_struct_test (SimpleStruct *self);
+static void simple_struct_main (void);
+static void simple_struct_test_pointers_element_access (void);
+static void simple_struct_test_pointers_return_value (void);
+static gint* simple_struct_return_pointer (void);
+
+static const gint SIMPLE_STRUCT_array[1] = {42};
+
+gint
+simple_struct_test (SimpleStruct *self)
+{
+       gint result = 0;
+       result = (*self).field;
+       return result;
+}
+
+static void
+simple_struct_main (void)
+{
+       SimpleStruct* st = NULL;
+       SimpleStruct* _tmp0_;
+       _tmp0_ = g_new0 (SimpleStruct, 1);
+       st = _tmp0_;
+       (*st).field = 1;
+       _vala_assert ((*st).field == simple_struct_test (st), "st->field == st->test ()");
+       _g_free0 (st);
+       simple_struct_test_pointers_element_access ();
+       simple_struct_test_pointers_return_value ();
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       simple_struct_main ();
+       return 0;
+}
+
+static void
+simple_struct_test_pointers_element_access (void)
+{
+       gint* array = NULL;
+       gint* _tmp0_;
+       gint _tmp1_;
+       _tmp0_ = g_new0 (gint, 42);
+       array = _tmp0_;
+       array[0] = 23;
+       _tmp1_ = array[0];
+       _vala_assert (_tmp1_ == 23, "array[0] == 23");
+       _g_free0 (array);
+}
+
+static gint*
+simple_struct_return_pointer (void)
+{
+       gint* result = NULL;
+       result = SIMPLE_STRUCT_array;
+       return result;
+}
+
+static void
+simple_struct_test_pointers_return_value (void)
+{
+       gint i = 0;
+       gint* _tmp0_;
+       gint _tmp1_;
+       _tmp0_ = simple_struct_return_pointer ();
+       _tmp1_ = _tmp0_[0];
+       i = _tmp1_;
+       _vala_assert (i == 42, "i == 42");
+}
+
+SimpleStruct*
+simple_struct_dup (const SimpleStruct* self)
+{
+       SimpleStruct* dup;
+       dup = g_new0 (SimpleStruct, 1);
+       memcpy (dup, self, sizeof (SimpleStruct));
+       return dup;
+}
+
+void
+simple_struct_free (SimpleStruct* self)
+{
+       g_free (self);
+}
+
+static GType
+simple_struct_get_type_once (void)
+{
+       GType simple_struct_type_id;
+       simple_struct_type_id = g_boxed_type_register_static ("SimpleStruct", (GBoxedCopyFunc) 
simple_struct_dup, (GBoxedFreeFunc) simple_struct_free);
+       return simple_struct_type_id;
+}
+
+GType
+simple_struct_get_type (void)
+{
+       static volatile gsize simple_struct_type_id__volatile = 0;
+       if (g_once_init_enter (&simple_struct_type_id__volatile)) {
+               GType simple_struct_type_id;
+               simple_struct_type_id = simple_struct_get_type_once ();
+               g_once_init_leave (&simple_struct_type_id__volatile, simple_struct_type_id);
+       }
+       return simple_struct_type_id__volatile;
+}
+
diff --git a/tests/basic-types/sizeof.c-expected b/tests/basic-types/sizeof.c-expected
new file mode 100644
index 000000000..5b39d707b
--- /dev/null
+++ b/tests/basic-types/sizeof.c-expected
@@ -0,0 +1,29 @@
+/* basic_types_sizeof.c generated by valac, the Vala compiler
+ * generated from basic_types_sizeof.vala, do not modify */
+
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+#define simple_size ((gsize) sizeof (gint))
+#define composed_size ((gsize) (sizeof (gint) + sizeof (gsize)))
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+       _vala_assert (composed_size == ((gsize) (sizeof (gint) + sizeof (gsize))), "composed_size == (sizeof 
(int) + sizeof (size_t))");
+       _vala_assert (simple_size == ((gsize) sizeof (gint)), "simple_size == sizeof (int)");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/basic-types/strings.c-expected b/tests/basic-types/strings.c-expected
new file mode 100644
index 000000000..0a18eb8fa
--- /dev/null
+++ b/tests/basic-types/strings.c-expected
@@ -0,0 +1,895 @@
+/* basic_types_strings.c generated by valac, the Vala compiler
+ * generated from basic_types_strings.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN void test_string (void);
+VALA_EXTERN void test_string_joinv (void);
+VALA_EXTERN void test_string_printf (void);
+VALA_EXTERN void test_string_replace (void);
+VALA_EXTERN void test_string_slice (void);
+VALA_EXTERN void test_string_splice (void);
+VALA_EXTERN void test_string_substring (void);
+static void _vala_main (void);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static gchar*
+string_slice (const gchar* self,
+              glong start,
+              glong end)
+{
+       glong string_length = 0L;
+       gint _tmp0_;
+       gint _tmp1_;
+       gboolean _tmp2_ = FALSE;
+       gboolean _tmp3_ = FALSE;
+       gchar* _tmp4_;
+       gchar* result = NULL;
+       g_return_val_if_fail (self != NULL, NULL);
+       _tmp0_ = strlen (self);
+       _tmp1_ = _tmp0_;
+       string_length = (glong) _tmp1_;
+       if (start < ((glong) 0)) {
+               start = string_length + start;
+       }
+       if (end < ((glong) 0)) {
+               end = string_length + end;
+       }
+       if (start >= ((glong) 0)) {
+               _tmp2_ = start <= string_length;
+       } else {
+               _tmp2_ = FALSE;
+       }
+       g_return_val_if_fail (_tmp2_, NULL);
+       if (end >= ((glong) 0)) {
+               _tmp3_ = end <= string_length;
+       } else {
+               _tmp3_ = FALSE;
+       }
+       g_return_val_if_fail (_tmp3_, NULL);
+       g_return_val_if_fail (start <= end, NULL);
+       _tmp4_ = g_strndup (((gchar*) self) + start, (gsize) (end - start));
+       result = _tmp4_;
+       return result;
+}
+
+static gchar
+string_get (const gchar* self,
+            glong index)
+{
+       gchar _tmp0_;
+       gchar result = '\0';
+       g_return_val_if_fail (self != NULL, '\0');
+       _tmp0_ = ((gchar*) self)[index];
+       result = _tmp0_;
+       return result;
+}
+
+void
+test_string (void)
+{
+       gchar* s = NULL;
+       gchar* _tmp0_;
+       const gchar* _tmp1_;
+       gchar* _tmp2_;
+       const gchar* _tmp3_;
+       gchar* t = NULL;
+       const gchar* _tmp4_;
+       gchar* _tmp5_;
+       const gchar* _tmp6_;
+       gchar* _tmp7_;
+       const gchar* _tmp8_;
+       gchar* _tmp9_;
+       const gchar* _tmp10_;
+       const gchar* _tmp11_;
+       const gchar* _tmp12_;
+       const gchar* _tmp13_;
+       const gchar* _tmp14_;
+       const gchar* _tmp15_;
+       const gchar* _tmp16_;
+       const gchar* _tmp17_;
+       const gchar* _tmp18_;
+       const gchar* _tmp19_;
+       const gchar* _tmp20_;
+       gchar* _tmp21_;
+       const gchar* _tmp22_;
+       gint _tmp23_;
+       gint _tmp24_;
+       const gchar* _tmp25_;
+       const gchar* _tmp26_;
+       const gchar* _tmp27_;
+       const gchar* _tmp28_;
+       gint _tmp29_;
+       gint _tmp30_;
+       gchar* _tmp31_;
+       const gchar* _tmp32_;
+       gint _tmp33_;
+       gint _tmp34_;
+       const gchar* _tmp35_;
+       const gchar* _tmp36_;
+       const gchar* _tmp37_;
+       gchar* _tmp38_;
+       const gchar* _tmp39_;
+       gint _tmp40_;
+       gint _tmp41_;
+       const gchar* _tmp42_;
+       const gchar* _tmp43_;
+       const gchar* _tmp44_;
+       const gchar* _tmp45_;
+       gint _tmp46_;
+       gint _tmp47_;
+       gchar* _tmp48_;
+       const gchar* _tmp49_;
+       const gchar* _tmp50_;
+       _tmp0_ = g_strdup ("hello");
+       s = _tmp0_;
+       _tmp1_ = s;
+       _vala_assert (g_strcmp0 (_tmp1_, "hello") == 0, "s == \"hello\"");
+       _tmp2_ = g_strdup ("world");
+       _g_free0 (s);
+       s = _tmp2_;
+       _tmp3_ = s;
+       _vala_assert (g_strcmp0 (_tmp3_, "world") == 0, "s == \"world\"");
+       _tmp4_ = s;
+       _tmp5_ = g_strdup (_tmp4_);
+       t = _tmp5_;
+       _tmp6_ = t;
+       _vala_assert (g_strcmp0 (_tmp6_, "world") == 0, "t == \"world\"");
+       _tmp7_ = g_strdup ("hello" "world");
+       _g_free0 (s);
+       s = _tmp7_;
+       _tmp8_ = s;
+       _vala_assert (g_strcmp0 (_tmp8_, "helloworld") == 0, "s == \"helloworld\"");
+       _tmp9_ = g_strdup ("hello");
+       _g_free0 (s);
+       s = _tmp9_;
+       _tmp10_ = s;
+       _vala_assert (g_strcmp0 (_tmp10_, "hello") == 0, "s == \"hello\"");
+       _tmp11_ = s;
+       _vala_assert (g_strcmp0 (_tmp11_, "world") != 0, "s != \"world\"");
+       _tmp12_ = s;
+       _vala_assert (g_strcmp0 (_tmp12_, "i") < 0, "s < \"i\"");
+       _tmp13_ = s;
+       _vala_assert (!(g_strcmp0 (_tmp13_, "g") < 0), "!(s < \"g\")");
+       _tmp14_ = s;
+       _vala_assert (g_strcmp0 (_tmp14_, "hello") <= 0, "s <= \"hello\"");
+       _tmp15_ = s;
+       _vala_assert (!(g_strcmp0 (_tmp15_, "g") <= 0), "!(s <= \"g\")");
+       _tmp16_ = s;
+       _vala_assert (g_strcmp0 (_tmp16_, "hello") >= 0, "s >= \"hello\"");
+       _tmp17_ = s;
+       _vala_assert (!(g_strcmp0 (_tmp17_, "i") >= 0), "!(s >= \"i\")");
+       _tmp18_ = s;
+       _vala_assert (g_strcmp0 (_tmp18_, "g") > 0, "s > \"g\"");
+       _tmp19_ = s;
+       _vala_assert (!(g_strcmp0 (_tmp19_, "i") > 0), "!(s > \"i\")");
+       _tmp20_ = s;
+       _tmp21_ = string_slice (_tmp20_, (glong) 2, (glong) 4);
+       _g_free0 (t);
+       t = _tmp21_;
+       _tmp22_ = t;
+       _tmp23_ = strlen (_tmp22_);
+       _tmp24_ = _tmp23_;
+       _vala_assert (_tmp24_ == 2, "t.length == 2");
+       _tmp25_ = t;
+       _vala_assert (string_get (_tmp25_, (glong) 0) == 'l', "t[0] == 'l'");
+       _tmp26_ = t;
+       _vala_assert (string_get (_tmp26_, (glong) 1) == 'l', "t[1] == 'l'");
+       _tmp27_ = s;
+       _tmp28_ = s;
+       _tmp29_ = strlen (_tmp28_);
+       _tmp30_ = _tmp29_;
+       _tmp31_ = string_slice (_tmp28_, (glong) -2, (glong) _tmp30_);
+       _g_free0 (t);
+       t = _tmp31_;
+       _tmp32_ = t;
+       _tmp33_ = strlen (_tmp32_);
+       _tmp34_ = _tmp33_;
+       _vala_assert (_tmp34_ == 2, "t.length == 2");
+       _tmp35_ = t;
+       _vala_assert (string_get (_tmp35_, (glong) 0) == 'l', "t[0] == 'l'");
+       _tmp36_ = t;
+       _vala_assert (string_get (_tmp36_, (glong) 1) == 'o', "t[1] == 'o'");
+       _tmp37_ = s;
+       _tmp38_ = string_slice (_tmp37_, (glong) 0, (glong) 2);
+       _g_free0 (t);
+       t = _tmp38_;
+       _tmp39_ = t;
+       _tmp40_ = strlen (_tmp39_);
+       _tmp41_ = _tmp40_;
+       _vala_assert (_tmp41_ == 2, "t.length == 2");
+       _tmp42_ = t;
+       _vala_assert (string_get (_tmp42_, (glong) 0) == 'h', "t[0] == 'h'");
+       _tmp43_ = t;
+       _vala_assert (string_get (_tmp43_, (glong) 1) == 'e', "t[1] == 'e'");
+       _tmp44_ = s;
+       _tmp45_ = s;
+       _tmp46_ = strlen (_tmp45_);
+       _tmp47_ = _tmp46_;
+       _tmp48_ = string_slice (_tmp45_, (glong) 0, (glong) _tmp47_);
+       _g_free0 (t);
+       t = _tmp48_;
+       _tmp49_ = t;
+       _tmp50_ = s;
+       _vala_assert (g_strcmp0 (_tmp49_, _tmp50_) == 0, "t == s");
+       _g_free0 (t);
+       _g_free0 (s);
+}
+
+static gchar*
+_vala_g_strjoinv (const gchar* separator,
+                  gchar** str_array,
+                  gint str_array_length1)
+{
+       gboolean _tmp0_ = FALSE;
+       gchar* result = NULL;
+       if (separator == NULL) {
+               separator = "";
+       }
+       if (str_array != NULL) {
+               gboolean _tmp1_ = FALSE;
+               if (str_array_length1 > 0) {
+                       _tmp1_ = TRUE;
+               } else {
+                       gboolean _tmp2_ = FALSE;
+                       if (str_array_length1 == -1) {
+                               const gchar* _tmp3_;
+                               _tmp3_ = str_array[0];
+                               _tmp2_ = _tmp3_ != NULL;
+                       } else {
+                               _tmp2_ = FALSE;
+                       }
+                       _tmp1_ = _tmp2_;
+               }
+               _tmp0_ = _tmp1_;
+       } else {
+               _tmp0_ = FALSE;
+       }
+       if (_tmp0_) {
+               gint i = 0;
+               gsize len = 0UL;
+               gint _tmp16_;
+               gint _tmp17_;
+               const gchar* res = NULL;
+               void* _tmp18_;
+               void* ptr = NULL;
+               const gchar* _tmp19_;
+               const gchar* _tmp20_;
+               void* _tmp21_;
+               const gchar* _tmp31_;
+               len = (gsize) 1;
+               {
+                       gboolean _tmp4_ = FALSE;
+                       i = 0;
+                       _tmp4_ = TRUE;
+                       while (TRUE) {
+                               gboolean _tmp6_ = FALSE;
+                               gboolean _tmp7_ = FALSE;
+                               gint _tmp10_ = 0;
+                               const gchar* _tmp11_;
+                               if (!_tmp4_) {
+                                       gint _tmp5_;
+                                       _tmp5_ = i;
+                                       i = _tmp5_ + 1;
+                               }
+                               _tmp4_ = FALSE;
+                               if (str_array_length1 != -1) {
+                                       _tmp7_ = i < str_array_length1;
+                               } else {
+                                       _tmp7_ = FALSE;
+                               }
+                               if (_tmp7_) {
+                                       _tmp6_ = TRUE;
+                               } else {
+                                       gboolean _tmp8_ = FALSE;
+                                       if (str_array_length1 == -1) {
+                                               const gchar* _tmp9_;
+                                               _tmp9_ = str_array[i];
+                                               _tmp8_ = _tmp9_ != NULL;
+                                       } else {
+                                               _tmp8_ = FALSE;
+                                       }
+                                       _tmp6_ = _tmp8_;
+                               }
+                               if (!_tmp6_) {
+                                       break;
+                               }
+                               _tmp11_ = str_array[i];
+                               if (_tmp11_ != NULL) {
+                                       const gchar* _tmp12_;
+                                       gint _tmp13_;
+                                       gint _tmp14_;
+                                       _tmp12_ = str_array[i];
+                                       _tmp13_ = strlen ((const gchar*) _tmp12_);
+                                       _tmp14_ = _tmp13_;
+                                       _tmp10_ = _tmp14_;
+                               } else {
+                                       _tmp10_ = 0;
+                               }
+                               len += (gsize) _tmp10_;
+                       }
+               }
+               if (i == 0) {
+                       gchar* _tmp15_;
+                       _tmp15_ = g_strdup ("");
+                       result = _tmp15_;
+                       return result;
+               }
+               str_array_length1 = i;
+               _tmp16_ = strlen ((const gchar*) separator);
+               _tmp17_ = _tmp16_;
+               len += (gsize) (_tmp17_ * (i - 1));
+               _tmp18_ = g_malloc (len);
+               res = _tmp18_;
+               _tmp19_ = res;
+               _tmp20_ = str_array[0];
+               _tmp21_ = g_stpcpy ((void*) _tmp19_, (const gchar*) _tmp20_);
+               ptr = _tmp21_;
+               {
+                       gboolean _tmp22_ = FALSE;
+                       i = 1;
+                       _tmp22_ = TRUE;
+                       while (TRUE) {
+                               void* _tmp24_;
+                               void* _tmp25_;
+                               const gchar* _tmp26_ = NULL;
+                               const gchar* _tmp27_;
+                               void* _tmp29_;
+                               void* _tmp30_;
+                               if (!_tmp22_) {
+                                       gint _tmp23_;
+                                       _tmp23_ = i;
+                                       i = _tmp23_ + 1;
+                               }
+                               _tmp22_ = FALSE;
+                               if (!(i < str_array_length1)) {
+                                       break;
+                               }
+                               _tmp24_ = ptr;
+                               _tmp25_ = g_stpcpy (_tmp24_, (const gchar*) separator);
+                               ptr = _tmp25_;
+                               _tmp27_ = str_array[i];
+                               if (_tmp27_ != NULL) {
+                                       const gchar* _tmp28_;
+                                       _tmp28_ = str_array[i];
+                                       _tmp26_ = (const gchar*) _tmp28_;
+                               } else {
+                                       _tmp26_ = "";
+                               }
+                               _tmp29_ = ptr;
+                               _tmp30_ = g_stpcpy (_tmp29_, _tmp26_);
+                               ptr = _tmp30_;
+                       }
+               }
+               _tmp31_ = res;
+               res = NULL;
+               result = (gchar*) _tmp31_;
+               return result;
+       } else {
+               gchar* _tmp32_;
+               _tmp32_ = g_strdup ("");
+               result = _tmp32_;
+               return result;
+       }
+}
+
+void
+test_string_joinv (void)
+{
+       gchar** sa = NULL;
+       gchar* _tmp0_;
+       gchar* _tmp1_;
+       gchar* _tmp2_;
+       gchar** _tmp3_;
+       gint sa_length1;
+       gint _sa_size_;
+       gchar* s = NULL;
+       gchar* _tmp4_;
+       const gchar* _tmp5_;
+       gchar* _tmp6_;
+       const gchar* _tmp7_;
+       gchar* _tmp8_;
+       const gchar* _tmp9_;
+       _tmp0_ = g_strdup ("hello");
+       _tmp1_ = g_strdup ("my");
+       _tmp2_ = g_strdup ("world");
+       _tmp3_ = g_new0 (gchar*, 3 + 1);
+       _tmp3_[0] = _tmp0_;
+       _tmp3_[1] = _tmp1_;
+       _tmp3_[2] = _tmp2_;
+       sa = _tmp3_;
+       sa_length1 = 3;
+       _sa_size_ = sa_length1;
+       _tmp4_ = _vala_g_strjoinv (" ", sa, (gint) sa_length1);
+       s = _tmp4_;
+       _tmp5_ = s;
+       _vala_assert (g_strcmp0 (_tmp5_, "hello my world") == 0, "s == \"hello my world\"");
+       sa_length1 = -1;
+       _tmp6_ = _vala_g_strjoinv (":", sa, (gint) sa_length1);
+       _g_free0 (s);
+       s = _tmp6_;
+       _tmp7_ = s;
+       _vala_assert (g_strcmp0 (_tmp7_, "hello:my:world") == 0, "s == \"hello:my:world\"");
+       _tmp8_ = _vala_g_strjoinv ("-", NULL, (gint) 0);
+       _g_free0 (s);
+       s = _tmp8_;
+       _tmp9_ = s;
+       _vala_assert (g_strcmp0 (_tmp9_, "") == 0, "s == \"\"");
+       sa_length1 = 3;
+       _g_free0 (s);
+       sa = (_vala_array_free (sa, sa_length1, (GDestroyNotify) g_free), NULL);
+}
+
+void
+test_string_printf (void)
+{
+       gchar* s = NULL;
+       gchar* _tmp0_;
+       _tmp0_ = g_strdup_printf ("%i %s %u %.4f", 42, "foo", 4711U, 3.1415);
+       s = _tmp0_;
+       _vala_assert (g_strcmp0 (s, "42 foo 4711 3.1415") == 0, "s == \"42 foo 4711 3.1415\"");
+       _g_free0 (s);
+}
+
+static gchar*
+string_replace (const gchar* self,
+                const gchar* old,
+                const gchar* replacement)
+{
+       gboolean _tmp0_ = FALSE;
+       gboolean _tmp1_ = FALSE;
+       GError* _inner_error0_ = NULL;
+       gchar* result = NULL;
+       g_return_val_if_fail (self != NULL, NULL);
+       g_return_val_if_fail (old != NULL, NULL);
+       g_return_val_if_fail (replacement != NULL, NULL);
+       if ((*((gchar*) self)) == '\0') {
+               _tmp1_ = TRUE;
+       } else {
+               _tmp1_ = (*((gchar*) old)) == '\0';
+       }
+       if (_tmp1_) {
+               _tmp0_ = TRUE;
+       } else {
+               _tmp0_ = g_strcmp0 (old, replacement) == 0;
+       }
+       if (_tmp0_) {
+               gchar* _tmp2_;
+               _tmp2_ = g_strdup (self);
+               result = _tmp2_;
+               return result;
+       }
+       {
+               GRegex* regex = NULL;
+               gchar* _tmp3_;
+               gchar* _tmp4_;
+               GRegex* _tmp5_;
+               GRegex* _tmp6_;
+               gchar* _tmp7_ = NULL;
+               GRegex* _tmp8_;
+               gchar* _tmp9_;
+               gchar* _tmp10_;
+               _tmp3_ = g_regex_escape_string (old, -1);
+               _tmp4_ = _tmp3_;
+               _tmp5_ = g_regex_new (_tmp4_, 0, 0, &_inner_error0_);
+               _tmp6_ = _tmp5_;
+               _g_free0 (_tmp4_);
+               regex = _tmp6_;
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       if (_inner_error0_->domain == G_REGEX_ERROR) {
+                               goto __catch0_g_regex_error;
+                       }
+                       g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return NULL;
+               }
+               _tmp8_ = regex;
+               _tmp9_ = g_regex_replace_literal (_tmp8_, self, (gssize) -1, 0, replacement, 0, 
&_inner_error0_);
+               _tmp7_ = _tmp9_;
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       _g_regex_unref0 (regex);
+                       if (_inner_error0_->domain == G_REGEX_ERROR) {
+                               goto __catch0_g_regex_error;
+                       }
+                       g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return NULL;
+               }
+               _tmp10_ = _tmp7_;
+               _tmp7_ = NULL;
+               result = _tmp10_;
+               _g_free0 (_tmp7_);
+               _g_regex_unref0 (regex);
+               return result;
+       }
+       goto __finally0;
+       __catch0_g_regex_error:
+       {
+               g_clear_error (&_inner_error0_);
+               g_assert_not_reached ();
+       }
+       __finally0:
+       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+       g_clear_error (&_inner_error0_);
+       return NULL;
+}
+
+void
+test_string_replace (void)
+{
+       gchar* s = NULL;
+       gchar* _tmp0_;
+       const gchar* _tmp1_;
+       gchar* _tmp2_;
+       const gchar* _tmp3_;
+       _tmp0_ = g_strdup ("hellomyworld");
+       s = _tmp0_;
+       _tmp1_ = s;
+       _tmp2_ = string_replace (_tmp1_, "my", "whole");
+       _g_free0 (s);
+       s = _tmp2_;
+       _tmp3_ = s;
+       _vala_assert (g_strcmp0 (_tmp3_, "hellowholeworld") == 0, "s == \"hellowholeworld\"");
+       _g_free0 (s);
+}
+
+void
+test_string_slice (void)
+{
+       gchar* s = NULL;
+       gchar* _tmp0_;
+       gchar* r = NULL;
+       gchar* _tmp1_;
+       const gchar* _tmp2_;
+       gchar* _tmp3_;
+       const gchar* _tmp4_;
+       gchar* _tmp5_;
+       const gchar* _tmp6_;
+       gchar* _tmp7_;
+       const gchar* _tmp8_;
+       gchar* _tmp9_;
+       const gchar* _tmp10_;
+       _tmp0_ = g_strdup ("hellomyworld");
+       s = _tmp0_;
+       _tmp1_ = string_slice (s, (glong) 5, (glong) 7);
+       r = _tmp1_;
+       _tmp2_ = r;
+       _vala_assert (g_strcmp0 (_tmp2_, "my") == 0, "r == \"my\"");
+       _tmp3_ = string_slice (s, (glong) -7, (glong) 7);
+       _g_free0 (r);
+       r = _tmp3_;
+       _tmp4_ = r;
+       _vala_assert (g_strcmp0 (_tmp4_, "my") == 0, "r == \"my\"");
+       _tmp5_ = string_slice (s, (glong) 5, (glong) -5);
+       _g_free0 (r);
+       r = _tmp5_;
+       _tmp6_ = r;
+       _vala_assert (g_strcmp0 (_tmp6_, "my") == 0, "r == \"my\"");
+       _tmp7_ = string_slice (s, (glong) -7, (glong) -5);
+       _g_free0 (r);
+       r = _tmp7_;
+       _tmp8_ = r;
+       _vala_assert (g_strcmp0 (_tmp8_, "my") == 0, "r == \"my\"");
+       _tmp9_ = string_slice (s, (glong) 0, (glong) 0);
+       _g_free0 (r);
+       r = _tmp9_;
+       _tmp10_ = r;
+       _vala_assert (g_strcmp0 (_tmp10_, "") == 0, "r == \"\"");
+       _g_free0 (r);
+       _g_free0 (s);
+}
+
+static gchar*
+string_splice (const gchar* self,
+               glong start,
+               glong end,
+               const gchar* str)
+{
+       glong string_length = 0L;
+       gint _tmp0_;
+       gint _tmp1_;
+       gboolean _tmp2_ = FALSE;
+       gboolean _tmp3_ = FALSE;
+       gsize str_size = 0UL;
+       const gchar* _result_ = NULL;
+       void* _tmp6_;
+       gchar* dest = NULL;
+       const gchar* _tmp7_;
+       gchar* _tmp8_;
+       gchar* _tmp9_;
+       gchar* _tmp12_;
+       const gchar* _tmp13_;
+       gchar* result = NULL;
+       g_return_val_if_fail (self != NULL, NULL);
+       _tmp0_ = strlen (self);
+       _tmp1_ = _tmp0_;
+       string_length = (glong) _tmp1_;
+       if (start < ((glong) 0)) {
+               start = string_length + start;
+       }
+       if (end < ((glong) 0)) {
+               end = string_length + end;
+       }
+       if (start >= ((glong) 0)) {
+               _tmp2_ = start <= string_length;
+       } else {
+               _tmp2_ = FALSE;
+       }
+       g_return_val_if_fail (_tmp2_, NULL);
+       if (end >= ((glong) 0)) {
+               _tmp3_ = end <= string_length;
+       } else {
+               _tmp3_ = FALSE;
+       }
+       g_return_val_if_fail (_tmp3_, NULL);
+       g_return_val_if_fail (start <= end, NULL);
+       if (str == NULL) {
+               str_size = (gsize) 0;
+       } else {
+               gint _tmp4_;
+               gint _tmp5_;
+               _tmp4_ = strlen ((const gchar*) str);
+               _tmp5_ = _tmp4_;
+               str_size = (gsize) _tmp5_;
+       }
+       _tmp6_ = g_malloc0 (((string_length - (end - start)) + str_size) + 1);
+       _result_ = _tmp6_;
+       _tmp7_ = _result_;
+       dest = (gchar*) _tmp7_;
+       _tmp8_ = dest;
+       memcpy (_tmp8_, self, (gsize) start);
+       _tmp9_ = dest;
+       dest = _tmp9_ + start;
+       if (str != NULL) {
+               gchar* _tmp10_;
+               gchar* _tmp11_;
+               _tmp10_ = dest;
+               memcpy (_tmp10_, str, str_size);
+               _tmp11_ = dest;
+               dest = _tmp11_ + str_size;
+       }
+       _tmp12_ = dest;
+       memcpy (_tmp12_, ((gchar*) self) + end, (gsize) (string_length - end));
+       _tmp13_ = _result_;
+       _result_ = NULL;
+       result = (gchar*) _tmp13_;
+       return result;
+}
+
+void
+test_string_splice (void)
+{
+       gchar* s = NULL;
+       gchar* _tmp0_;
+       const gchar* _tmp1_;
+       gchar* _tmp2_;
+       const gchar* _tmp3_;
+       const gchar* _tmp4_;
+       gchar* _tmp5_;
+       const gchar* _tmp6_;
+       const gchar* _tmp7_;
+       gchar* _tmp8_;
+       const gchar* _tmp9_;
+       const gchar* _tmp10_;
+       gchar* _tmp11_;
+       const gchar* _tmp12_;
+       const gchar* _tmp13_;
+       gchar* _tmp14_;
+       const gchar* _tmp15_;
+       gchar* _tmp16_;
+       const gchar* _tmp17_;
+       gchar* _tmp18_;
+       const gchar* _tmp19_;
+       _tmp0_ = g_strdup ("hellomyworld");
+       s = _tmp0_;
+       _tmp1_ = s;
+       _tmp2_ = string_splice (_tmp1_, (glong) 5, (glong) 7, NULL);
+       _g_free0 (s);
+       s = _tmp2_;
+       _tmp3_ = s;
+       _vala_assert (g_strcmp0 (_tmp3_, "helloworld") == 0, "s == \"helloworld\"");
+       _tmp4_ = s;
+       _tmp5_ = string_splice (_tmp4_, (glong) 5, (glong) 5, "whole");
+       _g_free0 (s);
+       s = _tmp5_;
+       _tmp6_ = s;
+       _vala_assert (g_strcmp0 (_tmp6_, "hellowholeworld") == 0, "s == \"hellowholeworld\"");
+       _tmp7_ = s;
+       _tmp8_ = string_splice (_tmp7_, (glong) 10, (glong) -5, "wide");
+       _g_free0 (s);
+       s = _tmp8_;
+       _tmp9_ = s;
+       _vala_assert (g_strcmp0 (_tmp9_, "hellowholewideworld") == 0, "s == \"hellowholewideworld\"");
+       _tmp10_ = s;
+       _tmp11_ = string_splice (_tmp10_, (glong) -14, (glong) 5, NULL);
+       _g_free0 (s);
+       s = _tmp11_;
+       _tmp12_ = s;
+       _vala_assert (g_strcmp0 (_tmp12_, "hellowholewideworld") == 0, "s == \"hellowholewideworld\"");
+       _tmp13_ = s;
+       _tmp14_ = string_splice (_tmp13_, (glong) -14, (glong) -5, NULL);
+       _g_free0 (s);
+       s = _tmp14_;
+       _tmp15_ = s;
+       _vala_assert (g_strcmp0 (_tmp15_, "helloworld") == 0, "s == \"helloworld\"");
+       _tmp16_ = string_splice ("hello", (glong) 0, (glong) 0, NULL);
+       _g_free0 (s);
+       s = _tmp16_;
+       _tmp17_ = s;
+       _vala_assert (g_strcmp0 (_tmp17_, "hello") == 0, "s == \"hello\"");
+       _tmp18_ = string_splice ("world", (glong) 0, (glong) 0, "hello");
+       _g_free0 (s);
+       s = _tmp18_;
+       _tmp19_ = s;
+       _vala_assert (g_strcmp0 (_tmp19_, "helloworld") == 0, "s == \"helloworld\"");
+       _g_free0 (s);
+}
+
+static glong
+string_strnlen (gchar* str,
+                glong maxlen)
+{
+       gchar* end = NULL;
+       gchar* _tmp0_;
+       gchar* _tmp1_;
+       glong result = 0L;
+       _tmp0_ = memchr (str, 0, (gsize) maxlen);
+       end = _tmp0_;
+       _tmp1_ = end;
+       if (_tmp1_ == NULL) {
+               result = maxlen;
+               return result;
+       } else {
+               gchar* _tmp2_;
+               _tmp2_ = end;
+               result = (glong) (_tmp2_ - str);
+               return result;
+       }
+}
+
+static gchar*
+string_substring (const gchar* self,
+                  glong offset,
+                  glong len)
+{
+       glong string_length = 0L;
+       gboolean _tmp0_ = FALSE;
+       gchar* _tmp3_;
+       gchar* result = NULL;
+       g_return_val_if_fail (self != NULL, NULL);
+       if (offset >= ((glong) 0)) {
+               _tmp0_ = len >= ((glong) 0);
+       } else {
+               _tmp0_ = FALSE;
+       }
+       if (_tmp0_) {
+               string_length = string_strnlen ((gchar*) self, offset + len);
+       } else {
+               gint _tmp1_;
+               gint _tmp2_;
+               _tmp1_ = strlen (self);
+               _tmp2_ = _tmp1_;
+               string_length = (glong) _tmp2_;
+       }
+       if (offset < ((glong) 0)) {
+               offset = string_length + offset;
+               g_return_val_if_fail (offset >= ((glong) 0), NULL);
+       } else {
+               g_return_val_if_fail (offset <= string_length, NULL);
+       }
+       if (len < ((glong) 0)) {
+               len = string_length - offset;
+       }
+       g_return_val_if_fail ((offset + len) <= string_length, NULL);
+       _tmp3_ = g_strndup (((gchar*) self) + offset, (gsize) len);
+       result = _tmp3_;
+       return result;
+}
+
+void
+test_string_substring (void)
+{
+       gchar* s = NULL;
+       gchar* _tmp0_;
+       gchar* r = NULL;
+       gchar* _tmp1_;
+       const gchar* _tmp2_;
+       gchar* _tmp3_;
+       const gchar* _tmp4_;
+       gchar* _tmp5_;
+       const gchar* _tmp6_;
+       gchar* _tmp7_;
+       const gchar* _tmp8_;
+       _tmp0_ = g_strdup ("hellomyworld");
+       s = _tmp0_;
+       _tmp1_ = string_substring (s, (glong) 5, (glong) 2);
+       r = _tmp1_;
+       _tmp2_ = r;
+       _vala_assert (g_strcmp0 (_tmp2_, "my") == 0, "r == \"my\"");
+       _tmp3_ = string_substring (s, (glong) -7, (glong) 2);
+       _g_free0 (r);
+       r = _tmp3_;
+       _tmp4_ = r;
+       _vala_assert (g_strcmp0 (_tmp4_, "my") == 0, "r == \"my\"");
+       _tmp5_ = string_substring (s, (glong) 5, (glong) -1);
+       _g_free0 (r);
+       r = _tmp5_;
+       _tmp6_ = r;
+       _vala_assert (g_strcmp0 (_tmp6_, "myworld") == 0, "r == \"myworld\"");
+       _tmp7_ = string_substring (s, (glong) -7, (glong) -1);
+       _g_free0 (r);
+       r = _tmp7_;
+       _tmp8_ = r;
+       _vala_assert (g_strcmp0 (_tmp8_, "myworld") == 0, "r == \"myworld\"");
+       _g_free0 (r);
+       _g_free0 (s);
+}
+
+static void
+_vala_main (void)
+{
+       test_string ();
+       test_string_joinv ();
+       test_string_printf ();
+       test_string_replace ();
+       test_string_slice ();
+       test_string_splice ();
+       test_string_substring ();
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/chainup/bug791785.c-expected b/tests/chainup/bug791785.c-expected
new file mode 100644
index 000000000..887bcbd8c
--- /dev/null
+++ b/tests/chainup/bug791785.c-expected
@@ -0,0 +1,432 @@
+/* chainup_bug791785.c generated by valac, the Vala compiler
+ * generated from chainup_bug791785.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+
+#define TYPE_ABSTRACT_BAR (abstract_bar_get_type ())
+#define ABSTRACT_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_ABSTRACT_BAR, AbstractBar))
+#define ABSTRACT_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_ABSTRACT_BAR, AbstractBarClass))
+#define IS_ABSTRACT_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_ABSTRACT_BAR))
+#define IS_ABSTRACT_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_ABSTRACT_BAR))
+#define ABSTRACT_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_ABSTRACT_BAR, AbstractBarClass))
+
+typedef struct _AbstractBar AbstractBar;
+typedef struct _AbstractBarClass AbstractBarClass;
+typedef struct _AbstractBarPrivate AbstractBarPrivate;
+typedef struct _ParamSpecAbstractBar ParamSpecAbstractBar;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+#define _abstract_bar_unref0(var) ((var == NULL) ? NULL : (var = (abstract_bar_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       gint i;
+};
+
+struct _AbstractBar {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       AbstractBarPrivate * priv;
+       Foo foo;
+};
+
+struct _AbstractBarClass {
+       GTypeClass parent_class;
+       void (*finalize) (AbstractBar *self);
+};
+
+struct _ParamSpecAbstractBar {
+       GParamSpec parent_instance;
+};
+
+struct _Bar {
+       AbstractBar parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       AbstractBarClass parent_class;
+};
+
+static gpointer abstract_bar_parent_class = NULL;
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN gpointer abstract_bar_ref (gpointer instance);
+VALA_EXTERN void abstract_bar_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_abstract_bar (const gchar* name,
+                                     const gchar* nick,
+                                     const gchar* blurb,
+                                     GType object_type,
+                                     GParamFlags flags);
+VALA_EXTERN void value_set_abstract_bar (GValue* value,
+                             gpointer v_object);
+VALA_EXTERN void value_take_abstract_bar (GValue* value,
+                              gpointer v_object);
+VALA_EXTERN gpointer value_get_abstract_bar (const GValue* value);
+VALA_EXTERN GType abstract_bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (AbstractBar, abstract_bar_unref)
+VALA_EXTERN AbstractBar* abstract_bar_construct (GType object_type,
+                                     Foo* foo);
+static void abstract_bar_finalize (AbstractBar * obj);
+static GType abstract_bar_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, abstract_bar_unref)
+VALA_EXTERN Bar* bar_new (Foo* foo);
+VALA_EXTERN Bar* bar_construct (GType object_type,
+                    Foo* foo);
+static GType bar_get_type_once (void);
+static void _vala_main (void);
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       memcpy (dup, self, sizeof (Foo));
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+AbstractBar*
+abstract_bar_construct (GType object_type,
+                        Foo* foo)
+{
+       AbstractBar* self = NULL;
+       Foo _tmp0_;
+       g_return_val_if_fail (foo != NULL, NULL);
+       self = (AbstractBar*) g_type_create_instance (object_type);
+       _tmp0_ = *foo;
+       self->foo = _tmp0_;
+       return self;
+}
+
+static void
+value_abstract_bar_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_abstract_bar_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               abstract_bar_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_abstract_bar_copy_value (const GValue* src_value,
+                               GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = abstract_bar_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_abstract_bar_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_abstract_bar_collect_value (GValue* value,
+                                  guint n_collect_values,
+                                  GTypeCValue* collect_values,
+                                  guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               AbstractBar * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = abstract_bar_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_abstract_bar_lcopy_value (const GValue* value,
+                                guint n_collect_values,
+                                GTypeCValue* collect_values,
+                                guint collect_flags)
+{
+       AbstractBar ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = abstract_bar_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_abstract_bar (const gchar* name,
+                         const gchar* nick,
+                         const gchar* blurb,
+                         GType object_type,
+                         GParamFlags flags)
+{
+       ParamSpecAbstractBar* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_ABSTRACT_BAR), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_abstract_bar (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_ABSTRACT_BAR), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_abstract_bar (GValue* value,
+                        gpointer v_object)
+{
+       AbstractBar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_ABSTRACT_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_ABSTRACT_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               abstract_bar_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               abstract_bar_unref (old);
+       }
+}
+
+void
+value_take_abstract_bar (GValue* value,
+                         gpointer v_object)
+{
+       AbstractBar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_ABSTRACT_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_ABSTRACT_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               abstract_bar_unref (old);
+       }
+}
+
+static void
+abstract_bar_class_init (AbstractBarClass * klass,
+                         gpointer klass_data)
+{
+       abstract_bar_parent_class = g_type_class_peek_parent (klass);
+       ((AbstractBarClass *) klass)->finalize = abstract_bar_finalize;
+}
+
+static void
+abstract_bar_instance_init (AbstractBar * self,
+                            gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+abstract_bar_finalize (AbstractBar * obj)
+{
+       AbstractBar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_ABSTRACT_BAR, AbstractBar);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+abstract_bar_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_abstract_bar_init, 
value_abstract_bar_free_value, value_abstract_bar_copy_value, value_abstract_bar_peek_pointer, "p", 
value_abstract_bar_collect_value, "p", value_abstract_bar_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (AbstractBarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) abstract_bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(AbstractBar), 0, (GInstanceInitFunc) abstract_bar_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType abstract_bar_type_id;
+       abstract_bar_type_id = g_type_register_fundamental (g_type_fundamental_next (), "AbstractBar", 
&g_define_type_info, &g_define_type_fundamental_info, G_TYPE_FLAG_ABSTRACT);
+       return abstract_bar_type_id;
+}
+
+GType
+abstract_bar_get_type (void)
+{
+       static volatile gsize abstract_bar_type_id__volatile = 0;
+       if (g_once_init_enter (&abstract_bar_type_id__volatile)) {
+               GType abstract_bar_type_id;
+               abstract_bar_type_id = abstract_bar_get_type_once ();
+               g_once_init_leave (&abstract_bar_type_id__volatile, abstract_bar_type_id);
+       }
+       return abstract_bar_type_id__volatile;
+}
+
+gpointer
+abstract_bar_ref (gpointer instance)
+{
+       AbstractBar * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+abstract_bar_unref (gpointer instance)
+{
+       AbstractBar * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               ABSTRACT_BAR_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+Bar*
+bar_construct (GType object_type,
+               Foo* foo)
+{
+       Bar* self = NULL;
+       Foo _tmp0_;
+       g_return_val_if_fail (foo != NULL, NULL);
+       _tmp0_ = *foo;
+       self = (Bar*) abstract_bar_construct (object_type, &_tmp0_);
+       return self;
+}
+
+Bar*
+bar_new (Foo* foo)
+{
+       return bar_construct (TYPE_BAR, foo);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (TYPE_ABSTRACT_BAR, "Bar", &g_define_type_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Bar* bar = NULL;
+       Foo _tmp0_ = {0};
+       Bar* _tmp1_;
+       Foo _tmp2_;
+       _tmp0_.i = 42;
+       _tmp1_ = bar_new (&_tmp0_);
+       bar = _tmp1_;
+       _tmp2_ = G_TYPE_CHECK_INSTANCE_CAST (bar, TYPE_ABSTRACT_BAR, AbstractBar)->foo;
+       _vala_assert (_tmp2_.i == 42, "bar.foo.i == 42");
+       _abstract_bar_unref0 (bar);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/chainup/class-base-foo.c-expected b/tests/chainup/class-base-foo.c-expected
new file mode 100644
index 000000000..e75541cec
--- /dev/null
+++ b/tests/chainup/class-base-foo.c-expected
@@ -0,0 +1,408 @@
+/* chainup_class_base_foo.c generated by valac, the Vala compiler
+ * generated from chainup_class_base_foo.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+       gint i;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+struct _Bar {
+       Foo parent_instance;
+       BarPrivate * priv;
+       gint j;
+};
+
+struct _BarClass {
+       FooClass parent_class;
+};
+
+static gpointer foo_parent_class = NULL;
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new_foo (void);
+VALA_EXTERN Foo* foo_construct_foo (GType object_type);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, foo_unref)
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static void bar_finalize (Foo * obj);
+static GType bar_get_type_once (void);
+static void _vala_main (void);
+
+Foo*
+foo_construct_foo (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       self->i = 1;
+       return self;
+}
+
+Foo*
+foo_new_foo (void)
+{
+       return foo_construct_foo (TYPE_FOO);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar* self = NULL;
+       self = (Bar*) foo_construct_foo (object_type);
+       self->j = 1;
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = bar_finalize;
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static void
+bar_finalize (Foo * obj)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       FOO_CLASS (bar_parent_class)->finalize (obj);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (TYPE_FOO, "Bar", &g_define_type_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Bar* bar = NULL;
+       Bar* _tmp0_;
+       _tmp0_ = bar_new ();
+       bar = _tmp0_;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (bar, TYPE_FOO, Foo)->i == 1, "bar.i == 1");
+       _vala_assert (bar->j == 1, "bar.j == 1");
+       _foo_unref0 (bar);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/chainup/class-base.c-expected b/tests/chainup/class-base.c-expected
new file mode 100644
index 000000000..aae5d4e18
--- /dev/null
+++ b/tests/chainup/class-base.c-expected
@@ -0,0 +1,392 @@
+/* chainup_class_base.c generated by valac, the Vala compiler
+ * generated from chainup_class_base.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+       gint i;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+struct _Bar {
+       Foo parent_instance;
+       BarPrivate * priv;
+       gint j;
+};
+
+struct _BarClass {
+       FooClass parent_class;
+};
+
+static gpointer foo_parent_class = NULL;
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, foo_unref)
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static void bar_finalize (Foo * obj);
+static GType bar_get_type_once (void);
+static void _vala_main (void);
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       self->i = 1;
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar* self = NULL;
+       self = (Bar*) foo_construct (object_type);
+       self->j = 1;
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = bar_finalize;
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static void
+bar_finalize (Foo * obj)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       FOO_CLASS (bar_parent_class)->finalize (obj);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (TYPE_FOO, "Bar", &g_define_type_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Bar* bar = NULL;
+       Bar* _tmp0_;
+       _tmp0_ = bar_new ();
+       bar = _tmp0_;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (bar, TYPE_FOO, Foo)->i == 1, "bar.i == 1");
+       _vala_assert (bar->j == 1, "bar.j == 1");
+       _foo_unref0 (bar);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/chainup/class-compact-base.c-expected b/tests/chainup/class-compact-base.c-expected
new file mode 100644
index 000000000..1a39e4ae9
--- /dev/null
+++ b/tests/chainup/class-compact-base.c-expected
@@ -0,0 +1,126 @@
+/* chainup_class_compact_base.c generated by valac, the Vala compiler
+ * generated from chainup_class_compact_base.vala, do not modify */
+
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef struct _Foo Foo;
+typedef Foo Bar;
+#define _foo_free0(var) ((var == NULL) ? NULL : (var = (foo_free (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       gint a;
+       gint b;
+};
+
+VALA_EXTERN void foo_free (Foo * self);
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_free)
+static void foo_instance_init (Foo * self);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN gint foo_sum (Foo* self);
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, foo_free)
+static void bar_instance_init (Bar * self);
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN gint bar_mul (Bar* self);
+VALA_EXTERN gint bar_mul2 (Bar* self);
+static void _vala_main (void);
+
+Foo*
+foo_new (void)
+{
+       Foo* self;
+       self = g_slice_new0 (Foo);
+       foo_instance_init (self);
+       self->a = 23;
+       return self;
+}
+
+gint
+foo_sum (Foo* self)
+{
+       gint result = 0;
+       g_return_val_if_fail (self != NULL, 0);
+       result = self->a + self->b;
+       return result;
+}
+
+static void
+foo_instance_init (Foo * self)
+{
+}
+
+void
+foo_free (Foo * self)
+{
+       g_slice_free (Foo, self);
+}
+
+Bar*
+bar_new (void)
+{
+       Bar* self;
+       self = (Bar*) foo_new ();
+       bar_instance_init (self);
+       ((Foo*) self)->b = 42;
+       return self;
+}
+
+gint
+bar_mul (Bar* self)
+{
+       gint result = 0;
+       g_return_val_if_fail (self != NULL, 0);
+       result = ((Foo*) self)->a * ((Foo*) self)->b;
+       return result;
+}
+
+gint
+bar_mul2 (Bar* self)
+{
+       gint result = 0;
+       g_return_val_if_fail (self != NULL, 0);
+       result = self->a * self->b;
+       return result;
+}
+
+static void
+bar_instance_init (Bar * self)
+{
+}
+
+static void
+_vala_main (void)
+{
+       Bar* bar = NULL;
+       Bar* _tmp0_;
+       _tmp0_ = bar_new ();
+       bar = _tmp0_;
+       _vala_assert (((Foo*) bar)->a == 23, "bar.a == 23");
+       _vala_assert (((Foo*) bar)->b == 42, "bar.b == 42");
+       _vala_assert (foo_sum ((Foo*) bar) == 65, "bar.sum () == 65");
+       _vala_assert (bar_mul (bar) == 966, "bar.mul () == 966");
+       _vala_assert (bar_mul2 (bar) == 966, "bar.mul2 () == 966");
+       _foo_free0 (bar);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/chainup/class-compact-this.c-expected b/tests/chainup/class-compact-this.c-expected
new file mode 100644
index 000000000..aaeb7299e
--- /dev/null
+++ b/tests/chainup/class-compact-this.c-expected
@@ -0,0 +1,118 @@
+/* chainup_class_compact_this.c generated by valac, the Vala compiler
+ * generated from chainup_class_compact_this.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef struct _Foo Foo;
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _foo_free0(var) ((var == NULL) ? NULL : (var = (foo_free (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       gchar* s;
+       gint i;
+       gint j;
+};
+
+VALA_EXTERN void foo_free (Foo * self);
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_free)
+static void foo_instance_init (Foo * self);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_new_bar (void);
+static void _vala_main (void);
+
+Foo*
+foo_new (void)
+{
+       Foo* self;
+       const gchar* _tmp0_;
+       self = g_slice_new0 (Foo);
+       foo_instance_init (self);
+       _tmp0_ = self->s;
+       _vala_assert (g_strcmp0 (_tmp0_, "foo") == 0, "s == \"foo\"");
+       _vala_assert (self->i == 42, "i == 42");
+       self->j = 23;
+       return self;
+}
+
+Foo*
+foo_new_bar (void)
+{
+       Foo* self;
+       const gchar* _tmp0_;
+       self = (Foo*) foo_new ();
+       _tmp0_ = self->s;
+       _vala_assert (g_strcmp0 (_tmp0_, "foo") == 0, "s == \"foo\"");
+       _vala_assert (self->i == 42, "i == 42");
+       _vala_assert (self->j == 23, "j == 23");
+       return self;
+}
+
+static void
+foo_instance_init (Foo * self)
+{
+       gchar* _tmp0_;
+       _tmp0_ = g_strdup ("foo");
+       self->s = _tmp0_;
+       self->i = 42;
+}
+
+void
+foo_free (Foo * self)
+{
+       _g_free0 (self->s);
+       g_slice_free (Foo, self);
+}
+
+static void
+_vala_main (void)
+{
+       {
+               Foo* foo = NULL;
+               Foo* _tmp0_;
+               const gchar* _tmp1_;
+               _tmp0_ = foo_new ();
+               foo = _tmp0_;
+               _tmp1_ = foo->s;
+               _vala_assert (g_strcmp0 (_tmp1_, "foo") == 0, "foo.s == \"foo\"");
+               _vala_assert (foo->i == 42, "foo.i == 42");
+               _vala_assert (foo->j == 23, "foo.j == 23");
+               _foo_free0 (foo);
+       }
+       {
+               Foo* foo = NULL;
+               Foo* _tmp2_;
+               const gchar* _tmp3_;
+               _tmp2_ = foo_new_bar ();
+               foo = _tmp2_;
+               _tmp3_ = foo->s;
+               _vala_assert (g_strcmp0 (_tmp3_, "foo") == 0, "foo.s == \"foo\"");
+               _vala_assert (foo->i == 42, "foo.i == 42");
+               _vala_assert (foo->j == 23, "foo.j == 23");
+               _foo_free0 (foo);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/chainup/class-object.c-expected b/tests/chainup/class-object.c-expected
new file mode 100644
index 000000000..64cc773cf
--- /dev/null
+++ b/tests/chainup/class-object.c-expected
@@ -0,0 +1,134 @@
+/* chainup_class_object.c generated by valac, the Vala compiler
+ * generated from chainup_class_object.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+       gint i;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (GObject * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       self->i = 1;
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       G_OBJECT_CLASS (klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static void
+foo_finalize (GObject * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       G_OBJECT_CLASS (foo_parent_class)->finalize (obj);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       _vala_assert (foo->i == 1, "foo.i == 1");
+       _g_object_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/chainup/class-this-foo.c-expected b/tests/chainup/class-this-foo.c-expected
new file mode 100644
index 000000000..a8eedf759
--- /dev/null
+++ b/tests/chainup/class-this-foo.c-expected
@@ -0,0 +1,324 @@
+/* chainup_class_this_foo.c generated by valac, the Vala compiler
+ * generated from chainup_class_this_foo.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+       gint i;
+       gint j;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+VALA_EXTERN Foo* foo_new_foo (void);
+VALA_EXTERN Foo* foo_construct_foo (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) foo_construct_foo (object_type);
+       self->j = 1;
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+Foo*
+foo_construct_foo (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       self->i = 1;
+       return self;
+}
+
+Foo*
+foo_new_foo (void)
+{
+       return foo_construct_foo (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       _vala_assert (foo->i == 1, "foo.i == 1");
+       _vala_assert (foo->j == 1, "foo.j == 1");
+       _foo_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/chainup/class-this.c-expected b/tests/chainup/class-this.c-expected
new file mode 100644
index 000000000..a430942e8
--- /dev/null
+++ b/tests/chainup/class-this.c-expected
@@ -0,0 +1,324 @@
+/* chainup_class_this.c generated by valac, the Vala compiler
+ * generated from chainup_class_this.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+       gint i;
+       gint j;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+VALA_EXTERN Foo* foo_new_bar (void);
+VALA_EXTERN Foo* foo_construct_bar (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       self->j = 1;
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+Foo*
+foo_construct_bar (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) foo_construct (object_type);
+       self->i = 1;
+       return self;
+}
+
+Foo*
+foo_new_bar (void)
+{
+       return foo_construct_bar (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       _tmp0_ = foo_new_bar ();
+       foo = _tmp0_;
+       _vala_assert (foo->i == 1, "foo.i == 1");
+       _vala_assert (foo->j == 1, "foo.j == 1");
+       _foo_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/chainup/method-lambda-base.c-expected b/tests/chainup/method-lambda-base.c-expected
new file mode 100644
index 000000000..ac475e075
--- /dev/null
+++ b/tests/chainup/method-lambda-base.c-expected
@@ -0,0 +1,438 @@
+/* chainup_method_lambda_base.c generated by valac, the Vala compiler
+ * generated from chainup_method_lambda_base.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef void (*Func) (gpointer user_data);
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+       gint i;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+       void (*foo) (Foo* self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+struct _Bar {
+       Foo parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       FooClass parent_class;
+};
+
+static gpointer foo_parent_class = NULL;
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN void foo_foo (Foo* self);
+static void foo_real_foo (Foo* self);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, foo_unref)
+static void bar_execute (Bar* self,
+                  Func func,
+                  gpointer func_target);
+static void bar_real_foo (Foo* base);
+static void __lambda4_ (Bar* self);
+static void ___lambda4__func (gpointer self);
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static GType bar_get_type_once (void);
+static void _vala_main (void);
+
+static void
+foo_real_foo (Foo* self)
+{
+       self->i = 1;
+}
+
+void
+foo_foo (Foo* self)
+{
+       FooClass* _klass_;
+       g_return_if_fail (IS_FOO (self));
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->foo) {
+               _klass_->foo (self);
+       }
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       ((FooClass *) klass)->foo = (void (*) (Foo*)) foo_real_foo;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+bar_execute (Bar* self,
+             Func func,
+             gpointer func_target)
+{
+       g_return_if_fail (IS_BAR (self));
+       func (func_target);
+}
+
+static void
+__lambda4_ (Bar* self)
+{
+       FOO_CLASS (bar_parent_class)->foo (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_FOO, Foo));
+}
+
+static void
+___lambda4__func (gpointer self)
+{
+       __lambda4_ ((Bar*) self);
+}
+
+static void
+bar_real_foo (Foo* base)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAR, Bar);
+       bar_execute (self, ___lambda4__func, self);
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar* self = NULL;
+       self = (Bar*) foo_construct (object_type);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->foo = (void (*) (Foo*)) bar_real_foo;
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (TYPE_FOO, "Bar", &g_define_type_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Bar* bar = NULL;
+       Bar* _tmp0_;
+       _tmp0_ = bar_new ();
+       bar = _tmp0_;
+       foo_foo (G_TYPE_CHECK_INSTANCE_CAST (bar, TYPE_FOO, Foo));
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (bar, TYPE_FOO, Foo)->i == 1, "bar.i == 1");
+       _foo_unref0 (bar);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/chainup/no-chainup.c-expected b/tests/chainup/no-chainup.c-expected
new file mode 100644
index 000000000..9914158dc
--- /dev/null
+++ b/tests/chainup/no-chainup.c-expected
@@ -0,0 +1,406 @@
+/* chainup_no_chainup.c generated by valac, the Vala compiler
+ * generated from chainup_no_chainup.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+#define TYPE_BAR (bar_get_type ())
+typedef struct _Bar Bar;
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _FooPrivate {
+       gint i;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+struct _Bar {
+       gint i;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+VALA_EXTERN Foo* foo_new_foo (void);
+VALA_EXTERN Foo* foo_construct_foo (GType object_type);
+static gboolean __lambda4_ (Foo* self);
+static gboolean ___lambda4__gsource_func (gpointer self);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Bar* bar_dup (const Bar* self);
+VALA_EXTERN void bar_free (Bar* self);
+VALA_EXTERN void bar_init (Bar *self);
+static void _vala_main (void);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       self->priv->i = 0;
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static gboolean
+__lambda4_ (Foo* self)
+{
+       gboolean result = FALSE;
+       result = TRUE;
+       return result;
+}
+
+static gboolean
+___lambda4__gsource_func (gpointer self)
+{
+       gboolean result;
+       result = __lambda4_ ((Foo*) self);
+       return result;
+}
+
+Foo*
+foo_construct_foo (GType object_type)
+{
+       Foo* self = NULL;
+       GSourceFunc f = NULL;
+       gpointer f_target;
+       GDestroyNotify f_target_destroy_notify;
+       self = (Foo*) g_type_create_instance (object_type);
+       f = ___lambda4__gsource_func;
+       f_target = foo_ref (self);
+       f_target_destroy_notify = foo_unref;
+       f (f_target);
+       (f_target_destroy_notify == NULL) ? NULL : (f_target_destroy_notify (f_target), NULL);
+       f = NULL;
+       f_target = NULL;
+       f_target_destroy_notify = NULL;
+       return self;
+}
+
+Foo*
+foo_new_foo (void)
+{
+       return foo_construct_foo (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+void
+bar_init (Bar *self)
+{
+       memset (self, 0, sizeof (Bar));
+       (*self).i = 0;
+}
+
+Bar*
+bar_dup (const Bar* self)
+{
+       Bar* dup;
+       dup = g_new0 (Bar, 1);
+       memcpy (dup, self, sizeof (Bar));
+       return dup;
+}
+
+void
+bar_free (Bar* self)
+{
+       g_free (self);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       GType bar_type_id;
+       bar_type_id = g_boxed_type_register_static ("Bar", (GBoxedCopyFunc) bar_dup, (GBoxedFreeFunc) 
bar_free);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/chainup/signal-default-handler.c-expected b/tests/chainup/signal-default-handler.c-expected
new file mode 100644
index 000000000..0ce9dc2ad
--- /dev/null
+++ b/tests/chainup/signal-default-handler.c-expected
@@ -0,0 +1,237 @@
+/* chainup_signal_default_handler.c generated by valac, the Vala compiler
+ * generated from chainup_signal_default_handler.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+enum  {
+       FOO_FOO_SIGNAL,
+       FOO_NUM_SIGNALS
+};
+static guint foo_signals[FOO_NUM_SIGNALS] = {0};
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+enum  {
+       BAR_0_PROPERTY,
+       BAR_NUM_PROPERTIES
+};
+static GParamSpec* bar_properties[BAR_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+       void (*foo) (Foo* self);
+};
+
+struct _Bar {
+       Foo parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       FooClass parent_class;
+};
+
+VALA_EXTERN gboolean reached;
+gboolean reached = FALSE;
+static gpointer foo_parent_class = NULL;
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_real_foo (Foo* self);
+static GType foo_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
+VALA_EXTERN void bar_bar (Bar* self);
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static GType bar_get_type_once (void);
+static void _vala_main (void);
+static void _g_assert_not_reached_foo_foo (Foo* _sender,
+                                    gpointer self);
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+foo_real_foo (Foo* self)
+{
+       reached = TRUE;
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->foo = foo_real_foo;
+       foo_signals[FOO_FOO_SIGNAL] = g_signal_new ("foo", TYPE_FOO, G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET 
(FooClass, foo), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+void
+bar_bar (Bar* self)
+{
+       g_return_if_fail (IS_BAR (self));
+       FOO_CLASS (bar_parent_class)->foo (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_FOO, Foo));
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar * self = NULL;
+       self = (Bar*) foo_construct (object_type);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (TYPE_FOO, "Bar", &g_define_type_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_g_assert_not_reached_foo_foo (Foo* _sender,
+                               gpointer self)
+{
+       g_assert_not_reached ();
+}
+
+static void
+_vala_main (void)
+{
+       Bar* bar = NULL;
+       Bar* _tmp0_;
+       _tmp0_ = bar_new ();
+       bar = _tmp0_;
+       g_signal_connect (G_TYPE_CHECK_INSTANCE_CAST (bar, TYPE_FOO, Foo), "foo", (GCallback) 
_g_assert_not_reached_foo_foo, NULL);
+       bar_bar (bar);
+       _vala_assert (reached, "reached");
+       _g_object_unref0 (bar);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/chainup/struct-base-foo.c-expected b/tests/chainup/struct-base-foo.c-expected
new file mode 100644
index 000000000..635f0104e
--- /dev/null
+++ b/tests/chainup/struct-base-foo.c-expected
@@ -0,0 +1,146 @@
+/* chainup_struct_base_foo.c generated by valac, the Vala compiler
+ * generated from chainup_struct_base_foo.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+
+#define TYPE_BAR (bar_get_type ())
+typedef Foo Bar;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       gint i;
+       gint j;
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN void foo_init_foo (Foo *self);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Bar* bar_dup (const Bar* self);
+VALA_EXTERN void bar_free (Bar* self);
+VALA_EXTERN void bar_init (Bar *self);
+static void _vala_main (void);
+
+void
+foo_init_foo (Foo *self)
+{
+       memset (self, 0, sizeof (Foo));
+       (*self).i = 1;
+}
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       memcpy (dup, self, sizeof (Foo));
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+void
+bar_init (Bar *self)
+{
+       Foo _tmp0_ = {0};
+       memset (self, 0, sizeof (Bar));
+       foo_init_foo (&_tmp0_);
+       (*self).j = 1;
+}
+
+Bar*
+bar_dup (const Bar* self)
+{
+       Bar* dup;
+       dup = g_new0 (Bar, 1);
+       memcpy (dup, self, sizeof (Bar));
+       return dup;
+}
+
+void
+bar_free (Bar* self)
+{
+       g_free (self);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       GType bar_type_id;
+       bar_type_id = g_boxed_type_register_static ("Bar", (GBoxedCopyFunc) bar_dup, (GBoxedFreeFunc) 
bar_free);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Bar bar = {0};
+       Bar _tmp0_;
+       bar_init (&bar);
+       _tmp0_ = bar;
+       _vala_assert (_tmp0_.j == 1, "bar.j == 1");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/chainup/struct-base.c-expected b/tests/chainup/struct-base.c-expected
new file mode 100644
index 000000000..0a89acf54
--- /dev/null
+++ b/tests/chainup/struct-base.c-expected
@@ -0,0 +1,148 @@
+/* chainup_struct_base.c generated by valac, the Vala compiler
+ * generated from chainup_struct_base.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+
+#define TYPE_BAR (bar_get_type ())
+typedef Foo Bar;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       gint i;
+       gint j;
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN void foo_init (Foo *self);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Bar* bar_dup (const Bar* self);
+VALA_EXTERN void bar_free (Bar* self);
+VALA_EXTERN void bar_init (Bar *self);
+static void _vala_main (void);
+
+void
+foo_init (Foo *self)
+{
+       memset (self, 0, sizeof (Foo));
+       (*self).i = 1;
+}
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       memcpy (dup, self, sizeof (Foo));
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+void
+bar_init (Bar *self)
+{
+       memset (self, 0, sizeof (Bar));
+       foo_init (self);
+       (*self).j = 1;
+}
+
+Bar*
+bar_dup (const Bar* self)
+{
+       Bar* dup;
+       dup = g_new0 (Bar, 1);
+       memcpy (dup, self, sizeof (Bar));
+       return dup;
+}
+
+void
+bar_free (Bar* self)
+{
+       g_free (self);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       GType bar_type_id;
+       bar_type_id = g_boxed_type_register_static ("Bar", (GBoxedCopyFunc) bar_dup, (GBoxedFreeFunc) 
bar_free);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Bar bar = {0};
+       Bar _tmp0_;
+       Bar _tmp1_;
+       bar_init (&bar);
+       _tmp0_ = bar;
+       _vala_assert (_tmp0_.i == 1, "bar.i == 1");
+       _tmp1_ = bar;
+       _vala_assert (_tmp1_.j == 1, "bar.j == 1");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/chainup/struct-no-gtype-base.c-expected b/tests/chainup/struct-no-gtype-base.c-expected
new file mode 100644
index 000000000..9257d6e5f
--- /dev/null
+++ b/tests/chainup/struct-no-gtype-base.c-expected
@@ -0,0 +1,112 @@
+/* chainup_struct_no_gtype_base.c generated by valac, the Vala compiler
+ * generated from chainup_struct_no_gtype_base.vala, do not modify */
+
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef struct _Foo Foo;
+typedef Foo Bar;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       gint a;
+       gint b;
+};
+
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN gint foo_sum (Foo *self);
+VALA_EXTERN Bar* bar_dup (const Bar* self);
+VALA_EXTERN void bar_free (Bar* self);
+VALA_EXTERN gint bar_mul (Bar *self);
+VALA_EXTERN gint bar_mul2 (Bar *self);
+static void _vala_main (void);
+
+gint
+foo_sum (Foo *self)
+{
+       gint result = 0;
+       result = (*self).a + (*self).b;
+       return result;
+}
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       memcpy (dup, self, sizeof (Foo));
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       g_free (self);
+}
+
+gint
+bar_mul (Bar *self)
+{
+       gint result = 0;
+       result = (*self).a * (*self).b;
+       return result;
+}
+
+gint
+bar_mul2 (Bar *self)
+{
+       gint result = 0;
+       result = (*self).a * (*self).b;
+       return result;
+}
+
+Bar*
+bar_dup (const Bar* self)
+{
+       Bar* dup;
+       dup = g_new0 (Bar, 1);
+       memcpy (dup, self, sizeof (Bar));
+       return dup;
+}
+
+void
+bar_free (Bar* self)
+{
+       g_free (self);
+}
+
+static void
+_vala_main (void)
+{
+       Bar bar = {0};
+       Bar _tmp0_ = {0};
+       _tmp0_.a = 23;
+       _tmp0_.b = 42;
+       bar = _tmp0_;
+       _vala_assert (foo_sum (&bar) == 65, "bar.sum () == 65");
+       _vala_assert (bar_mul (&bar) == 966, "bar.mul () == 966");
+       _vala_assert (bar_mul2 (&bar) == 966, "bar.mul2 () == 966");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/chainup/struct-simple-no-gtype-base.c-expected 
b/tests/chainup/struct-simple-no-gtype-base.c-expected
new file mode 100644
index 000000000..0e8923324
--- /dev/null
+++ b/tests/chainup/struct-simple-no-gtype-base.c-expected
@@ -0,0 +1,76 @@
+/* chainup_struct_simple_no_gtype_base.c generated by valac, the Vala compiler
+ * generated from chainup_struct_simple_no_gtype_base.vala, do not modify */
+
+#include <stdint.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef int32_t foo_t;
+typedef foo_t bar_t;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN gint foo_t_sum (foo_t self,
+                foo_t b);
+VALA_EXTERN gint bar_t_mul (bar_t self,
+                bar_t b);
+VALA_EXTERN gint bar_t_mul2 (bar_t self,
+                 bar_t b);
+static void _vala_main (void);
+
+gint
+foo_t_sum (foo_t self,
+           foo_t b)
+{
+       gint result = 0;
+       result = (gint) (self + b);
+       return result;
+}
+
+gint
+bar_t_mul (bar_t self,
+           bar_t b)
+{
+       gint result = 0;
+       result = (gint) (self * b);
+       return result;
+}
+
+gint
+bar_t_mul2 (bar_t self,
+            bar_t b)
+{
+       gint result = 0;
+       result = (gint) (self * b);
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       bar_t bar = {0};
+       bar = (bar_t) 23;
+       _vala_assert (foo_t_sum ((foo_t) bar, (foo_t) 42) == 65, "bar.sum (42) == 65");
+       _vala_assert (bar_t_mul (bar, (bar_t) 42) == 966, "bar.mul (42) == 966");
+       _vala_assert (bar_t_mul2 (bar, (bar_t) 42) == 966, "bar.mul2 (42) == 966");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/chainup/struct-this-foo.c-expected b/tests/chainup/struct-this-foo.c-expected
new file mode 100644
index 000000000..8ee82754f
--- /dev/null
+++ b/tests/chainup/struct-this-foo.c-expected
@@ -0,0 +1,105 @@
+/* chainup_struct_this_foo.c generated by valac, the Vala compiler
+ * generated from chainup_struct_this_foo.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       gint i;
+       gint j;
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN void foo_init (Foo *self);
+VALA_EXTERN void foo_init_foo (Foo *self);
+static void _vala_main (void);
+
+void
+foo_init (Foo *self)
+{
+       Foo _tmp0_ = {0};
+       memset (self, 0, sizeof (Foo));
+       foo_init_foo (&_tmp0_);
+       (*self).j = 1;
+}
+
+void
+foo_init_foo (Foo *self)
+{
+       memset (self, 0, sizeof (Foo));
+       (*self).i = 1;
+}
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       memcpy (dup, self, sizeof (Foo));
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Foo foo = {0};
+       Foo _tmp0_;
+       foo_init (&foo);
+       _tmp0_ = foo;
+       _vala_assert (_tmp0_.j == 1, "foo.j == 1");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/chainup/struct-this.c-expected b/tests/chainup/struct-this.c-expected
new file mode 100644
index 000000000..4414aaf7a
--- /dev/null
+++ b/tests/chainup/struct-this.c-expected
@@ -0,0 +1,107 @@
+/* chainup_struct_this.c generated by valac, the Vala compiler
+ * generated from chainup_struct_this.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       gint i;
+       gint j;
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN void foo_init (Foo *self);
+VALA_EXTERN void foo_init_bar (Foo *self);
+static void _vala_main (void);
+
+void
+foo_init (Foo *self)
+{
+       memset (self, 0, sizeof (Foo));
+       (*self).j = 1;
+}
+
+void
+foo_init_bar (Foo *self)
+{
+       memset (self, 0, sizeof (Foo));
+       foo_init (self);
+       (*self).i = 1;
+}
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       memcpy (dup, self, sizeof (Foo));
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Foo foo = {0};
+       Foo _tmp0_;
+       Foo _tmp1_;
+       foo_init_bar (&foo);
+       _tmp0_ = foo;
+       _vala_assert (_tmp0_.i == 1, "foo.i == 1");
+       _tmp1_ = foo;
+       _vala_assert (_tmp1_.j == 1, "foo.j == 1");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/constants/glog.c-expected b/tests/constants/glog.c-expected
new file mode 100644
index 000000000..02322fbd1
--- /dev/null
+++ b/tests/constants/glog.c-expected
@@ -0,0 +1,30 @@
+/* constants_glog.c generated by valac, the Vala compiler
+ * generated from constants_glog.vala, do not modify */
+
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+       _vala_assert (g_str_has_suffix ("constants_glog.vala", "glog.vala"), "Log.FILE.has_suffix 
(\"glog.vala\")");
+       _vala_assert (3 == 3, "Log.LINE == 3");
+       _vala_assert (g_strcmp0 ("main", "main") == 0, "Log.METHOD == \"main\"");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/constants/strings.c-expected b/tests/constants/strings.c-expected
new file mode 100644
index 000000000..812a169ff
--- /dev/null
+++ b/tests/constants/strings.c-expected
@@ -0,0 +1,25 @@
+/* constants_strings.c generated by valac, the Vala compiler
+ * generated from constants_strings.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+#include <glib/gi18n-lib.h>
+
+#define FOO "string constant"
+#define BAR _ ("translated string constant")
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/control-flow/assigned-local-variable.c-expected 
b/tests/control-flow/assigned-local-variable.c-expected
new file mode 100644
index 000000000..62abc8597
--- /dev/null
+++ b/tests/control-flow/assigned-local-variable.c-expected
@@ -0,0 +1,249 @@
+/* control_flow_assigned_local_variable.c generated by valac, the Vala compiler
+ * generated from control_flow_assigned_local_variable.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN gboolean foo (gchar* * s);
+VALA_EXTERN gint bar (void);
+static void _vala_main (void);
+
+gboolean
+foo (gchar* * s)
+{
+       gchar* _vala_s = NULL;
+       gchar* _tmp0_;
+       gboolean result = FALSE;
+       _tmp0_ = g_strdup ("foo");
+       _g_free0 (_vala_s);
+       _vala_s = _tmp0_;
+       result = TRUE;
+       if (s) {
+               *s = _vala_s;
+       } else {
+               _g_free0 (_vala_s);
+       }
+       return result;
+}
+
+gint
+bar (void)
+{
+       gint result = 0;
+       result = 42;
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       {
+               gchar* s = NULL;
+               gboolean _tmp0_ = FALSE;
+               gchar* _tmp1_ = NULL;
+               gboolean _tmp2_;
+               _tmp2_ = foo (&_tmp1_);
+               _g_free0 (s);
+               s = _tmp1_;
+               if (!_tmp2_) {
+                       _tmp0_ = TRUE;
+               } else {
+                       const gchar* _tmp3_;
+                       _tmp3_ = s;
+                       _tmp0_ = _tmp3_ == NULL;
+               }
+               if (_tmp0_) {
+                       g_assert_not_reached ();
+               }
+               _g_free0 (s);
+       }
+       {
+               gint i = 0;
+               gboolean _tmp4_ = FALSE;
+               i = bar ();
+               if (i > 42) {
+                       _tmp4_ = TRUE;
+               } else {
+                       _tmp4_ = i < 23;
+               }
+               if (_tmp4_) {
+                       g_assert_not_reached ();
+               }
+       }
+       {
+               gint i = 0;
+               gboolean _tmp5_ = FALSE;
+               i = bar ();
+               if (i > 42) {
+                       _tmp5_ = i < 23;
+               } else {
+                       _tmp5_ = FALSE;
+               }
+               if (_tmp5_) {
+                       g_assert_not_reached ();
+               }
+       }
+       {
+               gchar* s = NULL;
+               while (TRUE) {
+                       gboolean _tmp6_ = FALSE;
+                       gchar* _tmp7_ = NULL;
+                       gboolean _tmp8_;
+                       _tmp8_ = foo (&_tmp7_);
+                       _g_free0 (s);
+                       s = _tmp7_;
+                       if (!_tmp8_) {
+                               _tmp6_ = TRUE;
+                       } else {
+                               const gchar* _tmp9_;
+                               _tmp9_ = s;
+                               _tmp6_ = _tmp9_ == NULL;
+                       }
+                       if (!_tmp6_) {
+                               break;
+                       }
+                       g_assert_not_reached ();
+               }
+               _g_free0 (s);
+       }
+       {
+               gint i = 0;
+               while (TRUE) {
+                       gboolean _tmp10_ = FALSE;
+                       i = bar ();
+                       if (i > 42) {
+                               _tmp10_ = TRUE;
+                       } else {
+                               _tmp10_ = i < 23;
+                       }
+                       if (!_tmp10_) {
+                               break;
+                       }
+                       g_assert_not_reached ();
+               }
+       }
+       {
+               gint i = 0;
+               while (TRUE) {
+                       gboolean _tmp11_ = FALSE;
+                       i = bar ();
+                       if (i > 42) {
+                               _tmp11_ = i < 23;
+                       } else {
+                               _tmp11_ = FALSE;
+                       }
+                       if (!_tmp11_) {
+                               break;
+                       }
+                       g_assert_not_reached ();
+               }
+       }
+       {
+               gchar* s = NULL;
+               gboolean _tmp12_ = FALSE;
+               gboolean _tmp13_ = FALSE;
+               gchar* _tmp14_ = NULL;
+               gboolean _tmp15_;
+               _tmp15_ = foo (&_tmp14_);
+               _g_free0 (s);
+               s = _tmp14_;
+               if (!_tmp15_) {
+                       _tmp13_ = TRUE;
+               } else {
+                       const gchar* _tmp16_;
+                       _tmp16_ = s;
+                       _tmp13_ = _tmp16_ == NULL;
+               }
+               if (_tmp13_) {
+                       _tmp12_ = FALSE;
+               } else {
+                       _tmp12_ = TRUE;
+               }
+               _vala_assert (_tmp12_, "!foo (out s) || s == null ? false : true");
+               _g_free0 (s);
+       }
+       {
+               gchar* s = NULL;
+               gboolean _tmp17_ = FALSE;
+               gboolean _tmp18_ = FALSE;
+               gchar* _tmp19_ = NULL;
+               gboolean _tmp20_;
+               _tmp20_ = foo (&_tmp19_);
+               _g_free0 (s);
+               s = _tmp19_;
+               if (!_tmp20_) {
+                       const gchar* _tmp21_;
+                       _tmp21_ = s;
+                       _tmp18_ = _tmp21_ == NULL;
+               } else {
+                       _tmp18_ = FALSE;
+               }
+               if (_tmp18_) {
+                       _tmp17_ = FALSE;
+               } else {
+                       _tmp17_ = TRUE;
+               }
+               _vala_assert (_tmp17_, "!foo (out s) && s == null ? false : true");
+               _g_free0 (s);
+       }
+       {
+               gint i = 0;
+               gboolean _tmp22_ = FALSE;
+               gboolean _tmp23_ = FALSE;
+               i = bar ();
+               if (i > 42) {
+                       _tmp23_ = TRUE;
+               } else {
+                       _tmp23_ = i < 23;
+               }
+               if (_tmp23_) {
+                       _tmp22_ = FALSE;
+               } else {
+                       _tmp22_ = TRUE;
+               }
+               _vala_assert (_tmp22_, "(i = bar ()) > 42 || i < 23 ? false : true");
+       }
+       {
+               gint i = 0;
+               gboolean _tmp24_ = FALSE;
+               gboolean _tmp25_ = FALSE;
+               i = bar ();
+               if (i > 42) {
+                       _tmp25_ = i < 23;
+               } else {
+                       _tmp25_ = FALSE;
+               }
+               if (_tmp25_) {
+                       _tmp24_ = FALSE;
+               } else {
+                       _tmp24_ = TRUE;
+               }
+               _vala_assert (_tmp24_, "(i = bar ()) > 42 && i < 23 ? false : true");
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/control-flow/break.c-expected b/tests/control-flow/break.c-expected
new file mode 100644
index 000000000..8ae8af4cf
--- /dev/null
+++ b/tests/control-flow/break.c-expected
@@ -0,0 +1,141 @@
+/* control_flow_break.c generated by valac, the Vala compiler
+ * generated from control_flow_break.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <stdio.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define MAMAN_TYPE_BAR (maman_bar_get_type ())
+#define MAMAN_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_BAR, MamanBar))
+#define MAMAN_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAMAN_TYPE_BAR, MamanBarClass))
+#define MAMAN_IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_BAR))
+#define MAMAN_IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAMAN_TYPE_BAR))
+#define MAMAN_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAMAN_TYPE_BAR, MamanBarClass))
+
+typedef struct _MamanBar MamanBar;
+typedef struct _MamanBarClass MamanBarClass;
+typedef struct _MamanBarPrivate MamanBarPrivate;
+enum  {
+       MAMAN_BAR_0_PROPERTY,
+       MAMAN_BAR_NUM_PROPERTIES
+};
+static GParamSpec* maman_bar_properties[MAMAN_BAR_NUM_PROPERTIES];
+
+struct _MamanBar {
+       GObject parent_instance;
+       MamanBarPrivate * priv;
+};
+
+struct _MamanBarClass {
+       GObjectClass parent_class;
+};
+
+static gpointer maman_bar_parent_class = NULL;
+
+VALA_EXTERN GType maman_bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MamanBar, g_object_unref)
+static gint maman_bar_main (void);
+VALA_EXTERN MamanBar* maman_bar_new (void);
+VALA_EXTERN MamanBar* maman_bar_construct (GType object_type);
+static GType maman_bar_get_type_once (void);
+
+static gint
+maman_bar_main (void)
+{
+       FILE* _tmp0_;
+       gint i = 0;
+       FILE* _tmp4_;
+       gint result = 0;
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, "Break Test: 1");
+       {
+               gboolean _tmp1_ = FALSE;
+               i = 0;
+               _tmp1_ = TRUE;
+               while (TRUE) {
+                       FILE* _tmp3_;
+                       if (!_tmp1_) {
+                               gint _tmp2_;
+                               _tmp2_ = i;
+                               i = _tmp2_ + 1;
+                       }
+                       _tmp1_ = FALSE;
+                       if (!(i < 10)) {
+                               break;
+                       }
+                       _tmp3_ = stdout;
+                       fprintf (_tmp3_, " 2");
+                       break;
+               }
+       }
+       _tmp4_ = stdout;
+       fprintf (_tmp4_, " 3\n");
+       result = 0;
+       return result;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       return maman_bar_main ();
+}
+
+MamanBar*
+maman_bar_construct (GType object_type)
+{
+       MamanBar * self = NULL;
+       self = (MamanBar*) g_object_new (object_type, NULL);
+       return self;
+}
+
+MamanBar*
+maman_bar_new (void)
+{
+       return maman_bar_construct (MAMAN_TYPE_BAR);
+}
+
+static void
+maman_bar_class_init (MamanBarClass * klass,
+                      gpointer klass_data)
+{
+       maman_bar_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+maman_bar_instance_init (MamanBar * self,
+                         gpointer klass)
+{
+}
+
+static GType
+maman_bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (MamanBarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(MamanBar), 0, (GInstanceInitFunc) maman_bar_instance_init, NULL };
+       GType maman_bar_type_id;
+       maman_bar_type_id = g_type_register_static (G_TYPE_OBJECT, "MamanBar", &g_define_type_info, 0);
+       return maman_bar_type_id;
+}
+
+GType
+maman_bar_get_type (void)
+{
+       static volatile gsize maman_bar_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_bar_type_id__volatile)) {
+               GType maman_bar_type_id;
+               maman_bar_type_id = maman_bar_get_type_once ();
+               g_once_init_leave (&maman_bar_type_id__volatile, maman_bar_type_id);
+       }
+       return maman_bar_type_id__volatile;
+}
+
diff --git a/tests/control-flow/bug628336.c-expected b/tests/control-flow/bug628336.c-expected
new file mode 100644
index 000000000..533e332a1
--- /dev/null
+++ b/tests/control-flow/bug628336.c-expected
@@ -0,0 +1,163 @@
+/* control_flow_bug628336.c generated by valac, the Vala compiler
+ * generated from control_flow_bug628336.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+typedef struct _Block1Data Block1Data;
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Block1Data {
+       int _ref_count_;
+       gchar* bar;
+};
+
+static void _vala_main (void);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static gboolean ____lambda4_ (Block1Data* _data1_);
+static gboolean _____lambda4__gsource_func (gpointer self);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               _g_free0 (_data1_->bar);
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static gboolean
+____lambda4_ (Block1Data* _data1_)
+{
+       const gchar* _tmp0_;
+       gboolean result = FALSE;
+       _tmp0_ = _data1_->bar;
+       result = g_strcmp0 (_tmp0_, "bar") == 0;
+       return result;
+}
+
+static gboolean
+_____lambda4__gsource_func (gpointer self)
+{
+       gboolean result;
+       result = ____lambda4_ (self);
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       gchar** foo = NULL;
+       gchar* _tmp0_;
+       gchar* _tmp1_;
+       gchar** _tmp2_;
+       gint foo_length1;
+       gint _foo_size_;
+       gchar** _tmp3_;
+       gint _tmp3__length1;
+       _tmp0_ = g_strdup ("bar");
+       _tmp1_ = g_strdup ("bar");
+       _tmp2_ = g_new0 (gchar*, 2 + 1);
+       _tmp2_[0] = _tmp0_;
+       _tmp2_[1] = _tmp1_;
+       foo = _tmp2_;
+       foo_length1 = 2;
+       _foo_size_ = foo_length1;
+       _tmp3_ = foo;
+       _tmp3__length1 = foo_length1;
+       {
+               gchar** bar_collection = NULL;
+               gint bar_collection_length1 = 0;
+               gint _bar_collection_size_ = 0;
+               gint bar_it = 0;
+               bar_collection = _tmp3_;
+               bar_collection_length1 = _tmp3__length1;
+               for (bar_it = 0; bar_it < bar_collection_length1; bar_it = bar_it + 1) {
+                       gchar* _tmp4_;
+                       gchar* bar = NULL;
+                       _tmp4_ = g_strdup (bar_collection[bar_it]);
+                       bar = _tmp4_;
+                       {
+                               Block1Data* _data1_;
+                               const gchar* _tmp5_;
+                               GSourceFunc f = NULL;
+                               gpointer f_target;
+                               GDestroyNotify f_target_destroy_notify;
+                               GSourceFunc _tmp6_;
+                               gpointer _tmp6__target;
+                               _data1_ = g_slice_new0 (Block1Data);
+                               _data1_->_ref_count_ = 1;
+                               _data1_->bar = bar;
+                               _tmp5_ = _data1_->bar;
+                               _vala_assert (g_strcmp0 (_tmp5_, "bar") == 0, "bar == \"bar\"");
+                               f = _____lambda4__gsource_func;
+                               f_target = block1_data_ref (_data1_);
+                               f_target_destroy_notify = block1_data_unref;
+                               _tmp6_ = f;
+                               _tmp6__target = f_target;
+                               _vala_assert (_tmp6_ (_tmp6__target), "f ()");
+                               (f_target_destroy_notify == NULL) ? NULL : (f_target_destroy_notify 
(f_target), NULL);
+                               f = NULL;
+                               f_target = NULL;
+                               f_target_destroy_notify = NULL;
+                               block1_data_unref (_data1_);
+                               _data1_ = NULL;
+                       }
+               }
+       }
+       foo = (_vala_array_free (foo, foo_length1, (GDestroyNotify) g_free), NULL);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/control-flow/bug639482.c-expected b/tests/control-flow/bug639482.c-expected
new file mode 100644
index 000000000..cec8fea53
--- /dev/null
+++ b/tests/control-flow/bug639482.c-expected
@@ -0,0 +1,124 @@
+/* control_flow_bug639482.c generated by valac, the Vala compiler
+ * generated from control_flow_bug639482.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN gchar* test (GError** error);
+static void _vala_main (void);
+
+gchar*
+test (GError** error)
+{
+       gchar* _tmp0_;
+       gchar* result = NULL;
+       _tmp0_ = g_strdup ("foo");
+       result = _tmp0_;
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       gchar* empty = NULL;
+       const gchar* _tmp0_ = NULL;
+       gchar* _tmp3_ = NULL;
+       gchar* _tmp4_;
+       gchar* foo = NULL;
+       gchar* _tmp6_;
+       const gchar* _tmp7_;
+       gchar* _tmp8_ = NULL;
+       const gchar* _tmp9_;
+       gchar* _tmp10_;
+       gchar* _tmp12_;
+       const gchar* _tmp13_;
+       GError* _inner_error0_ = NULL;
+       empty = NULL;
+       if (FALSE) {
+               _tmp0_ = "A";
+       } else {
+               const gchar* _tmp1_ = NULL;
+               const gchar* _tmp2_;
+               _tmp2_ = empty;
+               _tmp1_ = _tmp2_;
+               if (_tmp1_ == NULL) {
+                       _tmp1_ = "B";
+               }
+               _tmp0_ = _tmp1_;
+       }
+       _vala_assert (g_strcmp0 (_tmp0_, "B") == 0, "(false ? \"A\" : (empty ?? \"B\")) == \"B\"");
+       _tmp4_ = g_strdup ("bar");
+       _tmp3_ = _tmp4_;
+       if (_tmp3_ == NULL) {
+               gchar* _tmp5_;
+               _tmp5_ = test (&_inner_error0_);
+               _g_free0 (_tmp3_);
+               _tmp3_ = _tmp5_;
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       _g_free0 (_tmp3_);
+                       _g_free0 (empty);
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+       }
+       _tmp6_ = _tmp3_;
+       _tmp3_ = NULL;
+       foo = _tmp6_;
+       _tmp7_ = foo;
+       _vala_assert (g_strcmp0 (_tmp7_, "bar") == 0, "foo == \"bar\"");
+       _tmp9_ = empty;
+       _tmp10_ = g_strdup (_tmp9_);
+       _tmp8_ = _tmp10_;
+       if (_tmp8_ == NULL) {
+               gchar* _tmp11_;
+               _tmp11_ = test (&_inner_error0_);
+               _g_free0 (_tmp8_);
+               _tmp8_ = _tmp11_;
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       _g_free0 (_tmp8_);
+                       _g_free0 (foo);
+                       _g_free0 (_tmp3_);
+                       _g_free0 (empty);
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+       }
+       _tmp12_ = _tmp8_;
+       _tmp8_ = NULL;
+       _g_free0 (foo);
+       foo = _tmp12_;
+       _tmp13_ = foo;
+       _vala_assert (g_strcmp0 (_tmp13_, "foo") == 0, "foo == \"foo\"");
+       _g_free0 (_tmp8_);
+       _g_free0 (foo);
+       _g_free0 (_tmp3_);
+       _g_free0 (empty);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/control-flow/bug652549.c-expected b/tests/control-flow/bug652549.c-expected
new file mode 100644
index 000000000..6e0999e7c
--- /dev/null
+++ b/tests/control-flow/bug652549.c-expected
@@ -0,0 +1,46 @@
+/* control_flow_bug652549.c generated by valac, the Vala compiler
+ * generated from control_flow_bug652549.vala, do not modify */
+
+#include <glib.h>
+#include <string.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+       gint foo[2] = {0};
+       gint _tmp0_[2] = {0};
+       _tmp0_[0] = 1;
+       _tmp0_[1] = 1;
+       memcpy (foo, _tmp0_, 2 * sizeof (gint));
+       {
+               gint* bar_collection = NULL;
+               gint bar_collection_length1 = 0;
+               gint _bar_collection_size_ = 0;
+               gint bar_it = 0;
+               bar_collection = foo;
+               bar_collection_length1 = 2;
+               for (bar_it = 0; bar_it < bar_collection_length1; bar_it = bar_it + 1) {
+                       gint bar = 0;
+                       bar = bar_collection[bar_it];
+                       {
+                               _vala_assert (bar == 1, "bar == 1");
+                       }
+               }
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/control-flow/bug661985.c-expected b/tests/control-flow/bug661985.c-expected
new file mode 100644
index 000000000..6e81e5156
--- /dev/null
+++ b/tests/control-flow/bug661985.c-expected
@@ -0,0 +1,51 @@
+/* control_flow_bug661985.c generated by valac, the Vala compiler
+ * generated from control_flow_bug661985.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+       gchar* foo = NULL;
+       gchar* _tmp0_;
+       void* foop = NULL;
+       const gchar* _tmp1_;
+       const gchar* _tmp2_ = NULL;
+       const gchar* _tmp3_;
+       const gchar* bar = NULL;
+       void* barp = NULL;
+       void* _tmp4_;
+       _tmp0_ = g_strdup ("foo");
+       foo = _tmp0_;
+       _tmp1_ = foo;
+       foop = _tmp1_;
+       _tmp3_ = foo;
+       _tmp2_ = _tmp3_;
+       if (_tmp2_ == NULL) {
+               _tmp2_ = "bar";
+       }
+       bar = _tmp2_;
+       barp = bar;
+       _tmp4_ = foop;
+       _vala_assert (_tmp4_ == barp, "foop == barp");
+       _g_free0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/control-flow/bug665904.c-expected b/tests/control-flow/bug665904.c-expected
new file mode 100644
index 000000000..a66522b72
--- /dev/null
+++ b/tests/control-flow/bug665904.c-expected
@@ -0,0 +1,143 @@
+/* control_flow_bug665904.c generated by valac, the Vala compiler
+ * generated from control_flow_bug665904.vala, do not modify */
+
+#include <glib.h>
+#include <float.h>
+#include <math.h>
+#include <string.h>
+
+#define _g_free0(var) ((var == NULL) ? NULL : (var = (g_free (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (void);
+static gdouble* _double_dup (gdouble* self);
+static gboolean _double_equal (const gdouble * s1,
+                        const gdouble * s2);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static gdouble*
+_double_dup (gdouble* self)
+{
+       gdouble* dup;
+       dup = g_new0 (gdouble, 1);
+       memcpy (dup, self, sizeof (gdouble));
+       return dup;
+}
+
+static gpointer
+__double_dup0 (gpointer self)
+{
+       return self ? _double_dup (self) : NULL;
+}
+
+static gboolean
+_double_equal (const gdouble * s1,
+               const gdouble * s2)
+{
+       if (s1 == s2) {
+               return TRUE;
+       }
+       if (s1 == NULL) {
+               return FALSE;
+       }
+       if (s2 == NULL) {
+               return FALSE;
+       }
+       return (*s1) == (*s2);
+}
+
+static void
+_vala_main (void)
+{
+       gdouble** array = NULL;
+       gdouble _tmp0_;
+       gdouble* _tmp1_;
+       gdouble _tmp2_;
+       gdouble* _tmp3_;
+       gdouble _tmp4_;
+       gdouble* _tmp5_;
+       gdouble** _tmp6_;
+       gint array_length1;
+       gint _array_size_;
+       gdouble** _tmp7_;
+       gint _tmp7__length1;
+       _tmp0_ = (gdouble) 3;
+       _tmp1_ = __double_dup0 (&_tmp0_);
+       _tmp2_ = (gdouble) 3;
+       _tmp3_ = __double_dup0 (&_tmp2_);
+       _tmp4_ = (gdouble) 3;
+       _tmp5_ = __double_dup0 (&_tmp4_);
+       _tmp6_ = g_new0 (gdouble*, 3);
+       _tmp6_[0] = _tmp1_;
+       _tmp6_[1] = _tmp3_;
+       _tmp6_[2] = _tmp5_;
+       array = _tmp6_;
+       array_length1 = 3;
+       _array_size_ = array_length1;
+       _tmp7_ = array;
+       _tmp7__length1 = array_length1;
+       {
+               gdouble** i_collection = NULL;
+               gint i_collection_length1 = 0;
+               gint _i_collection_size_ = 0;
+               gint i_it = 0;
+               i_collection = _tmp7_;
+               i_collection_length1 = _tmp7__length1;
+               for (i_it = 0; i_it < i_collection_length1; i_it = i_it + 1) {
+                       gdouble* _tmp8_;
+                       gdouble* i = NULL;
+                       _tmp8_ = __double_dup0 (i_collection[i_it]);
+                       i = _tmp8_;
+                       {
+                               gdouble* _tmp9_;
+                               gdouble _tmp10_;
+                               _tmp9_ = i;
+                               _tmp10_ = (gdouble) 3;
+                               _vala_assert (_double_equal (_tmp9_, &_tmp10_) == TRUE, "i == 3");
+                               _g_free0 (i);
+                       }
+               }
+       }
+       array = (_vala_array_free (array, array_length1, (GDestroyNotify) g_free), NULL);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/control-flow/bug691514.c-expected b/tests/control-flow/bug691514.c-expected
new file mode 100644
index 000000000..baa9426df
--- /dev/null
+++ b/tests/control-flow/bug691514.c-expected
@@ -0,0 +1,227 @@
+/* control_flow_bug691514.c generated by valac, the Vala compiler
+ * generated from control_flow_bug691514.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN gchar** test (gint* result_length1,
+              GError** error);
+static void _vala_main (void);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+gchar**
+test (gint* result_length1,
+      GError** error)
+{
+       gchar* _tmp0_;
+       gchar** _tmp1_;
+       gchar** _tmp2_;
+       gint _tmp2__length1;
+       gchar** result = NULL;
+       _tmp0_ = g_strdup ("1");
+       _tmp1_ = g_new0 (gchar*, 2 + 1);
+       _tmp1_[0] = NULL;
+       _tmp1_[1] = _tmp0_;
+       _tmp2_ = _tmp1_;
+       _tmp2__length1 = 2;
+       if (result_length1) {
+               *result_length1 = _tmp2__length1;
+       }
+       result = _tmp2_;
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       const gchar* _tmp0_ = NULL;
+       const gchar* _tmp1_ = NULL;
+       gchar* t = NULL;
+       gchar* _tmp2_;
+       const gchar* _tmp3_;
+       const gchar* _tmp4_ = NULL;
+       const gchar* _tmp5_ = NULL;
+       gchar* _tmp6_;
+       const gchar* _tmp7_;
+       const gchar* _tmp8_ = NULL;
+       const gchar* _tmp9_ = NULL;
+       gchar* _tmp10_;
+       const gchar* _tmp11_;
+       const gchar* _tmp12_ = NULL;
+       const gchar* _tmp13_ = NULL;
+       gchar* _tmp14_;
+       const gchar* _tmp15_;
+       gchar** _tmp16_ = NULL;
+       gint _tmp17_ = 0;
+       gchar** _tmp18_;
+       gint _tmp16__length1;
+       gint __tmp16__size_;
+       const gchar* _tmp19_ = NULL;
+       const gchar* _tmp20_;
+       gchar* _tmp21_;
+       const gchar* _tmp22_;
+       gchar** _tmp23_ = NULL;
+       gint _tmp24_ = 0;
+       gchar** _tmp25_;
+       gint _tmp23__length1;
+       gint __tmp23__size_;
+       const gchar* _tmp26_ = NULL;
+       const gchar* _tmp27_;
+       gchar* _tmp28_;
+       const gchar* _tmp29_;
+       GError* _inner_error0_ = NULL;
+       if (TRUE) {
+               _tmp0_ = "1";
+       } else {
+               _tmp0_ = "2";
+       }
+       _tmp1_ = _tmp0_;
+       if (_tmp1_ == NULL) {
+               _tmp1_ = "3";
+       }
+       _tmp2_ = g_strdup (_tmp1_);
+       t = _tmp2_;
+       _tmp3_ = t;
+       _vala_assert (g_strcmp0 (_tmp3_, "1") == 0, "t == \"1\"");
+       if (FALSE) {
+               _tmp4_ = "1";
+       } else {
+               _tmp4_ = "2";
+       }
+       _tmp5_ = _tmp4_;
+       if (_tmp5_ == NULL) {
+               _tmp5_ = "3";
+       }
+       _tmp6_ = g_strdup (_tmp5_);
+       _g_free0 (t);
+       t = _tmp6_;
+       _tmp7_ = t;
+       _vala_assert (g_strcmp0 (_tmp7_, "2") == 0, "t == \"2\"");
+       if (TRUE) {
+               _tmp8_ = NULL;
+       } else {
+               _tmp8_ = "2";
+       }
+       _tmp9_ = _tmp8_;
+       if (_tmp9_ == NULL) {
+               _tmp9_ = "3";
+       }
+       _tmp10_ = g_strdup (_tmp9_);
+       _g_free0 (t);
+       t = _tmp10_;
+       _tmp11_ = t;
+       _vala_assert (g_strcmp0 (_tmp11_, "3") == 0, "t == \"3\"");
+       if (FALSE) {
+               _tmp12_ = "1";
+       } else {
+               _tmp12_ = NULL;
+       }
+       _tmp13_ = _tmp12_;
+       if (_tmp13_ == NULL) {
+               _tmp13_ = "3";
+       }
+       _tmp14_ = g_strdup (_tmp13_);
+       _g_free0 (t);
+       t = _tmp14_;
+       _tmp15_ = t;
+       _vala_assert (g_strcmp0 (_tmp15_, "3") == 0, "t == \"3\"");
+       _tmp18_ = test (&_tmp17_, &_inner_error0_);
+       _tmp16_ = _tmp18_;
+       _tmp16__length1 = _tmp17_;
+       __tmp16__size_ = _tmp16__length1;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_free0 (t);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp20_ = _tmp16_[0];
+       _tmp19_ = _tmp20_;
+       if (_tmp19_ == NULL) {
+               _tmp19_ = "2";
+       }
+       _tmp21_ = g_strdup (_tmp19_);
+       _g_free0 (t);
+       t = _tmp21_;
+       _tmp22_ = t;
+       _vala_assert (g_strcmp0 (_tmp22_, "2") == 0, "t == \"2\"");
+       _tmp25_ = test (&_tmp24_, &_inner_error0_);
+       _tmp23_ = _tmp25_;
+       _tmp23__length1 = _tmp24_;
+       __tmp23__size_ = _tmp23__length1;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _tmp16_ = (_vala_array_free (_tmp16_, _tmp16__length1, (GDestroyNotify) g_free), NULL);
+               _g_free0 (t);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp27_ = _tmp23_[1];
+       _tmp26_ = _tmp27_;
+       if (_tmp26_ == NULL) {
+               _tmp26_ = "2";
+       }
+       _tmp28_ = g_strdup (_tmp26_);
+       _g_free0 (t);
+       t = _tmp28_;
+       _tmp29_ = t;
+       _vala_assert (g_strcmp0 (_tmp29_, "1") == 0, "t == \"1\"");
+       _tmp23_ = (_vala_array_free (_tmp23_, _tmp23__length1, (GDestroyNotify) g_free), NULL);
+       _tmp16_ = (_vala_array_free (_tmp16_, _tmp16__length1, (GDestroyNotify) g_free), NULL);
+       _g_free0 (t);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/control-flow/bug736774-1.c-expected b/tests/control-flow/bug736774-1.c-expected
new file mode 100644
index 000000000..a84ab1ec1
--- /dev/null
+++ b/tests/control-flow/bug736774-1.c-expected
@@ -0,0 +1,173 @@
+/* control_flow_bug736774_1.c generated by valac, the Vala compiler
+ * generated from control_flow_bug736774_1.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+VALA_EXTERN gint success;
+gint success = 0;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (GObject * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN Foo* may_fail (GError** error);
+VALA_EXTERN void func (Foo* foo);
+static void _vala_main (void);
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       G_OBJECT_CLASS (klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static void
+foo_finalize (GObject * obj)
+{
+       Foo * self;
+       gint _tmp0_;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       _tmp0_ = success;
+       success = _tmp0_ + 1;
+       G_OBJECT_CLASS (foo_parent_class)->finalize (obj);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+Foo*
+may_fail (GError** error)
+{
+       Foo* _tmp0_;
+       Foo* result = NULL;
+       _tmp0_ = foo_new ();
+       result = _tmp0_;
+       return result;
+}
+
+void
+func (Foo* foo)
+{
+       g_return_if_fail (IS_FOO (foo));
+}
+
+static void
+_vala_main (void)
+{
+       GError* _inner_error0_ = NULL;
+       {
+               Foo* _tmp0_ = NULL;
+               Foo* _tmp1_;
+               _tmp1_ = may_fail (&_inner_error0_);
+               _tmp0_ = _tmp1_;
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       goto __catch0_g_error;
+               }
+               func (_tmp0_);
+               _g_object_unref0 (_tmp0_);
+       }
+       goto __finally0;
+       __catch0_g_error:
+       {
+               g_clear_error (&_inner_error0_);
+       }
+       __finally0:
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _vala_assert (success == 1, "success == 1");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/control-flow/bug736774-2.c-expected b/tests/control-flow/bug736774-2.c-expected
new file mode 100644
index 000000000..47d895124
--- /dev/null
+++ b/tests/control-flow/bug736774-2.c-expected
@@ -0,0 +1,103 @@
+/* control_flow_bug736774_2.c generated by valac, the Vala compiler
+ * generated from control_flow_bug736774_2.vala, do not modify */
+
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib/gi18n-lib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef gchar vstring;
+#define _vstring_destroy0(var) ((var == NULL) ? NULL : (var = (vstring_destroy (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN gint success;
+gint success = 0;
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (vstring, g_free)
+static void vstring_instance_init (vstring * self);
+VALA_EXTERN const vstring* vstring_new (const gchar* s);
+VALA_EXTERN void vstring_destroy (const vstring* self);
+VALA_EXTERN vstring* may_fail (GError** error);
+static void _vala_main (void);
+
+void
+vstring_destroy (const vstring* self)
+{
+       gint _tmp0_;
+       g_return_if_fail (self != NULL);
+       g_free (self);
+       _tmp0_ = success;
+       success = _tmp0_ + 1;
+}
+
+static void
+vstring_instance_init (vstring * self)
+{
+}
+
+vstring*
+may_fail (GError** error)
+{
+       vstring* _result_ = NULL;
+       gchar* _tmp0_;
+       vstring* _tmp1_;
+       vstring* result = NULL;
+       _tmp0_ = g_strdup ("test");
+       _result_ = (vstring*) _tmp0_;
+       _tmp1_ = _result_;
+       _result_ = NULL;
+       result = _tmp1_;
+       _vstring_destroy0 (_result_);
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       GError* _inner_error0_ = NULL;
+       {
+               vstring* _tmp0_ = NULL;
+               vstring* _tmp1_;
+               _tmp1_ = may_fail (&_inner_error0_);
+               _tmp0_ = _tmp1_;
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       goto __catch0_g_error;
+               }
+               g_print (_ ("%s\n"), _tmp0_);
+               _vstring_destroy0 (_tmp0_);
+       }
+       goto __finally0;
+       __catch0_g_error:
+       {
+               g_clear_error (&_inner_error0_);
+       }
+       __finally0:
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _vala_assert (success == 1, "success == 1");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/control-flow/bug764440.c-expected b/tests/control-flow/bug764440.c-expected
new file mode 100644
index 000000000..b49776996
--- /dev/null
+++ b/tests/control-flow/bug764440.c-expected
@@ -0,0 +1,93 @@
+/* control_flow_bug764440.c generated by valac, the Vala compiler
+ * generated from control_flow_bug764440.vala, do not modify */
+
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef enum  {
+       FOO_ERROR_BAR
+} FooError;
+#define FOO_ERROR foo_error_quark ()
+
+VALA_EXTERN GQuark foo_error_quark (void);
+VALA_EXTERN const gchar* get_bar (GError** error);
+static void _vala_main (void);
+
+GQuark
+foo_error_quark (void)
+{
+       return g_quark_from_static_string ("foo-error-quark");
+}
+
+const gchar*
+get_bar (GError** error)
+{
+       GError* _tmp0_;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = g_error_new_literal (FOO_ERROR, FOO_ERROR_BAR, "bar");
+       _inner_error0_ = _tmp0_;
+       if (_inner_error0_->domain == FOO_ERROR) {
+               g_propagate_error (error, _inner_error0_);
+               return NULL;
+       } else {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return NULL;
+       }
+}
+
+static void
+_vala_main (void)
+{
+       GError* _inner_error0_ = NULL;
+       {
+               const gchar* foo = NULL;
+               const gchar* _tmp0_ = NULL;
+               const gchar* _tmp1_;
+               const gchar* bar = NULL;
+               foo = "foo";
+               _tmp1_ = foo;
+               _tmp0_ = _tmp1_;
+               if (_tmp0_ == NULL) {
+                       const gchar* _tmp2_;
+                       _tmp2_ = get_bar (&_inner_error0_);
+                       _tmp0_ = _tmp2_;
+                       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                               goto __catch0_g_error;
+                       }
+               }
+               bar = _tmp0_;
+       }
+       goto __finally0;
+       __catch0_g_error:
+       {
+               g_clear_error (&_inner_error0_);
+               g_assert_not_reached ();
+       }
+       __finally0:
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/control-flow/coalesce-as-argument.c-expected 
b/tests/control-flow/coalesce-as-argument.c-expected
new file mode 100644
index 000000000..fe4772f78
--- /dev/null
+++ b/tests/control-flow/coalesce-as-argument.c-expected
@@ -0,0 +1,74 @@
+/* control_flow_coalesce_as_argument.c generated by valac, the Vala compiler
+ * generated from control_flow_coalesce_as_argument.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN void set_foo (const gchar* s);
+VALA_EXTERN gchar* get_bar (void);
+static void _vala_main (void);
+
+void
+set_foo (const gchar* s)
+{
+       g_return_if_fail (s != NULL);
+       _vala_assert (g_strcmp0 (s, "bar") == 0, "s == \"bar\"");
+}
+
+gchar*
+get_bar (void)
+{
+       gchar* _tmp0_;
+       gchar* result = NULL;
+       _tmp0_ = g_strdup ("bar");
+       result = _tmp0_;
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       gchar* s = NULL;
+       gchar* _tmp0_ = NULL;
+       const gchar* _tmp1_;
+       gchar* _tmp2_;
+       s = NULL;
+       _tmp1_ = s;
+       _tmp2_ = g_strdup (_tmp1_);
+       _tmp0_ = _tmp2_;
+       if (_tmp0_ == NULL) {
+               gchar* _tmp3_;
+               _tmp3_ = get_bar ();
+               _g_free0 (_tmp0_);
+               _tmp0_ = _tmp3_;
+       }
+       set_foo (_tmp0_);
+       _g_free0 (_tmp0_);
+       _g_free0 (s);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/control-flow/coalesce-execution-order.c-expected 
b/tests/control-flow/coalesce-execution-order.c-expected
new file mode 100644
index 000000000..a2e52dae8
--- /dev/null
+++ b/tests/control-flow/coalesce-execution-order.c-expected
@@ -0,0 +1,102 @@
+/* control_flow_coalesce_execution_order.c generated by valac, the Vala compiler
+ * generated from control_flow_coalesce_execution_order.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN gint count;
+gint count = 0;
+
+VALA_EXTERN gchar* get_foo (void);
+VALA_EXTERN gchar* get_bar (void);
+static void _vala_main (void);
+
+gchar*
+get_foo (void)
+{
+       gchar* result = NULL;
+       _vala_assert (count == 0, "count == 0");
+       result = NULL;
+       return result;
+}
+
+gchar*
+get_bar (void)
+{
+       gint _tmp0_;
+       gchar* _tmp1_;
+       gchar* result = NULL;
+       _tmp0_ = count;
+       count = _tmp0_ + 1;
+       _vala_assert (count == 1, "count == 1");
+       _tmp1_ = g_strdup ("bar");
+       result = _tmp1_;
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       gchar* s = NULL;
+       gchar* _tmp0_ = NULL;
+       const gchar* _tmp1_;
+       gchar* _tmp2_;
+       gchar* foo = NULL;
+       gchar* _tmp7_;
+       count = 0;
+       s = NULL;
+       _tmp1_ = s;
+       _tmp2_ = g_strdup (_tmp1_);
+       _tmp0_ = _tmp2_;
+       if (_tmp0_ == NULL) {
+               gchar* _tmp3_ = NULL;
+               gchar* _tmp4_;
+               gchar* _tmp6_;
+               _tmp4_ = get_foo ();
+               _tmp3_ = _tmp4_;
+               if (_tmp3_ == NULL) {
+                       gchar* _tmp5_;
+                       _tmp5_ = get_bar ();
+                       _g_free0 (_tmp3_);
+                       _tmp3_ = _tmp5_;
+               }
+               _tmp6_ = _tmp3_;
+               _tmp3_ = NULL;
+               _g_free0 (_tmp0_);
+               _tmp0_ = _tmp6_;
+               _g_free0 (_tmp3_);
+       }
+       _tmp7_ = _tmp0_;
+       _tmp0_ = NULL;
+       foo = _tmp7_;
+       _vala_assert (g_strcmp0 (foo, "bar") == 0, "foo == \"bar\"");
+       _g_free0 (foo);
+       _g_free0 (_tmp0_);
+       _g_free0 (s);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/control-flow/coalesce-reference-transfer.c-expected 
b/tests/control-flow/coalesce-reference-transfer.c-expected
new file mode 100644
index 000000000..9bbb1de6b
--- /dev/null
+++ b/tests/control-flow/coalesce-reference-transfer.c-expected
@@ -0,0 +1,143 @@
+/* control_flow_coalesce_reference_transfer.c generated by valac, the Vala compiler
+ * generated from control_flow_coalesce_reference_transfer.vala, do not modify */
+
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef struct _Foo Foo;
+#define _foo_free0(var) ((var == NULL) ? NULL : (var = (foo_free (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       gint i;
+};
+
+VALA_EXTERN void foo_free (Foo * self);
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_free)
+static void foo_instance_init (Foo * self);
+VALA_EXTERN Foo* foo_new (gint i);
+VALA_EXTERN Foo* get_foo (gint* i);
+static void _vala_main (void);
+
+Foo*
+foo_new (gint i)
+{
+       Foo* self;
+       self = g_slice_new0 (Foo);
+       foo_instance_init (self);
+       self->i = i;
+       return self;
+}
+
+static void
+foo_instance_init (Foo * self)
+{
+}
+
+void
+foo_free (Foo * self)
+{
+       g_slice_free (Foo, self);
+}
+
+Foo*
+get_foo (gint* i)
+{
+       Foo* _tmp0_ = NULL;
+       Foo* result = NULL;
+       if (i != NULL) {
+               Foo* _tmp1_;
+               _tmp1_ = foo_new (*i);
+               _foo_free0 (_tmp0_);
+               _tmp0_ = _tmp1_;
+       } else {
+               _foo_free0 (_tmp0_);
+               _tmp0_ = NULL;
+       }
+       result = _tmp0_;
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       {
+               Foo* _tmp0_ = NULL;
+               Foo* _tmp1_;
+               Foo* foo = NULL;
+               Foo* _tmp4_;
+               Foo* _tmp5_;
+               _tmp1_ = get_foo (NULL);
+               _tmp0_ = _tmp1_;
+               if (_tmp0_ == NULL) {
+                       gint _tmp2_;
+                       Foo* _tmp3_;
+                       _tmp2_ = 42;
+                       _tmp3_ = get_foo (&_tmp2_);
+                       _foo_free0 (_tmp0_);
+                       _tmp0_ = _tmp3_;
+               }
+               _tmp4_ = _tmp0_;
+               _tmp0_ = NULL;
+               foo = _tmp4_;
+               _tmp5_ = foo;
+               _vala_assert (_tmp5_->i == 42, "foo.i == 42");
+               _foo_free0 (foo);
+               _foo_free0 (_tmp0_);
+       }
+       {
+               Foo* _tmp6_ = NULL;
+               Foo* _tmp7_;
+               Foo* foo = NULL;
+               Foo* _tmp13_;
+               _tmp7_ = get_foo (NULL);
+               _tmp6_ = _tmp7_;
+               if (_tmp6_ == NULL) {
+                       Foo* _tmp8_ = NULL;
+                       Foo* _tmp9_;
+                       Foo* _tmp12_;
+                       _tmp9_ = get_foo (NULL);
+                       _tmp8_ = _tmp9_;
+                       if (_tmp8_ == NULL) {
+                               gint _tmp10_;
+                               Foo* _tmp11_;
+                               _tmp10_ = 42;
+                               _tmp11_ = get_foo (&_tmp10_);
+                               _foo_free0 (_tmp8_);
+                               _tmp8_ = _tmp11_;
+                       }
+                       _tmp12_ = _tmp8_;
+                       _tmp8_ = NULL;
+                       _foo_free0 (_tmp6_);
+                       _tmp6_ = _tmp12_;
+                       _foo_free0 (_tmp8_);
+               }
+               _tmp13_ = _tmp6_;
+               _tmp6_ = NULL;
+               foo = _tmp13_;
+               _vala_assert (foo->i == 42, "foo.i == 42");
+               _foo_free0 (foo);
+               _foo_free0 (_tmp6_);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/control-flow/coalesce-right-value.c-expected 
b/tests/control-flow/coalesce-right-value.c-expected
new file mode 100644
index 000000000..e02d16825
--- /dev/null
+++ b/tests/control-flow/coalesce-right-value.c-expected
@@ -0,0 +1,173 @@
+/* control_flow_coalesce_right_value.c generated by valac, the Vala compiler
+ * generated from control_flow_coalesce_right_value.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+#define _g_free0(var) ((var == NULL) ? NULL : (var = (g_free (var), NULL)))
+#define _foo_free0(var) ((var == NULL) ? NULL : (var = (foo_free (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       gint i;
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+static void _vala_main (void);
+static gint* _int_dup (gint* self);
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       memcpy (dup, self, sizeof (Foo));
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static gint*
+_int_dup (gint* self)
+{
+       gint* dup;
+       dup = g_new0 (gint, 1);
+       memcpy (dup, self, sizeof (gint));
+       return dup;
+}
+
+static gpointer
+__int_dup0 (gpointer self)
+{
+       return self ? _int_dup (self) : NULL;
+}
+
+static gpointer
+_foo_dup0 (gpointer self)
+{
+       return self ? foo_dup (self) : NULL;
+}
+
+static void
+_vala_main (void)
+{
+       {
+               gint* null_int = NULL;
+               gint* _tmp0_ = NULL;
+               gint* _tmp1_;
+               gint* _tmp2_;
+               gint i = 0;
+               gint* _tmp5_;
+               gint* _tmp6_;
+               gint _tmp7_;
+               null_int = NULL;
+               _tmp1_ = null_int;
+               _tmp2_ = __int_dup0 (_tmp1_);
+               _tmp0_ = _tmp2_;
+               if (_tmp0_ == NULL) {
+                       gint _tmp3_;
+                       gint* _tmp4_;
+                       _tmp3_ = 42;
+                       _tmp4_ = __int_dup0 (&_tmp3_);
+                       _g_free0 (_tmp0_);
+                       _tmp0_ = _tmp4_;
+               }
+               _tmp5_ = _tmp0_;
+               _tmp0_ = NULL;
+               _tmp6_ = _tmp5_;
+               _tmp7_ = *_tmp6_;
+               _g_free0 (_tmp6_);
+               i = _tmp7_;
+               _vala_assert (i == 42, "i == 42");
+               _g_free0 (_tmp0_);
+               _g_free0 (null_int);
+       }
+       {
+               Foo* null_foo = NULL;
+               Foo right_foo = {0};
+               Foo _tmp8_ = {0};
+               Foo* _tmp9_ = NULL;
+               Foo* _tmp10_;
+               Foo* _tmp11_;
+               Foo foo = {0};
+               Foo* _tmp14_;
+               Foo* _tmp15_;
+               Foo _tmp16_;
+               Foo _tmp17_;
+               null_foo = NULL;
+               _tmp8_.i = 42;
+               right_foo = _tmp8_;
+               _tmp10_ = null_foo;
+               _tmp11_ = _foo_dup0 (_tmp10_);
+               _tmp9_ = _tmp11_;
+               if (_tmp9_ == NULL) {
+                       Foo _tmp12_;
+                       Foo* _tmp13_;
+                       _tmp12_ = right_foo;
+                       _tmp13_ = _foo_dup0 (&_tmp12_);
+                       _foo_free0 (_tmp9_);
+                       _tmp9_ = _tmp13_;
+               }
+               _tmp14_ = _tmp9_;
+               _tmp9_ = NULL;
+               _tmp15_ = _tmp14_;
+               _tmp16_ = *_tmp15_;
+               _foo_free0 (_tmp15_);
+               foo = _tmp16_;
+               _tmp17_ = foo;
+               _vala_assert (_tmp17_.i == 42, "foo.i == 42");
+               _foo_free0 (_tmp9_);
+               _foo_free0 (null_foo);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/control-flow/coalesce-short-circuit.c-expected 
b/tests/control-flow/coalesce-short-circuit.c-expected
new file mode 100644
index 000000000..461a854a0
--- /dev/null
+++ b/tests/control-flow/coalesce-short-circuit.c-expected
@@ -0,0 +1,99 @@
+/* control_flow_coalesce_short_circuit.c generated by valac, the Vala compiler
+ * generated from control_flow_coalesce_short_circuit.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN gchar* get_foo (void);
+static void _vala_main (void);
+
+gchar*
+get_foo (void)
+{
+       g_assert_not_reached ();
+}
+
+static void
+_vala_main (void)
+{
+       {
+               gchar* _tmp0_ = NULL;
+               gchar* _tmp1_;
+               gchar* foo = NULL;
+               gchar* _tmp3_;
+               const gchar* _tmp4_;
+               _tmp1_ = g_strdup ("foo");
+               _tmp0_ = _tmp1_;
+               if (_tmp0_ == NULL) {
+                       gchar* _tmp2_;
+                       _tmp2_ = get_foo ();
+                       _g_free0 (_tmp0_);
+                       _tmp0_ = _tmp2_;
+               }
+               _tmp3_ = _tmp0_;
+               _tmp0_ = NULL;
+               foo = _tmp3_;
+               _tmp4_ = foo;
+               _vala_assert (g_strcmp0 (_tmp4_, "foo") == 0, "foo == \"foo\"");
+               _g_free0 (foo);
+               _g_free0 (_tmp0_);
+       }
+       {
+               gchar* _tmp5_ = NULL;
+               gchar* _tmp6_;
+               gchar* foo = NULL;
+               gchar* _tmp11_;
+               _tmp6_ = g_strdup ("foo");
+               _tmp5_ = _tmp6_;
+               if (_tmp5_ == NULL) {
+                       gchar* _tmp7_ = NULL;
+                       gchar* _tmp8_;
+                       gchar* _tmp10_;
+                       _tmp8_ = get_foo ();
+                       _tmp7_ = _tmp8_;
+                       if (_tmp7_ == NULL) {
+                               gchar* _tmp9_;
+                               _tmp9_ = get_foo ();
+                               _g_free0 (_tmp7_);
+                               _tmp7_ = _tmp9_;
+                       }
+                       _tmp10_ = _tmp7_;
+                       _tmp7_ = NULL;
+                       _g_free0 (_tmp5_);
+                       _tmp5_ = _tmp10_;
+                       _g_free0 (_tmp7_);
+               }
+               _tmp11_ = _tmp5_;
+               _tmp5_ = NULL;
+               foo = _tmp11_;
+               _vala_assert (g_strcmp0 (foo, "foo") == 0, "foo == \"foo\"");
+               _g_free0 (foo);
+               _g_free0 (_tmp5_);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/control-flow/conditional-as-argument.c-expected 
b/tests/control-flow/conditional-as-argument.c-expected
new file mode 100644
index 000000000..15fa908ff
--- /dev/null
+++ b/tests/control-flow/conditional-as-argument.c-expected
@@ -0,0 +1,76 @@
+/* control_flow_conditional_as_argument.c generated by valac, the Vala compiler
+ * generated from control_flow_conditional_as_argument.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN void set_foo (const gchar* s);
+VALA_EXTERN gchar* get_bar (void);
+static void _vala_main (void);
+
+void
+set_foo (const gchar* s)
+{
+       g_return_if_fail (s != NULL);
+       _vala_assert (g_strcmp0 (s, "bar") == 0, "s == \"bar\"");
+}
+
+gchar*
+get_bar (void)
+{
+       gchar* _tmp0_;
+       gchar* result = NULL;
+       _tmp0_ = g_strdup ("bar");
+       result = _tmp0_;
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       gchar* s = NULL;
+       gchar* _tmp0_ = NULL;
+       const gchar* _tmp1_;
+       s = NULL;
+       _tmp1_ = s;
+       if (_tmp1_ == NULL) {
+               gchar* _tmp2_;
+               _tmp2_ = get_bar ();
+               _g_free0 (_tmp0_);
+               _tmp0_ = _tmp2_;
+       } else {
+               gchar* _tmp3_;
+               _tmp3_ = g_strdup ("foo");
+               _g_free0 (_tmp0_);
+               _tmp0_ = _tmp3_;
+       }
+       set_foo (_tmp0_);
+       _g_free0 (_tmp0_);
+       _g_free0 (s);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/control-flow/expressions-conditional.c-expected 
b/tests/control-flow/expressions-conditional.c-expected
new file mode 100644
index 000000000..9ef5cfa08
--- /dev/null
+++ b/tests/control-flow/expressions-conditional.c-expected
@@ -0,0 +1,160 @@
+/* control_flow_expressions_conditional.c generated by valac, the Vala compiler
+ * generated from control_flow_expressions_conditional.vala, do not modify */
+
+#include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+#include <stdio.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define MAMAN_TYPE_BAR (maman_bar_get_type ())
+#define MAMAN_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_BAR, MamanBar))
+#define MAMAN_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAMAN_TYPE_BAR, MamanBarClass))
+#define MAMAN_IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_BAR))
+#define MAMAN_IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAMAN_TYPE_BAR))
+#define MAMAN_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAMAN_TYPE_BAR, MamanBarClass))
+
+typedef struct _MamanBar MamanBar;
+typedef struct _MamanBarClass MamanBarClass;
+typedef struct _MamanBarPrivate MamanBarPrivate;
+enum  {
+       MAMAN_BAR_0_PROPERTY,
+       MAMAN_BAR_NUM_PROPERTIES
+};
+static GParamSpec* maman_bar_properties[MAMAN_BAR_NUM_PROPERTIES];
+#define _g_free0(var) (var = (g_free (var), NULL))
+
+struct _MamanBar {
+       GObject parent_instance;
+       MamanBarPrivate * priv;
+};
+
+struct _MamanBarClass {
+       GObjectClass parent_class;
+};
+
+static gpointer maman_bar_parent_class = NULL;
+
+VALA_EXTERN GType maman_bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MamanBar, g_object_unref)
+static gchar* maman_bar_get_number (void);
+static gint maman_bar_main (void);
+VALA_EXTERN MamanBar* maman_bar_new (void);
+VALA_EXTERN MamanBar* maman_bar_construct (GType object_type);
+static GType maman_bar_get_type_once (void);
+
+static gchar*
+maman_bar_get_number (void)
+{
+       const gchar* _tmp0_ = NULL;
+       gchar* _tmp1_;
+       gchar* result = NULL;
+       if (FALSE) {
+               _tmp0_ = "BAD";
+       } else {
+               _tmp0_ = "4";
+       }
+       _tmp1_ = g_strdup (_tmp0_);
+       result = _tmp1_;
+       return result;
+}
+
+static gint
+maman_bar_main (void)
+{
+       FILE* _tmp0_;
+       gint _tmp1_ = 0;
+       FILE* _tmp2_;
+       FILE* _tmp3_;
+       FILE* _tmp4_;
+       gchar* _tmp5_;
+       gchar* _tmp6_;
+       FILE* _tmp7_;
+       gint result = 0;
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, "Conditional Expression Test: 1");
+       if (FALSE) {
+               _tmp1_ = -1;
+       } else {
+               _tmp1_ = 2;
+       }
+       _tmp2_ = stdout;
+       fprintf (_tmp2_, " %d", _tmp1_);
+       _tmp3_ = stdout;
+       fprintf (_tmp3_, " 3");
+       _tmp4_ = stdout;
+       _tmp5_ = maman_bar_get_number ();
+       _tmp6_ = _tmp5_;
+       fprintf (_tmp4_, " %s", _tmp6_);
+       _g_free0 (_tmp6_);
+       _tmp7_ = stdout;
+       fprintf (_tmp7_, " 5\n");
+       result = 0;
+       return result;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       return maman_bar_main ();
+}
+
+MamanBar*
+maman_bar_construct (GType object_type)
+{
+       MamanBar * self = NULL;
+       self = (MamanBar*) g_object_new (object_type, NULL);
+       return self;
+}
+
+MamanBar*
+maman_bar_new (void)
+{
+       return maman_bar_construct (MAMAN_TYPE_BAR);
+}
+
+static void
+maman_bar_class_init (MamanBarClass * klass,
+                      gpointer klass_data)
+{
+       maman_bar_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+maman_bar_instance_init (MamanBar * self,
+                         gpointer klass)
+{
+}
+
+static GType
+maman_bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (MamanBarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(MamanBar), 0, (GInstanceInitFunc) maman_bar_instance_init, NULL };
+       GType maman_bar_type_id;
+       maman_bar_type_id = g_type_register_static (G_TYPE_OBJECT, "MamanBar", &g_define_type_info, 0);
+       return maman_bar_type_id;
+}
+
+GType
+maman_bar_get_type (void)
+{
+       static volatile gsize maman_bar_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_bar_type_id__volatile)) {
+               GType maman_bar_type_id;
+               maman_bar_type_id = maman_bar_get_type_once ();
+               g_once_init_leave (&maman_bar_type_id__volatile, maman_bar_type_id);
+       }
+       return maman_bar_type_id__volatile;
+}
+
diff --git a/tests/control-flow/for-switch-continue.c-expected 
b/tests/control-flow/for-switch-continue.c-expected
new file mode 100644
index 000000000..afe3bf145
--- /dev/null
+++ b/tests/control-flow/for-switch-continue.c-expected
@@ -0,0 +1,173 @@
+/* control_flow_for_switch_continue.c generated by valac, the Vala compiler
+ * generated from control_flow_for_switch_continue.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+VALA_EXTERN gboolean success;
+gboolean success = FALSE;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (GObject * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN void bar (void);
+static void _vala_main (void);
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       G_OBJECT_CLASS (klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static void
+foo_finalize (GObject * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       success = TRUE;
+       G_OBJECT_CLASS (foo_parent_class)->finalize (obj);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+void
+bar (void)
+{
+       _vala_assert (!success, "!success");
+       {
+               gint i = 0;
+               i = 0;
+               {
+                       gboolean _tmp0_ = FALSE;
+                       _tmp0_ = TRUE;
+                       while (TRUE) {
+                               Foo* foo = NULL;
+                               if (!_tmp0_) {
+                                       gint _tmp1_;
+                                       _tmp1_ = i;
+                                       i = _tmp1_ + 1;
+                               }
+                               _tmp0_ = FALSE;
+                               if (!(i < 1)) {
+                                       break;
+                               }
+                               foo = NULL;
+                               switch (i) {
+                                       case 0:
+                                       {
+                                               Foo* _tmp2_;
+                                               _tmp2_ = foo_new ();
+                                               _g_object_unref0 (foo);
+                                               foo = _tmp2_;
+                                               _g_object_unref0 (foo);
+                                               continue;
+                                       }
+                                       default:
+                                       break;
+                               }
+                               _g_object_unref0 (foo);
+                       }
+               }
+       }
+       _vala_assert (success, "success");
+}
+
+static void
+_vala_main (void)
+{
+       bar ();
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/control-flow/for.c-expected b/tests/control-flow/for.c-expected
new file mode 100644
index 000000000..f873866c4
--- /dev/null
+++ b/tests/control-flow/for.c-expected
@@ -0,0 +1,90 @@
+/* control_flow_for.c generated by valac, the Vala compiler
+ * generated from control_flow_for.vala, do not modify */
+
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+VALA_EXTERN void void_method (void);
+VALA_EXTERN void test_for_void_methods (void);
+VALA_EXTERN void condition_true (void);
+VALA_EXTERN void condition_false (void);
+static void _vala_main (void);
+
+void
+void_method (void)
+{
+}
+
+void
+test_for_void_methods (void)
+{
+       {
+               gboolean _tmp0_ = FALSE;
+               void_method ();
+               _tmp0_ = TRUE;
+               while (TRUE) {
+                       if (!_tmp0_) {
+                               void_method ();
+                       }
+                       _tmp0_ = FALSE;
+                       break;
+               }
+       }
+}
+
+void
+condition_true (void)
+{
+       {
+               gboolean _tmp0_ = FALSE;
+               _tmp0_ = TRUE;
+               while (TRUE) {
+                       if (!_tmp0_) {
+                       }
+                       _tmp0_ = FALSE;
+                       return;
+               }
+       }
+       g_assert_not_reached ();
+}
+
+void
+condition_false (void)
+{
+       {
+               gboolean _tmp0_ = FALSE;
+               _tmp0_ = TRUE;
+               while (TRUE) {
+                       if (!_tmp0_) {
+                       }
+                       _tmp0_ = FALSE;
+                       break;
+               }
+       }
+}
+
+static void
+_vala_main (void)
+{
+       condition_true ();
+       condition_false ();
+       test_for_void_methods ();
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/control-flow/foreach.c-expected b/tests/control-flow/foreach.c-expected
new file mode 100644
index 000000000..3a704b938
--- /dev/null
+++ b/tests/control-flow/foreach.c-expected
@@ -0,0 +1,470 @@
+/* control_flow_foreach.c generated by valac, the Vala compiler
+ * generated from control_flow_foreach.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _g_value_array_free0(var) ((var == NULL) ? NULL : (var = (g_value_array_free (var), NULL)))
+#define __vala_GValue_free0(var) ((var == NULL) ? NULL : (var = (_vala_GValue_free (var), NULL)))
+#define _g_ptr_array_unref0(var) ((var == NULL) ? NULL : (var = (g_ptr_array_unref (var), NULL)))
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN void test_owned (GValueArray* array);
+VALA_EXTERN void test_unowned (GValueArray* array);
+VALA_EXTERN void test_foreach_gvaluearray (void);
+VALA_EXTERN void test_generic_array_owned (GPtrArray* array);
+static GValue* _g_value_dup (GValue* self);
+static void _vala_GValue_free (GValue* self);
+VALA_EXTERN void test_generic_array_unowned (GPtrArray* array);
+VALA_EXTERN void test_foreach_genericarray (void);
+static void __vala_GValue_free0_ (gpointer var);
+VALA_EXTERN void test_foreach_multidim_array (void);
+VALA_EXTERN void test_foreach_const_array (void);
+VALA_EXTERN void test_foreach_slice_array (void);
+static void _vala_main (void);
+
+const gint FOO[6] = {1, 2, 3, 4, 5, 6};
+const gint BAR[6] = {6, 5, 4, 3, 2, 1};
+
+void
+test_owned (GValueArray* array)
+{
+       guint i = 0U;
+       g_return_if_fail (array != NULL);
+       i = (guint) 0;
+       {
+               GValueArray* item_collection = NULL;
+               guint item_index = 0U;
+               item_collection = array;
+               for (item_index = 0; item_index < item_collection->n_values; item_index = item_index + 1) {
+                       GValue _tmp0_;
+                       GValue _tmp1_ = {0};
+                       GValue item = {0};
+                       _tmp0_ = *g_value_array_get_nth (item_collection, item_index);
+                       if (G_IS_VALUE (&_tmp0_)) {
+                               g_value_init (&_tmp1_, G_VALUE_TYPE (&_tmp0_));
+                               g_value_copy (&_tmp0_, &_tmp1_);
+                       } else {
+                               _tmp1_ = _tmp0_;
+                       }
+                       item = _tmp1_;
+                       {
+                               guint _tmp2_;
+                               _tmp2_ = i;
+                               i = _tmp2_ + 1;
+                               G_IS_VALUE (&item) ? (g_value_unset (&item), NULL) : NULL;
+                       }
+               }
+       }
+       _vala_assert (i == ((guint) 3), "i == 3");
+}
+
+void
+test_unowned (GValueArray* array)
+{
+       guint i = 0U;
+       g_return_if_fail (array != NULL);
+       i = (guint) 0;
+       {
+               GValueArray* item_collection = NULL;
+               guint item_index = 0U;
+               item_collection = array;
+               for (item_index = 0; item_index < item_collection->n_values; item_index = item_index + 1) {
+                       GValue item = {0};
+                       item = *g_value_array_get_nth (item_collection, item_index);
+                       {
+                               guint _tmp0_;
+                               _tmp0_ = i;
+                               i = _tmp0_ + 1;
+                       }
+               }
+       }
+       _vala_assert (i == ((guint) 3), "i == 3");
+}
+
+void
+test_foreach_gvaluearray (void)
+{
+       GValue value = {0};
+       GValueArray* array = NULL;
+       GValueArray* _tmp0_;
+       GValue _tmp1_ = {0};
+       GValue _tmp2_;
+       GValue _tmp3_ = {0};
+       GValue _tmp4_;
+       GValue _tmp5_ = {0};
+       GValue _tmp6_;
+       _tmp0_ = g_value_array_new ((guint) 3);
+       array = _tmp0_;
+       g_value_init (&_tmp1_, G_TYPE_INT);
+       g_value_set_int (&_tmp1_, 1);
+       G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL;
+       value = _tmp1_;
+       _tmp2_ = value;
+       g_value_array_append (array, &_tmp2_);
+       g_value_init (&_tmp3_, G_TYPE_DOUBLE);
+       g_value_set_double (&_tmp3_, 2.0);
+       G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL;
+       value = _tmp3_;
+       _tmp4_ = value;
+       g_value_array_append (array, &_tmp4_);
+       g_value_init (&_tmp5_, G_TYPE_STRING);
+       g_value_set_string (&_tmp5_, "three");
+       G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL;
+       value = _tmp5_;
+       _tmp6_ = value;
+       g_value_array_append (array, &_tmp6_);
+       test_owned (array);
+       test_unowned (array);
+       _g_value_array_free0 (array);
+       G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL;
+}
+
+static GValue*
+_g_value_dup (GValue* self)
+{
+       return g_boxed_copy (G_TYPE_VALUE, self);
+}
+
+static gpointer
+__g_value_dup0 (gpointer self)
+{
+       return self ? _g_value_dup (self) : NULL;
+}
+
+static void
+_vala_GValue_free (GValue* self)
+{
+       g_boxed_free (G_TYPE_VALUE, self);
+}
+
+void
+test_generic_array_owned (GPtrArray* array)
+{
+       guint i = 0U;
+       g_return_if_fail (array != NULL);
+       i = (guint) 0;
+       {
+               GPtrArray* item_collection = NULL;
+               guint item_index = 0U;
+               item_collection = array;
+               for (item_index = 0; item_index < item_collection->len; item_index = item_index + 1) {
+                       GValue* _tmp0_;
+                       GValue* item = NULL;
+                       _tmp0_ = __g_value_dup0 (g_ptr_array_index (item_collection, item_index));
+                       item = _tmp0_;
+                       {
+                               guint _tmp1_;
+                               _tmp1_ = i;
+                               i = _tmp1_ + 1;
+                               __vala_GValue_free0 (item);
+                       }
+               }
+       }
+       _vala_assert (i == ((guint) 3), "i == 3");
+}
+
+void
+test_generic_array_unowned (GPtrArray* array)
+{
+       guint i = 0U;
+       g_return_if_fail (array != NULL);
+       i = (guint) 0;
+       {
+               GPtrArray* item_collection = NULL;
+               guint item_index = 0U;
+               item_collection = array;
+               for (item_index = 0; item_index < item_collection->len; item_index = item_index + 1) {
+                       GValue* item = NULL;
+                       item = g_ptr_array_index (item_collection, item_index);
+                       {
+                               guint _tmp0_;
+                               _tmp0_ = i;
+                               i = _tmp0_ + 1;
+                       }
+               }
+       }
+       _vala_assert (i == ((guint) 3), "i == 3");
+}
+
+static void
+__vala_GValue_free0_ (gpointer var)
+{
+       (var == NULL) ? NULL : (var = (_vala_GValue_free (var), NULL));
+}
+
+void
+test_foreach_genericarray (void)
+{
+       GValue value = {0};
+       GPtrArray* array = NULL;
+       GPtrArray* _tmp0_;
+       GValue _tmp1_ = {0};
+       GValue _tmp2_;
+       GValue _tmp3_;
+       GValue* _tmp4_;
+       GValue _tmp5_ = {0};
+       GValue _tmp6_;
+       GValue _tmp7_;
+       GValue* _tmp8_;
+       GValue _tmp9_ = {0};
+       GValue _tmp10_;
+       GValue _tmp11_;
+       GValue* _tmp12_;
+       _tmp0_ = g_ptr_array_new_full ((guint) 0, __vala_GValue_free0_);
+       array = _tmp0_;
+       g_value_init (&_tmp1_, G_TYPE_INT);
+       g_value_set_int (&_tmp1_, 1);
+       G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL;
+       value = _tmp1_;
+       _tmp2_ = value;
+       _tmp3_ = _tmp2_;
+       _tmp4_ = __g_value_dup0 (&_tmp3_);
+       g_ptr_array_add (array, _tmp4_);
+       g_value_init (&_tmp5_, G_TYPE_DOUBLE);
+       g_value_set_double (&_tmp5_, 2.0);
+       G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL;
+       value = _tmp5_;
+       _tmp6_ = value;
+       _tmp7_ = _tmp6_;
+       _tmp8_ = __g_value_dup0 (&_tmp7_);
+       g_ptr_array_add (array, _tmp8_);
+       g_value_init (&_tmp9_, G_TYPE_STRING);
+       g_value_set_string (&_tmp9_, "three");
+       G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL;
+       value = _tmp9_;
+       _tmp10_ = value;
+       _tmp11_ = _tmp10_;
+       _tmp12_ = __g_value_dup0 (&_tmp11_);
+       g_ptr_array_add (array, _tmp12_);
+       test_generic_array_owned (array);
+       test_generic_array_unowned (array);
+       _g_ptr_array_unref0 (array);
+       G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL;
+}
+
+void
+test_foreach_multidim_array (void)
+{
+       gint* foo = NULL;
+       gint* _tmp0_;
+       gint foo_length1;
+       gint foo_length2;
+       gchar* _result_ = NULL;
+       gchar* _tmp1_;
+       gint* _tmp2_;
+       gint _tmp2__length1;
+       gint _tmp2__length2;
+       const gchar* _tmp7_;
+       _tmp0_ = g_new0 (gint, 3 * 2);
+       _tmp0_[0] = 1;
+       _tmp0_[1] = 2;
+       _tmp0_[2] = 3;
+       _tmp0_[3] = 4;
+       _tmp0_[4] = 5;
+       _tmp0_[5] = 6;
+       foo = _tmp0_;
+       foo_length1 = 3;
+       foo_length2 = 2;
+       _tmp1_ = g_strdup ("");
+       _result_ = _tmp1_;
+       _tmp2_ = foo;
+       _tmp2__length1 = foo_length1;
+       _tmp2__length2 = foo_length2;
+       {
+               gint* i_collection = NULL;
+               gint i_collection_length1 = 0;
+               gint i_collection_length2 = 0;
+               gint i_it = 0;
+               i_collection = _tmp2_;
+               i_collection_length1 = _tmp2__length1 * _tmp2__length2;
+               for (i_it = 0; i_it < i_collection_length1; i_it = i_it + 1) {
+                       gint i = 0;
+                       i = i_collection[i_it];
+                       {
+                               const gchar* _tmp3_;
+                               gchar* _tmp4_;
+                               gchar* _tmp5_;
+                               gchar* _tmp6_;
+                               _tmp3_ = _result_;
+                               _tmp4_ = g_strdup_printf ("%i", i);
+                               _tmp5_ = _tmp4_;
+                               _tmp6_ = g_strconcat (_tmp3_, _tmp5_, NULL);
+                               _g_free0 (_result_);
+                               _result_ = _tmp6_;
+                               _g_free0 (_tmp5_);
+                       }
+               }
+       }
+       _tmp7_ = _result_;
+       _vala_assert (g_strcmp0 (_tmp7_, "123456") == 0, "result == \"123456\"");
+       _g_free0 (_result_);
+       foo = (g_free (foo), NULL);
+}
+
+void
+test_foreach_const_array (void)
+{
+       gchar* _result_ = NULL;
+       gchar* _tmp0_;
+       const gchar* _tmp5_;
+       gchar* result2 = NULL;
+       gchar* _tmp6_;
+       const gchar* _tmp11_;
+       _tmp0_ = g_strdup ("");
+       _result_ = _tmp0_;
+       {
+               gint* i_collection = NULL;
+               gint i_collection_length1 = 0;
+               gint _i_collection_size_ = 0;
+               gint i_it = 0;
+               i_collection = FOO;
+               i_collection_length1 = G_N_ELEMENTS (FOO);
+               for (i_it = 0; i_it < i_collection_length1; i_it = i_it + 1) {
+                       gint i = 0;
+                       i = i_collection[i_it];
+                       {
+                               const gchar* _tmp1_;
+                               gchar* _tmp2_;
+                               gchar* _tmp3_;
+                               gchar* _tmp4_;
+                               _tmp1_ = _result_;
+                               _tmp2_ = g_strdup_printf ("%i", i);
+                               _tmp3_ = _tmp2_;
+                               _tmp4_ = g_strconcat (_tmp1_, _tmp3_, NULL);
+                               _g_free0 (_result_);
+                               _result_ = _tmp4_;
+                               _g_free0 (_tmp3_);
+                       }
+               }
+       }
+       _tmp5_ = _result_;
+       _vala_assert (g_strcmp0 (_tmp5_, "123456") == 0, "result == \"123456\"");
+       _tmp6_ = g_strdup ("");
+       result2 = _tmp6_;
+       {
+               gint* i_collection = NULL;
+               gint i_collection_length1 = 0;
+               gint _i_collection_size_ = 0;
+               gint i_it = 0;
+               i_collection = BAR;
+               i_collection_length1 = G_N_ELEMENTS (BAR);
+               for (i_it = 0; i_it < i_collection_length1; i_it = i_it + 1) {
+                       gint i = 0;
+                       i = i_collection[i_it];
+                       {
+                               const gchar* _tmp7_;
+                               gchar* _tmp8_;
+                               gchar* _tmp9_;
+                               gchar* _tmp10_;
+                               _tmp7_ = result2;
+                               _tmp8_ = g_strdup_printf ("%i", i);
+                               _tmp9_ = _tmp8_;
+                               _tmp10_ = g_strconcat (_tmp7_, _tmp9_, NULL);
+                               _g_free0 (result2);
+                               result2 = _tmp10_;
+                               _g_free0 (_tmp9_);
+                       }
+               }
+       }
+       _tmp11_ = result2;
+       _vala_assert (g_strcmp0 (_tmp11_, "654321") == 0, "result2 == \"654321\"");
+       _g_free0 (result2);
+       _g_free0 (_result_);
+}
+
+void
+test_foreach_slice_array (void)
+{
+       gint* foo = NULL;
+       gint* _tmp0_;
+       gint foo_length1;
+       gint _foo_size_;
+       gchar* _result_ = NULL;
+       gchar* _tmp1_;
+       gint* _tmp2_;
+       gint _tmp2__length1;
+       gint* _tmp3_;
+       gint _tmp3__length1;
+       const gchar* _tmp8_;
+       _tmp0_ = g_new0 (gint, 6);
+       _tmp0_[0] = 1;
+       _tmp0_[1] = 2;
+       _tmp0_[2] = 3;
+       _tmp0_[3] = 4;
+       _tmp0_[4] = 5;
+       _tmp0_[5] = 6;
+       foo = _tmp0_;
+       foo_length1 = 6;
+       _foo_size_ = foo_length1;
+       _tmp1_ = g_strdup ("");
+       _result_ = _tmp1_;
+       _tmp2_ = foo;
+       _tmp2__length1 = foo_length1;
+       _tmp3_ = foo;
+       _tmp3__length1 = foo_length1;
+       {
+               gint* i_collection = NULL;
+               gint i_collection_length1 = 0;
+               gint _i_collection_size_ = 0;
+               gint i_it = 0;
+               i_collection = _tmp2_ + 1;
+               i_collection_length1 = (_tmp3__length1 - 1) - 1;
+               for (i_it = 0; i_it < i_collection_length1; i_it = i_it + 1) {
+                       gint i = 0;
+                       i = i_collection[i_it];
+                       {
+                               const gchar* _tmp4_;
+                               gchar* _tmp5_;
+                               gchar* _tmp6_;
+                               gchar* _tmp7_;
+                               _tmp4_ = _result_;
+                               _tmp5_ = g_strdup_printf ("%i", i);
+                               _tmp6_ = _tmp5_;
+                               _tmp7_ = g_strconcat (_tmp4_, _tmp6_, NULL);
+                               _g_free0 (_result_);
+                               _result_ = _tmp7_;
+                               _g_free0 (_tmp6_);
+                       }
+               }
+       }
+       _tmp8_ = _result_;
+       _vala_assert (g_strcmp0 (_tmp8_, "2345") == 0, "result == \"2345\"");
+       _g_free0 (_result_);
+       foo = (g_free (foo), NULL);
+}
+
+static void
+_vala_main (void)
+{
+       test_foreach_gvaluearray ();
+       test_foreach_genericarray ();
+       test_foreach_const_array ();
+       test_foreach_multidim_array ();
+       test_foreach_slice_array ();
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/control-flow/local-clash-with-implicit-this.c-expected 
b/tests/control-flow/local-clash-with-implicit-this.c-expected
new file mode 100644
index 000000000..e648f1d2a
--- /dev/null
+++ b/tests/control-flow/local-clash-with-implicit-this.c-expected
@@ -0,0 +1,320 @@
+/* control_flow_local_clash_with_implicit_this.c generated by valac, the Vala compiler
+ * generated from control_flow_local_clash_with_implicit_this.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _FooPrivate {
+       gint clash;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       gint clash = 0;
+       self = (Foo*) g_type_create_instance (object_type);
+       clash = self->priv->clash + 23;
+       _vala_assert (clash == 42, "clash == 42");
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+       self->priv->clash = 19;
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Foo* _tmp0_;
+       Foo* _tmp1_;
+       _tmp0_ = foo_new ();
+       _tmp1_ = _tmp0_;
+       _foo_unref0 (_tmp1_);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/control-flow/nested-conditional.c-expected 
b/tests/control-flow/nested-conditional.c-expected
new file mode 100644
index 000000000..75f1eba35
--- /dev/null
+++ b/tests/control-flow/nested-conditional.c-expected
@@ -0,0 +1,57 @@
+/* control_flow_nested_conditional.c generated by valac, the Vala compiler
+ * generated from control_flow_nested_conditional.vala, do not modify */
+
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN gboolean bar (void);
+static void _vala_main (void);
+
+gboolean
+bar (void)
+{
+       g_assert_not_reached ();
+}
+
+static void
+_vala_main (void)
+{
+       gint _tmp0_ = 0;
+       gint foo = 0;
+       if (TRUE) {
+               _tmp0_ = 0;
+       } else {
+               gint _tmp1_ = 0;
+               if (bar ()) {
+                       _tmp1_ = 1;
+               } else {
+                       _tmp1_ = 2;
+               }
+               _tmp0_ = _tmp1_;
+       }
+       foo = _tmp0_;
+       _vala_assert (foo == 0, "foo == 0");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/control-flow/pre-post-increment-field.c-expected 
b/tests/control-flow/pre-post-increment-field.c-expected
new file mode 100644
index 000000000..d8d16ceb5
--- /dev/null
+++ b/tests/control-flow/pre-post-increment-field.c-expected
@@ -0,0 +1,166 @@
+/* control_flow_pre_post_increment_field.c generated by valac, the Vala compiler
+ * generated from control_flow_pre_post_increment_field.vala, do not modify */
+
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN gint field;
+gint field = 0;
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+       {
+               gint res = 0;
+               gint _tmp0_;
+               gint _tmp1_;
+               field = 1;
+               _tmp0_ = field;
+               _tmp1_ = field;
+               field = _tmp1_ + 1;
+               res = _tmp0_ + _tmp1_;
+               _vala_assert (res == 2, "res == 2");
+               _vala_assert (field == 2, "field == 2");
+       }
+       {
+               gint res = 0;
+               gint _tmp2_;
+               gint _tmp3_;
+               field = 1;
+               _tmp2_ = field;
+               field = _tmp2_ + 1;
+               _tmp3_ = field;
+               res = _tmp2_ + _tmp3_;
+               _vala_assert (res == 3, "res == 3");
+               _vala_assert (field == 2, "field == 2");
+       }
+       {
+               gint res = 0;
+               gint _tmp4_;
+               gint _tmp5_;
+               field = 1;
+               _tmp4_ = field;
+               field = field + 1;
+               _tmp5_ = field;
+               res = _tmp4_ + _tmp5_;
+               _vala_assert (res == 3, "res == 3");
+               _vala_assert (field == 2, "field == 2");
+       }
+       {
+               gint res = 0;
+               gint _tmp6_;
+               gint _tmp7_;
+               field = 1;
+               field = field + 1;
+               _tmp6_ = field;
+               _tmp7_ = field;
+               res = _tmp6_ + _tmp7_;
+               _vala_assert (res == 4, "res == 4");
+               _vala_assert (field == 2, "field == 2");
+       }
+       {
+               gint _tmp8_;
+               field = 1;
+               _tmp8_ = field;
+               field = _tmp8_ + 1;
+               _vala_assert (_tmp8_ == 1, "field++ == 1");
+               _vala_assert (field == 2, "field == 2");
+       }
+       {
+               gint _tmp9_;
+               field = 1;
+               field = field + 1;
+               _tmp9_ = field;
+               _vala_assert (_tmp9_ == 2, "++field == 2");
+               _vala_assert (field == 2, "field == 2");
+       }
+       {
+               gint d = 0;
+               gint _tmp10_;
+               gint _tmp11_;
+               field = 1;
+               _tmp10_ = field;
+               _tmp11_ = field;
+               field = _tmp11_ - 1;
+               d = _tmp10_ + _tmp11_;
+               _vala_assert (d == 2, "d == 2");
+               _vala_assert (field == 0, "field == 0");
+       }
+       {
+               gint res = 0;
+               gint _tmp12_;
+               gint _tmp13_;
+               field = 1;
+               _tmp12_ = field;
+               field = _tmp12_ - 1;
+               _tmp13_ = field;
+               res = _tmp12_ + _tmp13_;
+               _vala_assert (res == 1, "res == 1");
+               _vala_assert (field == 0, "field == 0");
+       }
+       {
+               gint res = 0;
+               gint _tmp14_;
+               gint _tmp15_;
+               field = 1;
+               _tmp14_ = field;
+               field = field - 1;
+               _tmp15_ = field;
+               res = _tmp14_ + _tmp15_;
+               _vala_assert (res == 1, "res == 1");
+               _vala_assert (field == 0, "field == 0");
+       }
+       {
+               gint res = 0;
+               gint _tmp16_;
+               gint _tmp17_;
+               field = 1;
+               field = field - 1;
+               _tmp16_ = field;
+               _tmp17_ = field;
+               res = _tmp16_ + _tmp17_;
+               _vala_assert (res == 0, "res == 0");
+               _vala_assert (field == 0, "field == 0");
+       }
+       {
+               gint _tmp18_;
+               field = 1;
+               _tmp18_ = field;
+               field = _tmp18_ - 1;
+               _vala_assert (_tmp18_ == 1, "field-- == 1");
+               _vala_assert (field == 0, "field == 0");
+       }
+       {
+               gint _tmp19_;
+               field = 1;
+               field = field - 1;
+               _tmp19_ = field;
+               _vala_assert (_tmp19_ == 0, "--field == 0");
+               _vala_assert (field == 0, "field == 0");
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/control-flow/pre-post-increment-local.c-expected 
b/tests/control-flow/pre-post-increment-local.c-expected
new file mode 100644
index 000000000..fe58a03cb
--- /dev/null
+++ b/tests/control-flow/pre-post-increment-local.c-expected
@@ -0,0 +1,165 @@
+/* control_flow_pre_post_increment_local.c generated by valac, the Vala compiler
+ * generated from control_flow_pre_post_increment_local.vala, do not modify */
+
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+       {
+               gint local = 0;
+               gint res = 0;
+               gint _tmp0_;
+               gint _tmp1_;
+               local = 1;
+               _tmp0_ = local;
+               _tmp1_ = local;
+               local = _tmp1_ + 1;
+               res = _tmp0_ + _tmp1_;
+               _vala_assert (res == 2, "res == 2");
+               _vala_assert (local == 2, "local == 2");
+       }
+       {
+               gint local = 0;
+               gint res = 0;
+               gint _tmp2_;
+               gint _tmp3_;
+               local = 1;
+               _tmp2_ = local;
+               local = _tmp2_ + 1;
+               _tmp3_ = local;
+               res = _tmp2_ + _tmp3_;
+               _vala_assert (res == 3, "res == 3");
+               _vala_assert (local == 2, "local == 2");
+       }
+       {
+               gint local = 0;
+               gint res = 0;
+               gint _tmp4_;
+               gint _tmp5_;
+               local = 1;
+               _tmp4_ = local;
+               local = local + 1;
+               _tmp5_ = local;
+               res = _tmp4_ + _tmp5_;
+               _vala_assert (res == 3, "res == 3");
+               _vala_assert (local == 2, "local == 2");
+       }
+       {
+               gint local = 0;
+               gint res = 0;
+               gint _tmp6_;
+               gint _tmp7_;
+               local = 1;
+               local = local + 1;
+               _tmp6_ = local;
+               _tmp7_ = local;
+               res = _tmp6_ + _tmp7_;
+               _vala_assert (res == 4, "res == 4");
+               _vala_assert (local == 2, "local == 2");
+       }
+       {
+               gint local = 0;
+               gint _tmp8_;
+               local = 1;
+               _tmp8_ = local;
+               local = _tmp8_ + 1;
+               _vala_assert (_tmp8_ == 1, "local++ == 1");
+               _vala_assert (local == 2, "local == 2");
+       }
+       {
+               gint local = 0;
+               gint _tmp9_;
+               local = 1;
+               local = local + 1;
+               _tmp9_ = local;
+               _vala_assert (_tmp9_ == 2, "++local == 2");
+               _vala_assert (local == 2, "local == 2");
+       }
+       {
+               gint local = 0;
+               gint res = 0;
+               gint _tmp10_;
+               gint _tmp11_;
+               local = 1;
+               _tmp10_ = local;
+               _tmp11_ = local;
+               local = _tmp11_ - 1;
+               res = _tmp10_ + _tmp11_;
+               _vala_assert (res == 2, "res == 2");
+               _vala_assert (local == 0, "local == 0");
+       }
+       {
+               gint local = 0;
+               gint res = 0;
+               gint _tmp12_;
+               gint _tmp13_;
+               local = 1;
+               _tmp12_ = local;
+               local = _tmp12_ - 1;
+               _tmp13_ = local;
+               res = _tmp12_ + _tmp13_;
+               _vala_assert (res == 1, "res == 1");
+               _vala_assert (local == 0, "local == 0");
+       }
+       {
+               gint local = 0;
+               gint res = 0;
+               gint _tmp14_;
+               gint _tmp15_;
+               local = 1;
+               _tmp14_ = local;
+               local = local - 1;
+               _tmp15_ = local;
+               res = _tmp14_ + _tmp15_;
+               _vala_assert (res == 1, "res == 1");
+               _vala_assert (local == 0, "local == 0");
+       }
+       {
+               gint local = 0;
+               gint res = 0;
+               gint _tmp16_;
+               gint _tmp17_;
+               local = 1;
+               local = local - 1;
+               _tmp16_ = local;
+               _tmp17_ = local;
+               res = _tmp16_ + _tmp17_;
+               _vala_assert (res == 0, "res == 0");
+               _vala_assert (local == 0, "local == 0");
+       }
+       {
+               gint local = 0;
+               gint _tmp18_;
+               local = 1;
+               _tmp18_ = local;
+               local = _tmp18_ - 1;
+               _vala_assert (_tmp18_ == 1, "local-- == 1");
+               _vala_assert (local == 0, "local == 0");
+       }
+       {
+               gint local = 0;
+               gint _tmp19_;
+               local = 1;
+               local = local - 1;
+               _tmp19_ = local;
+               _vala_assert (_tmp19_ == 0, "--local == 0");
+               _vala_assert (local == 0, "local == 0");
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/control-flow/pre-post-increment-parameter.c-expected 
b/tests/control-flow/pre-post-increment-parameter.c-expected
new file mode 100644
index 000000000..2e328efdc
--- /dev/null
+++ b/tests/control-flow/pre-post-increment-parameter.c-expected
@@ -0,0 +1,170 @@
+/* control_flow_pre_post_increment_parameter.c generated by valac, the Vala compiler
+ * generated from control_flow_pre_post_increment_parameter.vala, do not modify */
+
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN void test_parameter (gint parameter);
+static void _vala_main (void);
+
+void
+test_parameter (gint parameter)
+{
+       {
+               gint res = 0;
+               gint _tmp0_;
+               gint _tmp1_;
+               parameter = 1;
+               _tmp0_ = parameter;
+               _tmp1_ = parameter;
+               parameter = _tmp1_ + 1;
+               res = _tmp0_ + _tmp1_;
+               _vala_assert (res == 2, "res == 2");
+               _vala_assert (parameter == 2, "parameter == 2");
+       }
+       {
+               gint res = 0;
+               gint _tmp2_;
+               gint _tmp3_;
+               parameter = 1;
+               _tmp2_ = parameter;
+               parameter = _tmp2_ + 1;
+               _tmp3_ = parameter;
+               res = _tmp2_ + _tmp3_;
+               _vala_assert (res == 3, "res == 3");
+               _vala_assert (parameter == 2, "parameter == 2");
+       }
+       {
+               gint res = 0;
+               gint _tmp4_;
+               gint _tmp5_;
+               parameter = 1;
+               _tmp4_ = parameter;
+               parameter = parameter + 1;
+               _tmp5_ = parameter;
+               res = _tmp4_ + _tmp5_;
+               _vala_assert (res == 3, "res == 3");
+               _vala_assert (parameter == 2, "parameter == 2");
+       }
+       {
+               gint res = 0;
+               gint _tmp6_;
+               gint _tmp7_;
+               parameter = 1;
+               parameter = parameter + 1;
+               _tmp6_ = parameter;
+               _tmp7_ = parameter;
+               res = _tmp6_ + _tmp7_;
+               _vala_assert (res == 4, "res == 4");
+               _vala_assert (parameter == 2, "parameter == 2");
+       }
+       {
+               gint _tmp8_;
+               parameter = 1;
+               _tmp8_ = parameter;
+               parameter = _tmp8_ + 1;
+               _vala_assert (_tmp8_ == 1, "parameter++ == 1");
+               _vala_assert (parameter == 2, "parameter == 2");
+       }
+       {
+               gint _tmp9_;
+               parameter = 1;
+               parameter = parameter + 1;
+               _tmp9_ = parameter;
+               _vala_assert (_tmp9_ == 2, "++parameter == 2");
+               _vala_assert (parameter == 2, "parameter == 2");
+       }
+       {
+               gint res = 0;
+               gint _tmp10_;
+               gint _tmp11_;
+               parameter = 1;
+               _tmp10_ = parameter;
+               _tmp11_ = parameter;
+               parameter = _tmp11_ - 1;
+               res = _tmp10_ + _tmp11_;
+               _vala_assert (res == 2, "res == 2");
+               _vala_assert (parameter == 0, "parameter == 0");
+       }
+       {
+               gint res = 0;
+               gint _tmp12_;
+               gint _tmp13_;
+               parameter = 1;
+               _tmp12_ = parameter;
+               parameter = _tmp12_ - 1;
+               _tmp13_ = parameter;
+               res = _tmp12_ + _tmp13_;
+               _vala_assert (res == 1, "res == 1");
+               _vala_assert (parameter == 0, "parameter == 0");
+       }
+       {
+               gint res = 0;
+               gint _tmp14_;
+               gint _tmp15_;
+               parameter = 1;
+               _tmp14_ = parameter;
+               parameter = parameter - 1;
+               _tmp15_ = parameter;
+               res = _tmp14_ + _tmp15_;
+               _vala_assert (res == 1, "res == 1");
+               _vala_assert (parameter == 0, "parameter == 0");
+       }
+       {
+               gint res = 0;
+               gint _tmp16_;
+               gint _tmp17_;
+               parameter = 1;
+               parameter = parameter - 1;
+               _tmp16_ = parameter;
+               _tmp17_ = parameter;
+               res = _tmp16_ + _tmp17_;
+               _vala_assert (res == 0, "res == 0");
+               _vala_assert (parameter == 0, "parameter == 0");
+       }
+       {
+               gint _tmp18_;
+               parameter = 1;
+               _tmp18_ = parameter;
+               parameter = _tmp18_ - 1;
+               _vala_assert (_tmp18_ == 1, "parameter-- == 1");
+               _vala_assert (parameter == 0, "parameter == 0");
+       }
+       {
+               gint _tmp19_;
+               parameter = 1;
+               parameter = parameter - 1;
+               _tmp19_ = parameter;
+               _vala_assert (_tmp19_ == 0, "--parameter == 0");
+               _vala_assert (parameter == 0, "parameter == 0");
+       }
+}
+
+static void
+_vala_main (void)
+{
+       test_parameter (1);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/control-flow/pre-post-increment-property.c-expected 
b/tests/control-flow/pre-post-increment-property.c-expected
new file mode 100644
index 000000000..f429d3212
--- /dev/null
+++ b/tests/control-flow/pre-post-increment-property.c-expected
@@ -0,0 +1,740 @@
+/* control_flow_pre_post_increment_property.c generated by valac, the Vala compiler
+ * generated from control_flow_pre_post_increment_property.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _FooPrivate {
+       gint _property;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+VALA_EXTERN void foo_set_property (Foo* self,
+                       gint value);
+VALA_EXTERN gint foo_get_property (Foo* self);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       {
+               gint res = 0;
+               gint _tmp0_;
+               gint _tmp1_;
+               gint _tmp2_;
+               foo_set_property (self, 1);
+               _tmp0_ = self->priv->_property;
+               _tmp1_ = self->priv->_property;
+               foo_set_property (self, _tmp1_ + 1);
+               res = _tmp0_ + _tmp1_;
+               _vala_assert (res == 2, "res == 2");
+               _tmp2_ = self->priv->_property;
+               _vala_assert (_tmp2_ == 2, "property == 2");
+       }
+       {
+               gint res = 0;
+               gint _tmp3_;
+               gint _tmp4_;
+               gint _tmp5_;
+               foo_set_property (self, 1);
+               _tmp3_ = self->priv->_property;
+               foo_set_property (self, _tmp3_ + 1);
+               _tmp4_ = self->priv->_property;
+               res = _tmp3_ + _tmp4_;
+               _vala_assert (res == 3, "res == 3");
+               _tmp5_ = self->priv->_property;
+               _vala_assert (_tmp5_ == 2, "property == 2");
+       }
+       {
+               gint res = 0;
+               gint _tmp6_;
+               gint _tmp7_;
+               gint _tmp8_;
+               gint _tmp9_;
+               foo_set_property (self, 1);
+               _tmp6_ = self->priv->_property;
+               _tmp7_ = self->priv->_property;
+               _tmp7_ = _tmp7_ + 1;
+               _tmp8_ = _tmp7_;
+               foo_set_property (self, _tmp8_);
+               res = _tmp6_ + _tmp8_;
+               _vala_assert (res == 3, "res == 3");
+               _tmp9_ = self->priv->_property;
+               _vala_assert (_tmp9_ == 2, "property == 2");
+       }
+       {
+               gint res = 0;
+               gint _tmp10_;
+               gint _tmp11_;
+               gint _tmp12_;
+               gint _tmp13_;
+               foo_set_property (self, 1);
+               _tmp10_ = self->priv->_property;
+               _tmp10_ = _tmp10_ + 1;
+               _tmp11_ = _tmp10_;
+               foo_set_property (self, _tmp11_);
+               _tmp12_ = self->priv->_property;
+               res = _tmp11_ + _tmp12_;
+               _vala_assert (res == 4, "res == 4");
+               _tmp13_ = self->priv->_property;
+               _vala_assert (_tmp13_ == 2, "property == 2");
+       }
+       {
+               gint _tmp14_;
+               gint _tmp15_;
+               foo_set_property (self, 1);
+               _tmp14_ = self->priv->_property;
+               foo_set_property (self, _tmp14_ + 1);
+               _vala_assert (_tmp14_ == 1, "property++ == 1");
+               _tmp15_ = self->priv->_property;
+               _vala_assert (_tmp15_ == 2, "property == 2");
+       }
+       {
+               gint _tmp16_;
+               gint _tmp17_;
+               gint _tmp18_;
+               foo_set_property (self, 1);
+               _tmp16_ = self->priv->_property;
+               _tmp16_ = _tmp16_ + 1;
+               _tmp17_ = _tmp16_;
+               foo_set_property (self, _tmp17_);
+               _vala_assert (_tmp17_ == 2, "++property == 2");
+               _tmp18_ = self->priv->_property;
+               _vala_assert (_tmp18_ == 2, "property == 2");
+       }
+       {
+               gint res = 0;
+               gint _tmp19_;
+               gint _tmp20_;
+               gint _tmp21_;
+               foo_set_property (self, 1);
+               _tmp19_ = self->priv->_property;
+               _tmp20_ = self->priv->_property;
+               foo_set_property (self, _tmp20_ - 1);
+               res = _tmp19_ + _tmp20_;
+               _vala_assert (res == 2, "res == 2");
+               _tmp21_ = self->priv->_property;
+               _vala_assert (_tmp21_ == 0, "property == 0");
+       }
+       {
+               gint res = 0;
+               gint _tmp22_;
+               gint _tmp23_;
+               gint _tmp24_;
+               foo_set_property (self, 1);
+               _tmp22_ = self->priv->_property;
+               foo_set_property (self, _tmp22_ - 1);
+               _tmp23_ = self->priv->_property;
+               res = _tmp22_ + _tmp23_;
+               _vala_assert (res == 1, "res == 1");
+               _tmp24_ = self->priv->_property;
+               _vala_assert (_tmp24_ == 0, "property == 0");
+       }
+       {
+               gint res = 0;
+               gint _tmp25_;
+               gint _tmp26_;
+               gint _tmp27_;
+               gint _tmp28_;
+               foo_set_property (self, 1);
+               _tmp25_ = self->priv->_property;
+               _tmp26_ = self->priv->_property;
+               _tmp26_ = _tmp26_ - 1;
+               _tmp27_ = _tmp26_;
+               foo_set_property (self, _tmp27_);
+               res = _tmp25_ + _tmp27_;
+               _vala_assert (res == 1, "res == 1");
+               _tmp28_ = self->priv->_property;
+               _vala_assert (_tmp28_ == 0, "property == 0");
+       }
+       {
+               gint res = 0;
+               gint _tmp29_;
+               gint _tmp30_;
+               gint _tmp31_;
+               gint _tmp32_;
+               foo_set_property (self, 1);
+               _tmp29_ = self->priv->_property;
+               _tmp29_ = _tmp29_ - 1;
+               _tmp30_ = _tmp29_;
+               foo_set_property (self, _tmp30_);
+               _tmp31_ = self->priv->_property;
+               res = _tmp30_ + _tmp31_;
+               _vala_assert (res == 0, "res == 0");
+               _tmp32_ = self->priv->_property;
+               _vala_assert (_tmp32_ == 0, "property == 0");
+       }
+       {
+               gint _tmp33_;
+               gint _tmp34_;
+               foo_set_property (self, 1);
+               _tmp33_ = self->priv->_property;
+               foo_set_property (self, _tmp33_ - 1);
+               _vala_assert (_tmp33_ == 1, "property-- == 1");
+               _tmp34_ = self->priv->_property;
+               _vala_assert (_tmp34_ == 0, "property == 0");
+       }
+       {
+               gint _tmp35_;
+               gint _tmp36_;
+               gint _tmp37_;
+               foo_set_property (self, 1);
+               _tmp35_ = self->priv->_property;
+               _tmp35_ = _tmp35_ - 1;
+               _tmp36_ = _tmp35_;
+               foo_set_property (self, _tmp36_);
+               _vala_assert (_tmp36_ == 0, "--property == 0");
+               _tmp37_ = self->priv->_property;
+               _vala_assert (_tmp37_ == 0, "property == 0");
+       }
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+gint
+foo_get_property (Foo* self)
+{
+       gint result;
+       g_return_val_if_fail (IS_FOO (self), 0);
+       result = self->priv->_property;
+       return result;
+}
+
+void
+foo_set_property (Foo* self,
+                  gint value)
+{
+       g_return_if_fail (IS_FOO (self));
+       self->priv->_property = value;
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       {
+               gint res = 0;
+               gint _tmp1_;
+               gint _tmp2_;
+               gint _tmp3_;
+               gint _tmp4_;
+               gint _tmp5_;
+               gint _tmp6_;
+               foo_set_property (foo, 1);
+               _tmp1_ = foo_get_property (foo);
+               _tmp2_ = _tmp1_;
+               _tmp3_ = foo_get_property (foo);
+               _tmp4_ = _tmp3_;
+               foo_set_property (foo, _tmp4_ + 1);
+               res = _tmp2_ + _tmp4_;
+               _vala_assert (res == 2, "res == 2");
+               _tmp5_ = foo_get_property (foo);
+               _tmp6_ = _tmp5_;
+               _vala_assert (_tmp6_ == 2, "foo.property == 2");
+       }
+       {
+               gint res = 0;
+               gint _tmp7_;
+               gint _tmp8_;
+               gint _tmp9_;
+               gint _tmp10_;
+               gint _tmp11_;
+               gint _tmp12_;
+               foo_set_property (foo, 1);
+               _tmp7_ = foo_get_property (foo);
+               _tmp8_ = _tmp7_;
+               foo_set_property (foo, _tmp8_ + 1);
+               _tmp9_ = foo_get_property (foo);
+               _tmp10_ = _tmp9_;
+               res = _tmp8_ + _tmp10_;
+               _vala_assert (res == 3, "res == 3");
+               _tmp11_ = foo_get_property (foo);
+               _tmp12_ = _tmp11_;
+               _vala_assert (_tmp12_ == 2, "foo.property == 2");
+       }
+       {
+               gint res = 0;
+               gint _tmp13_;
+               gint _tmp14_;
+               gint _tmp15_;
+               gint _tmp16_;
+               gint _tmp17_;
+               gint _tmp18_;
+               gint _tmp19_;
+               foo_set_property (foo, 1);
+               _tmp13_ = foo_get_property (foo);
+               _tmp14_ = _tmp13_;
+               _tmp15_ = foo_get_property (foo);
+               _tmp16_ = _tmp15_;
+               _tmp16_ = _tmp16_ + 1;
+               _tmp17_ = _tmp16_;
+               foo_set_property (foo, _tmp17_);
+               res = _tmp14_ + _tmp17_;
+               _vala_assert (res == 3, "res == 3");
+               _tmp18_ = foo_get_property (foo);
+               _tmp19_ = _tmp18_;
+               _vala_assert (_tmp19_ == 2, "foo.property == 2");
+       }
+       {
+               gint res = 0;
+               gint _tmp20_;
+               gint _tmp21_;
+               gint _tmp22_;
+               gint _tmp23_;
+               gint _tmp24_;
+               gint _tmp25_;
+               gint _tmp26_;
+               foo_set_property (foo, 1);
+               _tmp20_ = foo_get_property (foo);
+               _tmp21_ = _tmp20_;
+               _tmp21_ = _tmp21_ + 1;
+               _tmp22_ = _tmp21_;
+               foo_set_property (foo, _tmp22_);
+               _tmp23_ = foo_get_property (foo);
+               _tmp24_ = _tmp23_;
+               res = _tmp22_ + _tmp24_;
+               _vala_assert (res == 4, "res == 4");
+               _tmp25_ = foo_get_property (foo);
+               _tmp26_ = _tmp25_;
+               _vala_assert (_tmp26_ == 2, "foo.property == 2");
+       }
+       {
+               gint _tmp27_;
+               gint _tmp28_;
+               gint _tmp29_;
+               gint _tmp30_;
+               foo_set_property (foo, 1);
+               _tmp27_ = foo_get_property (foo);
+               _tmp28_ = _tmp27_;
+               foo_set_property (foo, _tmp28_ + 1);
+               _vala_assert (_tmp28_ == 1, "foo.property++ == 1");
+               _tmp29_ = foo_get_property (foo);
+               _tmp30_ = _tmp29_;
+               _vala_assert (_tmp30_ == 2, "foo.property == 2");
+       }
+       {
+               gint _tmp31_;
+               gint _tmp32_;
+               gint _tmp33_;
+               gint _tmp34_;
+               gint _tmp35_;
+               foo_set_property (foo, 1);
+               _tmp31_ = foo_get_property (foo);
+               _tmp32_ = _tmp31_;
+               _tmp32_ = _tmp32_ + 1;
+               _tmp33_ = _tmp32_;
+               foo_set_property (foo, _tmp33_);
+               _vala_assert (_tmp33_ == 2, "++foo.property == 2");
+               _tmp34_ = foo_get_property (foo);
+               _tmp35_ = _tmp34_;
+               _vala_assert (_tmp35_ == 2, "foo.property == 2");
+       }
+       {
+               gint res = 0;
+               gint _tmp36_;
+               gint _tmp37_;
+               gint _tmp38_;
+               gint _tmp39_;
+               gint _tmp40_;
+               gint _tmp41_;
+               foo_set_property (foo, 1);
+               _tmp36_ = foo_get_property (foo);
+               _tmp37_ = _tmp36_;
+               _tmp38_ = foo_get_property (foo);
+               _tmp39_ = _tmp38_;
+               foo_set_property (foo, _tmp39_ - 1);
+               res = _tmp37_ + _tmp39_;
+               _vala_assert (res == 2, "res == 2");
+               _tmp40_ = foo_get_property (foo);
+               _tmp41_ = _tmp40_;
+               _vala_assert (_tmp41_ == 0, "foo.property == 0");
+       }
+       {
+               gint res = 0;
+               gint _tmp42_;
+               gint _tmp43_;
+               gint _tmp44_;
+               gint _tmp45_;
+               gint _tmp46_;
+               gint _tmp47_;
+               foo_set_property (foo, 1);
+               _tmp42_ = foo_get_property (foo);
+               _tmp43_ = _tmp42_;
+               foo_set_property (foo, _tmp43_ - 1);
+               _tmp44_ = foo_get_property (foo);
+               _tmp45_ = _tmp44_;
+               res = _tmp43_ + _tmp45_;
+               _vala_assert (res == 1, "res == 1");
+               _tmp46_ = foo_get_property (foo);
+               _tmp47_ = _tmp46_;
+               _vala_assert (_tmp47_ == 0, "foo.property == 0");
+       }
+       {
+               gint res = 0;
+               gint _tmp48_;
+               gint _tmp49_;
+               gint _tmp50_;
+               gint _tmp51_;
+               gint _tmp52_;
+               gint _tmp53_;
+               gint _tmp54_;
+               foo_set_property (foo, 1);
+               _tmp48_ = foo_get_property (foo);
+               _tmp49_ = _tmp48_;
+               _tmp50_ = foo_get_property (foo);
+               _tmp51_ = _tmp50_;
+               _tmp51_ = _tmp51_ - 1;
+               _tmp52_ = _tmp51_;
+               foo_set_property (foo, _tmp52_);
+               res = _tmp49_ + _tmp52_;
+               _vala_assert (res == 1, "res == 1");
+               _tmp53_ = foo_get_property (foo);
+               _tmp54_ = _tmp53_;
+               _vala_assert (_tmp54_ == 0, "foo.property == 0");
+       }
+       {
+               gint res = 0;
+               gint _tmp55_;
+               gint _tmp56_;
+               gint _tmp57_;
+               gint _tmp58_;
+               gint _tmp59_;
+               gint _tmp60_;
+               gint _tmp61_;
+               foo_set_property (foo, 1);
+               _tmp55_ = foo_get_property (foo);
+               _tmp56_ = _tmp55_;
+               _tmp56_ = _tmp56_ - 1;
+               _tmp57_ = _tmp56_;
+               foo_set_property (foo, _tmp57_);
+               _tmp58_ = foo_get_property (foo);
+               _tmp59_ = _tmp58_;
+               res = _tmp57_ + _tmp59_;
+               _vala_assert (res == 0, "res == 0");
+               _tmp60_ = foo_get_property (foo);
+               _tmp61_ = _tmp60_;
+               _vala_assert (_tmp61_ == 0, "foo.property == 0");
+       }
+       {
+               gint _tmp62_;
+               gint _tmp63_;
+               gint _tmp64_;
+               gint _tmp65_;
+               foo_set_property (foo, 1);
+               _tmp62_ = foo_get_property (foo);
+               _tmp63_ = _tmp62_;
+               foo_set_property (foo, _tmp63_ - 1);
+               _vala_assert (_tmp63_ == 1, "foo.property-- == 1");
+               _tmp64_ = foo_get_property (foo);
+               _tmp65_ = _tmp64_;
+               _vala_assert (_tmp65_ == 0, "foo.property == 0");
+       }
+       {
+               gint _tmp66_;
+               gint _tmp67_;
+               gint _tmp68_;
+               gint _tmp69_;
+               gint _tmp70_;
+               foo_set_property (foo, 1);
+               _tmp66_ = foo_get_property (foo);
+               _tmp67_ = _tmp66_;
+               _tmp67_ = _tmp67_ - 1;
+               _tmp68_ = _tmp67_;
+               foo_set_property (foo, _tmp68_);
+               _vala_assert (_tmp68_ == 0, "--foo.property == 0");
+               _tmp69_ = foo_get_property (foo);
+               _tmp70_ = _tmp69_;
+               _vala_assert (_tmp70_ == 0, "foo.property == 0");
+       }
+       _foo_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/control-flow/pre-post-increment.c-expected 
b/tests/control-flow/pre-post-increment.c-expected
new file mode 100644
index 000000000..186e9f88f
--- /dev/null
+++ b/tests/control-flow/pre-post-increment.c-expected
@@ -0,0 +1,95 @@
+/* control_flow_pre_post_increment.c generated by valac, the Vala compiler
+ * generated from control_flow_pre_post_increment.vala, do not modify */
+
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+       {
+               gint i = 0;
+               gint _tmp0_;
+               i = 0;
+               _tmp0_ = i;
+               i = _tmp0_ + 1;
+               i = _tmp0_ + 1;
+               _vala_assert (i == 1, "i == 1");
+       }
+       {
+               gint i = 0;
+               gint _tmp1_;
+               i = 0;
+               _tmp1_ = i;
+               i = _tmp1_ + 1;
+               _vala_assert (_tmp1_ == 0, "i++ == 0");
+       }
+       {
+               gint i = 0;
+               gint _tmp2_;
+               i = 0;
+               i = i + 1;
+               _tmp2_ = i;
+               i = _tmp2_ + 1;
+               _vala_assert (i == 2, "i == 2");
+       }
+       {
+               gint i = 0;
+               gint _tmp3_;
+               i = 0;
+               i = i + 1;
+               _tmp3_ = i;
+               _vala_assert (_tmp3_ == 1, "++i == 1");
+       }
+       {
+               gint i = 0;
+               gint _tmp4_;
+               i = 1;
+               _tmp4_ = i;
+               i = _tmp4_ + 1;
+               i -= _tmp4_ % 2;
+               _vala_assert (i == 1, "i == 1");
+       }
+       {
+               gint i = 0;
+               gint _tmp5_;
+               i = 1;
+               i = i + 1;
+               _tmp5_ = i;
+               i -= _tmp5_ % 2;
+               _vala_assert (i == 2, "i == 2");
+       }
+       {
+               gint i = 0;
+               gint _tmp6_;
+               i = 1;
+               _tmp6_ = i;
+               i = _tmp6_ + 1;
+               i += _tmp6_ % 2;
+               _vala_assert (i == 3, "i == 3");
+       }
+       {
+               gint i = 0;
+               gint _tmp7_;
+               i = 1;
+               i = i + 1;
+               _tmp7_ = i;
+               i += _tmp7_ % 2;
+               _vala_assert (i == 2, "i == 2");
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/control-flow/sideeffects.c-expected b/tests/control-flow/sideeffects.c-expected
new file mode 100644
index 000000000..ccd72290c
--- /dev/null
+++ b/tests/control-flow/sideeffects.c-expected
@@ -0,0 +1,161 @@
+/* control_flow_sideeffects.c generated by valac, the Vala compiler
+ * generated from control_flow_sideeffects.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+       gint i;
+       gchar* data;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_sideeffect (Foo* self);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (GObject * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+Foo*
+foo_sideeffect (Foo* self)
+{
+       gint _tmp0_;
+       Foo* result = NULL;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       self->i = self->i - 1;
+       _tmp0_ = self->i;
+       result = self;
+       return result;
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       G_OBJECT_CLASS (klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->i = 1;
+}
+
+static void
+foo_finalize (GObject * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       _g_free0 (self->data);
+       G_OBJECT_CLASS (foo_parent_class)->finalize (obj);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       Foo* _tmp1_;
+       gchar* _tmp2_;
+       const gchar* _tmp3_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       _tmp1_ = foo_sideeffect (foo);
+       _tmp2_ = g_strdup ("foo");
+       _g_free0 (_tmp1_->data);
+       _tmp1_->data = _tmp2_;
+       _tmp3_ = foo->data;
+       _vala_assert (g_strcmp0 (_tmp3_, "foo") == 0, "foo.data == \"foo\"");
+       _vala_assert (foo->i == 0, "foo.i == 0");
+       _g_object_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/control-flow/switch-enum.c-expected b/tests/control-flow/switch-enum.c-expected
new file mode 100644
index 000000000..ad6c98fc3
--- /dev/null
+++ b/tests/control-flow/switch-enum.c-expected
@@ -0,0 +1,86 @@
+/* control_flow_switch_enum.c generated by valac, the Vala compiler
+ * generated from control_flow_switch_enum.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef enum  {
+       FOO_FOO,
+       FOO_BAR,
+       FOO_MANAM
+} Foo;
+
+#define TYPE_FOO (foo_get_type ())
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo foo (void);
+static void _vala_main (void);
+
+static GType
+foo_get_type_once (void)
+{
+       static const GEnumValue values[] = {{FOO_FOO, "FOO_FOO", "foo"}, {FOO_BAR, "FOO_BAR", "bar"}, 
{FOO_MANAM, "FOO_MANAM", "manam"}, {0, NULL, NULL}};
+       GType foo_type_id;
+       foo_type_id = g_enum_register_static ("Foo", values);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+Foo
+foo (void)
+{
+       Foo foo = 0;
+       Foo result = 0;
+       foo = FOO_BAR;
+       switch (foo) {
+               case FOO_FOO:
+               case FOO_BAR:
+               {
+                       break;
+               }
+               default:
+               break;
+       }
+       result = foo;
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       _vala_assert (foo () == FOO_BAR, "foo () == Foo.BAR");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/control-flow/switch-string.c-expected b/tests/control-flow/switch-string.c-expected
new file mode 100644
index 000000000..0711523ed
--- /dev/null
+++ b/tests/control-flow/switch-string.c-expected
@@ -0,0 +1,145 @@
+/* control_flow_switch_string.c generated by valac, the Vala compiler
+ * generated from control_flow_switch_string.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+#define FOO "foo"
+#define BAR "bar"
+#define MANAM "manam"
+VALA_EXTERN gchar* foo (void);
+VALA_EXTERN gchar* get_bar (void);
+VALA_EXTERN gchar* bar (void);
+static void _vala_main (void);
+
+gchar*
+foo (void)
+{
+       gchar* foo = NULL;
+       gchar* _tmp0_;
+       const gchar* _tmp1_;
+       GQuark _tmp3_ = 0U;
+       static GQuark _tmp2_label0 = 0;
+       gchar* result = NULL;
+       _tmp0_ = g_strdup ("foo");
+       foo = _tmp0_;
+       _tmp1_ = foo;
+       _tmp3_ = (NULL == _tmp1_) ? 0 : g_quark_from_string (_tmp1_);
+       if (_tmp3_ == g_quark_from_string (FOO)) {
+               switch (0) {
+                       default:
+                       {
+                               break;
+                       }
+               }
+       } else if ((_tmp3_ == g_quark_from_string (BAR)) || (_tmp3_ == g_quark_from_string (MANAM))) {
+               switch (0) {
+                       default:
+                       {
+                               g_assert_not_reached ();
+                       }
+               }
+       } else if (_tmp3_ == ((0 != _tmp2_label0) ? _tmp2_label0 : (_tmp2_label0 = g_quark_from_static_string 
("minim")))) {
+               switch (0) {
+                       default:
+                       {
+                               g_assert_not_reached ();
+                       }
+               }
+       }
+       result = foo;
+       return result;
+}
+
+gchar*
+get_bar (void)
+{
+       gchar* _tmp0_;
+       gchar* result = NULL;
+       _tmp0_ = g_strdup ("bar");
+       result = _tmp0_;
+       return result;
+}
+
+gchar*
+bar (void)
+{
+       gchar* _tmp0_;
+       gchar* _tmp1_;
+       GQuark _tmp3_ = 0U;
+       static GQuark _tmp2_label0 = 0;
+       gchar* _tmp4_;
+       gchar* result = NULL;
+       _tmp0_ = get_bar ();
+       _tmp1_ = _tmp0_;
+       _tmp3_ = (NULL == _tmp1_) ? 0 : g_quark_from_string (_tmp1_);
+       g_free (_tmp1_);
+       if (_tmp3_ == g_quark_from_string (BAR)) {
+               switch (0) {
+                       default:
+                       {
+                               break;
+                       }
+               }
+       } else if ((_tmp3_ == g_quark_from_string (FOO)) || (_tmp3_ == ((0 != _tmp2_label0) ? _tmp2_label0 : 
(_tmp2_label0 = g_quark_from_static_string ("minim"))))) {
+               switch (0) {
+                       default:
+                       {
+                               g_assert_not_reached ();
+                       }
+               }
+       } else {
+               switch (0) {
+                       default:
+                       {
+                               g_assert_not_reached ();
+                       }
+               }
+       }
+       _tmp4_ = g_strdup (BAR);
+       result = _tmp4_;
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       gchar* _tmp0_;
+       gchar* _tmp1_;
+       gchar* _tmp2_;
+       gchar* _tmp3_;
+       _tmp0_ = foo ();
+       _tmp1_ = _tmp0_;
+       _vala_assert (g_strcmp0 (_tmp1_, "foo") == 0, "foo () == \"foo\"");
+       _g_free0 (_tmp1_);
+       _tmp2_ = bar ();
+       _tmp3_ = _tmp2_;
+       _vala_assert (g_strcmp0 (_tmp3_, "bar") == 0, "bar () == \"bar\"");
+       _g_free0 (_tmp3_);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/control-flow/switch.c-expected b/tests/control-flow/switch.c-expected
new file mode 100644
index 000000000..97add93dd
--- /dev/null
+++ b/tests/control-flow/switch.c-expected
@@ -0,0 +1,367 @@
+/* control_flow_switch.c generated by valac, the Vala compiler
+ * generated from control_flow_switch.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <stdio.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define MAMAN_TYPE_BAR (maman_bar_get_type ())
+#define MAMAN_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_BAR, MamanBar))
+#define MAMAN_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAMAN_TYPE_BAR, MamanBarClass))
+#define MAMAN_IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_BAR))
+#define MAMAN_IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAMAN_TYPE_BAR))
+#define MAMAN_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAMAN_TYPE_BAR, MamanBarClass))
+
+typedef struct _MamanBar MamanBar;
+typedef struct _MamanBarClass MamanBarClass;
+typedef struct _MamanBarPrivate MamanBarPrivate;
+enum  {
+       MAMAN_BAR_0_PROPERTY,
+       MAMAN_BAR_NUM_PROPERTIES
+};
+static GParamSpec* maman_bar_properties[MAMAN_BAR_NUM_PROPERTIES];
+
+#define MAMAN_TYPE_FOO (maman_foo_get_type ())
+#define MAMAN_FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_FOO, MamanFoo))
+#define MAMAN_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAMAN_TYPE_FOO, MamanFooClass))
+#define MAMAN_IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_FOO))
+#define MAMAN_IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAMAN_TYPE_FOO))
+#define MAMAN_FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAMAN_TYPE_FOO, MamanFooClass))
+
+typedef struct _MamanFoo MamanFoo;
+typedef struct _MamanFooClass MamanFooClass;
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+typedef struct _MamanFooPrivate MamanFooPrivate;
+enum  {
+       MAMAN_FOO_0_PROPERTY,
+       MAMAN_FOO_NUM_PROPERTIES
+};
+static GParamSpec* maman_foo_properties[MAMAN_FOO_NUM_PROPERTIES];
+
+struct _MamanBar {
+       GObject parent_instance;
+       MamanBarPrivate * priv;
+};
+
+struct _MamanBarClass {
+       GObjectClass parent_class;
+};
+
+struct _MamanFoo {
+       GObject parent_instance;
+       MamanFooPrivate * priv;
+};
+
+struct _MamanFooClass {
+       GObjectClass parent_class;
+};
+
+struct _MamanFooPrivate {
+       gint counter;
+};
+
+static gpointer maman_bar_parent_class = NULL;
+static gint MamanFoo_private_offset;
+static gpointer maman_foo_parent_class = NULL;
+
+VALA_EXTERN GType maman_bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MamanBar, g_object_unref)
+static gboolean maman_bar_test_switch_control_flow_graph (void);
+static gint maman_bar_main (void);
+VALA_EXTERN GType maman_foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MamanFoo, g_object_unref)
+VALA_EXTERN MamanFoo* maman_foo_new (void);
+VALA_EXTERN MamanFoo* maman_foo_construct (GType object_type);
+VALA_EXTERN void maman_foo_run (MamanFoo* self);
+VALA_EXTERN MamanBar* maman_bar_new (void);
+VALA_EXTERN MamanBar* maman_bar_construct (GType object_type);
+static GType maman_bar_get_type_once (void);
+VALA_EXTERN gint maman_foo_inc (MamanFoo* self);
+static void maman_foo_finalize (GObject * obj);
+static GType maman_foo_get_type_once (void);
+
+static gboolean
+maman_bar_test_switch_control_flow_graph (void)
+{
+       gint a = 0;
+       gboolean result = FALSE;
+       a = 0;
+       switch (a) {
+               case 1:
+               {
+                       result = FALSE;
+                       return result;
+               }
+               default:
+               {
+                       result = TRUE;
+                       return result;
+               }
+       }
+}
+
+static gint
+maman_bar_main (void)
+{
+       FILE* _tmp0_;
+       gint i = 0;
+       FILE* _tmp4_;
+       FILE* _tmp5_;
+       MamanFoo* foo = NULL;
+       MamanFoo* _tmp6_;
+       FILE* _tmp7_;
+       gint result = 0;
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, "For Test: 1");
+       {
+               gboolean _tmp1_ = FALSE;
+               i = 2;
+               _tmp1_ = TRUE;
+               while (TRUE) {
+                       FILE* _tmp3_;
+                       if (!_tmp1_) {
+                               gint _tmp2_;
+                               _tmp2_ = i;
+                               i = _tmp2_ + 1;
+                       }
+                       _tmp1_ = FALSE;
+                       if (!(i < 7)) {
+                               break;
+                       }
+                       _tmp3_ = stdout;
+                       fprintf (_tmp3_, " %d", i);
+               }
+       }
+       _tmp4_ = stdout;
+       fprintf (_tmp4_, " 7\n");
+       _tmp5_ = stdout;
+       fprintf (_tmp5_, "Switch statement: 1");
+       _tmp6_ = maman_foo_new ();
+       foo = _tmp6_;
+       maman_foo_run (foo);
+       _tmp7_ = stdout;
+       fprintf (_tmp7_, " 7\n");
+       maman_bar_test_switch_control_flow_graph ();
+       result = 0;
+       _g_object_unref0 (foo);
+       return result;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       return maman_bar_main ();
+}
+
+MamanBar*
+maman_bar_construct (GType object_type)
+{
+       MamanBar * self = NULL;
+       self = (MamanBar*) g_object_new (object_type, NULL);
+       return self;
+}
+
+MamanBar*
+maman_bar_new (void)
+{
+       return maman_bar_construct (MAMAN_TYPE_BAR);
+}
+
+static void
+maman_bar_class_init (MamanBarClass * klass,
+                      gpointer klass_data)
+{
+       maman_bar_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+maman_bar_instance_init (MamanBar * self,
+                         gpointer klass)
+{
+}
+
+static GType
+maman_bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (MamanBarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(MamanBar), 0, (GInstanceInitFunc) maman_bar_instance_init, NULL };
+       GType maman_bar_type_id;
+       maman_bar_type_id = g_type_register_static (G_TYPE_OBJECT, "MamanBar", &g_define_type_info, 0);
+       return maman_bar_type_id;
+}
+
+GType
+maman_bar_get_type (void)
+{
+       static volatile gsize maman_bar_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_bar_type_id__volatile)) {
+               GType maman_bar_type_id;
+               maman_bar_type_id = maman_bar_get_type_once ();
+               g_once_init_leave (&maman_bar_type_id__volatile, maman_bar_type_id);
+       }
+       return maman_bar_type_id__volatile;
+}
+
+static inline gpointer
+maman_foo_get_instance_private (MamanFoo* self)
+{
+       return G_STRUCT_MEMBER_P (self, MamanFoo_private_offset);
+}
+
+void
+maman_foo_run (MamanFoo* self)
+{
+       FILE* _tmp0_;
+       FILE* _tmp9_;
+       g_return_if_fail (MAMAN_IS_FOO (self));
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, " 2");
+       switch (23) {
+               case 23:
+               {
+                       FILE* _tmp1_;
+                       _tmp1_ = stdout;
+                       fprintf (_tmp1_, " 3");
+                       break;
+               }
+               default:
+               {
+                       FILE* _tmp2_;
+                       _tmp2_ = stdout;
+                       fprintf (_tmp2_, " BAD");
+                       break;
+               }
+       }
+       switch (maman_foo_inc (self)) {
+               case 0:
+               {
+                       FILE* _tmp3_;
+                       _tmp3_ = stdout;
+                       fprintf (_tmp3_, " 4");
+                       break;
+               }
+               case 1:
+               {
+                       FILE* _tmp4_;
+                       _tmp4_ = stdout;
+                       fprintf (_tmp4_, " BAD");
+                       break;
+               }
+               default:
+               {
+                       FILE* _tmp5_;
+                       _tmp5_ = stdout;
+                       fprintf (_tmp5_, " BAD");
+                       break;
+               }
+       }
+       switch (42) {
+               case 0:
+               {
+                       FILE* _tmp6_;
+                       _tmp6_ = stdout;
+                       fprintf (_tmp6_, " BAD");
+                       break;
+               }
+               default:
+               {
+                       FILE* _tmp7_;
+                       _tmp7_ = stdout;
+                       fprintf (_tmp7_, " 5");
+                       break;
+               }
+               case 1:
+               {
+                       FILE* _tmp8_;
+                       _tmp8_ = stdout;
+                       fprintf (_tmp8_, " BAD");
+                       break;
+               }
+       }
+       _tmp9_ = stdout;
+       fprintf (_tmp9_, " 6");
+}
+
+gint
+maman_foo_inc (MamanFoo* self)
+{
+       gint _tmp0_;
+       gint result = 0;
+       g_return_val_if_fail (MAMAN_IS_FOO (self), 0);
+       _tmp0_ = self->priv->counter;
+       self->priv->counter = _tmp0_ + 1;
+       result = _tmp0_;
+       return result;
+}
+
+MamanFoo*
+maman_foo_construct (GType object_type)
+{
+       MamanFoo * self = NULL;
+       self = (MamanFoo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+MamanFoo*
+maman_foo_new (void)
+{
+       return maman_foo_construct (MAMAN_TYPE_FOO);
+}
+
+static void
+maman_foo_class_init (MamanFooClass * klass,
+                      gpointer klass_data)
+{
+       maman_foo_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &MamanFoo_private_offset);
+       G_OBJECT_CLASS (klass)->finalize = maman_foo_finalize;
+}
+
+static void
+maman_foo_instance_init (MamanFoo * self,
+                         gpointer klass)
+{
+       self->priv = maman_foo_get_instance_private (self);
+       self->priv->counter = 0;
+}
+
+static void
+maman_foo_finalize (GObject * obj)
+{
+       MamanFoo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, MAMAN_TYPE_FOO, MamanFoo);
+       G_OBJECT_CLASS (maman_foo_parent_class)->finalize (obj);
+}
+
+static GType
+maman_foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (MamanFooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(MamanFoo), 0, (GInstanceInitFunc) maman_foo_instance_init, NULL };
+       GType maman_foo_type_id;
+       maman_foo_type_id = g_type_register_static (G_TYPE_OBJECT, "MamanFoo", &g_define_type_info, 0);
+       MamanFoo_private_offset = g_type_add_instance_private (maman_foo_type_id, sizeof (MamanFooPrivate));
+       return maman_foo_type_id;
+}
+
+GType
+maman_foo_get_type (void)
+{
+       static volatile gsize maman_foo_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_foo_type_id__volatile)) {
+               GType maman_foo_type_id;
+               maman_foo_type_id = maman_foo_get_type_once ();
+               g_once_init_leave (&maman_foo_type_id__volatile, maman_foo_type_id);
+       }
+       return maman_foo_type_id__volatile;
+}
+
diff --git a/tests/control-flow/while-false.c-expected b/tests/control-flow/while-false.c-expected
new file mode 100644
index 000000000..63525993d
--- /dev/null
+++ b/tests/control-flow/while-false.c-expected
@@ -0,0 +1,23 @@
+/* control_flow_while_false.c generated by valac, the Vala compiler
+ * generated from control_flow_while_false.vala, do not modify */
+
+#include <glib.h>
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+       while (TRUE) {
+               break;
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/dbus/arrays_client.c-expected b/tests/dbus/arrays_client.c-expected
new file mode 100644
index 000000000..8c17358f0
--- /dev/null
+++ b/tests/dbus/arrays_client.c-expected
@@ -0,0 +1,1153 @@
+/* dbus_arrays_client.c generated by valac, the Vala compiler
+ * generated from dbus_arrays_client.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define TEST_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_TEST, TestIface))
+
+typedef struct _Test Test;
+typedef struct _TestIface TestIface;
+
+#define TYPE_TEST_PROXY (test_proxy_get_type ())
+typedef GDBusProxy TestProxy;
+typedef GDBusProxyClass TestProxyClass;
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _TestIface {
+       GTypeInterface parent_iface;
+       gint* (*test_int) (Test* self, gint* i, gint i_length1, gint** j, gint* j_length1, gint* 
result_length1, GError** error);
+       gchar** (*test_string) (Test* self, gchar** s, gint s_length1, gchar*** t, gint* t_length1, gint* 
result_length1, GError** error);
+       gchar** (*get_test_property) (Test* self, gint* result_length1);
+       void (*set_test_property) (Test* self, gchar** value, gint value_length1);
+};
+
+VALA_EXTERN GType test_proxy_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN guint test_register_object (void* object,
+                            GDBusConnection* connection,
+                            const gchar* path,
+                            GError** error);
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN gint* test_test_int (Test* self,
+                     gint* i,
+                     gint i_length1,
+                     gint** j,
+                     gint* j_length1,
+                     gint* result_length1,
+                     GError** error);
+VALA_EXTERN gchar** test_test_string (Test* self,
+                          gchar** s,
+                          gint s_length1,
+                          gchar*** t,
+                          gint* t_length1,
+                          gint* result_length1,
+                          GError** error);
+VALA_EXTERN gchar** test_get_test_property (Test* self,
+                                gint* result_length1);
+VALA_EXTERN void test_set_test_property (Test* self,
+                             gchar** value,
+                             gint value_length1);
+static GType test_get_type_once (void);
+static void test_proxy_g_signal (GDBusProxy* proxy,
+                          const gchar* sender_name,
+                          const gchar* signal_name,
+                          GVariant* parameters);
+static gint* test_proxy_test_int (Test* self,
+                           gint* i,
+                           gint i_length1,
+                           gint** j,
+                           gint* j_length1,
+                           gint* result_length1,
+                           GError** error);
+static gchar** test_proxy_test_string (Test* self,
+                                gchar** s,
+                                gint s_length1,
+                                gchar*** t,
+                                gint* t_length1,
+                                gint* result_length1,
+                                GError** error);
+static gchar** test_dbus_proxy_get_test_property (Test* self,
+                                           gint* result_length1);
+static void test_dbus_proxy_set_test_property (Test* self,
+                                        gchar** value,
+                                        gint value_length1);
+static void test_proxy_test_interface_init (TestIface* iface);
+static void _dbus_test_test_int (Test* self,
+                          GVariant* _parameters_,
+                          GDBusMethodInvocation* invocation);
+static void _dbus_test_test_string (Test* self,
+                             GVariant* _parameters_,
+                             GDBusMethodInvocation* invocation);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* method_name,
+                                      GVariant* parameters,
+                                      GDBusMethodInvocation* invocation,
+                                      gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+                                            const gchar* sender,
+                                            const gchar* object_path,
+                                            const gchar* interface_name,
+                                            const gchar* property_name,
+                                            GError** error,
+                                            gpointer user_data);
+static GVariant* _dbus_test_get_test_property (Test* self);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GVariant* value,
+                                           GError** error,
+                                           gpointer user_data);
+static void _dbus_test_set_test_property (Test* self,
+                                   GVariant* _value);
+static void _test_unregister_object (gpointer user_data);
+static void _vala_main (void);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static const GDBusArgInfo _test_dbus_arg_info_test_int_i = {-1, "i", "ai", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_int_j = {-1, "j", "ai", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_int_result = {-1, "result", "ai", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_int_in[] = {&_test_dbus_arg_info_test_int_i, 
NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_int_out[] = {&_test_dbus_arg_info_test_int_j, 
&_test_dbus_arg_info_test_int_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_int = {-1, "TestInt", (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_int_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_int_out), NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_string_s = {-1, "s", "as", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_string_t = {-1, "t", "as", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_string_result = {-1, "result", "as", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_string_in[] = 
{&_test_dbus_arg_info_test_string_s, NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_string_out[] = 
{&_test_dbus_arg_info_test_string_t, &_test_dbus_arg_info_test_string_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_string = {-1, "TestString", (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_string_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_string_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_test_int, 
&_test_dbus_method_info_test_string, NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo _test_dbus_property_info_test_property = {-1, "TestProperty", "as", 
G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = 
{&_test_dbus_property_info_test_property, NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) 
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, 
test_dbus_interface_get_property, test_dbus_interface_set_property};
+
+gint*
+test_test_int (Test* self,
+               gint* i,
+               gint i_length1,
+               gint** j,
+               gint* j_length1,
+               gint* result_length1,
+               GError** error)
+{
+       TestIface* _iface_;
+       g_return_val_if_fail (IS_TEST (self), NULL);
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->test_int) {
+               return _iface_->test_int (self, i, i_length1, j, j_length1, result_length1, error);
+       }
+       return NULL;
+}
+
+gchar**
+test_test_string (Test* self,
+                  gchar** s,
+                  gint s_length1,
+                  gchar*** t,
+                  gint* t_length1,
+                  gint* result_length1,
+                  GError** error)
+{
+       TestIface* _iface_;
+       g_return_val_if_fail (IS_TEST (self), NULL);
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->test_string) {
+               return _iface_->test_string (self, s, s_length1, t, t_length1, result_length1, error);
+       }
+       return NULL;
+}
+
+gchar**
+test_get_test_property (Test* self,
+                        gint* result_length1)
+{
+       TestIface* _iface_;
+       g_return_val_if_fail (IS_TEST (self), NULL);
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->get_test_property) {
+               return _iface_->get_test_property (self, result_length1);
+       }
+       return NULL;
+}
+
+void
+test_set_test_property (Test* self,
+                        gchar** value,
+                        gint value_length1)
+{
+       TestIface* _iface_;
+       g_return_if_fail (IS_TEST (self));
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->set_test_property) {
+               _iface_->set_test_property (self, value, value_length1);
+       }
+}
+
+static void
+test_default_init (TestIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType test_type_id;
+       test_type_id = g_type_register_static (G_TYPE_INTERFACE, "Test", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (test_type_id, G_TYPE_OBJECT);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) 
test_proxy_get_type);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), 
"org.example.Test");
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*) 
(&_test_dbus_interface_info));
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_register_object);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_TEST, 
test_proxy_test_interface_init) )
+static void
+test_proxy_class_init (TestProxyClass* klass)
+{
+       G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal;
+}
+
+static void
+test_proxy_g_signal (GDBusProxy* proxy,
+                     const gchar* sender_name,
+                     const gchar* signal_name,
+                     GVariant* parameters)
+{
+}
+
+static void
+test_proxy_init (TestProxy* self)
+{
+       g_dbus_proxy_set_interface_info (G_DBUS_PROXY (self), (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info));
+}
+
+static gint*
+test_proxy_test_int (Test* self,
+                     gint* i,
+                     gint i_length1,
+                     gint** j,
+                     gint* j_length1,
+                     gint* result_length1,
+                     GError** error)
+{
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       gint* _tmp0_;
+       GVariantBuilder _tmp1_;
+       gint _tmp2_;
+       GDBusMessage *_reply_message;
+       GVariant *_reply;
+       GVariantIter _reply_iter;
+       gint* _vala_j = NULL;
+       gint _vala_j_length1;
+       GVariant* _tmp3_;
+       gint* _tmp4_;
+       gint _tmp4__length;
+       gint _tmp4__size;
+       gint _tmp4__length1;
+       GVariantIter _tmp5_;
+       GVariant* _tmp6_;
+       gint* _result = NULL;
+       gint _result_length1;
+       GVariant* _tmp7_;
+       gint* _tmp8_;
+       gint _tmp8__length;
+       gint _tmp8__size;
+       gint _tmp8__length1;
+       GVariantIter _tmp9_;
+       GVariant* _tmp10_;
+       G_IO_ERROR;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "TestInt");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       _tmp0_ = i;
+       g_variant_builder_init (&_tmp1_, G_VARIANT_TYPE ("ai"));
+       for (_tmp2_ = 0; _tmp2_ < i_length1; _tmp2_++) {
+               g_variant_builder_add_value (&_tmp1_, g_variant_new_int32 (*_tmp0_));
+               _tmp0_++;
+       }
+       g_variant_builder_add_value (&_arguments_builder, g_variant_builder_end (&_tmp1_));
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       _reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout 
((GDBusProxy *) self), NULL, NULL, error);
+       g_object_unref (_message);
+       if (!_reply_message) {
+               return NULL;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, error)) {
+               g_object_unref (_reply_message);
+               return NULL;
+       }
+       _reply = g_dbus_message_get_body (_reply_message);
+       g_variant_iter_init (&_reply_iter, _reply);
+       _vala_j_length1 = 0;
+       _tmp3_ = g_variant_iter_next_value (&_reply_iter);
+       _tmp4_ = g_new (gint, 5);
+       _tmp4__length = 0;
+       _tmp4__size = 4;
+       _tmp4__length1 = 0;
+       g_variant_iter_init (&_tmp5_, _tmp3_);
+       for (; (_tmp6_ = g_variant_iter_next_value (&_tmp5_)) != NULL; _tmp4__length1++) {
+               if (_tmp4__size == _tmp4__length) {
+                       _tmp4__size = 2 * _tmp4__size;
+                       _tmp4_ = g_renew (gint, _tmp4_, _tmp4__size + 1);
+               }
+               _tmp4_[_tmp4__length++] = g_variant_get_int32 (_tmp6_);
+               g_variant_unref (_tmp6_);
+       }
+       _vala_j_length1 = _tmp4__length1;
+       _vala_j = _tmp4_;
+       g_variant_unref (_tmp3_);
+       *j = _vala_j;
+       *j_length1 = _vala_j_length1;
+       _result_length1 = 0;
+       _tmp7_ = g_variant_iter_next_value (&_reply_iter);
+       _tmp8_ = g_new (gint, 5);
+       _tmp8__length = 0;
+       _tmp8__size = 4;
+       _tmp8__length1 = 0;
+       g_variant_iter_init (&_tmp9_, _tmp7_);
+       for (; (_tmp10_ = g_variant_iter_next_value (&_tmp9_)) != NULL; _tmp8__length1++) {
+               if (_tmp8__size == _tmp8__length) {
+                       _tmp8__size = 2 * _tmp8__size;
+                       _tmp8_ = g_renew (gint, _tmp8_, _tmp8__size + 1);
+               }
+               _tmp8_[_tmp8__length++] = g_variant_get_int32 (_tmp10_);
+               g_variant_unref (_tmp10_);
+       }
+       _result_length1 = _tmp8__length1;
+       _result = _tmp8_;
+       g_variant_unref (_tmp7_);
+       *result_length1 = _result_length1;
+       g_object_unref (_reply_message);
+       return _result;
+}
+
+static gchar**
+test_proxy_test_string (Test* self,
+                        gchar** s,
+                        gint s_length1,
+                        gchar*** t,
+                        gint* t_length1,
+                        gint* result_length1,
+                        GError** error)
+{
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       gchar** _tmp11_;
+       GVariantBuilder _tmp12_;
+       gint _tmp13_;
+       GDBusMessage *_reply_message;
+       GVariant *_reply;
+       GVariantIter _reply_iter;
+       gchar** _vala_t = NULL;
+       gint _vala_t_length1;
+       GVariant* _tmp14_;
+       gchar** _tmp15_;
+       gint _tmp15__length;
+       gint _tmp15__size;
+       gint _tmp15__length1;
+       GVariantIter _tmp16_;
+       GVariant* _tmp17_;
+       gchar** _result = NULL;
+       gint _result_length1;
+       GVariant* _tmp18_;
+       gchar** _tmp19_;
+       gint _tmp19__length;
+       gint _tmp19__size;
+       gint _tmp19__length1;
+       GVariantIter _tmp20_;
+       GVariant* _tmp21_;
+       G_IO_ERROR;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "TestString");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       _tmp11_ = s;
+       g_variant_builder_init (&_tmp12_, G_VARIANT_TYPE ("as"));
+       for (_tmp13_ = 0; _tmp13_ < s_length1; _tmp13_++) {
+               g_variant_builder_add_value (&_tmp12_, g_variant_new_string (*_tmp11_));
+               _tmp11_++;
+       }
+       g_variant_builder_add_value (&_arguments_builder, g_variant_builder_end (&_tmp12_));
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       _reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout 
((GDBusProxy *) self), NULL, NULL, error);
+       g_object_unref (_message);
+       if (!_reply_message) {
+               return NULL;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, error)) {
+               g_object_unref (_reply_message);
+               return NULL;
+       }
+       _reply = g_dbus_message_get_body (_reply_message);
+       g_variant_iter_init (&_reply_iter, _reply);
+       _vala_t_length1 = 0;
+       _tmp14_ = g_variant_iter_next_value (&_reply_iter);
+       _tmp15_ = g_new (gchar*, 5);
+       _tmp15__length = 0;
+       _tmp15__size = 4;
+       _tmp15__length1 = 0;
+       g_variant_iter_init (&_tmp16_, _tmp14_);
+       for (; (_tmp17_ = g_variant_iter_next_value (&_tmp16_)) != NULL; _tmp15__length1++) {
+               if (_tmp15__size == _tmp15__length) {
+                       _tmp15__size = 2 * _tmp15__size;
+                       _tmp15_ = g_renew (gchar*, _tmp15_, _tmp15__size + 1);
+               }
+               _tmp15_[_tmp15__length++] = g_variant_dup_string (_tmp17_, NULL);
+               g_variant_unref (_tmp17_);
+       }
+       _vala_t_length1 = _tmp15__length1;
+       _tmp15_[_tmp15__length] = NULL;
+       _vala_t = _tmp15_;
+       g_variant_unref (_tmp14_);
+       *t = _vala_t;
+       *t_length1 = _vala_t_length1;
+       _result_length1 = 0;
+       _tmp18_ = g_variant_iter_next_value (&_reply_iter);
+       _tmp19_ = g_new (gchar*, 5);
+       _tmp19__length = 0;
+       _tmp19__size = 4;
+       _tmp19__length1 = 0;
+       g_variant_iter_init (&_tmp20_, _tmp18_);
+       for (; (_tmp21_ = g_variant_iter_next_value (&_tmp20_)) != NULL; _tmp19__length1++) {
+               if (_tmp19__size == _tmp19__length) {
+                       _tmp19__size = 2 * _tmp19__size;
+                       _tmp19_ = g_renew (gchar*, _tmp19_, _tmp19__size + 1);
+               }
+               _tmp19_[_tmp19__length++] = g_variant_dup_string (_tmp21_, NULL);
+               g_variant_unref (_tmp21_);
+       }
+       _result_length1 = _tmp19__length1;
+       _tmp19_[_tmp19__length] = NULL;
+       _result = _tmp19_;
+       g_variant_unref (_tmp18_);
+       *result_length1 = _result_length1;
+       g_object_unref (_reply_message);
+       return _result;
+}
+
+static gchar**
+test_dbus_proxy_get_test_property (Test* self,
+                                   gint* result_length1)
+{
+       GVariant *_inner_reply;
+       gchar** _result;
+       gint _result_length1;
+       gchar** _tmp22_;
+       gint _tmp22__length;
+       gint _tmp22__size;
+       gint _tmp22__length1;
+       GVariantIter _tmp23_;
+       GVariant* _tmp24_;
+       _inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "TestProperty");
+       if (!_inner_reply) {
+               GVariant *_arguments;
+               GVariant *_reply;
+               GVariantBuilder _arguments_builder;
+               g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+               g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.example.Test"));
+               g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("TestProperty"));
+               _arguments = g_variant_builder_end (&_arguments_builder);
+               _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", 
_arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+               if (!_reply) {
+                       return NULL;
+               }
+               g_variant_get (_reply, "(v)", &_inner_reply);
+               g_variant_unref (_reply);
+       }
+       _result_length1 = 0;
+       _tmp22_ = g_new (gchar*, 5);
+       _tmp22__length = 0;
+       _tmp22__size = 4;
+       _tmp22__length1 = 0;
+       g_variant_iter_init (&_tmp23_, _inner_reply);
+       for (; (_tmp24_ = g_variant_iter_next_value (&_tmp23_)) != NULL; _tmp22__length1++) {
+               if (_tmp22__size == _tmp22__length) {
+                       _tmp22__size = 2 * _tmp22__size;
+                       _tmp22_ = g_renew (gchar*, _tmp22_, _tmp22__size + 1);
+               }
+               _tmp22_[_tmp22__length++] = g_variant_dup_string (_tmp24_, NULL);
+               g_variant_unref (_tmp24_);
+       }
+       _result_length1 = _tmp22__length1;
+       _tmp22_[_tmp22__length] = NULL;
+       _result = _tmp22_;
+       *result_length1 = _result_length1;
+       g_variant_unref (_inner_reply);
+       return _result;
+}
+
+static void
+test_dbus_proxy_set_test_property (Test* self,
+                                   gchar** value,
+                                   gint value_length1)
+{
+       GVariant *_arguments;
+       GVariant *_reply;
+       GVariantBuilder _arguments_builder;
+       gchar** _tmp25_;
+       GVariantBuilder _tmp26_;
+       gint _tmp27_;
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.example.Test"));
+       g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("TestProperty"));
+       g_variant_builder_open (&_arguments_builder, G_VARIANT_TYPE_VARIANT);
+       _tmp25_ = value;
+       g_variant_builder_init (&_tmp26_, G_VARIANT_TYPE ("as"));
+       for (_tmp27_ = 0; _tmp27_ < value_length1; _tmp27_++) {
+               g_variant_builder_add_value (&_tmp26_, g_variant_new_string (*_tmp25_));
+               _tmp25_++;
+       }
+       g_variant_builder_add_value (&_arguments_builder, g_variant_builder_end (&_tmp26_));
+       g_variant_builder_close (&_arguments_builder);
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Set", 
_arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+       if (!_reply) {
+               return;
+       }
+       g_variant_unref (_reply);
+}
+
+static void
+test_proxy_test_interface_init (TestIface* iface)
+{
+       iface->test_int = test_proxy_test_int;
+       iface->test_string = test_proxy_test_string;
+       iface->get_test_property = test_dbus_proxy_get_test_property;
+       iface->set_test_property = test_dbus_proxy_set_test_property;
+}
+
+static void
+_dbus_test_test_int (Test* self,
+                     GVariant* _parameters_,
+                     GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       gint* i = NULL;
+       gint i_length1 = 0;
+       GVariant* _tmp28_;
+       gint* _tmp29_;
+       gint _tmp29__length;
+       gint _tmp29__size;
+       gint _tmp29__length1;
+       GVariantIter _tmp30_;
+       GVariant* _tmp31_;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       gint* j = NULL;
+       gint j_length1 = 0;
+       gint* _tmp32_;
+       GVariantBuilder _tmp33_;
+       gint _tmp34_;
+       gint* result;
+       gint result_length1 = 0;
+       gint* _tmp35_;
+       GVariantBuilder _tmp36_;
+       gint _tmp37_;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _tmp28_ = g_variant_iter_next_value (&_arguments_iter);
+       _tmp29_ = g_new (gint, 5);
+       _tmp29__length = 0;
+       _tmp29__size = 4;
+       _tmp29__length1 = 0;
+       g_variant_iter_init (&_tmp30_, _tmp28_);
+       for (; (_tmp31_ = g_variant_iter_next_value (&_tmp30_)) != NULL; _tmp29__length1++) {
+               if (_tmp29__size == _tmp29__length) {
+                       _tmp29__size = 2 * _tmp29__size;
+                       _tmp29_ = g_renew (gint, _tmp29_, _tmp29__size + 1);
+               }
+               _tmp29_[_tmp29__length++] = g_variant_get_int32 (_tmp31_);
+               g_variant_unref (_tmp31_);
+       }
+       i_length1 = _tmp29__length1;
+       i = _tmp29_;
+       g_variant_unref (_tmp28_);
+       result = test_test_int (self, i, i_length1, &j, &j_length1, &result_length1, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               goto _error;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _tmp32_ = j;
+       g_variant_builder_init (&_tmp33_, G_VARIANT_TYPE ("ai"));
+       for (_tmp34_ = 0; _tmp34_ < j_length1; _tmp34_++) {
+               g_variant_builder_add_value (&_tmp33_, g_variant_new_int32 (*_tmp32_));
+               _tmp32_++;
+       }
+       g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp33_));
+       _tmp35_ = result;
+       g_variant_builder_init (&_tmp36_, G_VARIANT_TYPE ("ai"));
+       for (_tmp37_ = 0; _tmp37_ < result_length1; _tmp37_++) {
+               g_variant_builder_add_value (&_tmp36_, g_variant_new_int32 (*_tmp35_));
+               _tmp35_++;
+       }
+       g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp36_));
+       result = (g_free (result), NULL);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+       _error:
+       i = (g_free (i), NULL);
+       j = (g_free (j), NULL);
+       ;
+}
+
+static void
+_dbus_test_test_string (Test* self,
+                        GVariant* _parameters_,
+                        GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       gchar** s = NULL;
+       gint s_length1 = 0;
+       GVariant* _tmp38_;
+       gchar** _tmp39_;
+       gint _tmp39__length;
+       gint _tmp39__size;
+       gint _tmp39__length1;
+       GVariantIter _tmp40_;
+       GVariant* _tmp41_;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       gchar** t = NULL;
+       gint t_length1 = 0;
+       gchar** _tmp42_;
+       GVariantBuilder _tmp43_;
+       gint _tmp44_;
+       gchar** result;
+       gint result_length1 = 0;
+       gchar** _tmp45_;
+       GVariantBuilder _tmp46_;
+       gint _tmp47_;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _tmp38_ = g_variant_iter_next_value (&_arguments_iter);
+       _tmp39_ = g_new (gchar*, 5);
+       _tmp39__length = 0;
+       _tmp39__size = 4;
+       _tmp39__length1 = 0;
+       g_variant_iter_init (&_tmp40_, _tmp38_);
+       for (; (_tmp41_ = g_variant_iter_next_value (&_tmp40_)) != NULL; _tmp39__length1++) {
+               if (_tmp39__size == _tmp39__length) {
+                       _tmp39__size = 2 * _tmp39__size;
+                       _tmp39_ = g_renew (gchar*, _tmp39_, _tmp39__size + 1);
+               }
+               _tmp39_[_tmp39__length++] = g_variant_dup_string (_tmp41_, NULL);
+               g_variant_unref (_tmp41_);
+       }
+       s_length1 = _tmp39__length1;
+       _tmp39_[_tmp39__length] = NULL;
+       s = _tmp39_;
+       g_variant_unref (_tmp38_);
+       result = test_test_string (self, s, s_length1, &t, &t_length1, &result_length1, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               goto _error;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _tmp42_ = t;
+       g_variant_builder_init (&_tmp43_, G_VARIANT_TYPE ("as"));
+       for (_tmp44_ = 0; _tmp44_ < t_length1; _tmp44_++) {
+               g_variant_builder_add_value (&_tmp43_, g_variant_new_string (*_tmp42_));
+               _tmp42_++;
+       }
+       g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp43_));
+       _tmp45_ = result;
+       g_variant_builder_init (&_tmp46_, G_VARIANT_TYPE ("as"));
+       for (_tmp47_ = 0; _tmp47_ < result_length1; _tmp47_++) {
+               g_variant_builder_add_value (&_tmp46_, g_variant_new_string (*_tmp45_));
+               _tmp45_++;
+       }
+       g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp46_));
+       result = (_vala_array_free (result, result_length1, (GDestroyNotify) g_free), NULL);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+       _error:
+       s = (_vala_array_free (s, s_length1, (GDestroyNotify) g_free), NULL);
+       t = (_vala_array_free (t, t_length1, (GDestroyNotify) g_free), NULL);
+       ;
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* method_name,
+                                 GVariant* parameters,
+                                 GDBusMethodInvocation* invocation,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "TestInt") == 0) {
+               _dbus_test_test_int (object, parameters, invocation);
+       } else if (strcmp (method_name, "TestString") == 0) {
+               _dbus_test_test_string (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+_dbus_test_get_test_property (Test* self)
+{
+       gchar** result;
+       gint result_length1 = 0;
+       GVariant* _reply;
+       gchar** _tmp48_;
+       GVariantBuilder _tmp49_;
+       gint _tmp50_;
+       result = test_get_test_property (self, &result_length1);
+       _tmp48_ = result;
+       g_variant_builder_init (&_tmp49_, G_VARIANT_TYPE ("as"));
+       for (_tmp50_ = 0; _tmp50_ < result_length1; _tmp50_++) {
+               g_variant_builder_add_value (&_tmp49_, g_variant_new_string (*_tmp48_));
+               _tmp48_++;
+       }
+       _reply = g_variant_builder_end (&_tmp49_);
+       result = (_vala_array_free (result, result_length1, (GDestroyNotify) g_free), NULL);
+       return _reply;
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (property_name, "TestProperty") == 0) {
+               return _dbus_test_get_test_property (object);
+       }
+       return NULL;
+}
+
+static void
+_dbus_test_set_test_property (Test* self,
+                              GVariant* _value)
+{
+       gchar** value = NULL;
+       gint value_length1;
+       gchar** _tmp51_;
+       gint _tmp51__length;
+       gint _tmp51__size;
+       gint _tmp51__length1;
+       GVariantIter _tmp52_;
+       GVariant* _tmp53_;
+       _tmp51_ = g_new (gchar*, 5);
+       _tmp51__length = 0;
+       _tmp51__size = 4;
+       _tmp51__length1 = 0;
+       g_variant_iter_init (&_tmp52_, _value);
+       for (; (_tmp53_ = g_variant_iter_next_value (&_tmp52_)) != NULL; _tmp51__length1++) {
+               if (_tmp51__size == _tmp51__length) {
+                       _tmp51__size = 2 * _tmp51__size;
+                       _tmp51_ = g_renew (gchar*, _tmp51_, _tmp51__size + 1);
+               }
+               _tmp51_[_tmp51__length++] = g_variant_dup_string (_tmp53_, NULL);
+               g_variant_unref (_tmp53_);
+       }
+       value_length1 = _tmp51__length1;
+       _tmp51_[_tmp51__length] = NULL;
+       value = _tmp51_;
+       test_set_test_property (self, value, value_length1);
+       value = (_vala_array_free (value, value_length1, (GDestroyNotify) g_free), NULL);
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GVariant* value,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (property_name, "TestProperty") == 0) {
+               _dbus_test_set_test_property (object, value);
+               return TRUE;
+       }
+       return FALSE;
+}
+
+guint
+test_register_object (gpointer object,
+                      GDBusConnection* connection,
+                      const gchar* path,
+                      GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+static void
+_vala_main (void)
+{
+       Test* test = NULL;
+       Test* _tmp0_;
+       gint* j = NULL;
+       gint j_length1 = 0;
+       gint _j_size_ = 0;
+       gint* k = NULL;
+       gint k_length1 = 0;
+       gint _k_size_ = 0;
+       gint* _tmp1_ = NULL;
+       Test* _tmp2_;
+       gint* _tmp3_;
+       gint* _tmp4_;
+       gint _tmp4__length1;
+       gint* _tmp5_ = NULL;
+       gint _tmp6_ = 0;
+       gint _tmp7_ = 0;
+       gint* _tmp8_;
+       gint* _tmp9_;
+       gint _tmp9__length1;
+       gint _tmp1__length1;
+       gint __tmp1__size_;
+       gint* _tmp10_;
+       gint _tmp10__length1;
+       gboolean _tmp11_ = FALSE;
+       gint* _tmp12_;
+       gint _tmp12__length1;
+       gboolean _tmp15_ = FALSE;
+       gint* _tmp16_;
+       gint _tmp16__length1;
+       gchar** t = NULL;
+       gint t_length1 = 0;
+       gint _t_size_ = 0;
+       gchar** u = NULL;
+       gint u_length1 = 0;
+       gint _u_size_ = 0;
+       gchar** _tmp19_ = NULL;
+       Test* _tmp20_;
+       gchar* _tmp21_;
+       gchar** _tmp22_;
+       gchar** _tmp23_;
+       gint _tmp23__length1;
+       gchar** _tmp24_ = NULL;
+       gint _tmp25_ = 0;
+       gint _tmp26_ = 0;
+       gchar** _tmp27_;
+       gchar** _tmp28_;
+       gint _tmp28__length1;
+       gint _tmp19__length1;
+       gint __tmp19__size_;
+       gchar** _tmp29_;
+       gint _tmp29__length1;
+       gboolean _tmp30_ = FALSE;
+       gchar** _tmp31_;
+       gint _tmp31__length1;
+       gboolean _tmp34_ = FALSE;
+       gchar** _tmp35_;
+       gint _tmp35__length1;
+       Test* _tmp38_;
+       gchar* _tmp39_;
+       gchar** _tmp40_;
+       gchar** _tmp41_;
+       gint _tmp41__length1;
+       Test* _tmp42_;
+       gchar** _tmp43_;
+       gint _tmp43__length1;
+       gint _tmp44_ = 0;
+       gchar** _tmp45_;
+       gint _tmp45__length1;
+       gboolean _tmp46_ = FALSE;
+       gchar** _tmp47_;
+       gint _tmp47__length1;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = (Test*) g_initable_new (TYPE_TEST_PROXY, NULL, &_inner_error0_, "g-flags", 
G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, "g-name", "org.example.Test", "g-bus-type", G_BUS_TYPE_SESSION, 
"g-object-path", "/org/example/test", "g-interface-name", "org.example.Test", NULL);
+       test = (Test*) _tmp0_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp2_ = test;
+       _tmp3_ = g_new0 (gint, 1);
+       _tmp3_[0] = 42;
+       _tmp4_ = _tmp3_;
+       _tmp4__length1 = 1;
+       _tmp8_ = test_test_int (_tmp2_, _tmp4_, (gint) 1, &_tmp5_, &_tmp6_, &_tmp7_, &_inner_error0_);
+       j = (g_free (j), NULL);
+       j = _tmp5_;
+       j_length1 = _tmp6_;
+       _j_size_ = j_length1;
+       _tmp9_ = _tmp8_;
+       _tmp9__length1 = _tmp7_;
+       _tmp4_ = (g_free (_tmp4_), NULL);
+       _tmp1_ = _tmp9_;
+       _tmp1__length1 = _tmp9__length1;
+       __tmp1__size_ = _tmp1__length1;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               k = (g_free (k), NULL);
+               j = (g_free (j), NULL);
+               _g_object_unref0 (test);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp10_ = _tmp1_;
+       _tmp10__length1 = _tmp1__length1;
+       _tmp1_ = NULL;
+       _tmp1__length1 = 0;
+       k = (g_free (k), NULL);
+       k = _tmp10_;
+       k_length1 = _tmp10__length1;
+       _k_size_ = k_length1;
+       _tmp12_ = j;
+       _tmp12__length1 = j_length1;
+       if (_tmp12__length1 == 1) {
+               gint* _tmp13_;
+               gint _tmp13__length1;
+               gint _tmp14_;
+               _tmp13_ = j;
+               _tmp13__length1 = j_length1;
+               _tmp14_ = _tmp13_[0];
+               _tmp11_ = _tmp14_ == 23;
+       } else {
+               _tmp11_ = FALSE;
+       }
+       _vala_assert (_tmp11_, "j.length == 1 && j[0] == 23");
+       _tmp16_ = k;
+       _tmp16__length1 = k_length1;
+       if (_tmp16__length1 == 1) {
+               gint* _tmp17_;
+               gint _tmp17__length1;
+               gint _tmp18_;
+               _tmp17_ = k;
+               _tmp17__length1 = k_length1;
+               _tmp18_ = _tmp17_[0];
+               _tmp15_ = _tmp18_ == 11;
+       } else {
+               _tmp15_ = FALSE;
+       }
+       _vala_assert (_tmp15_, "k.length == 1 && k[0] == 11");
+       _tmp20_ = test;
+       _tmp21_ = g_strdup ("hello");
+       _tmp22_ = g_new0 (gchar*, 1 + 1);
+       _tmp22_[0] = _tmp21_;
+       _tmp23_ = _tmp22_;
+       _tmp23__length1 = 1;
+       _tmp27_ = test_test_string (_tmp20_, _tmp23_, (gint) 1, &_tmp24_, &_tmp25_, &_tmp26_, 
&_inner_error0_);
+       t = (_vala_array_free (t, t_length1, (GDestroyNotify) g_free), NULL);
+       t = _tmp24_;
+       t_length1 = _tmp25_;
+       _t_size_ = t_length1;
+       _tmp28_ = _tmp27_;
+       _tmp28__length1 = _tmp26_;
+       _tmp23_ = (_vala_array_free (_tmp23_, _tmp23__length1, (GDestroyNotify) g_free), NULL);
+       _tmp19_ = _tmp28_;
+       _tmp19__length1 = _tmp28__length1;
+       __tmp19__size_ = _tmp19__length1;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               u = (_vala_array_free (u, u_length1, (GDestroyNotify) g_free), NULL);
+               t = (_vala_array_free (t, t_length1, (GDestroyNotify) g_free), NULL);
+               _tmp1_ = (g_free (_tmp1_), NULL);
+               k = (g_free (k), NULL);
+               j = (g_free (j), NULL);
+               _g_object_unref0 (test);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp29_ = _tmp19_;
+       _tmp29__length1 = _tmp19__length1;
+       _tmp19_ = NULL;
+       _tmp19__length1 = 0;
+       u = (_vala_array_free (u, u_length1, (GDestroyNotify) g_free), NULL);
+       u = _tmp29_;
+       u_length1 = _tmp29__length1;
+       _u_size_ = u_length1;
+       _tmp31_ = t;
+       _tmp31__length1 = t_length1;
+       if (_tmp31__length1 == 1) {
+               gchar** _tmp32_;
+               gint _tmp32__length1;
+               const gchar* _tmp33_;
+               _tmp32_ = t;
+               _tmp32__length1 = t_length1;
+               _tmp33_ = _tmp32_[0];
+               _tmp30_ = g_strcmp0 (_tmp33_, "world") == 0;
+       } else {
+               _tmp30_ = FALSE;
+       }
+       _vala_assert (_tmp30_, "t.length == 1 && t[0] == \"world\"");
+       _tmp35_ = u;
+       _tmp35__length1 = u_length1;
+       if (_tmp35__length1 == 1) {
+               gchar** _tmp36_;
+               gint _tmp36__length1;
+               const gchar* _tmp37_;
+               _tmp36_ = u;
+               _tmp36__length1 = u_length1;
+               _tmp37_ = _tmp36_[0];
+               _tmp34_ = g_strcmp0 (_tmp37_, "vala") == 0;
+       } else {
+               _tmp34_ = FALSE;
+       }
+       _vala_assert (_tmp34_, "u.length == 1 && u[0] == \"vala\"");
+       _tmp38_ = test;
+       _tmp39_ = g_strdup ("hello");
+       _tmp40_ = g_new0 (gchar*, 1 + 1);
+       _tmp40_[0] = _tmp39_;
+       _tmp41_ = _tmp40_;
+       _tmp41__length1 = 1;
+       test_set_test_property (_tmp38_, _tmp41_, 1);
+       _tmp41_ = (_vala_array_free (_tmp41_, _tmp41__length1, (GDestroyNotify) g_free), NULL);
+       _tmp42_ = test;
+       _tmp43_ = test_get_test_property (_tmp42_, &_tmp44_);
+       _tmp43__length1 = _tmp44_;
+       _tmp45_ = _tmp43_;
+       _tmp45__length1 = _tmp43__length1;
+       t = (_vala_array_free (t, t_length1, (GDestroyNotify) g_free), NULL);
+       t = _tmp45_;
+       t_length1 = _tmp45__length1;
+       _t_size_ = t_length1;
+       _tmp47_ = t;
+       _tmp47__length1 = t_length1;
+       if (_tmp47__length1 == 1) {
+               gchar** _tmp48_;
+               gint _tmp48__length1;
+               const gchar* _tmp49_;
+               _tmp48_ = t;
+               _tmp48__length1 = t_length1;
+               _tmp49_ = _tmp48_[0];
+               _tmp46_ = g_strcmp0 (_tmp49_, "hello") == 0;
+       } else {
+               _tmp46_ = FALSE;
+       }
+       _vala_assert (_tmp46_, "t.length == 1 && t[0] == \"hello\"");
+       _tmp19_ = (_vala_array_free (_tmp19_, _tmp19__length1, (GDestroyNotify) g_free), NULL);
+       u = (_vala_array_free (u, u_length1, (GDestroyNotify) g_free), NULL);
+       t = (_vala_array_free (t, t_length1, (GDestroyNotify) g_free), NULL);
+       _tmp1_ = (g_free (_tmp1_), NULL);
+       k = (g_free (k), NULL);
+       j = (g_free (j), NULL);
+       _g_object_unref0 (test);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/dbus/arrays_server.c-expected b/tests/dbus/arrays_server.c-expected
new file mode 100644
index 000000000..7cae17ed0
--- /dev/null
+++ b/tests/dbus/arrays_server.c-expected
@@ -0,0 +1,909 @@
+/* dbus_arrays_server.c generated by valac, the Vala compiler
+ * generated from dbus_arrays_server.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TEST, TestClass))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define IS_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TEST))
+#define TEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TEST, TestClass))
+
+typedef struct _Test Test;
+typedef struct _TestClass TestClass;
+typedef struct _TestPrivate TestPrivate;
+enum  {
+       TEST_0_PROPERTY,
+       TEST_TEST_PROPERTY_PROPERTY,
+       TEST_NUM_PROPERTIES
+};
+static GParamSpec* test_properties[TEST_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Test {
+       GObject parent_instance;
+       TestPrivate * priv;
+};
+
+struct _TestClass {
+       GObjectClass parent_class;
+};
+
+struct _TestPrivate {
+       gchar** _test_property;
+       gint _test_property_length1;
+       gint __test_property_size_;
+};
+
+static gint Test_private_offset;
+static gpointer test_parent_class = NULL;
+VALA_EXTERN GMainLoop* main_loop;
+GMainLoop* main_loop = NULL;
+
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
+VALA_EXTERN guint test_register_object (void* object,
+                            GDBusConnection* connection,
+                            const gchar* path,
+                            GError** error);
+VALA_EXTERN gint* test_test_int (Test* self,
+                     gint* i,
+                     gint i_length1,
+                     gint** j,
+                     gint* j_length1,
+                     gint* result_length1);
+VALA_EXTERN gchar** test_test_string (Test* self,
+                          gchar** s,
+                          gint s_length1,
+                          gchar*** t,
+                          gint* t_length1,
+                          gint* result_length1);
+VALA_EXTERN Test* test_new (void);
+VALA_EXTERN Test* test_construct (GType object_type);
+VALA_EXTERN gchar** test_get_test_property (Test* self,
+                                gint* result_length1);
+static gchar** _vala_array_dup1 (gchar** self,
+                          gssize length);
+VALA_EXTERN void test_set_test_property (Test* self,
+                             gchar** value,
+                             gint value_length1);
+static gchar** _vala_array_dup2 (gchar** self,
+                          gssize length);
+static void test_finalize (GObject * obj);
+static GType test_get_type_once (void);
+static void _vala_test_get_property (GObject * object,
+                              guint property_id,
+                              GValue * value,
+                              GParamSpec * pspec);
+static void _vala_test_set_property (GObject * object,
+                              guint property_id,
+                              const GValue * value,
+                              GParamSpec * pspec);
+static void _dbus_test_test_int (Test* self,
+                          GVariant* _parameters_,
+                          GDBusMethodInvocation* invocation);
+static void _dbus_test_test_string (Test* self,
+                             GVariant* _parameters_,
+                             GDBusMethodInvocation* invocation);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* method_name,
+                                      GVariant* parameters,
+                                      GDBusMethodInvocation* invocation,
+                                      gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+                                            const gchar* sender,
+                                            const gchar* object_path,
+                                            const gchar* interface_name,
+                                            const gchar* property_name,
+                                            GError** error,
+                                            gpointer user_data);
+static GVariant* _dbus_test_get_test_property (Test* self);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GVariant* value,
+                                           GError** error,
+                                           gpointer user_data);
+static void _dbus_test_set_test_property (Test* self,
+                                   GVariant* _value);
+static void _test_unregister_object (gpointer user_data);
+VALA_EXTERN void client_exit (GPid pid,
+                  gint status);
+static void _vala_main (void);
+static guint _variant_get1 (GVariant* value);
+static void _client_exit_gchild_watch_func (GPid pid,
+                                     gint wait_status,
+                                     gpointer self);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static const GDBusArgInfo _test_dbus_arg_info_test_int_i = {-1, "i", "ai", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_int_j = {-1, "j", "ai", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_int_result = {-1, "result", "ai", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_int_in[] = {&_test_dbus_arg_info_test_int_i, 
NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_int_out[] = {&_test_dbus_arg_info_test_int_j, 
&_test_dbus_arg_info_test_int_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_int = {-1, "TestInt", (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_int_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_int_out), NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_string_s = {-1, "s", "as", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_string_t = {-1, "t", "as", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_string_result = {-1, "result", "as", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_string_in[] = 
{&_test_dbus_arg_info_test_string_s, NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_string_out[] = 
{&_test_dbus_arg_info_test_string_t, &_test_dbus_arg_info_test_string_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_string = {-1, "TestString", (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_string_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_string_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_test_int, 
&_test_dbus_method_info_test_string, NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo _test_dbus_property_info_test_property = {-1, "TestProperty", "as", 
G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = 
{&_test_dbus_property_info_test_property, NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) 
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, 
test_dbus_interface_get_property, test_dbus_interface_set_property};
+
+static inline gpointer
+test_get_instance_private (Test* self)
+{
+       return G_STRUCT_MEMBER_P (self, Test_private_offset);
+}
+
+gint*
+test_test_int (Test* self,
+               gint* i,
+               gint i_length1,
+               gint** j,
+               gint* j_length1,
+               gint* result_length1)
+{
+       gint* _vala_j = NULL;
+       gint _vala_j_length1 = 0;
+       gboolean _tmp0_ = FALSE;
+       gint* _tmp2_;
+       gint* _tmp3_;
+       gint* _tmp4_;
+       gint _tmp4__length1;
+       gint* result = NULL;
+       g_return_val_if_fail (IS_TEST (self), NULL);
+       if (i_length1 == 1) {
+               gint _tmp1_;
+               _tmp1_ = i[0];
+               _tmp0_ = _tmp1_ == 42;
+       } else {
+               _tmp0_ = FALSE;
+       }
+       _vala_assert (_tmp0_, "i.length == 1 && i[0] == 42");
+       _tmp2_ = g_new0 (gint, 1);
+       _tmp2_[0] = 23;
+       _vala_j = (g_free (_vala_j), NULL);
+       _vala_j = _tmp2_;
+       _vala_j_length1 = 1;
+       _tmp3_ = g_new0 (gint, 1);
+       _tmp3_[0] = 11;
+       _tmp4_ = _tmp3_;
+       _tmp4__length1 = 1;
+       if (result_length1) {
+               *result_length1 = _tmp4__length1;
+       }
+       result = _tmp4_;
+       if (j) {
+               *j = _vala_j;
+       } else {
+               _vala_j = (g_free (_vala_j), NULL);
+       }
+       if (j_length1) {
+               *j_length1 = _vala_j_length1;
+       }
+       return result;
+}
+
+gchar**
+test_test_string (Test* self,
+                  gchar** s,
+                  gint s_length1,
+                  gchar*** t,
+                  gint* t_length1,
+                  gint* result_length1)
+{
+       gchar** _vala_t = NULL;
+       gint _vala_t_length1 = 0;
+       gboolean _tmp0_ = FALSE;
+       gchar* _tmp2_;
+       gchar** _tmp3_;
+       gchar* _tmp4_;
+       gchar** _tmp5_;
+       gchar** _tmp6_;
+       gint _tmp6__length1;
+       gchar** result = NULL;
+       g_return_val_if_fail (IS_TEST (self), NULL);
+       if (s_length1 == 1) {
+               const gchar* _tmp1_;
+               _tmp1_ = s[0];
+               _tmp0_ = g_strcmp0 (_tmp1_, "hello") == 0;
+       } else {
+               _tmp0_ = FALSE;
+       }
+       _vala_assert (_tmp0_, "s.length == 1 && s[0] == \"hello\"");
+       _tmp2_ = g_strdup ("world");
+       _tmp3_ = g_new0 (gchar*, 1 + 1);
+       _tmp3_[0] = _tmp2_;
+       _vala_t = (_vala_array_free (_vala_t, _vala_t_length1, (GDestroyNotify) g_free), NULL);
+       _vala_t = _tmp3_;
+       _vala_t_length1 = 1;
+       _tmp4_ = g_strdup ("vala");
+       _tmp5_ = g_new0 (gchar*, 1 + 1);
+       _tmp5_[0] = _tmp4_;
+       _tmp6_ = _tmp5_;
+       _tmp6__length1 = 1;
+       if (result_length1) {
+               *result_length1 = _tmp6__length1;
+       }
+       result = _tmp6_;
+       if (t) {
+               *t = _vala_t;
+       } else {
+               _vala_t = (_vala_array_free (_vala_t, _vala_t_length1, (GDestroyNotify) g_free), NULL);
+       }
+       if (t_length1) {
+               *t_length1 = _vala_t_length1;
+       }
+       return result;
+}
+
+Test*
+test_construct (GType object_type)
+{
+       Test * self = NULL;
+       self = (Test*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Test*
+test_new (void)
+{
+       return test_construct (TYPE_TEST);
+}
+
+static gchar**
+_vala_array_dup1 (gchar** self,
+                  gssize length)
+{
+       if (length >= 0) {
+               gchar** result;
+               gssize i;
+               result = g_new0 (gchar*, length + 1);
+               for (i = 0; i < length; i++) {
+                       gchar* _tmp0_;
+                       _tmp0_ = g_strdup (self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+gchar**
+test_get_test_property (Test* self,
+                        gint* result_length1)
+{
+       gchar** result;
+       gchar** _tmp0_;
+       gint _tmp0__length1;
+       gchar** _tmp1_;
+       gint _tmp1__length1;
+       gchar** _tmp2_;
+       gint _tmp2__length1;
+       g_return_val_if_fail (IS_TEST (self), NULL);
+       _tmp0_ = self->priv->_test_property;
+       _tmp0__length1 = self->priv->_test_property_length1;
+       _tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup1 (_tmp0_, _tmp0__length1) : _tmp0_;
+       _tmp1__length1 = _tmp0__length1;
+       _tmp2_ = _tmp1_;
+       _tmp2__length1 = _tmp1__length1;
+       if (result_length1) {
+               *result_length1 = _tmp2__length1;
+       }
+       result = _tmp2_;
+       return result;
+}
+
+static gchar**
+_vala_array_dup2 (gchar** self,
+                  gssize length)
+{
+       if (length >= 0) {
+               gchar** result;
+               gssize i;
+               result = g_new0 (gchar*, length + 1);
+               for (i = 0; i < length; i++) {
+                       gchar* _tmp0_;
+                       _tmp0_ = g_strdup (self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+void
+test_set_test_property (Test* self,
+                        gchar** value,
+                        gint value_length1)
+{
+       gchar** old_value;
+       gint old_value_length;
+       g_return_if_fail (IS_TEST (self));
+       old_value = test_get_test_property (self, &old_value_length);
+       if (old_value != value) {
+               gchar** _tmp0_;
+               gint _tmp0__length1;
+               _tmp0_ = (value != NULL) ? _vala_array_dup2 (value, value_length1) : value;
+               _tmp0__length1 = value_length1;
+               self->priv->_test_property = (_vala_array_free (self->priv->_test_property, 
self->priv->_test_property_length1, (GDestroyNotify) g_free), NULL);
+               self->priv->_test_property = _tmp0_;
+               self->priv->_test_property_length1 = _tmp0__length1;
+               self->priv->__test_property_size_ = self->priv->_test_property_length1;
+               g_object_notify_by_pspec ((GObject *) self, test_properties[TEST_TEST_PROPERTY_PROPERTY]);
+       }
+       old_value = (_vala_array_free (old_value, old_value_length, (GDestroyNotify) g_free), NULL);
+}
+
+static void
+test_class_init (TestClass * klass,
+                 gpointer klass_data)
+{
+       test_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Test_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_test_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_test_set_property;
+       G_OBJECT_CLASS (klass)->finalize = test_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), TEST_TEST_PROPERTY_PROPERTY, 
test_properties[TEST_TEST_PROPERTY_PROPERTY] = g_param_spec_boxed ("test-property", "test-property", 
"test-property", G_TYPE_STRV, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+}
+
+static void
+test_instance_init (Test * self,
+                    gpointer klass)
+{
+       self->priv = test_get_instance_private (self);
+}
+
+static void
+test_finalize (GObject * obj)
+{
+       Test * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_TEST, Test);
+       self->priv->_test_property = (_vala_array_free (self->priv->_test_property, 
self->priv->_test_property_length1, (GDestroyNotify) g_free), NULL);
+       G_OBJECT_CLASS (test_parent_class)->finalize (obj);
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Test), 
0, (GInstanceInitFunc) test_instance_init, NULL };
+       GType test_type_id;
+       test_type_id = g_type_register_static (G_TYPE_OBJECT, "Test", &g_define_type_info, 0);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_register_object);
+       Test_private_offset = g_type_add_instance_private (test_type_id, sizeof (TestPrivate));
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+static void
+_vala_test_get_property (GObject * object,
+                         guint property_id,
+                         GValue * value,
+                         GParamSpec * pspec)
+{
+       Test * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+       switch (property_id) {
+               case TEST_TEST_PROPERTY_PROPERTY:
+               {
+                       int length;
+                       g_value_take_boxed (value, test_get_test_property (self, &length));
+               }
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_test_set_property (GObject * object,
+                         guint property_id,
+                         const GValue * value,
+                         GParamSpec * pspec)
+{
+       Test * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+       switch (property_id) {
+               case TEST_TEST_PROPERTY_PROPERTY:
+               {
+                       gpointer boxed;
+                       boxed = g_value_get_boxed (value);
+                       test_set_test_property (self, boxed, (boxed == NULL) ? 0 : g_strv_length (boxed));
+               }
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_dbus_test_test_int (Test* self,
+                     GVariant* _parameters_,
+                     GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       gint* i = NULL;
+       gint i_length1 = 0;
+       GVariant* _tmp0_;
+       gint* _tmp1_;
+       gint _tmp1__length;
+       gint _tmp1__size;
+       gint _tmp1__length1;
+       GVariantIter _tmp2_;
+       GVariant* _tmp3_;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       gint* j = NULL;
+       gint j_length1 = 0;
+       gint* _tmp4_;
+       GVariantBuilder _tmp5_;
+       gint _tmp6_;
+       gint* result;
+       gint result_length1 = 0;
+       gint* _tmp7_;
+       GVariantBuilder _tmp8_;
+       gint _tmp9_;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _tmp0_ = g_variant_iter_next_value (&_arguments_iter);
+       _tmp1_ = g_new (gint, 5);
+       _tmp1__length = 0;
+       _tmp1__size = 4;
+       _tmp1__length1 = 0;
+       g_variant_iter_init (&_tmp2_, _tmp0_);
+       for (; (_tmp3_ = g_variant_iter_next_value (&_tmp2_)) != NULL; _tmp1__length1++) {
+               if (_tmp1__size == _tmp1__length) {
+                       _tmp1__size = 2 * _tmp1__size;
+                       _tmp1_ = g_renew (gint, _tmp1_, _tmp1__size + 1);
+               }
+               _tmp1_[_tmp1__length++] = g_variant_get_int32 (_tmp3_);
+               g_variant_unref (_tmp3_);
+       }
+       i_length1 = _tmp1__length1;
+       i = _tmp1_;
+       g_variant_unref (_tmp0_);
+       result = test_test_int (self, i, i_length1, &j, &j_length1, &result_length1);
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _tmp4_ = j;
+       g_variant_builder_init (&_tmp5_, G_VARIANT_TYPE ("ai"));
+       for (_tmp6_ = 0; _tmp6_ < j_length1; _tmp6_++) {
+               g_variant_builder_add_value (&_tmp5_, g_variant_new_int32 (*_tmp4_));
+               _tmp4_++;
+       }
+       g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp5_));
+       _tmp7_ = result;
+       g_variant_builder_init (&_tmp8_, G_VARIANT_TYPE ("ai"));
+       for (_tmp9_ = 0; _tmp9_ < result_length1; _tmp9_++) {
+               g_variant_builder_add_value (&_tmp8_, g_variant_new_int32 (*_tmp7_));
+               _tmp7_++;
+       }
+       g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp8_));
+       result = (g_free (result), NULL);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+       i = (g_free (i), NULL);
+       j = (g_free (j), NULL);
+}
+
+static void
+_dbus_test_test_string (Test* self,
+                        GVariant* _parameters_,
+                        GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       gchar** s = NULL;
+       gint s_length1 = 0;
+       GVariant* _tmp10_;
+       gchar** _tmp11_;
+       gint _tmp11__length;
+       gint _tmp11__size;
+       gint _tmp11__length1;
+       GVariantIter _tmp12_;
+       GVariant* _tmp13_;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       gchar** t = NULL;
+       gint t_length1 = 0;
+       gchar** _tmp14_;
+       GVariantBuilder _tmp15_;
+       gint _tmp16_;
+       gchar** result;
+       gint result_length1 = 0;
+       gchar** _tmp17_;
+       GVariantBuilder _tmp18_;
+       gint _tmp19_;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _tmp10_ = g_variant_iter_next_value (&_arguments_iter);
+       _tmp11_ = g_new (gchar*, 5);
+       _tmp11__length = 0;
+       _tmp11__size = 4;
+       _tmp11__length1 = 0;
+       g_variant_iter_init (&_tmp12_, _tmp10_);
+       for (; (_tmp13_ = g_variant_iter_next_value (&_tmp12_)) != NULL; _tmp11__length1++) {
+               if (_tmp11__size == _tmp11__length) {
+                       _tmp11__size = 2 * _tmp11__size;
+                       _tmp11_ = g_renew (gchar*, _tmp11_, _tmp11__size + 1);
+               }
+               _tmp11_[_tmp11__length++] = g_variant_dup_string (_tmp13_, NULL);
+               g_variant_unref (_tmp13_);
+       }
+       s_length1 = _tmp11__length1;
+       _tmp11_[_tmp11__length] = NULL;
+       s = _tmp11_;
+       g_variant_unref (_tmp10_);
+       result = test_test_string (self, s, s_length1, &t, &t_length1, &result_length1);
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _tmp14_ = t;
+       g_variant_builder_init (&_tmp15_, G_VARIANT_TYPE ("as"));
+       for (_tmp16_ = 0; _tmp16_ < t_length1; _tmp16_++) {
+               g_variant_builder_add_value (&_tmp15_, g_variant_new_string (*_tmp14_));
+               _tmp14_++;
+       }
+       g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp15_));
+       _tmp17_ = result;
+       g_variant_builder_init (&_tmp18_, G_VARIANT_TYPE ("as"));
+       for (_tmp19_ = 0; _tmp19_ < result_length1; _tmp19_++) {
+               g_variant_builder_add_value (&_tmp18_, g_variant_new_string (*_tmp17_));
+               _tmp17_++;
+       }
+       g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp18_));
+       result = (_vala_array_free (result, result_length1, (GDestroyNotify) g_free), NULL);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+       s = (_vala_array_free (s, s_length1, (GDestroyNotify) g_free), NULL);
+       t = (_vala_array_free (t, t_length1, (GDestroyNotify) g_free), NULL);
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* method_name,
+                                 GVariant* parameters,
+                                 GDBusMethodInvocation* invocation,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "TestInt") == 0) {
+               _dbus_test_test_int (object, parameters, invocation);
+       } else if (strcmp (method_name, "TestString") == 0) {
+               _dbus_test_test_string (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+_dbus_test_get_test_property (Test* self)
+{
+       gchar** result;
+       gint result_length1 = 0;
+       GVariant* _reply;
+       gchar** _tmp20_;
+       GVariantBuilder _tmp21_;
+       gint _tmp22_;
+       result = test_get_test_property (self, &result_length1);
+       _tmp20_ = result;
+       g_variant_builder_init (&_tmp21_, G_VARIANT_TYPE ("as"));
+       for (_tmp22_ = 0; _tmp22_ < result_length1; _tmp22_++) {
+               g_variant_builder_add_value (&_tmp21_, g_variant_new_string (*_tmp20_));
+               _tmp20_++;
+       }
+       _reply = g_variant_builder_end (&_tmp21_);
+       result = (_vala_array_free (result, result_length1, (GDestroyNotify) g_free), NULL);
+       return _reply;
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (property_name, "TestProperty") == 0) {
+               return _dbus_test_get_test_property (object);
+       }
+       return NULL;
+}
+
+static void
+_dbus_test_set_test_property (Test* self,
+                              GVariant* _value)
+{
+       gchar** value = NULL;
+       gint value_length1;
+       gchar** _tmp23_;
+       gint _tmp23__length;
+       gint _tmp23__size;
+       gint _tmp23__length1;
+       GVariantIter _tmp24_;
+       GVariant* _tmp25_;
+       _tmp23_ = g_new (gchar*, 5);
+       _tmp23__length = 0;
+       _tmp23__size = 4;
+       _tmp23__length1 = 0;
+       g_variant_iter_init (&_tmp24_, _value);
+       for (; (_tmp25_ = g_variant_iter_next_value (&_tmp24_)) != NULL; _tmp23__length1++) {
+               if (_tmp23__size == _tmp23__length) {
+                       _tmp23__size = 2 * _tmp23__size;
+                       _tmp23_ = g_renew (gchar*, _tmp23_, _tmp23__size + 1);
+               }
+               _tmp23_[_tmp23__length++] = g_variant_dup_string (_tmp25_, NULL);
+               g_variant_unref (_tmp25_);
+       }
+       value_length1 = _tmp23__length1;
+       _tmp23_[_tmp23__length] = NULL;
+       value = _tmp23_;
+       test_set_test_property (self, value, value_length1);
+       value = (_vala_array_free (value, value_length1, (GDestroyNotify) g_free), NULL);
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GVariant* value,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (property_name, "TestProperty") == 0) {
+               _dbus_test_set_test_property (object, value);
+               return TRUE;
+       }
+       return FALSE;
+}
+
+guint
+test_register_object (gpointer object,
+                      GDBusConnection* connection,
+                      const gchar* path,
+                      GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+void
+client_exit (GPid pid,
+             gint status)
+{
+       GMainLoop* _tmp0_;
+       _vala_assert (status == 0, "status == 0");
+       _tmp0_ = main_loop;
+       g_main_loop_quit (_tmp0_);
+}
+
+static guint
+_variant_get1 (GVariant* value)
+{
+       return g_variant_get_uint32 (value);
+}
+
+static void
+_client_exit_gchild_watch_func (GPid pid,
+                                gint wait_status,
+                                gpointer self)
+{
+       client_exit (pid, wait_status);
+}
+
+static void
+_vala_main (void)
+{
+       GDBusConnection* conn = NULL;
+       GDBusConnection* _tmp0_;
+       GDBusConnection* _tmp1_;
+       Test* _tmp2_;
+       Test* _tmp3_;
+       GVariant* request_result = NULL;
+       GDBusConnection* _tmp4_;
+       GVariant* _tmp5_;
+       GVariant* _tmp6_;
+       GVariant* _tmp7_;
+       GVariant* _tmp8_;
+       GVariant* _tmp9_;
+       GVariant* _tmp10_;
+       GVariant* _tmp11_;
+       guint _tmp12_;
+       GPid client_pid = 0;
+       gchar* _tmp13_;
+       gchar** _tmp14_;
+       gchar** _tmp15_;
+       gint _tmp15__length1;
+       GPid _tmp16_ = 0;
+       GMainLoop* _tmp17_;
+       GMainLoop* _tmp18_;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &_inner_error0_);
+       conn = _tmp0_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp1_ = conn;
+       _tmp2_ = test_new ();
+       _tmp3_ = _tmp2_;
+       test_register_object (_tmp3_, _tmp1_, "/org/example/test", &_inner_error0_);
+       _g_object_unref0 (_tmp3_);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp4_ = conn;
+       _tmp5_ = g_variant_new ("(su)", "org.example.Test", 0x4, NULL);
+       g_variant_ref_sink (_tmp5_);
+       _tmp6_ = _tmp5_;
+       _tmp7_ = g_dbus_connection_call_sync (_tmp4_, "org.freedesktop.DBus", "/org/freedesktop/DBus", 
"org.freedesktop.DBus", "RequestName", _tmp6_, NULL, 0, -1, NULL, &_inner_error0_);
+       _tmp8_ = _tmp7_;
+       _g_variant_unref0 (_tmp6_);
+       request_result = _tmp8_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp9_ = request_result;
+       _tmp10_ = g_variant_get_child_value (_tmp9_, (gsize) 0);
+       _tmp11_ = _tmp10_;
+       _tmp12_ = _variant_get1 (_tmp11_);
+       _vala_assert (_tmp12_ == ((guint) 1), "(uint) request_result.get_child_value (0) == 1");
+       _g_variant_unref0 (_tmp11_);
+       _tmp13_ = g_strdup ("dbus_arrays_client");
+       _tmp14_ = g_new0 (gchar*, 1 + 1);
+       _tmp14_[0] = _tmp13_;
+       _tmp15_ = _tmp14_;
+       _tmp15__length1 = 1;
+       g_spawn_async (NULL, _tmp15_, NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &_tmp16_, &_inner_error0_);
+       client_pid = _tmp16_;
+       _tmp15_ = (_vala_array_free (_tmp15_, _tmp15__length1, (GDestroyNotify) g_free), NULL);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_variant_unref0 (request_result);
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       g_child_watch_add_full (G_PRIORITY_DEFAULT_IDLE, client_pid, _client_exit_gchild_watch_func, NULL, 
NULL);
+       _tmp17_ = g_main_loop_new (NULL, FALSE);
+       _g_main_loop_unref0 (main_loop);
+       main_loop = _tmp17_;
+       _tmp18_ = main_loop;
+       g_main_loop_run (_tmp18_);
+       _g_variant_unref0 (request_result);
+       _g_object_unref0 (conn);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/dbus/async-bus_client.c-expected b/tests/dbus/async-bus_client.c-expected
new file mode 100644
index 000000000..5bc147231
--- /dev/null
+++ b/tests/dbus/async-bus_client.c-expected
@@ -0,0 +1,404 @@
+/* dbus_async_bus_client.c generated by valac, the Vala compiler
+ * generated from dbus_async_bus_client.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define TEST_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_TEST, TestIface))
+
+typedef struct _Test Test;
+typedef struct _TestIface TestIface;
+
+#define TYPE_TEST_PROXY (test_proxy_get_type ())
+typedef GDBusProxy TestProxy;
+typedef GDBusProxyClass TestProxyClass;
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _TestIface {
+       GTypeInterface parent_iface;
+       gint (*get_test) (Test* self, GError** error);
+};
+
+VALA_EXTERN GMainLoop* main_loop;
+GMainLoop* main_loop = NULL;
+
+VALA_EXTERN GType test_proxy_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN guint test_register_object (void* object,
+                            GDBusConnection* connection,
+                            const gchar* path,
+                            GError** error);
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN gint test_get_test (Test* self,
+                    GError** error);
+static GType test_get_type_once (void);
+static void test_proxy_g_signal (GDBusProxy* proxy,
+                          const gchar* sender_name,
+                          const gchar* signal_name,
+                          GVariant* parameters);
+static gint test_proxy_get_test (Test* self,
+                          GError** error);
+static void test_proxy_test_interface_init (TestIface* iface);
+static void _dbus_test_get_test (Test* self,
+                          GVariant* _parameters_,
+                          GDBusMethodInvocation* invocation);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* method_name,
+                                      GVariant* parameters,
+                                      GDBusMethodInvocation* invocation,
+                                      gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+                                            const gchar* sender,
+                                            const gchar* object_path,
+                                            const gchar* interface_name,
+                                            const gchar* property_name,
+                                            GError** error,
+                                            gpointer user_data);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GVariant* value,
+                                           GError** error,
+                                           gpointer user_data);
+static void _test_unregister_object (gpointer user_data);
+static void _vala_main (void);
+static void __lambda4_ (GObject* o,
+                 GAsyncResult* r);
+static void ___lambda4__gasync_ready_callback (GObject* source_object,
+                                        GAsyncResult* res,
+                                        gpointer self);
+
+static const GDBusArgInfo _test_dbus_arg_info_get_test_result = {-1, "result", "i", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_get_test_in[] = {NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_get_test_out[] = 
{&_test_dbus_arg_info_get_test_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_get_test = {-1, "GetTest", (GDBusArgInfo **) 
(&_test_dbus_arg_info_get_test_in), (GDBusArgInfo **) (&_test_dbus_arg_info_get_test_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_get_test, NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = {NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) 
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, 
test_dbus_interface_get_property, test_dbus_interface_set_property};
+
+gint
+test_get_test (Test* self,
+               GError** error)
+{
+       TestIface* _iface_;
+       g_return_val_if_fail (IS_TEST (self), 0);
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->get_test) {
+               return _iface_->get_test (self, error);
+       }
+       return -1;
+}
+
+static void
+test_default_init (TestIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType test_type_id;
+       test_type_id = g_type_register_static (G_TYPE_INTERFACE, "Test", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (test_type_id, G_TYPE_OBJECT);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) 
test_proxy_get_type);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), 
"org.example.Test");
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*) 
(&_test_dbus_interface_info));
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_register_object);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_TEST, 
test_proxy_test_interface_init) )
+static void
+test_proxy_class_init (TestProxyClass* klass)
+{
+       G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal;
+}
+
+static void
+test_proxy_g_signal (GDBusProxy* proxy,
+                     const gchar* sender_name,
+                     const gchar* signal_name,
+                     GVariant* parameters)
+{
+}
+
+static void
+test_proxy_init (TestProxy* self)
+{
+       g_dbus_proxy_set_interface_info (G_DBUS_PROXY (self), (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info));
+}
+
+static gint
+test_proxy_get_test (Test* self,
+                     GError** error)
+{
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       GDBusMessage *_reply_message;
+       GVariant *_reply;
+       GVariantIter _reply_iter;
+       gint _result = 0;
+       GVariant* _tmp2_;
+       G_DBUS_ERROR;
+       G_IO_ERROR;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "GetTest");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       _reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout 
((GDBusProxy *) self), NULL, NULL, error);
+       g_object_unref (_message);
+       if (!_reply_message) {
+               gint _tmp0_ = 0;
+               return _tmp0_;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, error)) {
+               gint _tmp1_ = 0;
+               g_object_unref (_reply_message);
+               return _tmp1_;
+       }
+       _reply = g_dbus_message_get_body (_reply_message);
+       g_variant_iter_init (&_reply_iter, _reply);
+       _tmp2_ = g_variant_iter_next_value (&_reply_iter);
+       _result = g_variant_get_int32 (_tmp2_);
+       g_variant_unref (_tmp2_);
+       g_object_unref (_reply_message);
+       return _result;
+}
+
+static void
+test_proxy_test_interface_init (TestIface* iface)
+{
+       iface->get_test = test_proxy_get_test;
+}
+
+static void
+_dbus_test_get_test (Test* self,
+                     GVariant* _parameters_,
+                     GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       gint result;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       result = test_get_test (self, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               return;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_int32 (result));
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* method_name,
+                                 GVariant* parameters,
+                                 GDBusMethodInvocation* invocation,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "GetTest") == 0) {
+               _dbus_test_get_test (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return NULL;
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GVariant* value,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return FALSE;
+}
+
+guint
+test_register_object (gpointer object,
+                      GDBusConnection* connection,
+                      const gchar* path,
+                      GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+static void
+__lambda4_ (GObject* o,
+            GAsyncResult* r)
+{
+       GError* _inner_error0_ = NULL;
+       g_return_if_fail ((o == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (o, G_TYPE_OBJECT));
+       g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (r, g_async_result_get_type ()));
+       {
+               Test* test = NULL;
+               Test* _tmp0_;
+               Test* _tmp1_;
+               gint _tmp2_ = 0;
+               Test* _tmp3_;
+               _tmp0_ = g_async_result_get_source_object (r);
+               _tmp1_ = (Test*) g_async_initable_new_finish ((GAsyncInitable *) _tmp0_, r, &_inner_error0_);
+               g_object_unref (_tmp0_);
+               test = (Test*) _tmp1_;
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       goto __catch0_g_error;
+               }
+               _tmp3_ = test;
+               _tmp2_ = test_get_test (_tmp3_, &_inner_error0_);
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       _g_object_unref0 (test);
+                       goto __catch0_g_error;
+               }
+               _vala_assert (_tmp2_ == 4711, "test.get_test () == 4711");
+               _g_object_unref0 (test);
+       }
+       goto __finally0;
+       __catch0_g_error:
+       {
+               g_clear_error (&_inner_error0_);
+       }
+       __finally0:
+       {
+               GError* _inner_error1_ = NULL;
+               GMainLoop* _tmp4_;
+               _tmp4_ = main_loop;
+               g_main_loop_quit (_tmp4_);
+       }
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+}
+
+static void
+___lambda4__gasync_ready_callback (GObject* source_object,
+                                   GAsyncResult* res,
+                                   gpointer self)
+{
+       __lambda4_ (source_object, res);
+}
+
+static void
+_vala_main (void)
+{
+       GMainLoop* _tmp0_;
+       GMainLoop* _tmp1_;
+       GError* _inner_error0_ = NULL;
+       g_async_initable_new_async (TYPE_TEST_PROXY, 0, NULL, ___lambda4__gasync_ready_callback, NULL, 
"g-flags", 0, "g-name", "org.example.Test", "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", 
"/org/example/test", "g-interface-name", "org.example.Test", NULL);
+       _tmp0_ = g_main_loop_new (NULL, FALSE);
+       _g_main_loop_unref0 (main_loop);
+       main_loop = _tmp0_;
+       _tmp1_ = main_loop;
+       g_main_loop_run (_tmp1_);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/dbus/async-bus_server.c-expected b/tests/dbus/async-bus_server.c-expected
new file mode 100644
index 000000000..2986ba176
--- /dev/null
+++ b/tests/dbus/async-bus_server.c-expected
@@ -0,0 +1,434 @@
+/* dbus_async_bus_server.c generated by valac, the Vala compiler
+ * generated from dbus_async_bus_server.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <glib.h>
+#include <string.h>
+#include <stdlib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TEST, TestClass))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define IS_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TEST))
+#define TEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TEST, TestClass))
+
+typedef struct _Test Test;
+typedef struct _TestClass TestClass;
+typedef struct _TestPrivate TestPrivate;
+enum  {
+       TEST_0_PROPERTY,
+       TEST_NUM_PROPERTIES
+};
+static GParamSpec* test_properties[TEST_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Test {
+       GObject parent_instance;
+       TestPrivate * priv;
+};
+
+struct _TestClass {
+       GObjectClass parent_class;
+};
+
+static gpointer test_parent_class = NULL;
+VALA_EXTERN GMainLoop* main_loop;
+GMainLoop* main_loop = NULL;
+
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
+VALA_EXTERN guint test_register_object (void* object,
+                            GDBusConnection* connection,
+                            const gchar* path,
+                            GError** error);
+VALA_EXTERN gint test_get_test (Test* self,
+                    GError** error);
+VALA_EXTERN Test* test_new (void);
+VALA_EXTERN Test* test_construct (GType object_type);
+static GType test_get_type_once (void);
+static void _dbus_test_get_test (Test* self,
+                          GVariant* _parameters_,
+                          GDBusMethodInvocation* invocation);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* method_name,
+                                      GVariant* parameters,
+                                      GDBusMethodInvocation* invocation,
+                                      gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+                                            const gchar* sender,
+                                            const gchar* object_path,
+                                            const gchar* interface_name,
+                                            const gchar* property_name,
+                                            GError** error,
+                                            gpointer user_data);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GVariant* value,
+                                           GError** error,
+                                           gpointer user_data);
+static void _test_unregister_object (gpointer user_data);
+VALA_EXTERN void client_exit (GPid pid,
+                  gint status);
+static void _vala_main (void);
+static guint _variant_get1 (GVariant* value);
+static void _client_exit_gchild_watch_func (GPid pid,
+                                     gint wait_status,
+                                     gpointer self);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static const GDBusArgInfo _test_dbus_arg_info_get_test_result = {-1, "result", "i", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_get_test_in[] = {NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_get_test_out[] = 
{&_test_dbus_arg_info_get_test_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_get_test = {-1, "GetTest", (GDBusArgInfo **) 
(&_test_dbus_arg_info_get_test_in), (GDBusArgInfo **) (&_test_dbus_arg_info_get_test_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_get_test, NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = {NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) 
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, 
test_dbus_interface_get_property, test_dbus_interface_set_property};
+
+gint
+test_get_test (Test* self,
+               GError** error)
+{
+       gint result = 0;
+       g_return_val_if_fail (IS_TEST (self), 0);
+       result = 4711;
+       return result;
+}
+
+Test*
+test_construct (GType object_type)
+{
+       Test * self = NULL;
+       self = (Test*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Test*
+test_new (void)
+{
+       return test_construct (TYPE_TEST);
+}
+
+static void
+test_class_init (TestClass * klass,
+                 gpointer klass_data)
+{
+       test_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+test_instance_init (Test * self,
+                    gpointer klass)
+{
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Test), 
0, (GInstanceInitFunc) test_instance_init, NULL };
+       GType test_type_id;
+       test_type_id = g_type_register_static (G_TYPE_OBJECT, "Test", &g_define_type_info, 0);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_register_object);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+static void
+_dbus_test_get_test (Test* self,
+                     GVariant* _parameters_,
+                     GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       gint result;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       result = test_get_test (self, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               return;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_int32 (result));
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* method_name,
+                                 GVariant* parameters,
+                                 GDBusMethodInvocation* invocation,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "GetTest") == 0) {
+               _dbus_test_get_test (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return NULL;
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GVariant* value,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return FALSE;
+}
+
+guint
+test_register_object (gpointer object,
+                      GDBusConnection* connection,
+                      const gchar* path,
+                      GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+void
+client_exit (GPid pid,
+             gint status)
+{
+       GMainLoop* _tmp0_;
+       _vala_assert (status == 0, "status == 0");
+       _tmp0_ = main_loop;
+       g_main_loop_quit (_tmp0_);
+}
+
+static guint
+_variant_get1 (GVariant* value)
+{
+       return g_variant_get_uint32 (value);
+}
+
+static void
+_client_exit_gchild_watch_func (GPid pid,
+                                gint wait_status,
+                                gpointer self)
+{
+       client_exit (pid, wait_status);
+}
+
+static void
+_vala_main (void)
+{
+       GDBusConnection* conn = NULL;
+       GDBusConnection* _tmp0_;
+       GDBusConnection* _tmp1_;
+       Test* _tmp2_;
+       Test* _tmp3_;
+       GVariant* request_result = NULL;
+       GDBusConnection* _tmp4_;
+       GVariant* _tmp5_;
+       GVariant* _tmp6_;
+       GVariant* _tmp7_;
+       GVariant* _tmp8_;
+       GVariant* _tmp9_;
+       GVariant* _tmp10_;
+       GVariant* _tmp11_;
+       guint _tmp12_;
+       GPid client_pid = 0;
+       gchar* _tmp13_;
+       gchar** _tmp14_;
+       gchar** _tmp15_;
+       gint _tmp15__length1;
+       GPid _tmp16_ = 0;
+       GMainLoop* _tmp17_;
+       GMainLoop* _tmp18_;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &_inner_error0_);
+       conn = _tmp0_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp1_ = conn;
+       _tmp2_ = test_new ();
+       _tmp3_ = _tmp2_;
+       test_register_object (_tmp3_, _tmp1_, "/org/example/test", &_inner_error0_);
+       _g_object_unref0 (_tmp3_);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp4_ = conn;
+       _tmp5_ = g_variant_new ("(su)", "org.example.Test", 0x4, NULL);
+       g_variant_ref_sink (_tmp5_);
+       _tmp6_ = _tmp5_;
+       _tmp7_ = g_dbus_connection_call_sync (_tmp4_, "org.freedesktop.DBus", "/org/freedesktop/DBus", 
"org.freedesktop.DBus", "RequestName", _tmp6_, NULL, 0, -1, NULL, &_inner_error0_);
+       _tmp8_ = _tmp7_;
+       _g_variant_unref0 (_tmp6_);
+       request_result = _tmp8_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp9_ = request_result;
+       _tmp10_ = g_variant_get_child_value (_tmp9_, (gsize) 0);
+       _tmp11_ = _tmp10_;
+       _tmp12_ = _variant_get1 (_tmp11_);
+       _vala_assert (_tmp12_ == ((guint) 1), "(uint) request_result.get_child_value (0) == 1");
+       _g_variant_unref0 (_tmp11_);
+       _tmp13_ = g_strdup ("dbus_async_bus_client");
+       _tmp14_ = g_new0 (gchar*, 1 + 1);
+       _tmp14_[0] = _tmp13_;
+       _tmp15_ = _tmp14_;
+       _tmp15__length1 = 1;
+       g_spawn_async (NULL, _tmp15_, NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &_tmp16_, &_inner_error0_);
+       client_pid = _tmp16_;
+       _tmp15_ = (_vala_array_free (_tmp15_, _tmp15__length1, (GDestroyNotify) g_free), NULL);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_variant_unref0 (request_result);
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       g_child_watch_add_full (G_PRIORITY_DEFAULT_IDLE, client_pid, _client_exit_gchild_watch_func, NULL, 
NULL);
+       _tmp17_ = g_main_loop_new (NULL, FALSE);
+       _g_main_loop_unref0 (main_loop);
+       main_loop = _tmp17_;
+       _tmp18_ = main_loop;
+       g_main_loop_run (_tmp18_);
+       _g_variant_unref0 (request_result);
+       _g_object_unref0 (conn);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/dbus/async-connection_client.c-expected b/tests/dbus/async-connection_client.c-expected
new file mode 100644
index 000000000..30ee60393
--- /dev/null
+++ b/tests/dbus/async-connection_client.c-expected
@@ -0,0 +1,414 @@
+/* dbus_async_connection_client.c generated by valac, the Vala compiler
+ * generated from dbus_async_connection_client.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define TEST_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_TEST, TestIface))
+
+typedef struct _Test Test;
+typedef struct _TestIface TestIface;
+
+#define TYPE_TEST_PROXY (test_proxy_get_type ())
+typedef GDBusProxy TestProxy;
+typedef GDBusProxyClass TestProxyClass;
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _TestIface {
+       GTypeInterface parent_iface;
+       gint (*get_test) (Test* self, GError** error);
+};
+
+VALA_EXTERN GMainLoop* main_loop;
+GMainLoop* main_loop = NULL;
+
+VALA_EXTERN GType test_proxy_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN guint test_register_object (void* object,
+                            GDBusConnection* connection,
+                            const gchar* path,
+                            GError** error);
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN gint test_get_test (Test* self,
+                    GError** error);
+static GType test_get_type_once (void);
+static void test_proxy_g_signal (GDBusProxy* proxy,
+                          const gchar* sender_name,
+                          const gchar* signal_name,
+                          GVariant* parameters);
+static gint test_proxy_get_test (Test* self,
+                          GError** error);
+static void test_proxy_test_interface_init (TestIface* iface);
+static void _dbus_test_get_test (Test* self,
+                          GVariant* _parameters_,
+                          GDBusMethodInvocation* invocation);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* method_name,
+                                      GVariant* parameters,
+                                      GDBusMethodInvocation* invocation,
+                                      gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+                                            const gchar* sender,
+                                            const gchar* object_path,
+                                            const gchar* interface_name,
+                                            const gchar* property_name,
+                                            GError** error,
+                                            gpointer user_data);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GVariant* value,
+                                           GError** error,
+                                           gpointer user_data);
+static void _test_unregister_object (gpointer user_data);
+static void _vala_main (void);
+static void __lambda4_ (GObject* o,
+                 GAsyncResult* r);
+static void ___lambda4__gasync_ready_callback (GObject* source_object,
+                                        GAsyncResult* res,
+                                        gpointer self);
+
+static const GDBusArgInfo _test_dbus_arg_info_get_test_result = {-1, "result", "i", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_get_test_in[] = {NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_get_test_out[] = 
{&_test_dbus_arg_info_get_test_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_get_test = {-1, "GetTest", (GDBusArgInfo **) 
(&_test_dbus_arg_info_get_test_in), (GDBusArgInfo **) (&_test_dbus_arg_info_get_test_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_get_test, NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = {NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) 
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, 
test_dbus_interface_get_property, test_dbus_interface_set_property};
+
+gint
+test_get_test (Test* self,
+               GError** error)
+{
+       TestIface* _iface_;
+       g_return_val_if_fail (IS_TEST (self), 0);
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->get_test) {
+               return _iface_->get_test (self, error);
+       }
+       return -1;
+}
+
+static void
+test_default_init (TestIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType test_type_id;
+       test_type_id = g_type_register_static (G_TYPE_INTERFACE, "Test", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (test_type_id, G_TYPE_OBJECT);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) 
test_proxy_get_type);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), 
"org.example.Test");
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*) 
(&_test_dbus_interface_info));
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_register_object);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_TEST, 
test_proxy_test_interface_init) )
+static void
+test_proxy_class_init (TestProxyClass* klass)
+{
+       G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal;
+}
+
+static void
+test_proxy_g_signal (GDBusProxy* proxy,
+                     const gchar* sender_name,
+                     const gchar* signal_name,
+                     GVariant* parameters)
+{
+}
+
+static void
+test_proxy_init (TestProxy* self)
+{
+       g_dbus_proxy_set_interface_info (G_DBUS_PROXY (self), (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info));
+}
+
+static gint
+test_proxy_get_test (Test* self,
+                     GError** error)
+{
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       GDBusMessage *_reply_message;
+       GVariant *_reply;
+       GVariantIter _reply_iter;
+       gint _result = 0;
+       GVariant* _tmp2_;
+       G_DBUS_ERROR;
+       G_IO_ERROR;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "GetTest");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       _reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout 
((GDBusProxy *) self), NULL, NULL, error);
+       g_object_unref (_message);
+       if (!_reply_message) {
+               gint _tmp0_ = 0;
+               return _tmp0_;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, error)) {
+               gint _tmp1_ = 0;
+               g_object_unref (_reply_message);
+               return _tmp1_;
+       }
+       _reply = g_dbus_message_get_body (_reply_message);
+       g_variant_iter_init (&_reply_iter, _reply);
+       _tmp2_ = g_variant_iter_next_value (&_reply_iter);
+       _result = g_variant_get_int32 (_tmp2_);
+       g_variant_unref (_tmp2_);
+       g_object_unref (_reply_message);
+       return _result;
+}
+
+static void
+test_proxy_test_interface_init (TestIface* iface)
+{
+       iface->get_test = test_proxy_get_test;
+}
+
+static void
+_dbus_test_get_test (Test* self,
+                     GVariant* _parameters_,
+                     GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       gint result;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       result = test_get_test (self, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               return;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_int32 (result));
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* method_name,
+                                 GVariant* parameters,
+                                 GDBusMethodInvocation* invocation,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "GetTest") == 0) {
+               _dbus_test_get_test (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return NULL;
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GVariant* value,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return FALSE;
+}
+
+guint
+test_register_object (gpointer object,
+                      GDBusConnection* connection,
+                      const gchar* path,
+                      GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+static void
+__lambda4_ (GObject* o,
+            GAsyncResult* r)
+{
+       GError* _inner_error0_ = NULL;
+       g_return_if_fail ((o == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (o, G_TYPE_OBJECT));
+       g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (r, g_async_result_get_type ()));
+       {
+               Test* test = NULL;
+               Test* _tmp0_;
+               Test* _tmp1_;
+               gint _tmp2_ = 0;
+               Test* _tmp3_;
+               _tmp0_ = g_async_result_get_source_object (r);
+               _tmp1_ = (Test*) g_async_initable_new_finish ((GAsyncInitable *) _tmp0_, r, &_inner_error0_);
+               g_object_unref (_tmp0_);
+               test = (Test*) _tmp1_;
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       goto __catch0_g_error;
+               }
+               _tmp3_ = test;
+               _tmp2_ = test_get_test (_tmp3_, &_inner_error0_);
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       _g_object_unref0 (test);
+                       goto __catch0_g_error;
+               }
+               _vala_assert (_tmp2_ == 4711, "test.get_test () == 4711");
+               _g_object_unref0 (test);
+       }
+       goto __finally0;
+       __catch0_g_error:
+       {
+               g_clear_error (&_inner_error0_);
+       }
+       __finally0:
+       {
+               GError* _inner_error1_ = NULL;
+               GMainLoop* _tmp4_;
+               _tmp4_ = main_loop;
+               g_main_loop_quit (_tmp4_);
+       }
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+}
+
+static void
+___lambda4__gasync_ready_callback (GObject* source_object,
+                                   GAsyncResult* res,
+                                   gpointer self)
+{
+       __lambda4_ (source_object, res);
+}
+
+static void
+_vala_main (void)
+{
+       GDBusConnection* conn = NULL;
+       GDBusConnection* _tmp0_;
+       GMainLoop* _tmp1_;
+       GMainLoop* _tmp2_;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &_inner_error0_);
+       conn = _tmp0_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       g_async_initable_new_async (TYPE_TEST_PROXY, 0, NULL, ___lambda4__gasync_ready_callback, NULL, 
"g-flags", 0, "g-name", "org.example.Test", "g-connection", conn, "g-object-path", "/org/example/test", 
"g-interface-name", "org.example.Test", NULL);
+       _tmp1_ = g_main_loop_new (NULL, FALSE);
+       _g_main_loop_unref0 (main_loop);
+       main_loop = _tmp1_;
+       _tmp2_ = main_loop;
+       g_main_loop_run (_tmp2_);
+       _g_object_unref0 (conn);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/dbus/async-connection_server.c-expected b/tests/dbus/async-connection_server.c-expected
new file mode 100644
index 000000000..ef52a336d
--- /dev/null
+++ b/tests/dbus/async-connection_server.c-expected
@@ -0,0 +1,434 @@
+/* dbus_async_connection_server.c generated by valac, the Vala compiler
+ * generated from dbus_async_connection_server.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <glib.h>
+#include <string.h>
+#include <stdlib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TEST, TestClass))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define IS_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TEST))
+#define TEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TEST, TestClass))
+
+typedef struct _Test Test;
+typedef struct _TestClass TestClass;
+typedef struct _TestPrivate TestPrivate;
+enum  {
+       TEST_0_PROPERTY,
+       TEST_NUM_PROPERTIES
+};
+static GParamSpec* test_properties[TEST_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Test {
+       GObject parent_instance;
+       TestPrivate * priv;
+};
+
+struct _TestClass {
+       GObjectClass parent_class;
+};
+
+static gpointer test_parent_class = NULL;
+VALA_EXTERN GMainLoop* main_loop;
+GMainLoop* main_loop = NULL;
+
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
+VALA_EXTERN guint test_register_object (void* object,
+                            GDBusConnection* connection,
+                            const gchar* path,
+                            GError** error);
+VALA_EXTERN gint test_get_test (Test* self,
+                    GError** error);
+VALA_EXTERN Test* test_new (void);
+VALA_EXTERN Test* test_construct (GType object_type);
+static GType test_get_type_once (void);
+static void _dbus_test_get_test (Test* self,
+                          GVariant* _parameters_,
+                          GDBusMethodInvocation* invocation);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* method_name,
+                                      GVariant* parameters,
+                                      GDBusMethodInvocation* invocation,
+                                      gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+                                            const gchar* sender,
+                                            const gchar* object_path,
+                                            const gchar* interface_name,
+                                            const gchar* property_name,
+                                            GError** error,
+                                            gpointer user_data);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GVariant* value,
+                                           GError** error,
+                                           gpointer user_data);
+static void _test_unregister_object (gpointer user_data);
+VALA_EXTERN void client_exit (GPid pid,
+                  gint status);
+static void _vala_main (void);
+static guint _variant_get1 (GVariant* value);
+static void _client_exit_gchild_watch_func (GPid pid,
+                                     gint wait_status,
+                                     gpointer self);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static const GDBusArgInfo _test_dbus_arg_info_get_test_result = {-1, "result", "i", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_get_test_in[] = {NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_get_test_out[] = 
{&_test_dbus_arg_info_get_test_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_get_test = {-1, "GetTest", (GDBusArgInfo **) 
(&_test_dbus_arg_info_get_test_in), (GDBusArgInfo **) (&_test_dbus_arg_info_get_test_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_get_test, NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = {NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) 
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, 
test_dbus_interface_get_property, test_dbus_interface_set_property};
+
+gint
+test_get_test (Test* self,
+               GError** error)
+{
+       gint result = 0;
+       g_return_val_if_fail (IS_TEST (self), 0);
+       result = 4711;
+       return result;
+}
+
+Test*
+test_construct (GType object_type)
+{
+       Test * self = NULL;
+       self = (Test*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Test*
+test_new (void)
+{
+       return test_construct (TYPE_TEST);
+}
+
+static void
+test_class_init (TestClass * klass,
+                 gpointer klass_data)
+{
+       test_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+test_instance_init (Test * self,
+                    gpointer klass)
+{
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Test), 
0, (GInstanceInitFunc) test_instance_init, NULL };
+       GType test_type_id;
+       test_type_id = g_type_register_static (G_TYPE_OBJECT, "Test", &g_define_type_info, 0);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_register_object);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+static void
+_dbus_test_get_test (Test* self,
+                     GVariant* _parameters_,
+                     GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       gint result;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       result = test_get_test (self, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               return;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_int32 (result));
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* method_name,
+                                 GVariant* parameters,
+                                 GDBusMethodInvocation* invocation,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "GetTest") == 0) {
+               _dbus_test_get_test (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return NULL;
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GVariant* value,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return FALSE;
+}
+
+guint
+test_register_object (gpointer object,
+                      GDBusConnection* connection,
+                      const gchar* path,
+                      GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+void
+client_exit (GPid pid,
+             gint status)
+{
+       GMainLoop* _tmp0_;
+       _vala_assert (status == 0, "status == 0");
+       _tmp0_ = main_loop;
+       g_main_loop_quit (_tmp0_);
+}
+
+static guint
+_variant_get1 (GVariant* value)
+{
+       return g_variant_get_uint32 (value);
+}
+
+static void
+_client_exit_gchild_watch_func (GPid pid,
+                                gint wait_status,
+                                gpointer self)
+{
+       client_exit (pid, wait_status);
+}
+
+static void
+_vala_main (void)
+{
+       GDBusConnection* conn = NULL;
+       GDBusConnection* _tmp0_;
+       GDBusConnection* _tmp1_;
+       Test* _tmp2_;
+       Test* _tmp3_;
+       GVariant* request_result = NULL;
+       GDBusConnection* _tmp4_;
+       GVariant* _tmp5_;
+       GVariant* _tmp6_;
+       GVariant* _tmp7_;
+       GVariant* _tmp8_;
+       GVariant* _tmp9_;
+       GVariant* _tmp10_;
+       GVariant* _tmp11_;
+       guint _tmp12_;
+       GPid client_pid = 0;
+       gchar* _tmp13_;
+       gchar** _tmp14_;
+       gchar** _tmp15_;
+       gint _tmp15__length1;
+       GPid _tmp16_ = 0;
+       GMainLoop* _tmp17_;
+       GMainLoop* _tmp18_;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &_inner_error0_);
+       conn = _tmp0_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp1_ = conn;
+       _tmp2_ = test_new ();
+       _tmp3_ = _tmp2_;
+       test_register_object (_tmp3_, _tmp1_, "/org/example/test", &_inner_error0_);
+       _g_object_unref0 (_tmp3_);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp4_ = conn;
+       _tmp5_ = g_variant_new ("(su)", "org.example.Test", 0x4, NULL);
+       g_variant_ref_sink (_tmp5_);
+       _tmp6_ = _tmp5_;
+       _tmp7_ = g_dbus_connection_call_sync (_tmp4_, "org.freedesktop.DBus", "/org/freedesktop/DBus", 
"org.freedesktop.DBus", "RequestName", _tmp6_, NULL, 0, -1, NULL, &_inner_error0_);
+       _tmp8_ = _tmp7_;
+       _g_variant_unref0 (_tmp6_);
+       request_result = _tmp8_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp9_ = request_result;
+       _tmp10_ = g_variant_get_child_value (_tmp9_, (gsize) 0);
+       _tmp11_ = _tmp10_;
+       _tmp12_ = _variant_get1 (_tmp11_);
+       _vala_assert (_tmp12_ == ((guint) 1), "(uint) request_result.get_child_value (0) == 1");
+       _g_variant_unref0 (_tmp11_);
+       _tmp13_ = g_strdup ("dbus_async_connection_client");
+       _tmp14_ = g_new0 (gchar*, 1 + 1);
+       _tmp14_[0] = _tmp13_;
+       _tmp15_ = _tmp14_;
+       _tmp15__length1 = 1;
+       g_spawn_async (NULL, _tmp15_, NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &_tmp16_, &_inner_error0_);
+       client_pid = _tmp16_;
+       _tmp15_ = (_vala_array_free (_tmp15_, _tmp15__length1, (GDestroyNotify) g_free), NULL);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_variant_unref0 (request_result);
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       g_child_watch_add_full (G_PRIORITY_DEFAULT_IDLE, client_pid, _client_exit_gchild_watch_func, NULL, 
NULL);
+       _tmp17_ = g_main_loop_new (NULL, FALSE);
+       _g_main_loop_unref0 (main_loop);
+       main_loop = _tmp17_;
+       _tmp18_ = main_loop;
+       g_main_loop_run (_tmp18_);
+       _g_variant_unref0 (request_result);
+       _g_object_unref0 (conn);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/dbus/async-errors_client.c-expected b/tests/dbus/async-errors_client.c-expected
new file mode 100644
index 000000000..4f9a12a28
--- /dev/null
+++ b/tests/dbus/async-errors_client.c-expected
@@ -0,0 +1,1143 @@
+/* dbus_async_errors_client.c generated by valac, the Vala compiler
+ * generated from dbus_async_errors_client.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define TEST_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_TEST, TestIface))
+
+typedef struct _Test Test;
+typedef struct _TestIface TestIface;
+
+#define TYPE_TEST_PROXY (test_proxy_get_type ())
+typedef GDBusProxy TestProxy;
+typedef GDBusProxyClass TestProxyClass;
+typedef struct _TestTestVoidReadyData TestTestVoidReadyData;
+typedef struct _TestTestIntReadyData TestTestIntReadyData;
+typedef struct _TestTestStringReadyData TestTestStringReadyData;
+#define _g_free0(var) (var = (g_free (var), NULL))
+typedef struct _TestTestCancellableReadyData TestTestCancellableReadyData;
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+typedef struct _RunData RunData;
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+
+struct _TestIface {
+       GTypeInterface parent_iface;
+       void (*test_void) (Test* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+       void (*test_void_finish) (Test* self, GAsyncResult* _res_, GError** error);
+       void (*test_int) (Test* self, gint i, GAsyncReadyCallback _callback_, gpointer _user_data_);
+       gint (*test_int_finish) (Test* self, GAsyncResult* _res_, gint* j, GError** error);
+       void (*test_string) (Test* self, const gchar* s, GAsyncReadyCallback _callback_, gpointer 
_user_data_);
+       gchar* (*test_string_finish) (Test* self, GAsyncResult* _res_, gchar* * t, GError** error);
+       void (*test_cancellable) (Test* self, GCancellable* cancellable, GAsyncReadyCallback _callback_, 
gpointer _user_data_);
+       void (*test_cancellable_finish) (Test* self, GAsyncResult* _res_, GError** error);
+};
+
+struct _TestTestVoidReadyData {
+       GDBusMethodInvocation* _invocation_;
+};
+
+struct _TestTestIntReadyData {
+       GDBusMethodInvocation* _invocation_;
+       gint i;
+};
+
+struct _TestTestStringReadyData {
+       GDBusMethodInvocation* _invocation_;
+       gchar* s;
+};
+
+struct _TestTestCancellableReadyData {
+       GDBusMethodInvocation* _invocation_;
+};
+
+struct _RunData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Test* test;
+       Test* _tmp0_;
+       gint j;
+       gint k;
+       gint _tmp1_;
+       gint _tmp2_;
+       gint _tmp3_;
+       gchar* t;
+       gchar* u;
+       gchar* _tmp4_;
+       gchar* _tmp5_;
+       gchar* _tmp6_;
+       gchar* _tmp7_;
+       GCancellable* cancellable;
+       GCancellable* _tmp8_;
+       GCancellable* _tmp9_;
+       GCancellable* _tmp10_;
+       GMainLoop* _tmp11_;
+       GError* _inner_error0_;
+};
+
+VALA_EXTERN GMainLoop* main_loop;
+GMainLoop* main_loop = NULL;
+
+VALA_EXTERN GType test_proxy_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN guint test_register_object (void* object,
+                            GDBusConnection* connection,
+                            const gchar* path,
+                            GError** error);
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN void test_test_void (Test* self,
+                     GAsyncReadyCallback _callback_,
+                     gpointer _user_data_);
+VALA_EXTERN void test_test_void_finish (Test* self,
+                            GAsyncResult* _res_,
+                            GError** error);
+VALA_EXTERN void test_test_int (Test* self,
+                    gint i,
+                    GAsyncReadyCallback _callback_,
+                    gpointer _user_data_);
+VALA_EXTERN gint test_test_int_finish (Test* self,
+                           GAsyncResult* _res_,
+                           gint* j,
+                           GError** error);
+VALA_EXTERN void test_test_string (Test* self,
+                       const gchar* s,
+                       GAsyncReadyCallback _callback_,
+                       gpointer _user_data_);
+VALA_EXTERN gchar* test_test_string_finish (Test* self,
+                                GAsyncResult* _res_,
+                                gchar* * t,
+                                GError** error);
+VALA_EXTERN void test_test_cancellable (Test* self,
+                            GCancellable* cancellable,
+                            GAsyncReadyCallback _callback_,
+                            gpointer _user_data_);
+VALA_EXTERN void test_test_cancellable_finish (Test* self,
+                                   GAsyncResult* _res_,
+                                   GError** error);
+static GType test_get_type_once (void);
+static void test_proxy_g_signal (GDBusProxy* proxy,
+                          const gchar* sender_name,
+                          const gchar* signal_name,
+                          GVariant* parameters);
+static void _vala_g_async_ready_callback (GObject *source_object,
+                                   GAsyncResult *res,
+                                   void *user_data);
+static void test_proxy_test_void_async (Test* self,
+                                 GAsyncReadyCallback _callback_,
+                                 gpointer _user_data_);
+static void test_proxy_test_void_finish (Test* self,
+                                  GAsyncResult* _res_,
+                                  GError** error);
+static void test_proxy_test_int_async (Test* self,
+                                gint i,
+                                GAsyncReadyCallback _callback_,
+                                gpointer _user_data_);
+static gint test_proxy_test_int_finish (Test* self,
+                                 GAsyncResult* _res_,
+                                 gint* j,
+                                 GError** error);
+static void test_proxy_test_string_async (Test* self,
+                                   const gchar* s,
+                                   GAsyncReadyCallback _callback_,
+                                   gpointer _user_data_);
+static gchar* test_proxy_test_string_finish (Test* self,
+                                      GAsyncResult* _res_,
+                                      gchar* * t,
+                                      GError** error);
+static void test_proxy_test_cancellable_async (Test* self,
+                                        GCancellable* cancellable,
+                                        GAsyncReadyCallback _callback_,
+                                        gpointer _user_data_);
+static void test_proxy_test_cancellable_finish (Test* self,
+                                         GAsyncResult* _res_,
+                                         GError** error);
+static void test_proxy_test_interface_init (TestIface* iface);
+static void _dbus_test_test_void (Test* self,
+                           GVariant* _parameters_,
+                           GDBusMethodInvocation* invocation);
+static void _dbus_test_test_void_ready (GObject * source_object,
+                                 GAsyncResult * _res_,
+                                 gpointer _user_data_);
+static void _dbus_test_test_int (Test* self,
+                          GVariant* _parameters_,
+                          GDBusMethodInvocation* invocation);
+static void _dbus_test_test_int_ready (GObject * source_object,
+                                GAsyncResult * _res_,
+                                gpointer _user_data_);
+static void _dbus_test_test_string (Test* self,
+                             GVariant* _parameters_,
+                             GDBusMethodInvocation* invocation);
+static void _dbus_test_test_string_ready (GObject * source_object,
+                                   GAsyncResult * _res_,
+                                   gpointer _user_data_);
+static void _dbus_test_test_cancellable (Test* self,
+                                  GVariant* _parameters_,
+                                  GDBusMethodInvocation* invocation);
+static void _dbus_test_test_cancellable_ready (GObject * source_object,
+                                        GAsyncResult * _res_,
+                                        gpointer _user_data_);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* method_name,
+                                      GVariant* parameters,
+                                      GDBusMethodInvocation* invocation,
+                                      gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+                                            const gchar* sender,
+                                            const gchar* object_path,
+                                            const gchar* interface_name,
+                                            const gchar* property_name,
+                                            GError** error,
+                                            gpointer user_data);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GVariant* value,
+                                           GError** error,
+                                           gpointer user_data);
+static void _test_unregister_object (gpointer user_data);
+static void run_data_free (gpointer _data);
+VALA_EXTERN void run (GAsyncReadyCallback _callback_,
+          gpointer _user_data_);
+VALA_EXTERN void run_finish (GAsyncResult* _res_);
+static gboolean run_co (RunData* _data_);
+static void run_ready (GObject* source_object,
+                GAsyncResult* _res_,
+                gpointer _user_data_);
+static void _vala_main (void);
+
+static const GDBusArgInfo * const _test_dbus_arg_info_test_void_in[] = {NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_void_out[] = {NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_void = {-1, "TestVoid", (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_void_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_void_out), NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_int_i = {-1, "i", "i", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_int_j = {-1, "j", "i", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_int_result = {-1, "result", "i", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_int_in[] = {&_test_dbus_arg_info_test_int_i, 
NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_int_out[] = {&_test_dbus_arg_info_test_int_j, 
&_test_dbus_arg_info_test_int_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_int = {-1, "TestInt", (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_int_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_int_out), NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_string_s = {-1, "s", "s", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_string_t = {-1, "t", "s", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_string_result = {-1, "result", "s", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_string_in[] = 
{&_test_dbus_arg_info_test_string_s, NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_string_out[] = 
{&_test_dbus_arg_info_test_string_t, &_test_dbus_arg_info_test_string_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_string = {-1, "TestString", (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_string_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_string_out), NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_cancellable_in[] = {NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_cancellable_out[] = {NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_cancellable = {-1, "TestCancellable", (GDBusArgInfo 
**) (&_test_dbus_arg_info_test_cancellable_in), (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_cancellable_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_test_void, 
&_test_dbus_method_info_test_int, &_test_dbus_method_info_test_string, 
&_test_dbus_method_info_test_cancellable, NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = {NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) 
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, 
test_dbus_interface_get_property, test_dbus_interface_set_property};
+
+void
+test_test_void (Test* self,
+                GAsyncReadyCallback _callback_,
+                gpointer _user_data_)
+{
+       TestIface* _iface_;
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->test_void) {
+               _iface_->test_void (self, _callback_, _user_data_);
+       }
+}
+
+void
+test_test_void_finish (Test* self,
+                       GAsyncResult* _res_,
+                       GError** error)
+{
+       TestIface* _iface_;
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->test_void_finish) {
+               _iface_->test_void_finish (self, _res_, error);
+       }
+}
+
+void
+test_test_int (Test* self,
+               gint i,
+               GAsyncReadyCallback _callback_,
+               gpointer _user_data_)
+{
+       TestIface* _iface_;
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->test_int) {
+               _iface_->test_int (self, i, _callback_, _user_data_);
+       }
+}
+
+gint
+test_test_int_finish (Test* self,
+                      GAsyncResult* _res_,
+                      gint* j,
+                      GError** error)
+{
+       TestIface* _iface_;
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->test_int_finish) {
+               return _iface_->test_int_finish (self, _res_, j, error);
+       }
+       return -1;
+}
+
+void
+test_test_string (Test* self,
+                  const gchar* s,
+                  GAsyncReadyCallback _callback_,
+                  gpointer _user_data_)
+{
+       TestIface* _iface_;
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->test_string) {
+               _iface_->test_string (self, s, _callback_, _user_data_);
+       }
+}
+
+gchar*
+test_test_string_finish (Test* self,
+                         GAsyncResult* _res_,
+                         gchar* * t,
+                         GError** error)
+{
+       TestIface* _iface_;
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->test_string_finish) {
+               return _iface_->test_string_finish (self, _res_, t, error);
+       }
+       return NULL;
+}
+
+void
+test_test_cancellable (Test* self,
+                       GCancellable* cancellable,
+                       GAsyncReadyCallback _callback_,
+                       gpointer _user_data_)
+{
+       TestIface* _iface_;
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->test_cancellable) {
+               _iface_->test_cancellable (self, cancellable, _callback_, _user_data_);
+       }
+}
+
+void
+test_test_cancellable_finish (Test* self,
+                              GAsyncResult* _res_,
+                              GError** error)
+{
+       TestIface* _iface_;
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->test_cancellable_finish) {
+               _iface_->test_cancellable_finish (self, _res_, error);
+       }
+}
+
+static void
+test_default_init (TestIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType test_type_id;
+       test_type_id = g_type_register_static (G_TYPE_INTERFACE, "Test", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (test_type_id, G_TYPE_OBJECT);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) 
test_proxy_get_type);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), 
"org.example.Test");
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*) 
(&_test_dbus_interface_info));
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_register_object);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_TEST, 
test_proxy_test_interface_init) )
+static void
+test_proxy_class_init (TestProxyClass* klass)
+{
+       G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal;
+}
+
+static void
+test_proxy_g_signal (GDBusProxy* proxy,
+                     const gchar* sender_name,
+                     const gchar* signal_name,
+                     GVariant* parameters)
+{
+}
+
+static void
+test_proxy_init (TestProxy* self)
+{
+       g_dbus_proxy_set_interface_info (G_DBUS_PROXY (self), (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info));
+}
+
+static void
+_vala_g_async_ready_callback (GObject *source_object,
+                              GAsyncResult *res,
+                              void *user_data)
+{
+       g_task_return_pointer (user_data, g_object_ref (res), g_object_unref);
+       g_object_unref (user_data);
+}
+
+static void
+test_proxy_test_void_async (Test* self,
+                            GAsyncReadyCallback _callback_,
+                            gpointer _user_data_)
+{
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "TestVoid");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       if (_callback_ != NULL) {
+               g_dbus_connection_send_message_with_reply (g_dbus_proxy_get_connection ((GDBusProxy *) self), 
_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout ((GDBusProxy *) self), NULL, NULL, 
_vala_g_async_ready_callback, g_task_new ((GObject *) self, NULL, _callback_, _user_data_));
+       } else {
+               g_dbus_message_set_flags (_message, G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED);
+               g_dbus_connection_send_message (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       }
+       g_object_unref (_message);
+}
+
+static void
+test_proxy_test_void_finish (Test* self,
+                             GAsyncResult* _res_,
+                             GError** error)
+{
+       GAsyncResult *_inner_res;
+       GDBusMessage *_reply_message;
+       _inner_res = g_task_propagate_pointer ((GTask *) _res_, NULL);
+       _reply_message = g_dbus_connection_send_message_with_reply_finish (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _inner_res, error);
+       g_object_unref (_inner_res);
+       if (!_reply_message) {
+               return;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, error)) {
+               g_object_unref (_reply_message);
+               return;
+       }
+       g_object_unref (_reply_message);
+}
+
+static void
+test_proxy_test_int_async (Test* self,
+                           gint i,
+                           GAsyncReadyCallback _callback_,
+                           gpointer _user_data_)
+{
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "TestInt");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_arguments_builder, g_variant_new_int32 (i));
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       if (_callback_ != NULL) {
+               g_dbus_connection_send_message_with_reply (g_dbus_proxy_get_connection ((GDBusProxy *) self), 
_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout ((GDBusProxy *) self), NULL, NULL, 
_vala_g_async_ready_callback, g_task_new ((GObject *) self, NULL, _callback_, _user_data_));
+       } else {
+               g_dbus_message_set_flags (_message, G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED);
+               g_dbus_connection_send_message (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       }
+       g_object_unref (_message);
+}
+
+static gint
+test_proxy_test_int_finish (Test* self,
+                            GAsyncResult* _res_,
+                            gint* j,
+                            GError** error)
+{
+       GAsyncResult *_inner_res;
+       GDBusMessage *_reply_message;
+       GVariant *_reply;
+       GVariantIter _reply_iter;
+       gint _vala_j = 0;
+       GVariant* _tmp2_;
+       gint _result = 0;
+       GVariant* _tmp3_;
+       _inner_res = g_task_propagate_pointer ((GTask *) _res_, NULL);
+       _reply_message = g_dbus_connection_send_message_with_reply_finish (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _inner_res, error);
+       g_object_unref (_inner_res);
+       if (!_reply_message) {
+               gint _tmp0_ = 0;
+               return _tmp0_;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, error)) {
+               gint _tmp1_ = 0;
+               g_object_unref (_reply_message);
+               return _tmp1_;
+       }
+       _reply = g_dbus_message_get_body (_reply_message);
+       g_variant_iter_init (&_reply_iter, _reply);
+       _tmp2_ = g_variant_iter_next_value (&_reply_iter);
+       _vala_j = g_variant_get_int32 (_tmp2_);
+       g_variant_unref (_tmp2_);
+       *j = _vala_j;
+       _tmp3_ = g_variant_iter_next_value (&_reply_iter);
+       _result = g_variant_get_int32 (_tmp3_);
+       g_variant_unref (_tmp3_);
+       g_object_unref (_reply_message);
+       return _result;
+}
+
+static void
+test_proxy_test_string_async (Test* self,
+                              const gchar* s,
+                              GAsyncReadyCallback _callback_,
+                              gpointer _user_data_)
+{
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "TestString");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (s));
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       if (_callback_ != NULL) {
+               g_dbus_connection_send_message_with_reply (g_dbus_proxy_get_connection ((GDBusProxy *) self), 
_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout ((GDBusProxy *) self), NULL, NULL, 
_vala_g_async_ready_callback, g_task_new ((GObject *) self, NULL, _callback_, _user_data_));
+       } else {
+               g_dbus_message_set_flags (_message, G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED);
+               g_dbus_connection_send_message (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       }
+       g_object_unref (_message);
+}
+
+static gchar*
+test_proxy_test_string_finish (Test* self,
+                               GAsyncResult* _res_,
+                               gchar* * t,
+                               GError** error)
+{
+       GAsyncResult *_inner_res;
+       GDBusMessage *_reply_message;
+       GVariant *_reply;
+       GVariantIter _reply_iter;
+       gchar* _vala_t = NULL;
+       GVariant* _tmp4_;
+       gchar* _result = NULL;
+       GVariant* _tmp5_;
+       _inner_res = g_task_propagate_pointer ((GTask *) _res_, NULL);
+       _reply_message = g_dbus_connection_send_message_with_reply_finish (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _inner_res, error);
+       g_object_unref (_inner_res);
+       if (!_reply_message) {
+               return NULL;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, error)) {
+               g_object_unref (_reply_message);
+               return NULL;
+       }
+       _reply = g_dbus_message_get_body (_reply_message);
+       g_variant_iter_init (&_reply_iter, _reply);
+       _tmp4_ = g_variant_iter_next_value (&_reply_iter);
+       _vala_t = g_variant_dup_string (_tmp4_, NULL);
+       g_variant_unref (_tmp4_);
+       *t = _vala_t;
+       _tmp5_ = g_variant_iter_next_value (&_reply_iter);
+       _result = g_variant_dup_string (_tmp5_, NULL);
+       g_variant_unref (_tmp5_);
+       g_object_unref (_reply_message);
+       return _result;
+}
+
+static void
+test_proxy_test_cancellable_async (Test* self,
+                                   GCancellable* cancellable,
+                                   GAsyncReadyCallback _callback_,
+                                   gpointer _user_data_)
+{
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "TestCancellable");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       if (_callback_ != NULL) {
+               g_dbus_connection_send_message_with_reply (g_dbus_proxy_get_connection ((GDBusProxy *) self), 
_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout ((GDBusProxy *) self), NULL, 
cancellable, _vala_g_async_ready_callback, g_task_new ((GObject *) self, NULL, _callback_, _user_data_));
+       } else {
+               g_dbus_message_set_flags (_message, G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED);
+               g_dbus_connection_send_message (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       }
+       g_object_unref (_message);
+}
+
+static void
+test_proxy_test_cancellable_finish (Test* self,
+                                    GAsyncResult* _res_,
+                                    GError** error)
+{
+       GAsyncResult *_inner_res;
+       GDBusMessage *_reply_message;
+       _inner_res = g_task_propagate_pointer ((GTask *) _res_, NULL);
+       _reply_message = g_dbus_connection_send_message_with_reply_finish (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _inner_res, error);
+       g_object_unref (_inner_res);
+       if (!_reply_message) {
+               return;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, error)) {
+               g_object_unref (_reply_message);
+               return;
+       }
+       g_object_unref (_reply_message);
+}
+
+static void
+test_proxy_test_interface_init (TestIface* iface)
+{
+       iface->test_void = test_proxy_test_void_async;
+       iface->test_void_finish = test_proxy_test_void_finish;
+       iface->test_int = test_proxy_test_int_async;
+       iface->test_int_finish = test_proxy_test_int_finish;
+       iface->test_string = test_proxy_test_string_async;
+       iface->test_string_finish = test_proxy_test_string_finish;
+       iface->test_cancellable = test_proxy_test_cancellable_async;
+       iface->test_cancellable_finish = test_proxy_test_cancellable_finish;
+}
+
+static void
+_dbus_test_test_void (Test* self,
+                      GVariant* _parameters_,
+                      GDBusMethodInvocation* invocation)
+{
+       GVariantIter _arguments_iter;
+       TestTestVoidReadyData* _ready_data;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _ready_data = g_slice_new0 (TestTestVoidReadyData);
+       _ready_data->_invocation_ = invocation;
+       test_test_void (self, (GAsyncReadyCallback) _dbus_test_test_void_ready, _ready_data);
+}
+
+static void
+_dbus_test_test_void_ready (GObject * source_object,
+                            GAsyncResult * _res_,
+                            gpointer _user_data_)
+{
+       TestTestVoidReadyData* _ready_data;
+       GDBusMethodInvocation* invocation;
+       GError* error = NULL;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       _ready_data = _user_data_;
+       invocation = _ready_data->_invocation_;
+       test_test_void_finish ((Test*) source_object, _res_, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               goto _error;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+       _error:
+       g_slice_free (TestTestVoidReadyData, _ready_data);
+}
+
+static void
+_dbus_test_test_int (Test* self,
+                     GVariant* _parameters_,
+                     GDBusMethodInvocation* invocation)
+{
+       GVariantIter _arguments_iter;
+       TestTestIntReadyData* _ready_data;
+       GVariant* _tmp6_;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _ready_data = g_slice_new0 (TestTestIntReadyData);
+       _ready_data->_invocation_ = invocation;
+       _tmp6_ = g_variant_iter_next_value (&_arguments_iter);
+       _ready_data->i = g_variant_get_int32 (_tmp6_);
+       g_variant_unref (_tmp6_);
+       test_test_int (self, _ready_data->i, (GAsyncReadyCallback) _dbus_test_test_int_ready, _ready_data);
+}
+
+static void
+_dbus_test_test_int_ready (GObject * source_object,
+                           GAsyncResult * _res_,
+                           gpointer _user_data_)
+{
+       TestTestIntReadyData* _ready_data;
+       GDBusMethodInvocation* invocation;
+       GError* error = NULL;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       gint j = 0;
+       gint result;
+       _ready_data = _user_data_;
+       invocation = _ready_data->_invocation_;
+       result = test_test_int_finish ((Test*) source_object, _res_, &j, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               goto _error;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_int32 (j));
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_int32 (result));
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+       _error:
+       g_slice_free (TestTestIntReadyData, _ready_data);
+}
+
+static void
+_dbus_test_test_string (Test* self,
+                        GVariant* _parameters_,
+                        GDBusMethodInvocation* invocation)
+{
+       GVariantIter _arguments_iter;
+       TestTestStringReadyData* _ready_data;
+       GVariant* _tmp7_;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _ready_data = g_slice_new0 (TestTestStringReadyData);
+       _ready_data->_invocation_ = invocation;
+       _tmp7_ = g_variant_iter_next_value (&_arguments_iter);
+       _ready_data->s = g_variant_dup_string (_tmp7_, NULL);
+       g_variant_unref (_tmp7_);
+       test_test_string (self, _ready_data->s, (GAsyncReadyCallback) _dbus_test_test_string_ready, 
_ready_data);
+       _error:
+       ;
+}
+
+static void
+_dbus_test_test_string_ready (GObject * source_object,
+                              GAsyncResult * _res_,
+                              gpointer _user_data_)
+{
+       TestTestStringReadyData* _ready_data;
+       GDBusMethodInvocation* invocation;
+       GError* error = NULL;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       gchar* t = NULL;
+       gchar* result;
+       _ready_data = _user_data_;
+       invocation = _ready_data->_invocation_;
+       result = test_test_string_finish ((Test*) source_object, _res_, &t, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               goto _error;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_string (t));
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_string (result));
+       _g_free0 (result);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+       _error:
+       _g_free0 (_ready_data->s);
+       _g_free0 (t);
+       g_slice_free (TestTestStringReadyData, _ready_data);
+}
+
+static void
+_dbus_test_test_cancellable (Test* self,
+                             GVariant* _parameters_,
+                             GDBusMethodInvocation* invocation)
+{
+       GVariantIter _arguments_iter;
+       TestTestCancellableReadyData* _ready_data;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _ready_data = g_slice_new0 (TestTestCancellableReadyData);
+       _ready_data->_invocation_ = invocation;
+       test_test_cancellable (self, NULL, (GAsyncReadyCallback) _dbus_test_test_cancellable_ready, 
_ready_data);
+}
+
+static void
+_dbus_test_test_cancellable_ready (GObject * source_object,
+                                   GAsyncResult * _res_,
+                                   gpointer _user_data_)
+{
+       TestTestCancellableReadyData* _ready_data;
+       GDBusMethodInvocation* invocation;
+       GError* error = NULL;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       _ready_data = _user_data_;
+       invocation = _ready_data->_invocation_;
+       test_test_cancellable_finish ((Test*) source_object, _res_, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               goto _error;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+       _error:
+       g_slice_free (TestTestCancellableReadyData, _ready_data);
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* method_name,
+                                 GVariant* parameters,
+                                 GDBusMethodInvocation* invocation,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "TestVoid") == 0) {
+               _dbus_test_test_void (object, parameters, invocation);
+       } else if (strcmp (method_name, "TestInt") == 0) {
+               _dbus_test_test_int (object, parameters, invocation);
+       } else if (strcmp (method_name, "TestString") == 0) {
+               _dbus_test_test_string (object, parameters, invocation);
+       } else if (strcmp (method_name, "TestCancellable") == 0) {
+               _dbus_test_test_cancellable (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return NULL;
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GVariant* value,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return FALSE;
+}
+
+guint
+test_register_object (gpointer object,
+                      GDBusConnection* connection,
+                      const gchar* path,
+                      GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+static void
+run_data_free (gpointer _data)
+{
+       RunData* _data_;
+       _data_ = _data;
+       g_slice_free (RunData, _data_);
+}
+
+void
+run (GAsyncReadyCallback _callback_,
+     gpointer _user_data_)
+{
+       RunData* _data_;
+       _data_ = g_slice_new0 (RunData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, run_data_free);
+       run_co (_data_);
+}
+
+void
+run_finish (GAsyncResult* _res_)
+{
+       RunData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static void
+run_ready (GObject* source_object,
+           GAsyncResult* _res_,
+           gpointer _user_data_)
+{
+       RunData* _data_;
+       _data_ = _user_data_;
+       _data_->_source_object_ = source_object;
+       _data_->_res_ = _res_;
+       run_co (_data_);
+}
+
+static gboolean
+run_co (RunData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               case 1:
+               goto _state_1;
+               case 2:
+               goto _state_2;
+               case 3:
+               goto _state_3;
+               case 4:
+               goto _state_4;
+               case 5:
+               goto _state_5;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->_state_ = 1;
+       g_async_initable_new_async (TYPE_TEST_PROXY, 0, NULL, run_ready, _data_, "g-flags", 0, "g-name", 
"org.example.Test", "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/example/test", 
"g-interface-name", "org.example.Test", NULL);
+       return FALSE;
+       _state_1:
+       _data_->_tmp0_ = (Test*) g_async_initable_new_finish ((GAsyncInitable *) _data_->_source_object_, 
_data_->_res_, &_data_->_inner_error0_);
+       _data_->test = (Test*) _data_->_tmp0_;
+       if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), 
_data_->_inner_error0_->code);
+               g_clear_error (&_data_->_inner_error0_);
+               g_object_unref (_data_->_async_result);
+               return FALSE;
+       }
+       {
+               _data_->_state_ = 2;
+               test_test_void (_data_->test, run_ready, _data_);
+               return FALSE;
+               _state_2:
+               test_test_void_finish (_data_->test, _data_->_res_, &_data_->_inner_error0_);
+               if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+                       goto __catch0_g_error;
+               }
+               g_assert_not_reached ();
+       }
+       goto __finally0;
+       __catch0_g_error:
+       {
+               g_clear_error (&_data_->_inner_error0_);
+       }
+       __finally0:
+       if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+               _g_object_unref0 (_data_->test);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), 
_data_->_inner_error0_->code);
+               g_clear_error (&_data_->_inner_error0_);
+               g_object_unref (_data_->_async_result);
+               return FALSE;
+       }
+       {
+               _data_->_tmp2_ = 0;
+               _data_->_state_ = 3;
+               test_test_int (_data_->test, 42, run_ready, _data_);
+               return FALSE;
+               _state_3:
+               _data_->_tmp3_ = test_test_int_finish (_data_->test, _data_->_res_, &_data_->_tmp2_, 
&_data_->_inner_error0_);
+               _data_->j = _data_->_tmp2_;
+               _data_->_tmp1_ = _data_->_tmp3_;
+               if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+                       goto __catch1_g_error;
+               }
+               _data_->k = _data_->_tmp1_;
+               g_assert_not_reached ();
+       }
+       goto __finally1;
+       __catch1_g_error:
+       {
+               g_clear_error (&_data_->_inner_error0_);
+       }
+       __finally1:
+       if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+               _g_object_unref0 (_data_->test);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), 
_data_->_inner_error0_->code);
+               g_clear_error (&_data_->_inner_error0_);
+               g_object_unref (_data_->_async_result);
+               return FALSE;
+       }
+       {
+               _data_->_tmp5_ = NULL;
+               _data_->_state_ = 4;
+               test_test_string (_data_->test, "hello", run_ready, _data_);
+               return FALSE;
+               _state_4:
+               _data_->_tmp6_ = test_test_string_finish (_data_->test, _data_->_res_, &_data_->_tmp5_, 
&_data_->_inner_error0_);
+               _g_free0 (_data_->t);
+               _data_->t = _data_->_tmp5_;
+               _data_->_tmp4_ = _data_->_tmp6_;
+               if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+                       _g_free0 (_data_->u);
+                       _g_free0 (_data_->t);
+                       goto __catch2_g_error;
+               }
+               _data_->_tmp7_ = _data_->_tmp4_;
+               _data_->_tmp4_ = NULL;
+               _g_free0 (_data_->u);
+               _data_->u = _data_->_tmp7_;
+               g_assert_not_reached ();
+               _g_free0 (_data_->_tmp4_);
+               _g_free0 (_data_->u);
+               _g_free0 (_data_->t);
+       }
+       goto __finally2;
+       __catch2_g_error:
+       {
+               g_clear_error (&_data_->_inner_error0_);
+       }
+       __finally2:
+       if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+               _g_object_unref0 (_data_->test);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), 
_data_->_inner_error0_->code);
+               g_clear_error (&_data_->_inner_error0_);
+               g_object_unref (_data_->_async_result);
+               return FALSE;
+       }
+       {
+               _data_->_tmp8_ = g_cancellable_new ();
+               _data_->cancellable = _data_->_tmp8_;
+               _data_->_tmp9_ = _data_->cancellable;
+               g_cancellable_cancel (_data_->_tmp9_);
+               _data_->_tmp10_ = _data_->cancellable;
+               _data_->_state_ = 5;
+               test_test_cancellable (_data_->test, _data_->_tmp10_, run_ready, _data_);
+               return FALSE;
+               _state_5:
+               test_test_cancellable_finish (_data_->test, _data_->_res_, &_data_->_inner_error0_);
+               if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+                       _g_object_unref0 (_data_->cancellable);
+                       goto __catch3_g_error;
+               }
+               g_assert_not_reached ();
+               _g_object_unref0 (_data_->cancellable);
+       }
+       goto __finally3;
+       __catch3_g_error:
+       {
+               g_clear_error (&_data_->_inner_error0_);
+       }
+       __finally3:
+       if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+               _g_object_unref0 (_data_->test);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), 
_data_->_inner_error0_->code);
+               g_clear_error (&_data_->_inner_error0_);
+               g_object_unref (_data_->_async_result);
+               return FALSE;
+       }
+       _data_->_tmp11_ = main_loop;
+       g_main_loop_quit (_data_->_tmp11_);
+       _g_object_unref0 (_data_->test);
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+_vala_main (void)
+{
+       GMainLoop* _tmp0_;
+       GMainLoop* _tmp1_;
+       run (NULL, NULL);
+       _tmp0_ = g_main_loop_new (NULL, FALSE);
+       _g_main_loop_unref0 (main_loop);
+       main_loop = _tmp0_;
+       _tmp1_ = main_loop;
+       g_main_loop_run (_tmp1_);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/dbus/async-errors_server.c-expected b/tests/dbus/async-errors_server.c-expected
new file mode 100644
index 000000000..819beebe7
--- /dev/null
+++ b/tests/dbus/async-errors_server.c-expected
@@ -0,0 +1,1071 @@
+/* dbus_async_errors_server.c generated by valac, the Vala compiler
+ * generated from dbus_async_errors_server.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TEST, TestClass))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define IS_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TEST))
+#define TEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TEST, TestClass))
+
+typedef struct _Test Test;
+typedef struct _TestClass TestClass;
+typedef struct _TestPrivate TestPrivate;
+enum  {
+       TEST_0_PROPERTY,
+       TEST_NUM_PROPERTIES
+};
+static GParamSpec* test_properties[TEST_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+typedef struct _TestTestVoidData TestTestVoidData;
+typedef struct _TestTestIntData TestTestIntData;
+#define _g_free0(var) (var = (g_free (var), NULL))
+typedef struct _TestTestStringData TestTestStringData;
+typedef struct _TestTestCancellableData TestTestCancellableData;
+typedef struct _TestTestVoidReadyData TestTestVoidReadyData;
+typedef struct _TestTestIntReadyData TestTestIntReadyData;
+typedef struct _TestTestStringReadyData TestTestStringReadyData;
+typedef struct _TestTestCancellableReadyData TestTestCancellableReadyData;
+#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Test {
+       GObject parent_instance;
+       TestPrivate * priv;
+};
+
+struct _TestClass {
+       GObjectClass parent_class;
+};
+
+struct _TestTestVoidData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Test* self;
+       GError* _tmp0_;
+       GError* _inner_error0_;
+};
+
+struct _TestTestIntData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Test* self;
+       gint i;
+       gint j;
+       gint result;
+       GError* _tmp0_;
+       GError* _inner_error0_;
+};
+
+struct _TestTestStringData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Test* self;
+       gchar* s;
+       gchar* t;
+       gchar* result;
+       GError* _tmp0_;
+       GError* _inner_error0_;
+};
+
+struct _TestTestCancellableData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Test* self;
+       GCancellable* cancellable;
+};
+
+struct _TestTestVoidReadyData {
+       GDBusMethodInvocation* _invocation_;
+};
+
+struct _TestTestIntReadyData {
+       GDBusMethodInvocation* _invocation_;
+       gint i;
+};
+
+struct _TestTestStringReadyData {
+       GDBusMethodInvocation* _invocation_;
+       gchar* s;
+};
+
+struct _TestTestCancellableReadyData {
+       GDBusMethodInvocation* _invocation_;
+};
+
+static gpointer test_parent_class = NULL;
+VALA_EXTERN GMainLoop* main_loop;
+GMainLoop* main_loop = NULL;
+
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
+VALA_EXTERN guint test_register_object (void* object,
+                            GDBusConnection* connection,
+                            const gchar* path,
+                            GError** error);
+static void test_test_void_data_free (gpointer _data);
+VALA_EXTERN void test_test_void (Test* self,
+                     GAsyncReadyCallback _callback_,
+                     gpointer _user_data_);
+VALA_EXTERN void test_test_void_finish (Test* self,
+                            GAsyncResult* _res_,
+                            GError** error);
+static gboolean test_test_void_co (TestTestVoidData* _data_);
+static gboolean _test_test_void_co_gsource_func (gpointer self);
+static void test_test_int_data_free (gpointer _data);
+VALA_EXTERN void test_test_int (Test* self,
+                    gint i,
+                    GAsyncReadyCallback _callback_,
+                    gpointer _user_data_);
+VALA_EXTERN gint test_test_int_finish (Test* self,
+                           GAsyncResult* _res_,
+                           gint* j,
+                           GError** error);
+static gboolean test_test_int_co (TestTestIntData* _data_);
+static gboolean _test_test_int_co_gsource_func (gpointer self);
+static void test_test_string_data_free (gpointer _data);
+VALA_EXTERN void test_test_string (Test* self,
+                       const gchar* s,
+                       GAsyncReadyCallback _callback_,
+                       gpointer _user_data_);
+VALA_EXTERN gchar* test_test_string_finish (Test* self,
+                                GAsyncResult* _res_,
+                                gchar* * t,
+                                GError** error);
+static gboolean test_test_string_co (TestTestStringData* _data_);
+static gboolean _test_test_string_co_gsource_func (gpointer self);
+static void test_test_cancellable_data_free (gpointer _data);
+VALA_EXTERN void test_test_cancellable (Test* self,
+                            GCancellable* cancellable,
+                            GAsyncReadyCallback _callback_,
+                            gpointer _user_data_);
+VALA_EXTERN void test_test_cancellable_finish (Test* self,
+                                   GAsyncResult* _res_,
+                                   GError** error);
+static gboolean test_test_cancellable_co (TestTestCancellableData* _data_);
+static gboolean _test_test_cancellable_co_gsource_func (gpointer self);
+VALA_EXTERN Test* test_new (void);
+VALA_EXTERN Test* test_construct (GType object_type);
+static GType test_get_type_once (void);
+static void _dbus_test_test_void (Test* self,
+                           GVariant* _parameters_,
+                           GDBusMethodInvocation* invocation);
+static void _dbus_test_test_void_ready (GObject * source_object,
+                                 GAsyncResult * _res_,
+                                 gpointer _user_data_);
+static void _dbus_test_test_int (Test* self,
+                          GVariant* _parameters_,
+                          GDBusMethodInvocation* invocation);
+static void _dbus_test_test_int_ready (GObject * source_object,
+                                GAsyncResult * _res_,
+                                gpointer _user_data_);
+static void _dbus_test_test_string (Test* self,
+                             GVariant* _parameters_,
+                             GDBusMethodInvocation* invocation);
+static void _dbus_test_test_string_ready (GObject * source_object,
+                                   GAsyncResult * _res_,
+                                   gpointer _user_data_);
+static void _dbus_test_test_cancellable (Test* self,
+                                  GVariant* _parameters_,
+                                  GDBusMethodInvocation* invocation);
+static void _dbus_test_test_cancellable_ready (GObject * source_object,
+                                        GAsyncResult * _res_,
+                                        gpointer _user_data_);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* method_name,
+                                      GVariant* parameters,
+                                      GDBusMethodInvocation* invocation,
+                                      gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+                                            const gchar* sender,
+                                            const gchar* object_path,
+                                            const gchar* interface_name,
+                                            const gchar* property_name,
+                                            GError** error,
+                                            gpointer user_data);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GVariant* value,
+                                           GError** error,
+                                           gpointer user_data);
+static void _test_unregister_object (gpointer user_data);
+VALA_EXTERN void client_exit (GPid pid,
+                  gint status);
+static void _vala_main (void);
+static guint _variant_get1 (GVariant* value);
+static void _client_exit_gchild_watch_func (GPid pid,
+                                     gint wait_status,
+                                     gpointer self);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static const GDBusArgInfo * const _test_dbus_arg_info_test_void_in[] = {NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_void_out[] = {NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_void = {-1, "TestVoid", (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_void_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_void_out), NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_int_i = {-1, "i", "i", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_int_j = {-1, "j", "i", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_int_result = {-1, "result", "i", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_int_in[] = {&_test_dbus_arg_info_test_int_i, 
NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_int_out[] = {&_test_dbus_arg_info_test_int_j, 
&_test_dbus_arg_info_test_int_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_int = {-1, "TestInt", (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_int_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_int_out), NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_string_s = {-1, "s", "s", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_string_t = {-1, "t", "s", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_string_result = {-1, "result", "s", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_string_in[] = 
{&_test_dbus_arg_info_test_string_s, NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_string_out[] = 
{&_test_dbus_arg_info_test_string_t, &_test_dbus_arg_info_test_string_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_string = {-1, "TestString", (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_string_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_string_out), NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_cancellable_in[] = {NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_cancellable_out[] = {NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_cancellable = {-1, "TestCancellable", (GDBusArgInfo 
**) (&_test_dbus_arg_info_test_cancellable_in), (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_cancellable_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_test_void, 
&_test_dbus_method_info_test_int, &_test_dbus_method_info_test_string, 
&_test_dbus_method_info_test_cancellable, NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = {NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) 
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, 
test_dbus_interface_get_property, test_dbus_interface_set_property};
+
+static void
+test_test_void_data_free (gpointer _data)
+{
+       TestTestVoidData* _data_;
+       _data_ = _data;
+       _g_object_unref0 (_data_->self);
+       g_slice_free (TestTestVoidData, _data_);
+}
+
+static gpointer
+_g_object_ref0 (gpointer self)
+{
+       return self ? g_object_ref (self) : NULL;
+}
+
+void
+test_test_void (Test* self,
+                GAsyncReadyCallback _callback_,
+                gpointer _user_data_)
+{
+       TestTestVoidData* _data_;
+       Test* _tmp0_;
+       g_return_if_fail (IS_TEST (self));
+       _data_ = g_slice_new0 (TestTestVoidData);
+       _data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, test_test_void_data_free);
+       _tmp0_ = _g_object_ref0 (self);
+       _data_->self = _tmp0_;
+       test_test_void_co (_data_);
+}
+
+void
+test_test_void_finish (Test* self,
+                       GAsyncResult* _res_,
+                       GError** error)
+{
+       TestTestVoidData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), error);
+       if (NULL == _data_) {
+               return;
+       }
+}
+
+static gboolean
+_test_test_void_co_gsource_func (gpointer self)
+{
+       gboolean result;
+       result = test_test_void_co (self);
+       return result;
+}
+
+static gboolean
+test_test_void_co (TestTestVoidData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               case 1:
+               goto _state_1;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _test_test_void_co_gsource_func, _data_, NULL);
+       _data_->_state_ = 1;
+       return FALSE;
+       _state_1:
+       ;
+       _data_->_tmp0_ = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, "Operation failed");
+       _data_->_inner_error0_ = _data_->_tmp0_;
+       g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+test_test_int_data_free (gpointer _data)
+{
+       TestTestIntData* _data_;
+       _data_ = _data;
+       _g_object_unref0 (_data_->self);
+       g_slice_free (TestTestIntData, _data_);
+}
+
+void
+test_test_int (Test* self,
+               gint i,
+               GAsyncReadyCallback _callback_,
+               gpointer _user_data_)
+{
+       TestTestIntData* _data_;
+       Test* _tmp0_;
+       g_return_if_fail (IS_TEST (self));
+       _data_ = g_slice_new0 (TestTestIntData);
+       _data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, test_test_int_data_free);
+       _tmp0_ = _g_object_ref0 (self);
+       _data_->self = _tmp0_;
+       _data_->i = i;
+       test_test_int_co (_data_);
+}
+
+gint
+test_test_int_finish (Test* self,
+                      GAsyncResult* _res_,
+                      gint* j,
+                      GError** error)
+{
+       gint result;
+       TestTestIntData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), error);
+       if (NULL == _data_) {
+               gint _tmp0_ = 0;
+               return _tmp0_;
+       }
+       if (j) {
+               *j = _data_->j;
+       }
+       result = _data_->result;
+       return result;
+}
+
+static gboolean
+_test_test_int_co_gsource_func (gpointer self)
+{
+       gboolean result;
+       result = test_test_int_co (self);
+       return result;
+}
+
+static gboolean
+test_test_int_co (TestTestIntData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               case 1:
+               goto _state_1;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _test_test_int_co_gsource_func, _data_, NULL);
+       _data_->_state_ = 1;
+       return FALSE;
+       _state_1:
+       ;
+       _data_->_tmp0_ = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, "Operation failed");
+       _data_->_inner_error0_ = _data_->_tmp0_;
+       g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+test_test_string_data_free (gpointer _data)
+{
+       TestTestStringData* _data_;
+       _data_ = _data;
+       _g_free0 (_data_->s);
+       _g_free0 (_data_->result);
+       _g_object_unref0 (_data_->self);
+       g_slice_free (TestTestStringData, _data_);
+}
+
+void
+test_test_string (Test* self,
+                  const gchar* s,
+                  GAsyncReadyCallback _callback_,
+                  gpointer _user_data_)
+{
+       TestTestStringData* _data_;
+       Test* _tmp0_;
+       gchar* _tmp1_;
+       g_return_if_fail (IS_TEST (self));
+       g_return_if_fail (s != NULL);
+       _data_ = g_slice_new0 (TestTestStringData);
+       _data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, test_test_string_data_free);
+       _tmp0_ = _g_object_ref0 (self);
+       _data_->self = _tmp0_;
+       _tmp1_ = g_strdup (s);
+       _g_free0 (_data_->s);
+       _data_->s = _tmp1_;
+       test_test_string_co (_data_);
+}
+
+gchar*
+test_test_string_finish (Test* self,
+                         GAsyncResult* _res_,
+                         gchar* * t,
+                         GError** error)
+{
+       gchar* result;
+       TestTestStringData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), error);
+       if (NULL == _data_) {
+               return NULL;
+       }
+       if (t) {
+               *t = _data_->t;
+       } else {
+               _g_free0 (_data_->t);
+       }
+       _data_->t = NULL;
+       result = _data_->result;
+       _data_->result = NULL;
+       return result;
+}
+
+static gboolean
+_test_test_string_co_gsource_func (gpointer self)
+{
+       gboolean result;
+       result = test_test_string_co (self);
+       return result;
+}
+
+static gboolean
+test_test_string_co (TestTestStringData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               case 1:
+               goto _state_1;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _test_test_string_co_gsource_func, _data_, NULL);
+       _data_->_state_ = 1;
+       return FALSE;
+       _state_1:
+       ;
+       _data_->_tmp0_ = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, "Operation failed");
+       _data_->_inner_error0_ = _data_->_tmp0_;
+       g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
+       _g_free0 (_data_->t);
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+test_test_cancellable_data_free (gpointer _data)
+{
+       TestTestCancellableData* _data_;
+       _data_ = _data;
+       _g_object_unref0 (_data_->cancellable);
+       _g_object_unref0 (_data_->self);
+       g_slice_free (TestTestCancellableData, _data_);
+}
+
+void
+test_test_cancellable (Test* self,
+                       GCancellable* cancellable,
+                       GAsyncReadyCallback _callback_,
+                       gpointer _user_data_)
+{
+       TestTestCancellableData* _data_;
+       Test* _tmp0_;
+       GCancellable* _tmp1_;
+       g_return_if_fail (IS_TEST (self));
+       g_return_if_fail ((cancellable == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (cancellable, 
g_cancellable_get_type ()));
+       _data_ = g_slice_new0 (TestTestCancellableData);
+       _data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, test_test_cancellable_data_free);
+       _tmp0_ = _g_object_ref0 (self);
+       _data_->self = _tmp0_;
+       _tmp1_ = _g_object_ref0 (cancellable);
+       _g_object_unref0 (_data_->cancellable);
+       _data_->cancellable = _tmp1_;
+       test_test_cancellable_co (_data_);
+}
+
+void
+test_test_cancellable_finish (Test* self,
+                              GAsyncResult* _res_,
+                              GError** error)
+{
+       TestTestCancellableData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), error);
+       if (NULL == _data_) {
+               return;
+       }
+}
+
+static gboolean
+_test_test_cancellable_co_gsource_func (gpointer self)
+{
+       gboolean result;
+       result = test_test_cancellable_co (self);
+       return result;
+}
+
+static gboolean
+test_test_cancellable_co (TestTestCancellableData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               case 1:
+               goto _state_1;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _test_test_cancellable_co_gsource_func, _data_, NULL);
+       _data_->_state_ = 1;
+       return FALSE;
+       _state_1:
+       ;
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+Test*
+test_construct (GType object_type)
+{
+       Test * self = NULL;
+       self = (Test*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Test*
+test_new (void)
+{
+       return test_construct (TYPE_TEST);
+}
+
+static void
+test_class_init (TestClass * klass,
+                 gpointer klass_data)
+{
+       test_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+test_instance_init (Test * self,
+                    gpointer klass)
+{
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Test), 
0, (GInstanceInitFunc) test_instance_init, NULL };
+       GType test_type_id;
+       test_type_id = g_type_register_static (G_TYPE_OBJECT, "Test", &g_define_type_info, 0);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_register_object);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+static void
+_dbus_test_test_void (Test* self,
+                      GVariant* _parameters_,
+                      GDBusMethodInvocation* invocation)
+{
+       GVariantIter _arguments_iter;
+       TestTestVoidReadyData* _ready_data;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _ready_data = g_slice_new0 (TestTestVoidReadyData);
+       _ready_data->_invocation_ = invocation;
+       test_test_void (self, (GAsyncReadyCallback) _dbus_test_test_void_ready, _ready_data);
+}
+
+static void
+_dbus_test_test_void_ready (GObject * source_object,
+                            GAsyncResult * _res_,
+                            gpointer _user_data_)
+{
+       TestTestVoidReadyData* _ready_data;
+       GDBusMethodInvocation* invocation;
+       GError* error = NULL;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       _ready_data = _user_data_;
+       invocation = _ready_data->_invocation_;
+       test_test_void_finish ((Test*) source_object, _res_, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               goto _error;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+       _error:
+       g_slice_free (TestTestVoidReadyData, _ready_data);
+}
+
+static void
+_dbus_test_test_int (Test* self,
+                     GVariant* _parameters_,
+                     GDBusMethodInvocation* invocation)
+{
+       GVariantIter _arguments_iter;
+       TestTestIntReadyData* _ready_data;
+       GVariant* _tmp0_;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _ready_data = g_slice_new0 (TestTestIntReadyData);
+       _ready_data->_invocation_ = invocation;
+       _tmp0_ = g_variant_iter_next_value (&_arguments_iter);
+       _ready_data->i = g_variant_get_int32 (_tmp0_);
+       g_variant_unref (_tmp0_);
+       test_test_int (self, _ready_data->i, (GAsyncReadyCallback) _dbus_test_test_int_ready, _ready_data);
+}
+
+static void
+_dbus_test_test_int_ready (GObject * source_object,
+                           GAsyncResult * _res_,
+                           gpointer _user_data_)
+{
+       TestTestIntReadyData* _ready_data;
+       GDBusMethodInvocation* invocation;
+       GError* error = NULL;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       gint j = 0;
+       gint result;
+       _ready_data = _user_data_;
+       invocation = _ready_data->_invocation_;
+       result = test_test_int_finish ((Test*) source_object, _res_, &j, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               goto _error;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_int32 (j));
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_int32 (result));
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+       _error:
+       g_slice_free (TestTestIntReadyData, _ready_data);
+}
+
+static void
+_dbus_test_test_string (Test* self,
+                        GVariant* _parameters_,
+                        GDBusMethodInvocation* invocation)
+{
+       GVariantIter _arguments_iter;
+       TestTestStringReadyData* _ready_data;
+       GVariant* _tmp1_;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _ready_data = g_slice_new0 (TestTestStringReadyData);
+       _ready_data->_invocation_ = invocation;
+       _tmp1_ = g_variant_iter_next_value (&_arguments_iter);
+       _ready_data->s = g_variant_dup_string (_tmp1_, NULL);
+       g_variant_unref (_tmp1_);
+       test_test_string (self, _ready_data->s, (GAsyncReadyCallback) _dbus_test_test_string_ready, 
_ready_data);
+       _error:
+       ;
+}
+
+static void
+_dbus_test_test_string_ready (GObject * source_object,
+                              GAsyncResult * _res_,
+                              gpointer _user_data_)
+{
+       TestTestStringReadyData* _ready_data;
+       GDBusMethodInvocation* invocation;
+       GError* error = NULL;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       gchar* t = NULL;
+       gchar* result;
+       _ready_data = _user_data_;
+       invocation = _ready_data->_invocation_;
+       result = test_test_string_finish ((Test*) source_object, _res_, &t, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               goto _error;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_string (t));
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_string (result));
+       _g_free0 (result);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+       _error:
+       _g_free0 (_ready_data->s);
+       _g_free0 (t);
+       g_slice_free (TestTestStringReadyData, _ready_data);
+}
+
+static void
+_dbus_test_test_cancellable (Test* self,
+                             GVariant* _parameters_,
+                             GDBusMethodInvocation* invocation)
+{
+       GVariantIter _arguments_iter;
+       TestTestCancellableReadyData* _ready_data;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _ready_data = g_slice_new0 (TestTestCancellableReadyData);
+       _ready_data->_invocation_ = invocation;
+       test_test_cancellable (self, NULL, (GAsyncReadyCallback) _dbus_test_test_cancellable_ready, 
_ready_data);
+}
+
+static void
+_dbus_test_test_cancellable_ready (GObject * source_object,
+                                   GAsyncResult * _res_,
+                                   gpointer _user_data_)
+{
+       TestTestCancellableReadyData* _ready_data;
+       GDBusMethodInvocation* invocation;
+       GError* error = NULL;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       _ready_data = _user_data_;
+       invocation = _ready_data->_invocation_;
+       test_test_cancellable_finish ((Test*) source_object, _res_, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               goto _error;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+       _error:
+       g_slice_free (TestTestCancellableReadyData, _ready_data);
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* method_name,
+                                 GVariant* parameters,
+                                 GDBusMethodInvocation* invocation,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "TestVoid") == 0) {
+               _dbus_test_test_void (object, parameters, invocation);
+       } else if (strcmp (method_name, "TestInt") == 0) {
+               _dbus_test_test_int (object, parameters, invocation);
+       } else if (strcmp (method_name, "TestString") == 0) {
+               _dbus_test_test_string (object, parameters, invocation);
+       } else if (strcmp (method_name, "TestCancellable") == 0) {
+               _dbus_test_test_cancellable (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return NULL;
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GVariant* value,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return FALSE;
+}
+
+guint
+test_register_object (gpointer object,
+                      GDBusConnection* connection,
+                      const gchar* path,
+                      GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+void
+client_exit (GPid pid,
+             gint status)
+{
+       GMainLoop* _tmp0_;
+       _vala_assert (status == 0, "status == 0");
+       _tmp0_ = main_loop;
+       g_main_loop_quit (_tmp0_);
+}
+
+static guint
+_variant_get1 (GVariant* value)
+{
+       return g_variant_get_uint32 (value);
+}
+
+static void
+_client_exit_gchild_watch_func (GPid pid,
+                                gint wait_status,
+                                gpointer self)
+{
+       client_exit (pid, wait_status);
+}
+
+static void
+_vala_main (void)
+{
+       GDBusConnection* conn = NULL;
+       GDBusConnection* _tmp0_;
+       GDBusConnection* _tmp1_;
+       Test* _tmp2_;
+       Test* _tmp3_;
+       GVariant* request_result = NULL;
+       GDBusConnection* _tmp4_;
+       GVariant* _tmp5_;
+       GVariant* _tmp6_;
+       GVariant* _tmp7_;
+       GVariant* _tmp8_;
+       GVariant* _tmp9_;
+       GVariant* _tmp10_;
+       GVariant* _tmp11_;
+       guint _tmp12_;
+       GPid client_pid = 0;
+       gchar* _tmp13_;
+       gchar** _tmp14_;
+       gchar** _tmp15_;
+       gint _tmp15__length1;
+       GPid _tmp16_ = 0;
+       GMainLoop* _tmp17_;
+       GMainLoop* _tmp18_;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &_inner_error0_);
+       conn = _tmp0_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp1_ = conn;
+       _tmp2_ = test_new ();
+       _tmp3_ = _tmp2_;
+       test_register_object (_tmp3_, _tmp1_, "/org/example/test", &_inner_error0_);
+       _g_object_unref0 (_tmp3_);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp4_ = conn;
+       _tmp5_ = g_variant_new ("(su)", "org.example.Test", 0x4, NULL);
+       g_variant_ref_sink (_tmp5_);
+       _tmp6_ = _tmp5_;
+       _tmp7_ = g_dbus_connection_call_sync (_tmp4_, "org.freedesktop.DBus", "/org/freedesktop/DBus", 
"org.freedesktop.DBus", "RequestName", _tmp6_, NULL, 0, -1, NULL, &_inner_error0_);
+       _tmp8_ = _tmp7_;
+       _g_variant_unref0 (_tmp6_);
+       request_result = _tmp8_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp9_ = request_result;
+       _tmp10_ = g_variant_get_child_value (_tmp9_, (gsize) 0);
+       _tmp11_ = _tmp10_;
+       _tmp12_ = _variant_get1 (_tmp11_);
+       _vala_assert (_tmp12_ == ((guint) 1), "(uint) request_result.get_child_value (0) == 1");
+       _g_variant_unref0 (_tmp11_);
+       _tmp13_ = g_strdup ("dbus_async_errors_client");
+       _tmp14_ = g_new0 (gchar*, 1 + 1);
+       _tmp14_[0] = _tmp13_;
+       _tmp15_ = _tmp14_;
+       _tmp15__length1 = 1;
+       g_spawn_async (NULL, _tmp15_, NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &_tmp16_, &_inner_error0_);
+       client_pid = _tmp16_;
+       _tmp15_ = (_vala_array_free (_tmp15_, _tmp15__length1, (GDestroyNotify) g_free), NULL);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_variant_unref0 (request_result);
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       g_child_watch_add_full (G_PRIORITY_DEFAULT_IDLE, client_pid, _client_exit_gchild_watch_func, NULL, 
NULL);
+       _tmp17_ = g_main_loop_new (NULL, FALSE);
+       _g_main_loop_unref0 (main_loop);
+       main_loop = _tmp17_;
+       _tmp18_ = main_loop;
+       g_main_loop_run (_tmp18_);
+       _g_variant_unref0 (request_result);
+       _g_object_unref0 (conn);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/dbus/async-no-reply_client.c-expected b/tests/dbus/async-no-reply_client.c-expected
new file mode 100644
index 000000000..abb397e7d
--- /dev/null
+++ b/tests/dbus/async-no-reply_client.c-expected
@@ -0,0 +1,1012 @@
+/* dbus_async_no_reply_client.c generated by valac, the Vala compiler
+ * generated from dbus_async_no_reply_client.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define TEST_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_TEST, TestIface))
+
+typedef struct _Test Test;
+typedef struct _TestIface TestIface;
+
+#define TYPE_TEST_PROXY (test_proxy_get_type ())
+typedef GDBusProxy TestProxy;
+typedef GDBusProxyClass TestProxyClass;
+typedef struct _TestListMessagesReadyData TestListMessagesReadyData;
+typedef struct _TestPostMessageReadyData TestPostMessageReadyData;
+#define _g_free0(var) (var = (g_free (var), NULL))
+typedef struct _Block1Data Block1Data;
+#define _g_async_queue_unref0(var) ((var == NULL) ? NULL : (var = (g_async_queue_unref (var), NULL)))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+typedef struct _RunData RunData;
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _TestIface {
+       GTypeInterface parent_iface;
+       void (*list_messages) (Test* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+       gchar** (*list_messages_finish) (Test* self, GAsyncResult* _res_, gint* result_length1, GError** 
error);
+       void (*post_message) (Test* self, const gchar* message, GAsyncReadyCallback _callback_, gpointer 
_user_data_);
+       void (*post_message_finish) (Test* self, GAsyncResult* _res_, GError** error);
+};
+
+struct _TestListMessagesReadyData {
+       GDBusMethodInvocation* _invocation_;
+};
+
+struct _TestPostMessageReadyData {
+       GDBusMethodInvocation* _invocation_;
+       gchar* message;
+};
+
+struct _Block1Data {
+       int _ref_count_;
+       GAsyncQueue* events;
+       gpointer _async_data_;
+};
+
+struct _RunData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Block1Data* _data1_;
+       Test* test;
+       Test* _tmp0_;
+       GAsyncQueue* _tmp1_;
+       GDBusConnection* connection;
+       Test* _tmp2_;
+       GDBusConnection* _tmp3_;
+       GDBusConnection* _tmp4_;
+       GDBusConnection* _tmp5_;
+       gchar** messages;
+       Test* _tmp6_;
+       gint _tmp7_;
+       gchar** _tmp8_;
+       gint messages_length1;
+       gint _messages_size_;
+       gchar** _tmp9_;
+       gint _tmp9__length1;
+       Test* _tmp10_;
+       GAsyncQueue* _tmp11_;
+       gpointer _tmp12_;
+       gchar* _tmp13_;
+       GAsyncQueue* _tmp14_;
+       gpointer _tmp15_;
+       gchar* _tmp16_;
+       Test* _tmp17_;
+       GAsyncQueue* _tmp18_;
+       gpointer _tmp19_;
+       gchar* _tmp20_;
+       GAsyncQueue* _tmp21_;
+       gpointer _tmp22_;
+       gchar* _tmp23_;
+       gchar** _tmp24_;
+       Test* _tmp25_;
+       gint _tmp26_;
+       gchar** _tmp27_;
+       gint _tmp24__length1;
+       gint __tmp24__size_;
+       gchar** _tmp28_;
+       gint _tmp28__length1;
+       gchar** _tmp29_;
+       gint _tmp29__length1;
+       gchar** _tmp30_;
+       gint _tmp30__length1;
+       const gchar* _tmp31_;
+       gchar** _tmp32_;
+       gint _tmp32__length1;
+       const gchar* _tmp33_;
+       GMainLoop* _tmp34_;
+       GError* _inner_error0_;
+};
+
+VALA_EXTERN GMainLoop* main_loop;
+GMainLoop* main_loop = NULL;
+
+VALA_EXTERN GType test_proxy_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN guint test_register_object (void* object,
+                            GDBusConnection* connection,
+                            const gchar* path,
+                            GError** error);
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN void test_list_messages (Test* self,
+                         GAsyncReadyCallback _callback_,
+                         gpointer _user_data_);
+VALA_EXTERN gchar** test_list_messages_finish (Test* self,
+                                   GAsyncResult* _res_,
+                                   gint* result_length1,
+                                   GError** error);
+VALA_EXTERN void test_post_message (Test* self,
+                        const gchar* message,
+                        GAsyncReadyCallback _callback_,
+                        gpointer _user_data_);
+VALA_EXTERN void test_post_message_finish (Test* self,
+                               GAsyncResult* _res_,
+                               GError** error);
+static GType test_get_type_once (void);
+static void test_proxy_g_signal (GDBusProxy* proxy,
+                          const gchar* sender_name,
+                          const gchar* signal_name,
+                          GVariant* parameters);
+static void _vala_g_async_ready_callback (GObject *source_object,
+                                   GAsyncResult *res,
+                                   void *user_data);
+static void test_proxy_list_messages_async (Test* self,
+                                     GAsyncReadyCallback _callback_,
+                                     gpointer _user_data_);
+static gchar** test_proxy_list_messages_finish (Test* self,
+                                         GAsyncResult* _res_,
+                                         gint* result_length1,
+                                         GError** error);
+static void test_proxy_post_message_async (Test* self,
+                                    const gchar* message,
+                                    GAsyncReadyCallback _callback_,
+                                    gpointer _user_data_);
+static void test_proxy_post_message_finish (Test* self,
+                                     GAsyncResult* _res_,
+                                     GError** error);
+static void test_proxy_test_interface_init (TestIface* iface);
+static void _dbus_test_list_messages (Test* self,
+                               GVariant* _parameters_,
+                               GDBusMethodInvocation* invocation);
+static void _dbus_test_list_messages_ready (GObject * source_object,
+                                     GAsyncResult * _res_,
+                                     gpointer _user_data_);
+static void _dbus_test_post_message (Test* self,
+                              GVariant* _parameters_,
+                              GDBusMethodInvocation* invocation);
+static void _dbus_test_post_message_ready (GObject * source_object,
+                                    GAsyncResult * _res_,
+                                    gpointer _user_data_);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* method_name,
+                                      GVariant* parameters,
+                                      GDBusMethodInvocation* invocation,
+                                      gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+                                            const gchar* sender,
+                                            const gchar* object_path,
+                                            const gchar* interface_name,
+                                            const gchar* property_name,
+                                            GError** error,
+                                            gpointer user_data);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GVariant* value,
+                                           GError** error,
+                                           gpointer user_data);
+static void _test_unregister_object (gpointer user_data);
+static void run_data_free (gpointer _data);
+VALA_EXTERN void run (GAsyncReadyCallback _callback_,
+          gpointer _user_data_);
+VALA_EXTERN void run_finish (GAsyncResult* _res_);
+static gboolean run_co (RunData* _data_);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static void run_ready (GObject* source_object,
+                GAsyncResult* _res_,
+                gpointer _user_data_);
+static void _g_free0_ (gpointer var);
+static GDBusMessage* __lambda4_ (Block1Data* _data1_,
+                          GDBusConnection* conn,
+                          GDBusMessage* message,
+                          gboolean incoming);
+static GDBusMessage* ___lambda4__gd_bus_message_filter_function (GDBusConnection* connection,
+                                                          GDBusMessage* message,
+                                                          gboolean incoming,
+                                                          gpointer self);
+static void _vala_main (void);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static const GDBusArgInfo _test_dbus_arg_info_list_messages_result = {-1, "result", "as", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_list_messages_in[] = {NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_list_messages_out[] = 
{&_test_dbus_arg_info_list_messages_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_list_messages = {-1, "ListMessages", (GDBusArgInfo **) 
(&_test_dbus_arg_info_list_messages_in), (GDBusArgInfo **) (&_test_dbus_arg_info_list_messages_out), NULL};
+static const GDBusArgInfo _test_dbus_arg_info_post_message_message = {-1, "message", "s", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_post_message_in[] = 
{&_test_dbus_arg_info_post_message_message, NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_post_message_out[] = {NULL};
+static const GDBusMethodInfo _test_dbus_method_info_post_message = {-1, "PostMessage", (GDBusArgInfo **) 
(&_test_dbus_arg_info_post_message_in), (GDBusArgInfo **) (&_test_dbus_arg_info_post_message_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_list_messages, 
&_test_dbus_method_info_post_message, NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = {NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) 
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, 
test_dbus_interface_get_property, test_dbus_interface_set_property};
+
+void
+test_list_messages (Test* self,
+                    GAsyncReadyCallback _callback_,
+                    gpointer _user_data_)
+{
+       TestIface* _iface_;
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->list_messages) {
+               _iface_->list_messages (self, _callback_, _user_data_);
+       }
+}
+
+gchar**
+test_list_messages_finish (Test* self,
+                           GAsyncResult* _res_,
+                           gint* result_length1,
+                           GError** error)
+{
+       TestIface* _iface_;
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->list_messages_finish) {
+               return _iface_->list_messages_finish (self, _res_, result_length1, error);
+       }
+       return NULL;
+}
+
+void
+test_post_message (Test* self,
+                   const gchar* message,
+                   GAsyncReadyCallback _callback_,
+                   gpointer _user_data_)
+{
+       TestIface* _iface_;
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->post_message) {
+               _iface_->post_message (self, message, _callback_, _user_data_);
+       }
+}
+
+void
+test_post_message_finish (Test* self,
+                          GAsyncResult* _res_,
+                          GError** error)
+{
+       TestIface* _iface_;
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->post_message_finish) {
+               _iface_->post_message_finish (self, _res_, error);
+       }
+}
+
+static void
+test_default_init (TestIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType test_type_id;
+       test_type_id = g_type_register_static (G_TYPE_INTERFACE, "Test", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (test_type_id, G_TYPE_OBJECT);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) 
test_proxy_get_type);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), 
"org.example.Test");
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*) 
(&_test_dbus_interface_info));
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_register_object);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_TEST, 
test_proxy_test_interface_init) )
+static void
+test_proxy_class_init (TestProxyClass* klass)
+{
+       G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal;
+}
+
+static void
+test_proxy_g_signal (GDBusProxy* proxy,
+                     const gchar* sender_name,
+                     const gchar* signal_name,
+                     GVariant* parameters)
+{
+}
+
+static void
+test_proxy_init (TestProxy* self)
+{
+       g_dbus_proxy_set_interface_info (G_DBUS_PROXY (self), (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info));
+}
+
+static void
+_vala_g_async_ready_callback (GObject *source_object,
+                              GAsyncResult *res,
+                              void *user_data)
+{
+       g_task_return_pointer (user_data, g_object_ref (res), g_object_unref);
+       g_object_unref (user_data);
+}
+
+static void
+test_proxy_list_messages_async (Test* self,
+                                GAsyncReadyCallback _callback_,
+                                gpointer _user_data_)
+{
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       G_IO_ERROR;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "ListMessages");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       if (_callback_ != NULL) {
+               g_dbus_connection_send_message_with_reply (g_dbus_proxy_get_connection ((GDBusProxy *) self), 
_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout ((GDBusProxy *) self), NULL, NULL, 
_vala_g_async_ready_callback, g_task_new ((GObject *) self, NULL, _callback_, _user_data_));
+       } else {
+               g_dbus_message_set_flags (_message, G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED);
+               g_dbus_connection_send_message (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       }
+       g_object_unref (_message);
+}
+
+static gchar**
+test_proxy_list_messages_finish (Test* self,
+                                 GAsyncResult* _res_,
+                                 gint* result_length1,
+                                 GError** error)
+{
+       GAsyncResult *_inner_res;
+       GDBusMessage *_reply_message;
+       GVariant *_reply;
+       GVariantIter _reply_iter;
+       gchar** _result = NULL;
+       gint _result_length1;
+       GVariant* _tmp0_;
+       gchar** _tmp1_;
+       gint _tmp1__length;
+       gint _tmp1__size;
+       gint _tmp1__length1;
+       GVariantIter _tmp2_;
+       GVariant* _tmp3_;
+       _inner_res = g_task_propagate_pointer ((GTask *) _res_, NULL);
+       _reply_message = g_dbus_connection_send_message_with_reply_finish (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _inner_res, error);
+       g_object_unref (_inner_res);
+       if (!_reply_message) {
+               return NULL;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, error)) {
+               g_object_unref (_reply_message);
+               return NULL;
+       }
+       _reply = g_dbus_message_get_body (_reply_message);
+       g_variant_iter_init (&_reply_iter, _reply);
+       _result_length1 = 0;
+       _tmp0_ = g_variant_iter_next_value (&_reply_iter);
+       _tmp1_ = g_new (gchar*, 5);
+       _tmp1__length = 0;
+       _tmp1__size = 4;
+       _tmp1__length1 = 0;
+       g_variant_iter_init (&_tmp2_, _tmp0_);
+       for (; (_tmp3_ = g_variant_iter_next_value (&_tmp2_)) != NULL; _tmp1__length1++) {
+               if (_tmp1__size == _tmp1__length) {
+                       _tmp1__size = 2 * _tmp1__size;
+                       _tmp1_ = g_renew (gchar*, _tmp1_, _tmp1__size + 1);
+               }
+               _tmp1_[_tmp1__length++] = g_variant_dup_string (_tmp3_, NULL);
+               g_variant_unref (_tmp3_);
+       }
+       _result_length1 = _tmp1__length1;
+       _tmp1_[_tmp1__length] = NULL;
+       _result = _tmp1_;
+       g_variant_unref (_tmp0_);
+       *result_length1 = _result_length1;
+       g_object_unref (_reply_message);
+       return _result;
+}
+
+static void
+test_proxy_post_message_async (Test* self,
+                               const gchar* message,
+                               GAsyncReadyCallback _callback_,
+                               gpointer _user_data_)
+{
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       G_IO_ERROR;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "PostMessage");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (message));
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       if (_callback_ != NULL) {
+               g_dbus_connection_send_message_with_reply (g_dbus_proxy_get_connection ((GDBusProxy *) self), 
_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout ((GDBusProxy *) self), NULL, NULL, 
_vala_g_async_ready_callback, g_task_new ((GObject *) self, NULL, _callback_, _user_data_));
+       } else {
+               g_dbus_message_set_flags (_message, G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED);
+               g_dbus_connection_send_message (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       }
+       g_object_unref (_message);
+}
+
+static void
+test_proxy_post_message_finish (Test* self,
+                                GAsyncResult* _res_,
+                                GError** error)
+{
+       GAsyncResult *_inner_res;
+       GDBusMessage *_reply_message;
+       _inner_res = g_task_propagate_pointer ((GTask *) _res_, NULL);
+       _reply_message = g_dbus_connection_send_message_with_reply_finish (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _inner_res, error);
+       g_object_unref (_inner_res);
+       if (!_reply_message) {
+               return;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, error)) {
+               g_object_unref (_reply_message);
+               return;
+       }
+       g_object_unref (_reply_message);
+}
+
+static void
+test_proxy_test_interface_init (TestIface* iface)
+{
+       iface->list_messages = test_proxy_list_messages_async;
+       iface->list_messages_finish = test_proxy_list_messages_finish;
+       iface->post_message = test_proxy_post_message_async;
+       iface->post_message_finish = test_proxy_post_message_finish;
+}
+
+static void
+_dbus_test_list_messages (Test* self,
+                          GVariant* _parameters_,
+                          GDBusMethodInvocation* invocation)
+{
+       GVariantIter _arguments_iter;
+       TestListMessagesReadyData* _ready_data;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _ready_data = g_slice_new0 (TestListMessagesReadyData);
+       _ready_data->_invocation_ = invocation;
+       test_list_messages (self, (GAsyncReadyCallback) _dbus_test_list_messages_ready, _ready_data);
+}
+
+static void
+_dbus_test_list_messages_ready (GObject * source_object,
+                                GAsyncResult * _res_,
+                                gpointer _user_data_)
+{
+       TestListMessagesReadyData* _ready_data;
+       GDBusMethodInvocation* invocation;
+       GError* error = NULL;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       gchar** result;
+       gint result_length1 = 0;
+       gchar** _tmp4_;
+       GVariantBuilder _tmp5_;
+       gint _tmp6_;
+       _ready_data = _user_data_;
+       invocation = _ready_data->_invocation_;
+       result = test_list_messages_finish ((Test*) source_object, _res_, &result_length1, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               goto _error;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _tmp4_ = result;
+       g_variant_builder_init (&_tmp5_, G_VARIANT_TYPE ("as"));
+       for (_tmp6_ = 0; _tmp6_ < result_length1; _tmp6_++) {
+               g_variant_builder_add_value (&_tmp5_, g_variant_new_string (*_tmp4_));
+               _tmp4_++;
+       }
+       g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp5_));
+       result = (_vala_array_free (result, result_length1, (GDestroyNotify) g_free), NULL);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+       _error:
+       g_slice_free (TestListMessagesReadyData, _ready_data);
+}
+
+static void
+_dbus_test_post_message (Test* self,
+                         GVariant* _parameters_,
+                         GDBusMethodInvocation* invocation)
+{
+       GVariantIter _arguments_iter;
+       TestPostMessageReadyData* _ready_data;
+       GVariant* _tmp7_;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _ready_data = g_slice_new0 (TestPostMessageReadyData);
+       _ready_data->_invocation_ = invocation;
+       _tmp7_ = g_variant_iter_next_value (&_arguments_iter);
+       _ready_data->message = g_variant_dup_string (_tmp7_, NULL);
+       g_variant_unref (_tmp7_);
+       test_post_message (self, _ready_data->message, (GAsyncReadyCallback) _dbus_test_post_message_ready, 
_ready_data);
+       _error:
+       ;
+}
+
+static void
+_dbus_test_post_message_ready (GObject * source_object,
+                               GAsyncResult * _res_,
+                               gpointer _user_data_)
+{
+       TestPostMessageReadyData* _ready_data;
+       GDBusMethodInvocation* invocation;
+       GError* error = NULL;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       _ready_data = _user_data_;
+       invocation = _ready_data->_invocation_;
+       test_post_message_finish ((Test*) source_object, _res_, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               goto _error;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+       _error:
+       _g_free0 (_ready_data->message);
+       g_slice_free (TestPostMessageReadyData, _ready_data);
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* method_name,
+                                 GVariant* parameters,
+                                 GDBusMethodInvocation* invocation,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "ListMessages") == 0) {
+               _dbus_test_list_messages (object, parameters, invocation);
+       } else if (strcmp (method_name, "PostMessage") == 0) {
+               _dbus_test_post_message (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return NULL;
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GVariant* value,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return FALSE;
+}
+
+guint
+test_register_object (gpointer object,
+                      GDBusConnection* connection,
+                      const gchar* path,
+                      GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+static void
+run_data_free (gpointer _data)
+{
+       RunData* _data_;
+       _data_ = _data;
+       g_slice_free (RunData, _data_);
+}
+
+void
+run (GAsyncReadyCallback _callback_,
+     gpointer _user_data_)
+{
+       RunData* _data_;
+       _data_ = g_slice_new0 (RunData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, run_data_free);
+       run_co (_data_);
+}
+
+void
+run_finish (GAsyncResult* _res_)
+{
+       RunData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               _g_async_queue_unref0 (_data1_->events);
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static void
+run_ready (GObject* source_object,
+           GAsyncResult* _res_,
+           gpointer _user_data_)
+{
+       RunData* _data_;
+       _data_ = _user_data_;
+       _data_->_source_object_ = source_object;
+       _data_->_res_ = _res_;
+       run_co (_data_);
+}
+
+static void
+_g_free0_ (gpointer var)
+{
+       var = (g_free (var), NULL);
+}
+
+static gpointer
+_g_object_ref0 (gpointer self)
+{
+       return self ? g_object_ref (self) : NULL;
+}
+
+static GDBusMessage*
+__lambda4_ (Block1Data* _data1_,
+            GDBusConnection* conn,
+            GDBusMessage* message,
+            gboolean incoming)
+{
+       gboolean _tmp0_ = FALSE;
+       const gchar* _tmp1_;
+       GDBusMessage* _tmp6_;
+       GDBusMessage* result = NULL;
+       g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (conn, g_dbus_connection_get_type ()), NULL);
+       g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (message, g_dbus_message_get_type ()), NULL);
+       _tmp1_ = g_dbus_message_get_interface (message);
+       if (g_strcmp0 (_tmp1_, "org.example.Test") == 0) {
+               const gchar* _tmp2_;
+               _tmp2_ = g_dbus_message_get_member (message);
+               _tmp0_ = g_strcmp0 (_tmp2_, "ListMessages") != 0;
+       } else {
+               _tmp0_ = FALSE;
+       }
+       if (_tmp0_) {
+               switch (g_dbus_message_get_message_type (message)) {
+                       case G_DBUS_MESSAGE_TYPE_METHOD_CALL:
+                       {
+                               GAsyncQueue* _tmp3_;
+                               GFlagsValue* _tmp4_;
+                               gchar* _tmp5_;
+                               _tmp3_ = _data1_->events;
+                               _tmp4_ = g_flags_get_first_value (g_type_class_ref 
(g_dbus_message_flags_get_type ()), g_dbus_message_get_flags (message));
+                               _tmp5_ = g_strdup ((_tmp4_ != NULL) ? _tmp4_->value_name : NULL);
+                               g_async_queue_push (_tmp3_, _tmp5_);
+                               break;
+                       }
+                       default:
+                       {
+                               g_assert_not_reached ();
+                       }
+               }
+       }
+       _tmp6_ = _g_object_ref0 (message);
+       result = _tmp6_;
+       _g_object_unref0 (message);
+       return result;
+}
+
+static GDBusMessage*
+___lambda4__gd_bus_message_filter_function (GDBusConnection* connection,
+                                            GDBusMessage* message,
+                                            gboolean incoming,
+                                            gpointer self)
+{
+       GDBusMessage* result;
+       result = __lambda4_ (self, connection, message, incoming);
+       return result;
+}
+
+static gboolean
+run_co (RunData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               case 1:
+               goto _state_1;
+               case 2:
+               goto _state_2;
+               case 3:
+               goto _state_3;
+               case 4:
+               goto _state_4;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->_data1_ = g_slice_new0 (Block1Data);
+       _data_->_data1_->_ref_count_ = 1;
+       _data_->_data1_->_async_data_ = _data_;
+       _data_->_state_ = 1;
+       g_async_initable_new_async (TYPE_TEST_PROXY, 0, NULL, run_ready, _data_, "g-flags", 0, "g-name", 
"org.example.Test", "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/example/Test", 
"g-interface-name", "org.example.Test", NULL);
+       return FALSE;
+       _state_1:
+       _data_->_tmp0_ = (Test*) g_async_initable_new_finish ((GAsyncInitable *) _data_->_source_object_, 
_data_->_res_, &_data_->_inner_error0_);
+       _data_->test = (Test*) _data_->_tmp0_;
+       if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+               block1_data_unref (_data_->_data1_);
+               _data_->_data1_ = NULL;
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), 
_data_->_inner_error0_->code);
+               g_clear_error (&_data_->_inner_error0_);
+               g_object_unref (_data_->_async_result);
+               return FALSE;
+       }
+       _data_->_tmp1_ = g_async_queue_new_full (_g_free0_);
+       _data_->_data1_->events = _data_->_tmp1_;
+       _data_->_tmp2_ = _data_->test;
+       g_object_get (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp2_, g_dbus_proxy_get_type (), GDBusProxy), 
"g-connection", &_data_->_tmp3_, NULL);
+       _data_->_tmp4_ = _data_->_tmp3_;
+       _data_->connection = _data_->_tmp4_;
+       _data_->_tmp5_ = _data_->connection;
+       g_dbus_connection_add_filter (_data_->_tmp5_, ___lambda4__gd_bus_message_filter_function, 
block1_data_ref (_data_->_data1_), block1_data_unref);
+       _data_->_tmp6_ = _data_->test;
+       _data_->_tmp7_ = 0;
+       _data_->_state_ = 2;
+       test_list_messages (_data_->_tmp6_, run_ready, _data_);
+       return FALSE;
+       _state_2:
+       _data_->_tmp8_ = test_list_messages_finish (_data_->_tmp6_, _data_->_res_, &_data_->_tmp7_, 
&_data_->_inner_error0_);
+       _data_->messages = _data_->_tmp8_;
+       _data_->messages_length1 = _data_->_tmp7_;
+       _data_->_messages_size_ = _data_->messages_length1;
+       if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+               _g_object_unref0 (_data_->connection);
+               _g_object_unref0 (_data_->test);
+               block1_data_unref (_data_->_data1_);
+               _data_->_data1_ = NULL;
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), 
_data_->_inner_error0_->code);
+               g_clear_error (&_data_->_inner_error0_);
+               g_object_unref (_data_->_async_result);
+               return FALSE;
+       }
+       _data_->_tmp9_ = _data_->messages;
+       _data_->_tmp9__length1 = _data_->messages_length1;
+       _vala_assert (_data_->_tmp9__length1 == 0, "messages.length == 0");
+       _data_->_tmp10_ = _data_->test;
+       _data_->_state_ = 3;
+       test_post_message (_data_->_tmp10_, "round-trip", run_ready, _data_);
+       return FALSE;
+       _state_3:
+       test_post_message_finish (_data_->_tmp10_, _data_->_res_, &_data_->_inner_error0_);
+       if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+               _data_->messages = (_vala_array_free (_data_->messages, _data_->messages_length1, 
(GDestroyNotify) g_free), NULL);
+               _g_object_unref0 (_data_->connection);
+               _g_object_unref0 (_data_->test);
+               block1_data_unref (_data_->_data1_);
+               _data_->_data1_ = NULL;
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), 
_data_->_inner_error0_->code);
+               g_clear_error (&_data_->_inner_error0_);
+               g_object_unref (_data_->_async_result);
+               return FALSE;
+       }
+       _data_->_tmp11_ = _data_->_data1_->events;
+       _data_->_tmp12_ = g_async_queue_pop (_data_->_tmp11_);
+       _data_->_tmp13_ = (gchar*) _data_->_tmp12_;
+       _vala_assert (g_strcmp0 (_data_->_tmp13_, "G_DBUS_MESSAGE_FLAGS_NONE") == 0, "events.pop () == 
\"G_DBUS_MESSAGE_FLAGS_NONE\"");
+       _g_free0 (_data_->_tmp13_);
+       _data_->_tmp14_ = _data_->_data1_->events;
+       _data_->_tmp15_ = g_async_queue_try_pop (_data_->_tmp14_);
+       _data_->_tmp16_ = (gchar*) _data_->_tmp15_;
+       _vala_assert (_data_->_tmp16_ == NULL, "events.try_pop () == null");
+       _g_free0 (_data_->_tmp16_);
+       _data_->_tmp17_ = _data_->test;
+       test_post_message (_data_->_tmp17_, "fire-and-forget", NULL, NULL);
+       _data_->_tmp18_ = _data_->_data1_->events;
+       _data_->_tmp19_ = g_async_queue_pop (_data_->_tmp18_);
+       _data_->_tmp20_ = (gchar*) _data_->_tmp19_;
+       _vala_assert (g_strcmp0 (_data_->_tmp20_, "G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED") == 0, "events.pop 
() == \"G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED\"");
+       _g_free0 (_data_->_tmp20_);
+       _data_->_tmp21_ = _data_->_data1_->events;
+       _data_->_tmp22_ = g_async_queue_try_pop (_data_->_tmp21_);
+       _data_->_tmp23_ = (gchar*) _data_->_tmp22_;
+       _vala_assert (_data_->_tmp23_ == NULL, "events.try_pop () == null");
+       _g_free0 (_data_->_tmp23_);
+       _data_->_tmp25_ = _data_->test;
+       _data_->_tmp26_ = 0;
+       _data_->_state_ = 4;
+       test_list_messages (_data_->_tmp25_, run_ready, _data_);
+       return FALSE;
+       _state_4:
+       _data_->_tmp27_ = test_list_messages_finish (_data_->_tmp25_, _data_->_res_, &_data_->_tmp26_, 
&_data_->_inner_error0_);
+       _data_->_tmp24_ = _data_->_tmp27_;
+       _data_->_tmp24__length1 = _data_->_tmp26_;
+       _data_->__tmp24__size_ = _data_->_tmp24__length1;
+       if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+               _data_->messages = (_vala_array_free (_data_->messages, _data_->messages_length1, 
(GDestroyNotify) g_free), NULL);
+               _g_object_unref0 (_data_->connection);
+               _g_object_unref0 (_data_->test);
+               block1_data_unref (_data_->_data1_);
+               _data_->_data1_ = NULL;
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), 
_data_->_inner_error0_->code);
+               g_clear_error (&_data_->_inner_error0_);
+               g_object_unref (_data_->_async_result);
+               return FALSE;
+       }
+       _data_->_tmp28_ = _data_->_tmp24_;
+       _data_->_tmp28__length1 = _data_->_tmp24__length1;
+       _data_->_tmp24_ = NULL;
+       _data_->_tmp24__length1 = 0;
+       _data_->messages = (_vala_array_free (_data_->messages, _data_->messages_length1, (GDestroyNotify) 
g_free), NULL);
+       _data_->messages = _data_->_tmp28_;
+       _data_->messages_length1 = _data_->_tmp28__length1;
+       _data_->_messages_size_ = _data_->messages_length1;
+       _data_->_tmp29_ = _data_->messages;
+       _data_->_tmp29__length1 = _data_->messages_length1;
+       _vala_assert (_data_->_tmp29__length1 == 2, "messages.length == 2");
+       _data_->_tmp30_ = _data_->messages;
+       _data_->_tmp30__length1 = _data_->messages_length1;
+       _data_->_tmp31_ = _data_->_tmp30_[0];
+       _vala_assert (g_strcmp0 (_data_->_tmp31_, "round-trip") == 0, "messages[0] == \"round-trip\"");
+       _data_->_tmp32_ = _data_->messages;
+       _data_->_tmp32__length1 = _data_->messages_length1;
+       _data_->_tmp33_ = _data_->_tmp32_[1];
+       _vala_assert (g_strcmp0 (_data_->_tmp33_, "fire-and-forget") == 0, "messages[1] == 
\"fire-and-forget\"");
+       _data_->_tmp34_ = main_loop;
+       g_main_loop_quit (_data_->_tmp34_);
+       _data_->_tmp24_ = (_vala_array_free (_data_->_tmp24_, _data_->_tmp24__length1, (GDestroyNotify) 
g_free), NULL);
+       _data_->messages = (_vala_array_free (_data_->messages, _data_->messages_length1, (GDestroyNotify) 
g_free), NULL);
+       _g_object_unref0 (_data_->connection);
+       _g_object_unref0 (_data_->test);
+       block1_data_unref (_data_->_data1_);
+       _data_->_data1_ = NULL;
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+_vala_main (void)
+{
+       GMainLoop* _tmp0_;
+       GMainLoop* _tmp1_;
+       run (NULL, NULL);
+       _tmp0_ = g_main_loop_new (NULL, FALSE);
+       _g_main_loop_unref0 (main_loop);
+       main_loop = _tmp0_;
+       _tmp1_ = main_loop;
+       g_main_loop_run (_tmp1_);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/dbus/async-no-reply_server.c-expected b/tests/dbus/async-no-reply_server.c-expected
new file mode 100644
index 000000000..f01b56937
--- /dev/null
+++ b/tests/dbus/async-no-reply_server.c-expected
@@ -0,0 +1,765 @@
+/* dbus_async_no_reply_server.c generated by valac, the Vala compiler
+ * generated from dbus_async_no_reply_server.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TEST, TestClass))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define IS_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TEST))
+#define TEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TEST, TestClass))
+
+typedef struct _Test Test;
+typedef struct _TestClass TestClass;
+typedef struct _TestPrivate TestPrivate;
+enum  {
+       TEST_0_PROPERTY,
+       TEST_NUM_PROPERTIES
+};
+static GParamSpec* test_properties[TEST_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+typedef struct _TestListMessagesData TestListMessagesData;
+#define _g_free0(var) (var = (g_free (var), NULL))
+typedef struct _TestPostMessageData TestPostMessageData;
+typedef struct _TestListMessagesReadyData TestListMessagesReadyData;
+typedef struct _TestPostMessageReadyData TestPostMessageReadyData;
+#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Test {
+       GObject parent_instance;
+       TestPrivate * priv;
+};
+
+struct _TestClass {
+       GObjectClass parent_class;
+};
+
+struct _TestPrivate {
+       gchar** messages;
+       gint messages_length1;
+       gint _messages_size_;
+};
+
+struct _TestListMessagesData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Test* self;
+       gchar** result;
+       gint result_length1;
+       gchar** _tmp0_;
+       gint _tmp0__length1;
+       gchar** _tmp1_;
+       gint _tmp1__length1;
+       gchar** _tmp2_;
+       gint _tmp2__length1;
+};
+
+struct _TestPostMessageData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Test* self;
+       gchar* message;
+       gchar* _tmp0_;
+};
+
+struct _TestListMessagesReadyData {
+       GDBusMethodInvocation* _invocation_;
+};
+
+struct _TestPostMessageReadyData {
+       GDBusMethodInvocation* _invocation_;
+       gchar* message;
+};
+
+static gint Test_private_offset;
+static gpointer test_parent_class = NULL;
+VALA_EXTERN GMainLoop* main_loop;
+GMainLoop* main_loop = NULL;
+
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
+VALA_EXTERN guint test_register_object (void* object,
+                            GDBusConnection* connection,
+                            const gchar* path,
+                            GError** error);
+static void test_list_messages_data_free (gpointer _data);
+VALA_EXTERN void test_list_messages (Test* self,
+                         GAsyncReadyCallback _callback_,
+                         gpointer _user_data_);
+VALA_EXTERN gchar** test_list_messages_finish (Test* self,
+                                   GAsyncResult* _res_,
+                                   gint* result_length1);
+static gboolean test_list_messages_co (TestListMessagesData* _data_);
+static gchar** _vala_array_dup1 (gchar** self,
+                          gssize length);
+static void test_post_message_data_free (gpointer _data);
+VALA_EXTERN void test_post_message (Test* self,
+                        const gchar* message,
+                        GAsyncReadyCallback _callback_,
+                        gpointer _user_data_);
+VALA_EXTERN void test_post_message_finish (Test* self,
+                               GAsyncResult* _res_);
+static gboolean test_post_message_co (TestPostMessageData* _data_);
+static void _vala_array_add1 (gchar** * array,
+                       gint* length,
+                       gint* size,
+                       gchar* value);
+VALA_EXTERN Test* test_new (void);
+VALA_EXTERN Test* test_construct (GType object_type);
+static void test_finalize (GObject * obj);
+static GType test_get_type_once (void);
+static void _dbus_test_list_messages (Test* self,
+                               GVariant* _parameters_,
+                               GDBusMethodInvocation* invocation);
+static void _dbus_test_list_messages_ready (GObject * source_object,
+                                     GAsyncResult * _res_,
+                                     gpointer _user_data_);
+static void _dbus_test_post_message (Test* self,
+                              GVariant* _parameters_,
+                              GDBusMethodInvocation* invocation);
+static void _dbus_test_post_message_ready (GObject * source_object,
+                                    GAsyncResult * _res_,
+                                    gpointer _user_data_);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* method_name,
+                                      GVariant* parameters,
+                                      GDBusMethodInvocation* invocation,
+                                      gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+                                            const gchar* sender,
+                                            const gchar* object_path,
+                                            const gchar* interface_name,
+                                            const gchar* property_name,
+                                            GError** error,
+                                            gpointer user_data);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GVariant* value,
+                                           GError** error,
+                                           gpointer user_data);
+static void _test_unregister_object (gpointer user_data);
+VALA_EXTERN void client_exit (GPid pid,
+                  gint status);
+static void _vala_main (void);
+static guint _variant_get1 (GVariant* value);
+static void _client_exit_gchild_watch_func (GPid pid,
+                                     gint wait_status,
+                                     gpointer self);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static const GDBusArgInfo _test_dbus_arg_info_list_messages_result = {-1, "result", "as", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_list_messages_in[] = {NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_list_messages_out[] = 
{&_test_dbus_arg_info_list_messages_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_list_messages = {-1, "ListMessages", (GDBusArgInfo **) 
(&_test_dbus_arg_info_list_messages_in), (GDBusArgInfo **) (&_test_dbus_arg_info_list_messages_out), NULL};
+static const GDBusArgInfo _test_dbus_arg_info_post_message_message = {-1, "message", "s", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_post_message_in[] = 
{&_test_dbus_arg_info_post_message_message, NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_post_message_out[] = {NULL};
+static const GDBusMethodInfo _test_dbus_method_info_post_message = {-1, "PostMessage", (GDBusArgInfo **) 
(&_test_dbus_arg_info_post_message_in), (GDBusArgInfo **) (&_test_dbus_arg_info_post_message_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_list_messages, 
&_test_dbus_method_info_post_message, NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = {NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) 
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, 
test_dbus_interface_get_property, test_dbus_interface_set_property};
+
+static inline gpointer
+test_get_instance_private (Test* self)
+{
+       return G_STRUCT_MEMBER_P (self, Test_private_offset);
+}
+
+static void
+test_list_messages_data_free (gpointer _data)
+{
+       TestListMessagesData* _data_;
+       _data_ = _data;
+       _data_->result = (_vala_array_free (_data_->result, _data_->result_length1, (GDestroyNotify) g_free), 
NULL);
+       _g_object_unref0 (_data_->self);
+       g_slice_free (TestListMessagesData, _data_);
+}
+
+static gpointer
+_g_object_ref0 (gpointer self)
+{
+       return self ? g_object_ref (self) : NULL;
+}
+
+void
+test_list_messages (Test* self,
+                    GAsyncReadyCallback _callback_,
+                    gpointer _user_data_)
+{
+       TestListMessagesData* _data_;
+       Test* _tmp0_;
+       g_return_if_fail (IS_TEST (self));
+       _data_ = g_slice_new0 (TestListMessagesData);
+       _data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, test_list_messages_data_free);
+       _tmp0_ = _g_object_ref0 (self);
+       _data_->self = _tmp0_;
+       test_list_messages_co (_data_);
+}
+
+gchar**
+test_list_messages_finish (Test* self,
+                           GAsyncResult* _res_,
+                           gint* result_length1)
+{
+       gchar** result;
+       TestListMessagesData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+       result = _data_->result;
+       *result_length1 = _data_->result_length1;
+       _data_->result = NULL;
+       return result;
+}
+
+static gchar**
+_vala_array_dup1 (gchar** self,
+                  gssize length)
+{
+       if (length >= 0) {
+               gchar** result;
+               gssize i;
+               result = g_new0 (gchar*, length + 1);
+               for (i = 0; i < length; i++) {
+                       gchar* _tmp0_;
+                       _tmp0_ = g_strdup (self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+static gboolean
+test_list_messages_co (TestListMessagesData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->_tmp0_ = _data_->self->priv->messages;
+       _data_->_tmp0__length1 = _data_->self->priv->messages_length1;
+       _data_->_tmp1_ = (_data_->_tmp0_ != NULL) ? _vala_array_dup1 (_data_->_tmp0_, _data_->_tmp0__length1) 
: _data_->_tmp0_;
+       _data_->_tmp1__length1 = _data_->_tmp0__length1;
+       _data_->_tmp2_ = _data_->_tmp1_;
+       _data_->_tmp2__length1 = _data_->_tmp1__length1;
+       _data_->result_length1 = _data_->_tmp2__length1;
+       _data_->result = _data_->_tmp2_;
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+test_post_message_data_free (gpointer _data)
+{
+       TestPostMessageData* _data_;
+       _data_ = _data;
+       _g_free0 (_data_->message);
+       _g_object_unref0 (_data_->self);
+       g_slice_free (TestPostMessageData, _data_);
+}
+
+void
+test_post_message (Test* self,
+                   const gchar* message,
+                   GAsyncReadyCallback _callback_,
+                   gpointer _user_data_)
+{
+       TestPostMessageData* _data_;
+       Test* _tmp0_;
+       gchar* _tmp1_;
+       g_return_if_fail (IS_TEST (self));
+       g_return_if_fail (message != NULL);
+       _data_ = g_slice_new0 (TestPostMessageData);
+       _data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, test_post_message_data_free);
+       _tmp0_ = _g_object_ref0 (self);
+       _data_->self = _tmp0_;
+       _tmp1_ = g_strdup (message);
+       _g_free0 (_data_->message);
+       _data_->message = _tmp1_;
+       test_post_message_co (_data_);
+}
+
+void
+test_post_message_finish (Test* self,
+                          GAsyncResult* _res_)
+{
+       TestPostMessageData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static void
+_vala_array_add1 (gchar** * array,
+                  gint* length,
+                  gint* size,
+                  gchar* value)
+{
+       if ((*length) == (*size)) {
+               *size = (*size) ? (2 * (*size)) : 4;
+               *array = g_renew (gchar*, *array, (*size) + 1);
+       }
+       (*array)[(*length)++] = value;
+       (*array)[*length] = NULL;
+}
+
+static gboolean
+test_post_message_co (TestPostMessageData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->_tmp0_ = g_strdup (_data_->message);
+       _vala_array_add1 (&_data_->self->priv->messages, &_data_->self->priv->messages_length1, 
&_data_->self->priv->_messages_size_, _data_->_tmp0_);
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+Test*
+test_construct (GType object_type)
+{
+       Test * self = NULL;
+       self = (Test*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Test*
+test_new (void)
+{
+       return test_construct (TYPE_TEST);
+}
+
+static void
+test_class_init (TestClass * klass,
+                 gpointer klass_data)
+{
+       test_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Test_private_offset);
+       G_OBJECT_CLASS (klass)->finalize = test_finalize;
+}
+
+static void
+test_instance_init (Test * self,
+                    gpointer klass)
+{
+       gchar** _tmp0_;
+       self->priv = test_get_instance_private (self);
+       _tmp0_ = g_new0 (gchar*, 0 + 1);
+       self->priv->messages = _tmp0_;
+       self->priv->messages_length1 = 0;
+       self->priv->_messages_size_ = self->priv->messages_length1;
+}
+
+static void
+test_finalize (GObject * obj)
+{
+       Test * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_TEST, Test);
+       self->priv->messages = (_vala_array_free (self->priv->messages, self->priv->messages_length1, 
(GDestroyNotify) g_free), NULL);
+       G_OBJECT_CLASS (test_parent_class)->finalize (obj);
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Test), 
0, (GInstanceInitFunc) test_instance_init, NULL };
+       GType test_type_id;
+       test_type_id = g_type_register_static (G_TYPE_OBJECT, "Test", &g_define_type_info, 0);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_register_object);
+       Test_private_offset = g_type_add_instance_private (test_type_id, sizeof (TestPrivate));
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+static void
+_dbus_test_list_messages (Test* self,
+                          GVariant* _parameters_,
+                          GDBusMethodInvocation* invocation)
+{
+       GVariantIter _arguments_iter;
+       TestListMessagesReadyData* _ready_data;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _ready_data = g_slice_new0 (TestListMessagesReadyData);
+       _ready_data->_invocation_ = invocation;
+       test_list_messages (self, (GAsyncReadyCallback) _dbus_test_list_messages_ready, _ready_data);
+}
+
+static void
+_dbus_test_list_messages_ready (GObject * source_object,
+                                GAsyncResult * _res_,
+                                gpointer _user_data_)
+{
+       TestListMessagesReadyData* _ready_data;
+       GDBusMethodInvocation* invocation;
+       GError* error = NULL;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       gchar** result;
+       gint result_length1 = 0;
+       gchar** _tmp0_;
+       GVariantBuilder _tmp1_;
+       gint _tmp2_;
+       _ready_data = _user_data_;
+       invocation = _ready_data->_invocation_;
+       result = test_list_messages_finish ((Test*) source_object, _res_, &result_length1);
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _tmp0_ = result;
+       g_variant_builder_init (&_tmp1_, G_VARIANT_TYPE ("as"));
+       for (_tmp2_ = 0; _tmp2_ < result_length1; _tmp2_++) {
+               g_variant_builder_add_value (&_tmp1_, g_variant_new_string (*_tmp0_));
+               _tmp0_++;
+       }
+       g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp1_));
+       result = (_vala_array_free (result, result_length1, (GDestroyNotify) g_free), NULL);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+       _error:
+       g_slice_free (TestListMessagesReadyData, _ready_data);
+}
+
+static void
+_dbus_test_post_message (Test* self,
+                         GVariant* _parameters_,
+                         GDBusMethodInvocation* invocation)
+{
+       GVariantIter _arguments_iter;
+       TestPostMessageReadyData* _ready_data;
+       GVariant* _tmp3_;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _ready_data = g_slice_new0 (TestPostMessageReadyData);
+       _ready_data->_invocation_ = invocation;
+       _tmp3_ = g_variant_iter_next_value (&_arguments_iter);
+       _ready_data->message = g_variant_dup_string (_tmp3_, NULL);
+       g_variant_unref (_tmp3_);
+       test_post_message (self, _ready_data->message, (GAsyncReadyCallback) _dbus_test_post_message_ready, 
_ready_data);
+}
+
+static void
+_dbus_test_post_message_ready (GObject * source_object,
+                               GAsyncResult * _res_,
+                               gpointer _user_data_)
+{
+       TestPostMessageReadyData* _ready_data;
+       GDBusMethodInvocation* invocation;
+       GError* error = NULL;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       _ready_data = _user_data_;
+       invocation = _ready_data->_invocation_;
+       test_post_message_finish ((Test*) source_object, _res_);
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+       _error:
+       _g_free0 (_ready_data->message);
+       g_slice_free (TestPostMessageReadyData, _ready_data);
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* method_name,
+                                 GVariant* parameters,
+                                 GDBusMethodInvocation* invocation,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "ListMessages") == 0) {
+               _dbus_test_list_messages (object, parameters, invocation);
+       } else if (strcmp (method_name, "PostMessage") == 0) {
+               _dbus_test_post_message (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return NULL;
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GVariant* value,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return FALSE;
+}
+
+guint
+test_register_object (gpointer object,
+                      GDBusConnection* connection,
+                      const gchar* path,
+                      GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+void
+client_exit (GPid pid,
+             gint status)
+{
+       GMainLoop* _tmp0_;
+       _vala_assert (status == 0, "status == 0");
+       _tmp0_ = main_loop;
+       g_main_loop_quit (_tmp0_);
+}
+
+static guint
+_variant_get1 (GVariant* value)
+{
+       return g_variant_get_uint32 (value);
+}
+
+static void
+_client_exit_gchild_watch_func (GPid pid,
+                                gint wait_status,
+                                gpointer self)
+{
+       client_exit (pid, wait_status);
+}
+
+static void
+_vala_main (void)
+{
+       GDBusConnection* conn = NULL;
+       GDBusConnection* _tmp0_;
+       GDBusConnection* _tmp1_;
+       Test* _tmp2_;
+       Test* _tmp3_;
+       GVariant* request_result = NULL;
+       GDBusConnection* _tmp4_;
+       GVariant* _tmp5_;
+       GVariant* _tmp6_;
+       GVariant* _tmp7_;
+       GVariant* _tmp8_;
+       GVariant* _tmp9_;
+       GVariant* _tmp10_;
+       GVariant* _tmp11_;
+       guint _tmp12_;
+       GPid client_pid = 0;
+       gchar* _tmp13_;
+       gchar** _tmp14_;
+       gchar** _tmp15_;
+       gint _tmp15__length1;
+       GPid _tmp16_ = 0;
+       GMainLoop* _tmp17_;
+       GMainLoop* _tmp18_;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &_inner_error0_);
+       conn = _tmp0_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp1_ = conn;
+       _tmp2_ = test_new ();
+       _tmp3_ = _tmp2_;
+       test_register_object (_tmp3_, _tmp1_, "/org/example/Test", &_inner_error0_);
+       _g_object_unref0 (_tmp3_);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp4_ = conn;
+       _tmp5_ = g_variant_new ("(su)", "org.example.Test", 0x4, NULL);
+       g_variant_ref_sink (_tmp5_);
+       _tmp6_ = _tmp5_;
+       _tmp7_ = g_dbus_connection_call_sync (_tmp4_, "org.freedesktop.DBus", "/org/freedesktop/DBus", 
"org.freedesktop.DBus", "RequestName", _tmp6_, NULL, 0, -1, NULL, &_inner_error0_);
+       _tmp8_ = _tmp7_;
+       _g_variant_unref0 (_tmp6_);
+       request_result = _tmp8_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp9_ = request_result;
+       _tmp10_ = g_variant_get_child_value (_tmp9_, (gsize) 0);
+       _tmp11_ = _tmp10_;
+       _tmp12_ = _variant_get1 (_tmp11_);
+       _vala_assert (_tmp12_ == ((guint) 1), "(uint) request_result.get_child_value (0) == 1");
+       _g_variant_unref0 (_tmp11_);
+       _tmp13_ = g_strdup ("dbus_async_no_reply_client");
+       _tmp14_ = g_new0 (gchar*, 1 + 1);
+       _tmp14_[0] = _tmp13_;
+       _tmp15_ = _tmp14_;
+       _tmp15__length1 = 1;
+       g_spawn_async (NULL, _tmp15_, NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &_tmp16_, &_inner_error0_);
+       client_pid = _tmp16_;
+       _tmp15_ = (_vala_array_free (_tmp15_, _tmp15__length1, (GDestroyNotify) g_free), NULL);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_variant_unref0 (request_result);
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       g_child_watch_add_full (G_PRIORITY_DEFAULT_IDLE, client_pid, _client_exit_gchild_watch_func, NULL, 
NULL);
+       _tmp17_ = g_main_loop_new (NULL, FALSE);
+       _g_main_loop_unref0 (main_loop);
+       main_loop = _tmp17_;
+       _tmp18_ = main_loop;
+       g_main_loop_run (_tmp18_);
+       _g_variant_unref0 (request_result);
+       _g_object_unref0 (conn);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/dbus/async_client.c-expected b/tests/dbus/async_client.c-expected
new file mode 100644
index 000000000..659449fc2
--- /dev/null
+++ b/tests/dbus/async_client.c-expected
@@ -0,0 +1,947 @@
+/* dbus_async_client.c generated by valac, the Vala compiler
+ * generated from dbus_async_client.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define TEST_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_TEST, TestIface))
+
+typedef struct _Test Test;
+typedef struct _TestIface TestIface;
+
+#define TYPE_TEST_PROXY (test_proxy_get_type ())
+typedef GDBusProxy TestProxy;
+typedef GDBusProxyClass TestProxyClass;
+typedef struct _TestTestVoidReadyData TestTestVoidReadyData;
+typedef struct _TestTestIntReadyData TestTestIntReadyData;
+typedef struct _TestTestStringReadyData TestTestStringReadyData;
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+typedef struct _RunData RunData;
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _TestIface {
+       GTypeInterface parent_iface;
+       void (*test_void) (Test* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+       void (*test_void_finish) (Test* self, GAsyncResult* _res_, GError** error);
+       void (*test_int) (Test* self, gint i, GAsyncReadyCallback _callback_, gpointer _user_data_);
+       gint (*test_int_finish) (Test* self, GAsyncResult* _res_, gint* j, GError** error);
+       void (*test_string) (Test* self, const gchar* s, GAsyncReadyCallback _callback_, gpointer 
_user_data_);
+       gchar* (*test_string_finish) (Test* self, GAsyncResult* _res_, gchar* * t, GError** error);
+};
+
+struct _TestTestVoidReadyData {
+       GDBusMethodInvocation* _invocation_;
+};
+
+struct _TestTestIntReadyData {
+       GDBusMethodInvocation* _invocation_;
+       gint i;
+};
+
+struct _TestTestStringReadyData {
+       GDBusMethodInvocation* _invocation_;
+       gchar* s;
+};
+
+struct _RunData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Test* test;
+       Test* _tmp0_;
+       Test* _tmp1_;
+       gint j;
+       gint k;
+       gint _tmp2_;
+       Test* _tmp3_;
+       gint _tmp4_;
+       gint _tmp5_;
+       gchar* t;
+       gchar* u;
+       gchar* _tmp6_;
+       Test* _tmp7_;
+       gchar* _tmp8_;
+       gchar* _tmp9_;
+       gchar* _tmp10_;
+       const gchar* _tmp11_;
+       const gchar* _tmp12_;
+       GMainLoop* _tmp13_;
+       GError* _inner_error0_;
+};
+
+VALA_EXTERN GMainLoop* main_loop;
+GMainLoop* main_loop = NULL;
+
+VALA_EXTERN GType test_proxy_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN guint test_register_object (void* object,
+                            GDBusConnection* connection,
+                            const gchar* path,
+                            GError** error);
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN void test_test_void (Test* self,
+                     GAsyncReadyCallback _callback_,
+                     gpointer _user_data_);
+VALA_EXTERN void test_test_void_finish (Test* self,
+                            GAsyncResult* _res_,
+                            GError** error);
+VALA_EXTERN void test_test_int (Test* self,
+                    gint i,
+                    GAsyncReadyCallback _callback_,
+                    gpointer _user_data_);
+VALA_EXTERN gint test_test_int_finish (Test* self,
+                           GAsyncResult* _res_,
+                           gint* j,
+                           GError** error);
+VALA_EXTERN void test_test_string (Test* self,
+                       const gchar* s,
+                       GAsyncReadyCallback _callback_,
+                       gpointer _user_data_);
+VALA_EXTERN gchar* test_test_string_finish (Test* self,
+                                GAsyncResult* _res_,
+                                gchar* * t,
+                                GError** error);
+static GType test_get_type_once (void);
+static void test_proxy_g_signal (GDBusProxy* proxy,
+                          const gchar* sender_name,
+                          const gchar* signal_name,
+                          GVariant* parameters);
+static void _vala_g_async_ready_callback (GObject *source_object,
+                                   GAsyncResult *res,
+                                   void *user_data);
+static void test_proxy_test_void_async (Test* self,
+                                 GAsyncReadyCallback _callback_,
+                                 gpointer _user_data_);
+static void test_proxy_test_void_finish (Test* self,
+                                  GAsyncResult* _res_,
+                                  GError** error);
+static void test_proxy_test_int_async (Test* self,
+                                gint i,
+                                GAsyncReadyCallback _callback_,
+                                gpointer _user_data_);
+static gint test_proxy_test_int_finish (Test* self,
+                                 GAsyncResult* _res_,
+                                 gint* j,
+                                 GError** error);
+static void test_proxy_test_string_async (Test* self,
+                                   const gchar* s,
+                                   GAsyncReadyCallback _callback_,
+                                   gpointer _user_data_);
+static gchar* test_proxy_test_string_finish (Test* self,
+                                      GAsyncResult* _res_,
+                                      gchar* * t,
+                                      GError** error);
+static void test_proxy_test_interface_init (TestIface* iface);
+static void _dbus_test_test_void (Test* self,
+                           GVariant* _parameters_,
+                           GDBusMethodInvocation* invocation);
+static void _dbus_test_test_void_ready (GObject * source_object,
+                                 GAsyncResult * _res_,
+                                 gpointer _user_data_);
+static void _dbus_test_test_int (Test* self,
+                          GVariant* _parameters_,
+                          GDBusMethodInvocation* invocation);
+static void _dbus_test_test_int_ready (GObject * source_object,
+                                GAsyncResult * _res_,
+                                gpointer _user_data_);
+static void _dbus_test_test_string (Test* self,
+                             GVariant* _parameters_,
+                             GDBusMethodInvocation* invocation);
+static void _dbus_test_test_string_ready (GObject * source_object,
+                                   GAsyncResult * _res_,
+                                   gpointer _user_data_);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* method_name,
+                                      GVariant* parameters,
+                                      GDBusMethodInvocation* invocation,
+                                      gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+                                            const gchar* sender,
+                                            const gchar* object_path,
+                                            const gchar* interface_name,
+                                            const gchar* property_name,
+                                            GError** error,
+                                            gpointer user_data);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GVariant* value,
+                                           GError** error,
+                                           gpointer user_data);
+static void _test_unregister_object (gpointer user_data);
+static void run_data_free (gpointer _data);
+VALA_EXTERN void run (GAsyncReadyCallback _callback_,
+          gpointer _user_data_);
+VALA_EXTERN void run_finish (GAsyncResult* _res_);
+static gboolean run_co (RunData* _data_);
+static void run_ready (GObject* source_object,
+                GAsyncResult* _res_,
+                gpointer _user_data_);
+static void _vala_main (void);
+
+static const GDBusArgInfo * const _test_dbus_arg_info_test_void_in[] = {NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_void_out[] = {NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_void = {-1, "TestVoid", (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_void_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_void_out), NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_int_i = {-1, "i", "i", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_int_j = {-1, "j", "i", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_int_result = {-1, "result", "i", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_int_in[] = {&_test_dbus_arg_info_test_int_i, 
NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_int_out[] = {&_test_dbus_arg_info_test_int_j, 
&_test_dbus_arg_info_test_int_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_int = {-1, "TestInt", (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_int_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_int_out), NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_string_s = {-1, "s", "s", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_string_t = {-1, "t", "s", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_string_result = {-1, "result", "s", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_string_in[] = 
{&_test_dbus_arg_info_test_string_s, NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_string_out[] = 
{&_test_dbus_arg_info_test_string_t, &_test_dbus_arg_info_test_string_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_string = {-1, "TestString", (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_string_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_string_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_test_void, 
&_test_dbus_method_info_test_int, &_test_dbus_method_info_test_string, NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = {NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) 
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, 
test_dbus_interface_get_property, test_dbus_interface_set_property};
+
+void
+test_test_void (Test* self,
+                GAsyncReadyCallback _callback_,
+                gpointer _user_data_)
+{
+       TestIface* _iface_;
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->test_void) {
+               _iface_->test_void (self, _callback_, _user_data_);
+       }
+}
+
+void
+test_test_void_finish (Test* self,
+                       GAsyncResult* _res_,
+                       GError** error)
+{
+       TestIface* _iface_;
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->test_void_finish) {
+               _iface_->test_void_finish (self, _res_, error);
+       }
+}
+
+void
+test_test_int (Test* self,
+               gint i,
+               GAsyncReadyCallback _callback_,
+               gpointer _user_data_)
+{
+       TestIface* _iface_;
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->test_int) {
+               _iface_->test_int (self, i, _callback_, _user_data_);
+       }
+}
+
+gint
+test_test_int_finish (Test* self,
+                      GAsyncResult* _res_,
+                      gint* j,
+                      GError** error)
+{
+       TestIface* _iface_;
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->test_int_finish) {
+               return _iface_->test_int_finish (self, _res_, j, error);
+       }
+       return -1;
+}
+
+void
+test_test_string (Test* self,
+                  const gchar* s,
+                  GAsyncReadyCallback _callback_,
+                  gpointer _user_data_)
+{
+       TestIface* _iface_;
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->test_string) {
+               _iface_->test_string (self, s, _callback_, _user_data_);
+       }
+}
+
+gchar*
+test_test_string_finish (Test* self,
+                         GAsyncResult* _res_,
+                         gchar* * t,
+                         GError** error)
+{
+       TestIface* _iface_;
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->test_string_finish) {
+               return _iface_->test_string_finish (self, _res_, t, error);
+       }
+       return NULL;
+}
+
+static void
+test_default_init (TestIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType test_type_id;
+       test_type_id = g_type_register_static (G_TYPE_INTERFACE, "Test", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (test_type_id, G_TYPE_OBJECT);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) 
test_proxy_get_type);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), 
"org.example.Test");
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*) 
(&_test_dbus_interface_info));
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_register_object);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_TEST, 
test_proxy_test_interface_init) )
+static void
+test_proxy_class_init (TestProxyClass* klass)
+{
+       G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal;
+}
+
+static void
+test_proxy_g_signal (GDBusProxy* proxy,
+                     const gchar* sender_name,
+                     const gchar* signal_name,
+                     GVariant* parameters)
+{
+}
+
+static void
+test_proxy_init (TestProxy* self)
+{
+       g_dbus_proxy_set_interface_info (G_DBUS_PROXY (self), (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info));
+}
+
+static void
+_vala_g_async_ready_callback (GObject *source_object,
+                              GAsyncResult *res,
+                              void *user_data)
+{
+       g_task_return_pointer (user_data, g_object_ref (res), g_object_unref);
+       g_object_unref (user_data);
+}
+
+static void
+test_proxy_test_void_async (Test* self,
+                            GAsyncReadyCallback _callback_,
+                            gpointer _user_data_)
+{
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       G_IO_ERROR;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "TestVoid");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       if (_callback_ != NULL) {
+               g_dbus_connection_send_message_with_reply (g_dbus_proxy_get_connection ((GDBusProxy *) self), 
_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout ((GDBusProxy *) self), NULL, NULL, 
_vala_g_async_ready_callback, g_task_new ((GObject *) self, NULL, _callback_, _user_data_));
+       } else {
+               g_dbus_message_set_flags (_message, G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED);
+               g_dbus_connection_send_message (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       }
+       g_object_unref (_message);
+}
+
+static void
+test_proxy_test_void_finish (Test* self,
+                             GAsyncResult* _res_,
+                             GError** error)
+{
+       GAsyncResult *_inner_res;
+       GDBusMessage *_reply_message;
+       _inner_res = g_task_propagate_pointer ((GTask *) _res_, NULL);
+       _reply_message = g_dbus_connection_send_message_with_reply_finish (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _inner_res, error);
+       g_object_unref (_inner_res);
+       if (!_reply_message) {
+               return;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, error)) {
+               g_object_unref (_reply_message);
+               return;
+       }
+       g_object_unref (_reply_message);
+}
+
+static void
+test_proxy_test_int_async (Test* self,
+                           gint i,
+                           GAsyncReadyCallback _callback_,
+                           gpointer _user_data_)
+{
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       G_IO_ERROR;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "TestInt");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_arguments_builder, g_variant_new_int32 (i));
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       if (_callback_ != NULL) {
+               g_dbus_connection_send_message_with_reply (g_dbus_proxy_get_connection ((GDBusProxy *) self), 
_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout ((GDBusProxy *) self), NULL, NULL, 
_vala_g_async_ready_callback, g_task_new ((GObject *) self, NULL, _callback_, _user_data_));
+       } else {
+               g_dbus_message_set_flags (_message, G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED);
+               g_dbus_connection_send_message (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       }
+       g_object_unref (_message);
+}
+
+static gint
+test_proxy_test_int_finish (Test* self,
+                            GAsyncResult* _res_,
+                            gint* j,
+                            GError** error)
+{
+       GAsyncResult *_inner_res;
+       GDBusMessage *_reply_message;
+       GVariant *_reply;
+       GVariantIter _reply_iter;
+       gint _vala_j = 0;
+       GVariant* _tmp2_;
+       gint _result = 0;
+       GVariant* _tmp3_;
+       _inner_res = g_task_propagate_pointer ((GTask *) _res_, NULL);
+       _reply_message = g_dbus_connection_send_message_with_reply_finish (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _inner_res, error);
+       g_object_unref (_inner_res);
+       if (!_reply_message) {
+               gint _tmp0_ = 0;
+               return _tmp0_;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, error)) {
+               gint _tmp1_ = 0;
+               g_object_unref (_reply_message);
+               return _tmp1_;
+       }
+       _reply = g_dbus_message_get_body (_reply_message);
+       g_variant_iter_init (&_reply_iter, _reply);
+       _tmp2_ = g_variant_iter_next_value (&_reply_iter);
+       _vala_j = g_variant_get_int32 (_tmp2_);
+       g_variant_unref (_tmp2_);
+       *j = _vala_j;
+       _tmp3_ = g_variant_iter_next_value (&_reply_iter);
+       _result = g_variant_get_int32 (_tmp3_);
+       g_variant_unref (_tmp3_);
+       g_object_unref (_reply_message);
+       return _result;
+}
+
+static void
+test_proxy_test_string_async (Test* self,
+                              const gchar* s,
+                              GAsyncReadyCallback _callback_,
+                              gpointer _user_data_)
+{
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       G_IO_ERROR;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "TestString");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (s));
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       if (_callback_ != NULL) {
+               g_dbus_connection_send_message_with_reply (g_dbus_proxy_get_connection ((GDBusProxy *) self), 
_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout ((GDBusProxy *) self), NULL, NULL, 
_vala_g_async_ready_callback, g_task_new ((GObject *) self, NULL, _callback_, _user_data_));
+       } else {
+               g_dbus_message_set_flags (_message, G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED);
+               g_dbus_connection_send_message (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       }
+       g_object_unref (_message);
+}
+
+static gchar*
+test_proxy_test_string_finish (Test* self,
+                               GAsyncResult* _res_,
+                               gchar* * t,
+                               GError** error)
+{
+       GAsyncResult *_inner_res;
+       GDBusMessage *_reply_message;
+       GVariant *_reply;
+       GVariantIter _reply_iter;
+       gchar* _vala_t = NULL;
+       GVariant* _tmp4_;
+       gchar* _result = NULL;
+       GVariant* _tmp5_;
+       _inner_res = g_task_propagate_pointer ((GTask *) _res_, NULL);
+       _reply_message = g_dbus_connection_send_message_with_reply_finish (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _inner_res, error);
+       g_object_unref (_inner_res);
+       if (!_reply_message) {
+               return NULL;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, error)) {
+               g_object_unref (_reply_message);
+               return NULL;
+       }
+       _reply = g_dbus_message_get_body (_reply_message);
+       g_variant_iter_init (&_reply_iter, _reply);
+       _tmp4_ = g_variant_iter_next_value (&_reply_iter);
+       _vala_t = g_variant_dup_string (_tmp4_, NULL);
+       g_variant_unref (_tmp4_);
+       *t = _vala_t;
+       _tmp5_ = g_variant_iter_next_value (&_reply_iter);
+       _result = g_variant_dup_string (_tmp5_, NULL);
+       g_variant_unref (_tmp5_);
+       g_object_unref (_reply_message);
+       return _result;
+}
+
+static void
+test_proxy_test_interface_init (TestIface* iface)
+{
+       iface->test_void = test_proxy_test_void_async;
+       iface->test_void_finish = test_proxy_test_void_finish;
+       iface->test_int = test_proxy_test_int_async;
+       iface->test_int_finish = test_proxy_test_int_finish;
+       iface->test_string = test_proxy_test_string_async;
+       iface->test_string_finish = test_proxy_test_string_finish;
+}
+
+static void
+_dbus_test_test_void (Test* self,
+                      GVariant* _parameters_,
+                      GDBusMethodInvocation* invocation)
+{
+       GVariantIter _arguments_iter;
+       TestTestVoidReadyData* _ready_data;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _ready_data = g_slice_new0 (TestTestVoidReadyData);
+       _ready_data->_invocation_ = invocation;
+       test_test_void (self, (GAsyncReadyCallback) _dbus_test_test_void_ready, _ready_data);
+}
+
+static void
+_dbus_test_test_void_ready (GObject * source_object,
+                            GAsyncResult * _res_,
+                            gpointer _user_data_)
+{
+       TestTestVoidReadyData* _ready_data;
+       GDBusMethodInvocation* invocation;
+       GError* error = NULL;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       _ready_data = _user_data_;
+       invocation = _ready_data->_invocation_;
+       test_test_void_finish ((Test*) source_object, _res_, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               goto _error;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+       _error:
+       g_slice_free (TestTestVoidReadyData, _ready_data);
+}
+
+static void
+_dbus_test_test_int (Test* self,
+                     GVariant* _parameters_,
+                     GDBusMethodInvocation* invocation)
+{
+       GVariantIter _arguments_iter;
+       TestTestIntReadyData* _ready_data;
+       GVariant* _tmp6_;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _ready_data = g_slice_new0 (TestTestIntReadyData);
+       _ready_data->_invocation_ = invocation;
+       _tmp6_ = g_variant_iter_next_value (&_arguments_iter);
+       _ready_data->i = g_variant_get_int32 (_tmp6_);
+       g_variant_unref (_tmp6_);
+       test_test_int (self, _ready_data->i, (GAsyncReadyCallback) _dbus_test_test_int_ready, _ready_data);
+}
+
+static void
+_dbus_test_test_int_ready (GObject * source_object,
+                           GAsyncResult * _res_,
+                           gpointer _user_data_)
+{
+       TestTestIntReadyData* _ready_data;
+       GDBusMethodInvocation* invocation;
+       GError* error = NULL;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       gint j = 0;
+       gint result;
+       _ready_data = _user_data_;
+       invocation = _ready_data->_invocation_;
+       result = test_test_int_finish ((Test*) source_object, _res_, &j, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               goto _error;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_int32 (j));
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_int32 (result));
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+       _error:
+       g_slice_free (TestTestIntReadyData, _ready_data);
+}
+
+static void
+_dbus_test_test_string (Test* self,
+                        GVariant* _parameters_,
+                        GDBusMethodInvocation* invocation)
+{
+       GVariantIter _arguments_iter;
+       TestTestStringReadyData* _ready_data;
+       GVariant* _tmp7_;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _ready_data = g_slice_new0 (TestTestStringReadyData);
+       _ready_data->_invocation_ = invocation;
+       _tmp7_ = g_variant_iter_next_value (&_arguments_iter);
+       _ready_data->s = g_variant_dup_string (_tmp7_, NULL);
+       g_variant_unref (_tmp7_);
+       test_test_string (self, _ready_data->s, (GAsyncReadyCallback) _dbus_test_test_string_ready, 
_ready_data);
+       _error:
+       ;
+}
+
+static void
+_dbus_test_test_string_ready (GObject * source_object,
+                              GAsyncResult * _res_,
+                              gpointer _user_data_)
+{
+       TestTestStringReadyData* _ready_data;
+       GDBusMethodInvocation* invocation;
+       GError* error = NULL;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       gchar* t = NULL;
+       gchar* result;
+       _ready_data = _user_data_;
+       invocation = _ready_data->_invocation_;
+       result = test_test_string_finish ((Test*) source_object, _res_, &t, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               goto _error;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_string (t));
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_string (result));
+       _g_free0 (result);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+       _error:
+       _g_free0 (_ready_data->s);
+       _g_free0 (t);
+       g_slice_free (TestTestStringReadyData, _ready_data);
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* method_name,
+                                 GVariant* parameters,
+                                 GDBusMethodInvocation* invocation,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "TestVoid") == 0) {
+               _dbus_test_test_void (object, parameters, invocation);
+       } else if (strcmp (method_name, "TestInt") == 0) {
+               _dbus_test_test_int (object, parameters, invocation);
+       } else if (strcmp (method_name, "TestString") == 0) {
+               _dbus_test_test_string (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return NULL;
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GVariant* value,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return FALSE;
+}
+
+guint
+test_register_object (gpointer object,
+                      GDBusConnection* connection,
+                      const gchar* path,
+                      GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+static void
+run_data_free (gpointer _data)
+{
+       RunData* _data_;
+       _data_ = _data;
+       g_slice_free (RunData, _data_);
+}
+
+void
+run (GAsyncReadyCallback _callback_,
+     gpointer _user_data_)
+{
+       RunData* _data_;
+       _data_ = g_slice_new0 (RunData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, run_data_free);
+       run_co (_data_);
+}
+
+void
+run_finish (GAsyncResult* _res_)
+{
+       RunData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static void
+run_ready (GObject* source_object,
+           GAsyncResult* _res_,
+           gpointer _user_data_)
+{
+       RunData* _data_;
+       _data_ = _user_data_;
+       _data_->_source_object_ = source_object;
+       _data_->_res_ = _res_;
+       run_co (_data_);
+}
+
+static gboolean
+run_co (RunData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               case 1:
+               goto _state_1;
+               case 2:
+               goto _state_2;
+               case 3:
+               goto _state_3;
+               case 4:
+               goto _state_4;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->_state_ = 1;
+       g_async_initable_new_async (TYPE_TEST_PROXY, 0, NULL, run_ready, _data_, "g-flags", 0, "g-name", 
"org.example.Test", "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/example/test", 
"g-interface-name", "org.example.Test", NULL);
+       return FALSE;
+       _state_1:
+       _data_->_tmp0_ = (Test*) g_async_initable_new_finish ((GAsyncInitable *) _data_->_source_object_, 
_data_->_res_, &_data_->_inner_error0_);
+       _data_->test = (Test*) _data_->_tmp0_;
+       if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), 
_data_->_inner_error0_->code);
+               g_clear_error (&_data_->_inner_error0_);
+               g_object_unref (_data_->_async_result);
+               return FALSE;
+       }
+       _data_->_tmp1_ = _data_->test;
+       _data_->_state_ = 2;
+       test_test_void (_data_->_tmp1_, run_ready, _data_);
+       return FALSE;
+       _state_2:
+       test_test_void_finish (_data_->_tmp1_, _data_->_res_, &_data_->_inner_error0_);
+       if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+               _g_object_unref0 (_data_->test);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), 
_data_->_inner_error0_->code);
+               g_clear_error (&_data_->_inner_error0_);
+               g_object_unref (_data_->_async_result);
+               return FALSE;
+       }
+       _data_->_tmp3_ = _data_->test;
+       _data_->_tmp4_ = 0;
+       _data_->_state_ = 3;
+       test_test_int (_data_->_tmp3_, 42, run_ready, _data_);
+       return FALSE;
+       _state_3:
+       _data_->_tmp5_ = test_test_int_finish (_data_->_tmp3_, _data_->_res_, &_data_->_tmp4_, 
&_data_->_inner_error0_);
+       _data_->j = _data_->_tmp4_;
+       _data_->_tmp2_ = _data_->_tmp5_;
+       if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+               _g_object_unref0 (_data_->test);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), 
_data_->_inner_error0_->code);
+               g_clear_error (&_data_->_inner_error0_);
+               g_object_unref (_data_->_async_result);
+               return FALSE;
+       }
+       _data_->k = _data_->_tmp2_;
+       _vala_assert (_data_->j == 23, "j == 23");
+       _vala_assert (_data_->k == 11, "k == 11");
+       _data_->_tmp7_ = _data_->test;
+       _data_->_tmp8_ = NULL;
+       _data_->_state_ = 4;
+       test_test_string (_data_->_tmp7_, "hello", run_ready, _data_);
+       return FALSE;
+       _state_4:
+       _data_->_tmp9_ = test_test_string_finish (_data_->_tmp7_, _data_->_res_, &_data_->_tmp8_, 
&_data_->_inner_error0_);
+       _g_free0 (_data_->t);
+       _data_->t = _data_->_tmp8_;
+       _data_->_tmp6_ = _data_->_tmp9_;
+       if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+               _g_free0 (_data_->u);
+               _g_free0 (_data_->t);
+               _g_object_unref0 (_data_->test);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), 
_data_->_inner_error0_->code);
+               g_clear_error (&_data_->_inner_error0_);
+               g_object_unref (_data_->_async_result);
+               return FALSE;
+       }
+       _data_->_tmp10_ = _data_->_tmp6_;
+       _data_->_tmp6_ = NULL;
+       _g_free0 (_data_->u);
+       _data_->u = _data_->_tmp10_;
+       _data_->_tmp11_ = _data_->t;
+       _vala_assert (g_strcmp0 (_data_->_tmp11_, "world") == 0, "t == \"world\"");
+       _data_->_tmp12_ = _data_->u;
+       _vala_assert (g_strcmp0 (_data_->_tmp12_, "vala") == 0, "u == \"vala\"");
+       _data_->_tmp13_ = main_loop;
+       g_main_loop_quit (_data_->_tmp13_);
+       _g_free0 (_data_->_tmp6_);
+       _g_free0 (_data_->u);
+       _g_free0 (_data_->t);
+       _g_object_unref0 (_data_->test);
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+_vala_main (void)
+{
+       GMainLoop* _tmp0_;
+       GMainLoop* _tmp1_;
+       run (NULL, NULL);
+       _tmp0_ = g_main_loop_new (NULL, FALSE);
+       _g_main_loop_unref0 (main_loop);
+       main_loop = _tmp0_;
+       _tmp1_ = main_loop;
+       g_main_loop_run (_tmp1_);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/dbus/async_server.c-expected b/tests/dbus/async_server.c-expected
new file mode 100644
index 000000000..dae62a88f
--- /dev/null
+++ b/tests/dbus/async_server.c-expected
@@ -0,0 +1,885 @@
+/* dbus_async_server.c generated by valac, the Vala compiler
+ * generated from dbus_async_server.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TEST, TestClass))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define IS_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TEST))
+#define TEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TEST, TestClass))
+
+typedef struct _Test Test;
+typedef struct _TestClass TestClass;
+typedef struct _TestPrivate TestPrivate;
+enum  {
+       TEST_0_PROPERTY,
+       TEST_NUM_PROPERTIES
+};
+static GParamSpec* test_properties[TEST_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+typedef struct _TestTestVoidData TestTestVoidData;
+typedef struct _TestTestIntData TestTestIntData;
+#define _g_free0(var) (var = (g_free (var), NULL))
+typedef struct _TestTestStringData TestTestStringData;
+typedef struct _TestTestVoidReadyData TestTestVoidReadyData;
+typedef struct _TestTestIntReadyData TestTestIntReadyData;
+typedef struct _TestTestStringReadyData TestTestStringReadyData;
+#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Test {
+       GObject parent_instance;
+       TestPrivate * priv;
+};
+
+struct _TestClass {
+       GObjectClass parent_class;
+};
+
+struct _TestTestVoidData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Test* self;
+};
+
+struct _TestTestIntData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Test* self;
+       gint i;
+       gint j;
+       gint result;
+};
+
+struct _TestTestStringData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Test* self;
+       gchar* s;
+       gchar* t;
+       gchar* result;
+       gchar* _tmp0_;
+       gchar* _tmp1_;
+};
+
+struct _TestTestVoidReadyData {
+       GDBusMethodInvocation* _invocation_;
+};
+
+struct _TestTestIntReadyData {
+       GDBusMethodInvocation* _invocation_;
+       gint i;
+};
+
+struct _TestTestStringReadyData {
+       GDBusMethodInvocation* _invocation_;
+       gchar* s;
+};
+
+static gpointer test_parent_class = NULL;
+VALA_EXTERN GMainLoop* main_loop;
+GMainLoop* main_loop = NULL;
+
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
+VALA_EXTERN guint test_register_object (void* object,
+                            GDBusConnection* connection,
+                            const gchar* path,
+                            GError** error);
+static void test_test_void_data_free (gpointer _data);
+VALA_EXTERN void test_test_void (Test* self,
+                     GAsyncReadyCallback _callback_,
+                     gpointer _user_data_);
+VALA_EXTERN void test_test_void_finish (Test* self,
+                            GAsyncResult* _res_);
+static gboolean test_test_void_co (TestTestVoidData* _data_);
+static gboolean _test_test_void_co_gsource_func (gpointer self);
+static void test_test_int_data_free (gpointer _data);
+VALA_EXTERN void test_test_int (Test* self,
+                    gint i,
+                    GAsyncReadyCallback _callback_,
+                    gpointer _user_data_);
+VALA_EXTERN gint test_test_int_finish (Test* self,
+                           GAsyncResult* _res_,
+                           gint* j);
+static gboolean test_test_int_co (TestTestIntData* _data_);
+static gboolean _test_test_int_co_gsource_func (gpointer self);
+static void test_test_string_data_free (gpointer _data);
+VALA_EXTERN void test_test_string (Test* self,
+                       const gchar* s,
+                       GAsyncReadyCallback _callback_,
+                       gpointer _user_data_);
+VALA_EXTERN gchar* test_test_string_finish (Test* self,
+                                GAsyncResult* _res_,
+                                gchar* * t);
+static gboolean test_test_string_co (TestTestStringData* _data_);
+static gboolean _test_test_string_co_gsource_func (gpointer self);
+VALA_EXTERN Test* test_new (void);
+VALA_EXTERN Test* test_construct (GType object_type);
+static GType test_get_type_once (void);
+static void _dbus_test_test_void (Test* self,
+                           GVariant* _parameters_,
+                           GDBusMethodInvocation* invocation);
+static void _dbus_test_test_void_ready (GObject * source_object,
+                                 GAsyncResult * _res_,
+                                 gpointer _user_data_);
+static void _dbus_test_test_int (Test* self,
+                          GVariant* _parameters_,
+                          GDBusMethodInvocation* invocation);
+static void _dbus_test_test_int_ready (GObject * source_object,
+                                GAsyncResult * _res_,
+                                gpointer _user_data_);
+static void _dbus_test_test_string (Test* self,
+                             GVariant* _parameters_,
+                             GDBusMethodInvocation* invocation);
+static void _dbus_test_test_string_ready (GObject * source_object,
+                                   GAsyncResult * _res_,
+                                   gpointer _user_data_);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* method_name,
+                                      GVariant* parameters,
+                                      GDBusMethodInvocation* invocation,
+                                      gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+                                            const gchar* sender,
+                                            const gchar* object_path,
+                                            const gchar* interface_name,
+                                            const gchar* property_name,
+                                            GError** error,
+                                            gpointer user_data);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GVariant* value,
+                                           GError** error,
+                                           gpointer user_data);
+static void _test_unregister_object (gpointer user_data);
+VALA_EXTERN void client_exit (GPid pid,
+                  gint status);
+static void _vala_main (void);
+static guint _variant_get1 (GVariant* value);
+static void _client_exit_gchild_watch_func (GPid pid,
+                                     gint wait_status,
+                                     gpointer self);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static const GDBusArgInfo * const _test_dbus_arg_info_test_void_in[] = {NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_void_out[] = {NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_void = {-1, "TestVoid", (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_void_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_void_out), NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_int_i = {-1, "i", "i", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_int_j = {-1, "j", "i", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_int_result = {-1, "result", "i", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_int_in[] = {&_test_dbus_arg_info_test_int_i, 
NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_int_out[] = {&_test_dbus_arg_info_test_int_j, 
&_test_dbus_arg_info_test_int_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_int = {-1, "TestInt", (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_int_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_int_out), NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_string_s = {-1, "s", "s", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_string_t = {-1, "t", "s", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_string_result = {-1, "result", "s", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_string_in[] = 
{&_test_dbus_arg_info_test_string_s, NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_string_out[] = 
{&_test_dbus_arg_info_test_string_t, &_test_dbus_arg_info_test_string_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_string = {-1, "TestString", (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_string_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_string_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_test_void, 
&_test_dbus_method_info_test_int, &_test_dbus_method_info_test_string, NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = {NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) 
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, 
test_dbus_interface_get_property, test_dbus_interface_set_property};
+
+static void
+test_test_void_data_free (gpointer _data)
+{
+       TestTestVoidData* _data_;
+       _data_ = _data;
+       _g_object_unref0 (_data_->self);
+       g_slice_free (TestTestVoidData, _data_);
+}
+
+static gpointer
+_g_object_ref0 (gpointer self)
+{
+       return self ? g_object_ref (self) : NULL;
+}
+
+void
+test_test_void (Test* self,
+                GAsyncReadyCallback _callback_,
+                gpointer _user_data_)
+{
+       TestTestVoidData* _data_;
+       Test* _tmp0_;
+       g_return_if_fail (IS_TEST (self));
+       _data_ = g_slice_new0 (TestTestVoidData);
+       _data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, test_test_void_data_free);
+       _tmp0_ = _g_object_ref0 (self);
+       _data_->self = _tmp0_;
+       test_test_void_co (_data_);
+}
+
+void
+test_test_void_finish (Test* self,
+                       GAsyncResult* _res_)
+{
+       TestTestVoidData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static gboolean
+_test_test_void_co_gsource_func (gpointer self)
+{
+       gboolean result;
+       result = test_test_void_co (self);
+       return result;
+}
+
+static gboolean
+test_test_void_co (TestTestVoidData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               case 1:
+               goto _state_1;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _test_test_void_co_gsource_func, _data_, NULL);
+       _data_->_state_ = 1;
+       return FALSE;
+       _state_1:
+       ;
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+test_test_int_data_free (gpointer _data)
+{
+       TestTestIntData* _data_;
+       _data_ = _data;
+       _g_object_unref0 (_data_->self);
+       g_slice_free (TestTestIntData, _data_);
+}
+
+void
+test_test_int (Test* self,
+               gint i,
+               GAsyncReadyCallback _callback_,
+               gpointer _user_data_)
+{
+       TestTestIntData* _data_;
+       Test* _tmp0_;
+       g_return_if_fail (IS_TEST (self));
+       _data_ = g_slice_new0 (TestTestIntData);
+       _data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, test_test_int_data_free);
+       _tmp0_ = _g_object_ref0 (self);
+       _data_->self = _tmp0_;
+       _data_->i = i;
+       test_test_int_co (_data_);
+}
+
+gint
+test_test_int_finish (Test* self,
+                      GAsyncResult* _res_,
+                      gint* j)
+{
+       gint result;
+       TestTestIntData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+       if (j) {
+               *j = _data_->j;
+       }
+       result = _data_->result;
+       return result;
+}
+
+static gboolean
+_test_test_int_co_gsource_func (gpointer self)
+{
+       gboolean result;
+       result = test_test_int_co (self);
+       return result;
+}
+
+static gboolean
+test_test_int_co (TestTestIntData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               case 1:
+               goto _state_1;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _vala_assert (_data_->i == 42, "i == 42");
+       g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _test_test_int_co_gsource_func, _data_, NULL);
+       _data_->_state_ = 1;
+       return FALSE;
+       _state_1:
+       ;
+       _data_->j = 23;
+       _data_->result = 11;
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+test_test_string_data_free (gpointer _data)
+{
+       TestTestStringData* _data_;
+       _data_ = _data;
+       _g_free0 (_data_->s);
+       _g_free0 (_data_->result);
+       _g_object_unref0 (_data_->self);
+       g_slice_free (TestTestStringData, _data_);
+}
+
+void
+test_test_string (Test* self,
+                  const gchar* s,
+                  GAsyncReadyCallback _callback_,
+                  gpointer _user_data_)
+{
+       TestTestStringData* _data_;
+       Test* _tmp0_;
+       gchar* _tmp1_;
+       g_return_if_fail (IS_TEST (self));
+       g_return_if_fail (s != NULL);
+       _data_ = g_slice_new0 (TestTestStringData);
+       _data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, test_test_string_data_free);
+       _tmp0_ = _g_object_ref0 (self);
+       _data_->self = _tmp0_;
+       _tmp1_ = g_strdup (s);
+       _g_free0 (_data_->s);
+       _data_->s = _tmp1_;
+       test_test_string_co (_data_);
+}
+
+gchar*
+test_test_string_finish (Test* self,
+                         GAsyncResult* _res_,
+                         gchar* * t)
+{
+       gchar* result;
+       TestTestStringData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+       if (t) {
+               *t = _data_->t;
+       } else {
+               _g_free0 (_data_->t);
+       }
+       _data_->t = NULL;
+       result = _data_->result;
+       _data_->result = NULL;
+       return result;
+}
+
+static gboolean
+_test_test_string_co_gsource_func (gpointer self)
+{
+       gboolean result;
+       result = test_test_string_co (self);
+       return result;
+}
+
+static gboolean
+test_test_string_co (TestTestStringData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               case 1:
+               goto _state_1;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _vala_assert (g_strcmp0 (_data_->s, "hello") == 0, "s == \"hello\"");
+       g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _test_test_string_co_gsource_func, _data_, NULL);
+       _data_->_state_ = 1;
+       return FALSE;
+       _state_1:
+       ;
+       _data_->_tmp0_ = g_strdup ("world");
+       _g_free0 (_data_->t);
+       _data_->t = _data_->_tmp0_;
+       _data_->_tmp1_ = g_strdup ("vala");
+       _data_->result = _data_->_tmp1_;
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+Test*
+test_construct (GType object_type)
+{
+       Test * self = NULL;
+       self = (Test*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Test*
+test_new (void)
+{
+       return test_construct (TYPE_TEST);
+}
+
+static void
+test_class_init (TestClass * klass,
+                 gpointer klass_data)
+{
+       test_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+test_instance_init (Test * self,
+                    gpointer klass)
+{
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Test), 
0, (GInstanceInitFunc) test_instance_init, NULL };
+       GType test_type_id;
+       test_type_id = g_type_register_static (G_TYPE_OBJECT, "Test", &g_define_type_info, 0);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_register_object);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+static void
+_dbus_test_test_void (Test* self,
+                      GVariant* _parameters_,
+                      GDBusMethodInvocation* invocation)
+{
+       GVariantIter _arguments_iter;
+       TestTestVoidReadyData* _ready_data;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _ready_data = g_slice_new0 (TestTestVoidReadyData);
+       _ready_data->_invocation_ = invocation;
+       test_test_void (self, (GAsyncReadyCallback) _dbus_test_test_void_ready, _ready_data);
+}
+
+static void
+_dbus_test_test_void_ready (GObject * source_object,
+                            GAsyncResult * _res_,
+                            gpointer _user_data_)
+{
+       TestTestVoidReadyData* _ready_data;
+       GDBusMethodInvocation* invocation;
+       GError* error = NULL;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       _ready_data = _user_data_;
+       invocation = _ready_data->_invocation_;
+       test_test_void_finish ((Test*) source_object, _res_);
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+       _error:
+       g_slice_free (TestTestVoidReadyData, _ready_data);
+}
+
+static void
+_dbus_test_test_int (Test* self,
+                     GVariant* _parameters_,
+                     GDBusMethodInvocation* invocation)
+{
+       GVariantIter _arguments_iter;
+       TestTestIntReadyData* _ready_data;
+       GVariant* _tmp0_;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _ready_data = g_slice_new0 (TestTestIntReadyData);
+       _ready_data->_invocation_ = invocation;
+       _tmp0_ = g_variant_iter_next_value (&_arguments_iter);
+       _ready_data->i = g_variant_get_int32 (_tmp0_);
+       g_variant_unref (_tmp0_);
+       test_test_int (self, _ready_data->i, (GAsyncReadyCallback) _dbus_test_test_int_ready, _ready_data);
+}
+
+static void
+_dbus_test_test_int_ready (GObject * source_object,
+                           GAsyncResult * _res_,
+                           gpointer _user_data_)
+{
+       TestTestIntReadyData* _ready_data;
+       GDBusMethodInvocation* invocation;
+       GError* error = NULL;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       gint j = 0;
+       gint result;
+       _ready_data = _user_data_;
+       invocation = _ready_data->_invocation_;
+       result = test_test_int_finish ((Test*) source_object, _res_, &j);
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_int32 (j));
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_int32 (result));
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+       _error:
+       g_slice_free (TestTestIntReadyData, _ready_data);
+}
+
+static void
+_dbus_test_test_string (Test* self,
+                        GVariant* _parameters_,
+                        GDBusMethodInvocation* invocation)
+{
+       GVariantIter _arguments_iter;
+       TestTestStringReadyData* _ready_data;
+       GVariant* _tmp1_;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _ready_data = g_slice_new0 (TestTestStringReadyData);
+       _ready_data->_invocation_ = invocation;
+       _tmp1_ = g_variant_iter_next_value (&_arguments_iter);
+       _ready_data->s = g_variant_dup_string (_tmp1_, NULL);
+       g_variant_unref (_tmp1_);
+       test_test_string (self, _ready_data->s, (GAsyncReadyCallback) _dbus_test_test_string_ready, 
_ready_data);
+}
+
+static void
+_dbus_test_test_string_ready (GObject * source_object,
+                              GAsyncResult * _res_,
+                              gpointer _user_data_)
+{
+       TestTestStringReadyData* _ready_data;
+       GDBusMethodInvocation* invocation;
+       GError* error = NULL;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       gchar* t = NULL;
+       gchar* result;
+       _ready_data = _user_data_;
+       invocation = _ready_data->_invocation_;
+       result = test_test_string_finish ((Test*) source_object, _res_, &t);
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_string (t));
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_string (result));
+       _g_free0 (result);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+       _error:
+       _g_free0 (_ready_data->s);
+       _g_free0 (t);
+       g_slice_free (TestTestStringReadyData, _ready_data);
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* method_name,
+                                 GVariant* parameters,
+                                 GDBusMethodInvocation* invocation,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "TestVoid") == 0) {
+               _dbus_test_test_void (object, parameters, invocation);
+       } else if (strcmp (method_name, "TestInt") == 0) {
+               _dbus_test_test_int (object, parameters, invocation);
+       } else if (strcmp (method_name, "TestString") == 0) {
+               _dbus_test_test_string (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return NULL;
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GVariant* value,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return FALSE;
+}
+
+guint
+test_register_object (gpointer object,
+                      GDBusConnection* connection,
+                      const gchar* path,
+                      GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+void
+client_exit (GPid pid,
+             gint status)
+{
+       GMainLoop* _tmp0_;
+       _vala_assert (status == 0, "status == 0");
+       _tmp0_ = main_loop;
+       g_main_loop_quit (_tmp0_);
+}
+
+static guint
+_variant_get1 (GVariant* value)
+{
+       return g_variant_get_uint32 (value);
+}
+
+static void
+_client_exit_gchild_watch_func (GPid pid,
+                                gint wait_status,
+                                gpointer self)
+{
+       client_exit (pid, wait_status);
+}
+
+static void
+_vala_main (void)
+{
+       GDBusConnection* conn = NULL;
+       GDBusConnection* _tmp0_;
+       GDBusConnection* _tmp1_;
+       Test* _tmp2_;
+       Test* _tmp3_;
+       GVariant* request_result = NULL;
+       GDBusConnection* _tmp4_;
+       GVariant* _tmp5_;
+       GVariant* _tmp6_;
+       GVariant* _tmp7_;
+       GVariant* _tmp8_;
+       GVariant* _tmp9_;
+       GVariant* _tmp10_;
+       GVariant* _tmp11_;
+       guint _tmp12_;
+       GPid client_pid = 0;
+       gchar* _tmp13_;
+       gchar** _tmp14_;
+       gchar** _tmp15_;
+       gint _tmp15__length1;
+       GPid _tmp16_ = 0;
+       GMainLoop* _tmp17_;
+       GMainLoop* _tmp18_;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &_inner_error0_);
+       conn = _tmp0_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp1_ = conn;
+       _tmp2_ = test_new ();
+       _tmp3_ = _tmp2_;
+       test_register_object (_tmp3_, _tmp1_, "/org/example/test", &_inner_error0_);
+       _g_object_unref0 (_tmp3_);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp4_ = conn;
+       _tmp5_ = g_variant_new ("(su)", "org.example.Test", 0x4, NULL);
+       g_variant_ref_sink (_tmp5_);
+       _tmp6_ = _tmp5_;
+       _tmp7_ = g_dbus_connection_call_sync (_tmp4_, "org.freedesktop.DBus", "/org/freedesktop/DBus", 
"org.freedesktop.DBus", "RequestName", _tmp6_, NULL, 0, -1, NULL, &_inner_error0_);
+       _tmp8_ = _tmp7_;
+       _g_variant_unref0 (_tmp6_);
+       request_result = _tmp8_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp9_ = request_result;
+       _tmp10_ = g_variant_get_child_value (_tmp9_, (gsize) 0);
+       _tmp11_ = _tmp10_;
+       _tmp12_ = _variant_get1 (_tmp11_);
+       _vala_assert (_tmp12_ == ((guint) 1), "(uint) request_result.get_child_value (0) == 1");
+       _g_variant_unref0 (_tmp11_);
+       _tmp13_ = g_strdup ("dbus_async_client");
+       _tmp14_ = g_new0 (gchar*, 1 + 1);
+       _tmp14_[0] = _tmp13_;
+       _tmp15_ = _tmp14_;
+       _tmp15__length1 = 1;
+       g_spawn_async (NULL, _tmp15_, NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &_tmp16_, &_inner_error0_);
+       client_pid = _tmp16_;
+       _tmp15_ = (_vala_array_free (_tmp15_, _tmp15__length1, (GDestroyNotify) g_free), NULL);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_variant_unref0 (request_result);
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       g_child_watch_add_full (G_PRIORITY_DEFAULT_IDLE, client_pid, _client_exit_gchild_watch_func, NULL, 
NULL);
+       _tmp17_ = g_main_loop_new (NULL, FALSE);
+       _g_main_loop_unref0 (main_loop);
+       main_loop = _tmp17_;
+       _tmp18_ = main_loop;
+       g_main_loop_run (_tmp18_);
+       _g_variant_unref0 (request_result);
+       _g_object_unref0 (conn);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/dbus/basic-types_client.c-expected b/tests/dbus/basic-types_client.c-expected
new file mode 100644
index 000000000..6d1d4b65c
--- /dev/null
+++ b/tests/dbus/basic-types_client.c-expected
@@ -0,0 +1,872 @@
+/* dbus_basic_types_client.c generated by valac, the Vala compiler
+ * generated from dbus_basic_types_client.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define TEST_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_TEST, TestIface))
+
+typedef struct _Test Test;
+typedef struct _TestIface TestIface;
+
+#define TYPE_TEST_PROXY (test_proxy_get_type ())
+typedef GDBusProxy TestProxy;
+typedef GDBusProxyClass TestProxyClass;
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _TestIface {
+       GTypeInterface parent_iface;
+       void (*test_void) (Test* self, GError** error);
+       gint (*test_int) (Test* self, gint i, gint* j, GError** error);
+       gchar* (*test_string) (Test* self, const gchar* s, gchar* * t, GError** error);
+       gchar* (*get_test_property) (Test* self);
+       void (*set_test_property) (Test* self, const gchar* value);
+       gint (*get_test_int_property) (Test* self);
+       void (*set_test_int_property) (Test* self, gint value);
+};
+
+VALA_EXTERN GType test_proxy_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN guint test_register_object (void* object,
+                            GDBusConnection* connection,
+                            const gchar* path,
+                            GError** error);
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN void test_test_void (Test* self,
+                     GError** error);
+VALA_EXTERN gint test_test_int (Test* self,
+                    gint i,
+                    gint* j,
+                    GError** error);
+VALA_EXTERN gchar* test_test_string (Test* self,
+                         const gchar* s,
+                         gchar* * t,
+                         GError** error);
+VALA_EXTERN gchar* test_get_test_property (Test* self);
+VALA_EXTERN void test_set_test_property (Test* self,
+                             const gchar* value);
+VALA_EXTERN gint test_get_test_int_property (Test* self);
+VALA_EXTERN void test_set_test_int_property (Test* self,
+                                 gint value);
+static GType test_get_type_once (void);
+static void test_proxy_g_signal (GDBusProxy* proxy,
+                          const gchar* sender_name,
+                          const gchar* signal_name,
+                          GVariant* parameters);
+static void test_proxy_test_void (Test* self,
+                           GError** error);
+static gint test_proxy_test_int (Test* self,
+                          gint i,
+                          gint* j,
+                          GError** error);
+static gchar* test_proxy_test_string (Test* self,
+                               const gchar* s,
+                               gchar* * t,
+                               GError** error);
+static gchar* test_dbus_proxy_get_test_property (Test* self);
+static void test_dbus_proxy_set_test_property (Test* self,
+                                        const gchar* value);
+static gint test_dbus_proxy_get_test_int_property (Test* self);
+static void test_dbus_proxy_set_test_int_property (Test* self,
+                                            gint value);
+static void test_proxy_test_interface_init (TestIface* iface);
+static void _dbus_test_test_void (Test* self,
+                           GVariant* _parameters_,
+                           GDBusMethodInvocation* invocation);
+static void _dbus_test_test_int (Test* self,
+                          GVariant* _parameters_,
+                          GDBusMethodInvocation* invocation);
+static void _dbus_test_test_string (Test* self,
+                             GVariant* _parameters_,
+                             GDBusMethodInvocation* invocation);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* method_name,
+                                      GVariant* parameters,
+                                      GDBusMethodInvocation* invocation,
+                                      gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+                                            const gchar* sender,
+                                            const gchar* object_path,
+                                            const gchar* interface_name,
+                                            const gchar* property_name,
+                                            GError** error,
+                                            gpointer user_data);
+static GVariant* _dbus_test_get_test_property (Test* self);
+static GVariant* _dbus_test_get_test_int_property (Test* self);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GVariant* value,
+                                           GError** error,
+                                           gpointer user_data);
+static void _dbus_test_set_test_property (Test* self,
+                                   GVariant* _value);
+static void _dbus_test_set_test_int_property (Test* self,
+                                       GVariant* _value);
+static void _test_unregister_object (gpointer user_data);
+static void _vala_main (void);
+
+static const GDBusArgInfo * const _test_dbus_arg_info_test_void_in[] = {NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_void_out[] = {NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_void = {-1, "TestVoid", (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_void_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_void_out), NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_int_i = {-1, "i", "i", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_int_j = {-1, "j", "i", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_int_result = {-1, "result", "i", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_int_in[] = {&_test_dbus_arg_info_test_int_i, 
NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_int_out[] = {&_test_dbus_arg_info_test_int_j, 
&_test_dbus_arg_info_test_int_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_int = {-1, "TestInt", (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_int_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_int_out), NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_string_s = {-1, "s", "s", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_string_t = {-1, "t", "s", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_string_result = {-1, "result", "s", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_string_in[] = 
{&_test_dbus_arg_info_test_string_s, NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_string_out[] = 
{&_test_dbus_arg_info_test_string_t, &_test_dbus_arg_info_test_string_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_string = {-1, "TestString", (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_string_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_string_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_test_void, 
&_test_dbus_method_info_test_int, &_test_dbus_method_info_test_string, NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo _test_dbus_property_info_test_property = {-1, "TestProperty", "s", 
G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, NULL};
+static const GDBusPropertyInfo _test_dbus_property_info_test_int_property = {-1, "TestIntProperty", "i", 
G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = 
{&_test_dbus_property_info_test_property, &_test_dbus_property_info_test_int_property, NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) 
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, 
test_dbus_interface_get_property, test_dbus_interface_set_property};
+
+void
+test_test_void (Test* self,
+                GError** error)
+{
+       TestIface* _iface_;
+       g_return_if_fail (IS_TEST (self));
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->test_void) {
+               _iface_->test_void (self, error);
+       }
+}
+
+gint
+test_test_int (Test* self,
+               gint i,
+               gint* j,
+               GError** error)
+{
+       TestIface* _iface_;
+       g_return_val_if_fail (IS_TEST (self), 0);
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->test_int) {
+               return _iface_->test_int (self, i, j, error);
+       }
+       return -1;
+}
+
+gchar*
+test_test_string (Test* self,
+                  const gchar* s,
+                  gchar* * t,
+                  GError** error)
+{
+       TestIface* _iface_;
+       g_return_val_if_fail (IS_TEST (self), NULL);
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->test_string) {
+               return _iface_->test_string (self, s, t, error);
+       }
+       return NULL;
+}
+
+gchar*
+test_get_test_property (Test* self)
+{
+       TestIface* _iface_;
+       g_return_val_if_fail (IS_TEST (self), NULL);
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->get_test_property) {
+               return _iface_->get_test_property (self);
+       }
+       return NULL;
+}
+
+void
+test_set_test_property (Test* self,
+                        const gchar* value)
+{
+       TestIface* _iface_;
+       g_return_if_fail (IS_TEST (self));
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->set_test_property) {
+               _iface_->set_test_property (self, value);
+       }
+}
+
+gint
+test_get_test_int_property (Test* self)
+{
+       TestIface* _iface_;
+       g_return_val_if_fail (IS_TEST (self), 0);
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->get_test_int_property) {
+               return _iface_->get_test_int_property (self);
+       }
+       return -1;
+}
+
+void
+test_set_test_int_property (Test* self,
+                            gint value)
+{
+       TestIface* _iface_;
+       g_return_if_fail (IS_TEST (self));
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->set_test_int_property) {
+               _iface_->set_test_int_property (self, value);
+       }
+}
+
+static void
+test_default_init (TestIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType test_type_id;
+       test_type_id = g_type_register_static (G_TYPE_INTERFACE, "Test", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (test_type_id, G_TYPE_OBJECT);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) 
test_proxy_get_type);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), 
"org.example.Test");
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*) 
(&_test_dbus_interface_info));
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_register_object);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_TEST, 
test_proxy_test_interface_init) )
+static void
+test_proxy_class_init (TestProxyClass* klass)
+{
+       G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal;
+}
+
+static void
+test_proxy_g_signal (GDBusProxy* proxy,
+                     const gchar* sender_name,
+                     const gchar* signal_name,
+                     GVariant* parameters)
+{
+}
+
+static void
+test_proxy_init (TestProxy* self)
+{
+       g_dbus_proxy_set_interface_info (G_DBUS_PROXY (self), (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info));
+}
+
+static void
+test_proxy_test_void (Test* self,
+                      GError** error)
+{
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       GDBusMessage *_reply_message;
+       G_IO_ERROR;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "TestVoid");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       _reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout 
((GDBusProxy *) self), NULL, NULL, error);
+       g_object_unref (_message);
+       if (!_reply_message) {
+               return;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, error)) {
+               g_object_unref (_reply_message);
+               return;
+       }
+       g_object_unref (_reply_message);
+}
+
+static gint
+test_proxy_test_int (Test* self,
+                     gint i,
+                     gint* j,
+                     GError** error)
+{
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       GDBusMessage *_reply_message;
+       GVariant *_reply;
+       GVariantIter _reply_iter;
+       gint _vala_j = 0;
+       GVariant* _tmp2_;
+       gint _result = 0;
+       GVariant* _tmp3_;
+       G_IO_ERROR;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "TestInt");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_arguments_builder, g_variant_new_int32 (i));
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       _reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout 
((GDBusProxy *) self), NULL, NULL, error);
+       g_object_unref (_message);
+       if (!_reply_message) {
+               gint _tmp0_ = 0;
+               return _tmp0_;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, error)) {
+               gint _tmp1_ = 0;
+               g_object_unref (_reply_message);
+               return _tmp1_;
+       }
+       _reply = g_dbus_message_get_body (_reply_message);
+       g_variant_iter_init (&_reply_iter, _reply);
+       _tmp2_ = g_variant_iter_next_value (&_reply_iter);
+       _vala_j = g_variant_get_int32 (_tmp2_);
+       g_variant_unref (_tmp2_);
+       *j = _vala_j;
+       _tmp3_ = g_variant_iter_next_value (&_reply_iter);
+       _result = g_variant_get_int32 (_tmp3_);
+       g_variant_unref (_tmp3_);
+       g_object_unref (_reply_message);
+       return _result;
+}
+
+static gchar*
+test_proxy_test_string (Test* self,
+                        const gchar* s,
+                        gchar* * t,
+                        GError** error)
+{
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       GDBusMessage *_reply_message;
+       GVariant *_reply;
+       GVariantIter _reply_iter;
+       gchar* _vala_t = NULL;
+       GVariant* _tmp4_;
+       gchar* _result = NULL;
+       GVariant* _tmp5_;
+       G_IO_ERROR;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "TestString");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (s));
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       _reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout 
((GDBusProxy *) self), NULL, NULL, error);
+       g_object_unref (_message);
+       if (!_reply_message) {
+               return NULL;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, error)) {
+               g_object_unref (_reply_message);
+               return NULL;
+       }
+       _reply = g_dbus_message_get_body (_reply_message);
+       g_variant_iter_init (&_reply_iter, _reply);
+       _tmp4_ = g_variant_iter_next_value (&_reply_iter);
+       _vala_t = g_variant_dup_string (_tmp4_, NULL);
+       g_variant_unref (_tmp4_);
+       *t = _vala_t;
+       _tmp5_ = g_variant_iter_next_value (&_reply_iter);
+       _result = g_variant_dup_string (_tmp5_, NULL);
+       g_variant_unref (_tmp5_);
+       g_object_unref (_reply_message);
+       return _result;
+}
+
+static gchar*
+test_dbus_proxy_get_test_property (Test* self)
+{
+       GVariant *_inner_reply;
+       gchar* _result;
+       _inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "TestProperty");
+       if (!_inner_reply) {
+               GVariant *_arguments;
+               GVariant *_reply;
+               GVariantBuilder _arguments_builder;
+               g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+               g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.example.Test"));
+               g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("TestProperty"));
+               _arguments = g_variant_builder_end (&_arguments_builder);
+               _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", 
_arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+               if (!_reply) {
+                       return NULL;
+               }
+               g_variant_get (_reply, "(v)", &_inner_reply);
+               g_variant_unref (_reply);
+       }
+       _result = g_variant_dup_string (_inner_reply, NULL);
+       g_variant_unref (_inner_reply);
+       return _result;
+}
+
+static void
+test_dbus_proxy_set_test_property (Test* self,
+                                   const gchar* value)
+{
+       GVariant *_arguments;
+       GVariant *_reply;
+       GVariantBuilder _arguments_builder;
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.example.Test"));
+       g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("TestProperty"));
+       g_variant_builder_open (&_arguments_builder, G_VARIANT_TYPE_VARIANT);
+       g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (value));
+       g_variant_builder_close (&_arguments_builder);
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Set", 
_arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+       if (!_reply) {
+               return;
+       }
+       g_variant_unref (_reply);
+}
+
+static gint
+test_dbus_proxy_get_test_int_property (Test* self)
+{
+       GVariant *_inner_reply;
+       gint _result;
+       _inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "TestIntProperty");
+       if (!_inner_reply) {
+               GVariant *_arguments;
+               GVariant *_reply;
+               GVariantBuilder _arguments_builder;
+               g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+               g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.example.Test"));
+               g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("TestIntProperty"));
+               _arguments = g_variant_builder_end (&_arguments_builder);
+               _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", 
_arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+               if (!_reply) {
+                       gint _tmp6_ = 0;
+                       return _tmp6_;
+               }
+               g_variant_get (_reply, "(v)", &_inner_reply);
+               g_variant_unref (_reply);
+       }
+       _result = g_variant_get_int32 (_inner_reply);
+       g_variant_unref (_inner_reply);
+       return _result;
+}
+
+static void
+test_dbus_proxy_set_test_int_property (Test* self,
+                                       gint value)
+{
+       GVariant *_arguments;
+       GVariant *_reply;
+       GVariantBuilder _arguments_builder;
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.example.Test"));
+       g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("TestIntProperty"));
+       g_variant_builder_open (&_arguments_builder, G_VARIANT_TYPE_VARIANT);
+       g_variant_builder_add_value (&_arguments_builder, g_variant_new_int32 (value));
+       g_variant_builder_close (&_arguments_builder);
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Set", 
_arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+       if (!_reply) {
+               return;
+       }
+       g_variant_unref (_reply);
+}
+
+static void
+test_proxy_test_interface_init (TestIface* iface)
+{
+       iface->test_void = test_proxy_test_void;
+       iface->test_int = test_proxy_test_int;
+       iface->test_string = test_proxy_test_string;
+       iface->get_test_property = test_dbus_proxy_get_test_property;
+       iface->set_test_property = test_dbus_proxy_set_test_property;
+       iface->get_test_int_property = test_dbus_proxy_get_test_int_property;
+       iface->set_test_int_property = test_dbus_proxy_set_test_int_property;
+}
+
+static void
+_dbus_test_test_void (Test* self,
+                      GVariant* _parameters_,
+                      GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       test_test_void (self, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               return;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+}
+
+static void
+_dbus_test_test_int (Test* self,
+                     GVariant* _parameters_,
+                     GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       gint i = 0;
+       GVariant* _tmp7_;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       gint j = 0;
+       gint result;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _tmp7_ = g_variant_iter_next_value (&_arguments_iter);
+       i = g_variant_get_int32 (_tmp7_);
+       g_variant_unref (_tmp7_);
+       result = test_test_int (self, i, &j, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               return;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_int32 (j));
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_int32 (result));
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+}
+
+static void
+_dbus_test_test_string (Test* self,
+                        GVariant* _parameters_,
+                        GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       gchar* s = NULL;
+       GVariant* _tmp8_;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       gchar* t = NULL;
+       gchar* result;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _tmp8_ = g_variant_iter_next_value (&_arguments_iter);
+       s = g_variant_dup_string (_tmp8_, NULL);
+       g_variant_unref (_tmp8_);
+       result = test_test_string (self, s, &t, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               goto _error;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_string (t));
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_string (result));
+       _g_free0 (result);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+       _error:
+       _g_free0 (s);
+       _g_free0 (t);
+       ;
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* method_name,
+                                 GVariant* parameters,
+                                 GDBusMethodInvocation* invocation,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "TestVoid") == 0) {
+               _dbus_test_test_void (object, parameters, invocation);
+       } else if (strcmp (method_name, "TestInt") == 0) {
+               _dbus_test_test_int (object, parameters, invocation);
+       } else if (strcmp (method_name, "TestString") == 0) {
+               _dbus_test_test_string (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+_dbus_test_get_test_property (Test* self)
+{
+       gchar* result;
+       GVariant* _reply;
+       result = test_get_test_property (self);
+       _reply = g_variant_new_string (result);
+       _g_free0 (result);
+       return _reply;
+}
+
+static GVariant*
+_dbus_test_get_test_int_property (Test* self)
+{
+       gint result;
+       GVariant* _reply;
+       result = test_get_test_int_property (self);
+       _reply = g_variant_new_int32 (result);
+       return _reply;
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (property_name, "TestProperty") == 0) {
+               return _dbus_test_get_test_property (object);
+       } else if (strcmp (property_name, "TestIntProperty") == 0) {
+               return _dbus_test_get_test_int_property (object);
+       }
+       return NULL;
+}
+
+static void
+_dbus_test_set_test_property (Test* self,
+                              GVariant* _value)
+{
+       gchar* value = NULL;
+       value = g_variant_dup_string (_value, NULL);
+       test_set_test_property (self, value);
+       _g_free0 (value);
+}
+
+static void
+_dbus_test_set_test_int_property (Test* self,
+                                  GVariant* _value)
+{
+       gint value = 0;
+       value = g_variant_get_int32 (_value);
+       test_set_test_int_property (self, value);
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GVariant* value,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (property_name, "TestProperty") == 0) {
+               _dbus_test_set_test_property (object, value);
+               return TRUE;
+       } else if (strcmp (property_name, "TestIntProperty") == 0) {
+               _dbus_test_set_test_int_property (object, value);
+               return TRUE;
+       }
+       return FALSE;
+}
+
+guint
+test_register_object (gpointer object,
+                      GDBusConnection* connection,
+                      const gchar* path,
+                      GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+static void
+_vala_main (void)
+{
+       Test* test = NULL;
+       Test* _tmp0_;
+       Test* _tmp1_;
+       gint j = 0;
+       gint k = 0;
+       gint _tmp2_ = 0;
+       Test* _tmp3_;
+       gint _tmp4_ = 0;
+       gint _tmp5_;
+       gchar* t = NULL;
+       gchar* u = NULL;
+       gchar* _tmp6_ = NULL;
+       Test* _tmp7_;
+       gchar* _tmp8_ = NULL;
+       gchar* _tmp9_;
+       gchar* _tmp10_;
+       const gchar* _tmp11_;
+       const gchar* _tmp12_;
+       Test* _tmp13_;
+       Test* _tmp14_;
+       gchar* _tmp15_;
+       gchar* _tmp16_;
+       const gchar* _tmp17_;
+       Test* _tmp18_;
+       Test* _tmp19_;
+       gint _tmp20_;
+       gint _tmp21_;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = (Test*) g_initable_new (TYPE_TEST_PROXY, NULL, &_inner_error0_, "g-flags", 
G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, "g-name", "org.example.Test", "g-bus-type", G_BUS_TYPE_SESSION, 
"g-object-path", "/org/example/test", "g-interface-name", "org.example.Test", NULL);
+       test = (Test*) _tmp0_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp1_ = test;
+       test_test_void (_tmp1_, &_inner_error0_);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (test);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp3_ = test;
+       _tmp5_ = test_test_int (_tmp3_, 42, &_tmp4_, &_inner_error0_);
+       j = _tmp4_;
+       _tmp2_ = _tmp5_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (test);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       k = _tmp2_;
+       _vala_assert (j == 23, "j == 23");
+       _vala_assert (k == 11, "k == 11");
+       _tmp7_ = test;
+       _tmp9_ = test_test_string (_tmp7_, "hello", &_tmp8_, &_inner_error0_);
+       _g_free0 (t);
+       t = _tmp8_;
+       _tmp6_ = _tmp9_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_free0 (u);
+               _g_free0 (t);
+               _g_object_unref0 (test);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp10_ = _tmp6_;
+       _tmp6_ = NULL;
+       _g_free0 (u);
+       u = _tmp10_;
+       _tmp11_ = t;
+       _vala_assert (g_strcmp0 (_tmp11_, "world") == 0, "t == \"world\"");
+       _tmp12_ = u;
+       _vala_assert (g_strcmp0 (_tmp12_, "vala") == 0, "u == \"vala\"");
+       _tmp13_ = test;
+       test_set_test_property (_tmp13_, "hello");
+       _tmp14_ = test;
+       _tmp15_ = test_get_test_property (_tmp14_);
+       _tmp16_ = _tmp15_;
+       _g_free0 (t);
+       t = _tmp16_;
+       _tmp17_ = t;
+       _vala_assert (g_strcmp0 (_tmp17_, "hello") == 0, "t == \"hello\"");
+       _tmp18_ = test;
+       test_set_test_int_property (_tmp18_, 42);
+       _tmp19_ = test;
+       _tmp20_ = test_get_test_int_property (_tmp19_);
+       _tmp21_ = _tmp20_;
+       j = _tmp21_;
+       _vala_assert (j == 42, "j == 42");
+       _g_free0 (_tmp6_);
+       _g_free0 (u);
+       _g_free0 (t);
+       _g_object_unref0 (test);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/dbus/basic-types_server.c-expected b/tests/dbus/basic-types_server.c-expected
new file mode 100644
index 000000000..f0731f71b
--- /dev/null
+++ b/tests/dbus/basic-types_server.c-expected
@@ -0,0 +1,755 @@
+/* dbus_basic_types_server.c generated by valac, the Vala compiler
+ * generated from dbus_basic_types_server.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TEST, TestClass))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define IS_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TEST))
+#define TEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TEST, TestClass))
+
+typedef struct _Test Test;
+typedef struct _TestClass TestClass;
+typedef struct _TestPrivate TestPrivate;
+enum  {
+       TEST_0_PROPERTY,
+       TEST_TEST_PROPERTY_PROPERTY,
+       TEST_TEST_INT_PROPERTY_PROPERTY,
+       TEST_NUM_PROPERTIES
+};
+static GParamSpec* test_properties[TEST_NUM_PROPERTIES];
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Test {
+       GObject parent_instance;
+       TestPrivate * priv;
+};
+
+struct _TestClass {
+       GObjectClass parent_class;
+};
+
+struct _TestPrivate {
+       gchar* _test_property;
+       gint _test_int_property;
+};
+
+static gint Test_private_offset;
+static gpointer test_parent_class = NULL;
+VALA_EXTERN GMainLoop* main_loop;
+GMainLoop* main_loop = NULL;
+
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
+VALA_EXTERN guint test_register_object (void* object,
+                            GDBusConnection* connection,
+                            const gchar* path,
+                            GError** error);
+VALA_EXTERN void test_test_void (Test* self);
+VALA_EXTERN gint test_test_int (Test* self,
+                    gint i,
+                    gint* j);
+VALA_EXTERN gchar* test_test_string (Test* self,
+                         const gchar* s,
+                         gchar* * t);
+VALA_EXTERN Test* test_new (void);
+VALA_EXTERN Test* test_construct (GType object_type);
+VALA_EXTERN gchar* test_get_test_property (Test* self);
+VALA_EXTERN void test_set_test_property (Test* self,
+                             const gchar* value);
+VALA_EXTERN gint test_get_test_int_property (Test* self);
+VALA_EXTERN void test_set_test_int_property (Test* self,
+                                 gint value);
+static void test_finalize (GObject * obj);
+static GType test_get_type_once (void);
+static void _vala_test_get_property (GObject * object,
+                              guint property_id,
+                              GValue * value,
+                              GParamSpec * pspec);
+static void _vala_test_set_property (GObject * object,
+                              guint property_id,
+                              const GValue * value,
+                              GParamSpec * pspec);
+static void _dbus_test_test_void (Test* self,
+                           GVariant* _parameters_,
+                           GDBusMethodInvocation* invocation);
+static void _dbus_test_test_int (Test* self,
+                          GVariant* _parameters_,
+                          GDBusMethodInvocation* invocation);
+static void _dbus_test_test_string (Test* self,
+                             GVariant* _parameters_,
+                             GDBusMethodInvocation* invocation);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* method_name,
+                                      GVariant* parameters,
+                                      GDBusMethodInvocation* invocation,
+                                      gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+                                            const gchar* sender,
+                                            const gchar* object_path,
+                                            const gchar* interface_name,
+                                            const gchar* property_name,
+                                            GError** error,
+                                            gpointer user_data);
+static GVariant* _dbus_test_get_test_property (Test* self);
+static GVariant* _dbus_test_get_test_int_property (Test* self);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GVariant* value,
+                                           GError** error,
+                                           gpointer user_data);
+static void _dbus_test_set_test_property (Test* self,
+                                   GVariant* _value);
+static void _dbus_test_set_test_int_property (Test* self,
+                                       GVariant* _value);
+static void _test_unregister_object (gpointer user_data);
+VALA_EXTERN void client_exit (GPid pid,
+                  gint status);
+static void _vala_main (void);
+static guint _variant_get1 (GVariant* value);
+static void _client_exit_gchild_watch_func (GPid pid,
+                                     gint wait_status,
+                                     gpointer self);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static const GDBusArgInfo * const _test_dbus_arg_info_test_void_in[] = {NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_void_out[] = {NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_void = {-1, "TestVoid", (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_void_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_void_out), NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_int_i = {-1, "i", "i", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_int_j = {-1, "j", "i", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_int_result = {-1, "result", "i", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_int_in[] = {&_test_dbus_arg_info_test_int_i, 
NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_int_out[] = {&_test_dbus_arg_info_test_int_j, 
&_test_dbus_arg_info_test_int_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_int = {-1, "TestInt", (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_int_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_int_out), NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_string_s = {-1, "s", "s", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_string_t = {-1, "t", "s", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_string_result = {-1, "result", "s", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_string_in[] = 
{&_test_dbus_arg_info_test_string_s, NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_string_out[] = 
{&_test_dbus_arg_info_test_string_t, &_test_dbus_arg_info_test_string_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_string = {-1, "TestString", (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_string_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_string_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_test_void, 
&_test_dbus_method_info_test_int, &_test_dbus_method_info_test_string, NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo _test_dbus_property_info_test_property = {-1, "TestProperty", "s", 
G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, NULL};
+static const GDBusPropertyInfo _test_dbus_property_info_test_int_property = {-1, "TestIntProperty", "i", 
G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = 
{&_test_dbus_property_info_test_property, &_test_dbus_property_info_test_int_property, NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) 
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, 
test_dbus_interface_get_property, test_dbus_interface_set_property};
+
+static inline gpointer
+test_get_instance_private (Test* self)
+{
+       return G_STRUCT_MEMBER_P (self, Test_private_offset);
+}
+
+void
+test_test_void (Test* self)
+{
+       g_return_if_fail (IS_TEST (self));
+}
+
+gint
+test_test_int (Test* self,
+               gint i,
+               gint* j)
+{
+       gint _vala_j = 0;
+       gint result = 0;
+       g_return_val_if_fail (IS_TEST (self), 0);
+       _vala_assert (i == 42, "i == 42");
+       _vala_j = 23;
+       result = 11;
+       if (j) {
+               *j = _vala_j;
+       }
+       return result;
+}
+
+gchar*
+test_test_string (Test* self,
+                  const gchar* s,
+                  gchar* * t)
+{
+       gchar* _vala_t = NULL;
+       gchar* _tmp0_;
+       gchar* _tmp1_;
+       gchar* result = NULL;
+       g_return_val_if_fail (IS_TEST (self), NULL);
+       g_return_val_if_fail (s != NULL, NULL);
+       _vala_assert (g_strcmp0 (s, "hello") == 0, "s == \"hello\"");
+       _tmp0_ = g_strdup ("world");
+       _g_free0 (_vala_t);
+       _vala_t = _tmp0_;
+       _tmp1_ = g_strdup ("vala");
+       result = _tmp1_;
+       if (t) {
+               *t = _vala_t;
+       } else {
+               _g_free0 (_vala_t);
+       }
+       return result;
+}
+
+Test*
+test_construct (GType object_type)
+{
+       Test * self = NULL;
+       self = (Test*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Test*
+test_new (void)
+{
+       return test_construct (TYPE_TEST);
+}
+
+gchar*
+test_get_test_property (Test* self)
+{
+       gchar* result;
+       const gchar* _tmp0_;
+       gchar* _tmp1_;
+       g_return_val_if_fail (IS_TEST (self), NULL);
+       _tmp0_ = self->priv->_test_property;
+       _tmp1_ = g_strdup (_tmp0_);
+       result = _tmp1_;
+       return result;
+}
+
+void
+test_set_test_property (Test* self,
+                        const gchar* value)
+{
+       gchar* old_value;
+       g_return_if_fail (IS_TEST (self));
+       old_value = test_get_test_property (self);
+       if (g_strcmp0 (value, old_value) != 0) {
+               gchar* _tmp0_;
+               _tmp0_ = g_strdup (value);
+               _g_free0 (self->priv->_test_property);
+               self->priv->_test_property = _tmp0_;
+               g_object_notify_by_pspec ((GObject *) self, test_properties[TEST_TEST_PROPERTY_PROPERTY]);
+       }
+       _g_free0 (old_value);
+}
+
+gint
+test_get_test_int_property (Test* self)
+{
+       gint result;
+       g_return_val_if_fail (IS_TEST (self), 0);
+       result = self->priv->_test_int_property;
+       return result;
+}
+
+void
+test_set_test_int_property (Test* self,
+                            gint value)
+{
+       gint old_value;
+       g_return_if_fail (IS_TEST (self));
+       old_value = test_get_test_int_property (self);
+       if (old_value != value) {
+               self->priv->_test_int_property = value;
+               g_object_notify_by_pspec ((GObject *) self, test_properties[TEST_TEST_INT_PROPERTY_PROPERTY]);
+       }
+}
+
+static void
+test_class_init (TestClass * klass,
+                 gpointer klass_data)
+{
+       test_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Test_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_test_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_test_set_property;
+       G_OBJECT_CLASS (klass)->finalize = test_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), TEST_TEST_PROPERTY_PROPERTY, 
test_properties[TEST_TEST_PROPERTY_PROPERTY] = g_param_spec_string ("test-property", "test-property", 
"test-property", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), TEST_TEST_INT_PROPERTY_PROPERTY, 
test_properties[TEST_TEST_INT_PROPERTY_PROPERTY] = g_param_spec_int ("test-int-property", 
"test-int-property", "test-int-property", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | 
G_PARAM_WRITABLE));
+}
+
+static void
+test_instance_init (Test * self,
+                    gpointer klass)
+{
+       self->priv = test_get_instance_private (self);
+}
+
+static void
+test_finalize (GObject * obj)
+{
+       Test * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_TEST, Test);
+       _g_free0 (self->priv->_test_property);
+       G_OBJECT_CLASS (test_parent_class)->finalize (obj);
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Test), 
0, (GInstanceInitFunc) test_instance_init, NULL };
+       GType test_type_id;
+       test_type_id = g_type_register_static (G_TYPE_OBJECT, "Test", &g_define_type_info, 0);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_register_object);
+       Test_private_offset = g_type_add_instance_private (test_type_id, sizeof (TestPrivate));
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+static void
+_vala_test_get_property (GObject * object,
+                         guint property_id,
+                         GValue * value,
+                         GParamSpec * pspec)
+{
+       Test * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+       switch (property_id) {
+               case TEST_TEST_PROPERTY_PROPERTY:
+               g_value_take_string (value, test_get_test_property (self));
+               break;
+               case TEST_TEST_INT_PROPERTY_PROPERTY:
+               g_value_set_int (value, test_get_test_int_property (self));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_test_set_property (GObject * object,
+                         guint property_id,
+                         const GValue * value,
+                         GParamSpec * pspec)
+{
+       Test * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+       switch (property_id) {
+               case TEST_TEST_PROPERTY_PROPERTY:
+               test_set_test_property (self, g_value_get_string (value));
+               break;
+               case TEST_TEST_INT_PROPERTY_PROPERTY:
+               test_set_test_int_property (self, g_value_get_int (value));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_dbus_test_test_void (Test* self,
+                      GVariant* _parameters_,
+                      GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       test_test_void (self);
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+}
+
+static void
+_dbus_test_test_int (Test* self,
+                     GVariant* _parameters_,
+                     GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       gint i = 0;
+       GVariant* _tmp0_;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       gint j = 0;
+       gint result;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _tmp0_ = g_variant_iter_next_value (&_arguments_iter);
+       i = g_variant_get_int32 (_tmp0_);
+       g_variant_unref (_tmp0_);
+       result = test_test_int (self, i, &j);
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_int32 (j));
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_int32 (result));
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+}
+
+static void
+_dbus_test_test_string (Test* self,
+                        GVariant* _parameters_,
+                        GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       gchar* s = NULL;
+       GVariant* _tmp1_;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       gchar* t = NULL;
+       gchar* result;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _tmp1_ = g_variant_iter_next_value (&_arguments_iter);
+       s = g_variant_dup_string (_tmp1_, NULL);
+       g_variant_unref (_tmp1_);
+       result = test_test_string (self, s, &t);
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_string (t));
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_string (result));
+       _g_free0 (result);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+       _g_free0 (s);
+       _g_free0 (t);
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* method_name,
+                                 GVariant* parameters,
+                                 GDBusMethodInvocation* invocation,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "TestVoid") == 0) {
+               _dbus_test_test_void (object, parameters, invocation);
+       } else if (strcmp (method_name, "TestInt") == 0) {
+               _dbus_test_test_int (object, parameters, invocation);
+       } else if (strcmp (method_name, "TestString") == 0) {
+               _dbus_test_test_string (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+_dbus_test_get_test_property (Test* self)
+{
+       gchar* result;
+       GVariant* _reply;
+       result = test_get_test_property (self);
+       _reply = g_variant_new_string (result);
+       _g_free0 (result);
+       return _reply;
+}
+
+static GVariant*
+_dbus_test_get_test_int_property (Test* self)
+{
+       gint result;
+       GVariant* _reply;
+       result = test_get_test_int_property (self);
+       _reply = g_variant_new_int32 (result);
+       return _reply;
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (property_name, "TestProperty") == 0) {
+               return _dbus_test_get_test_property (object);
+       } else if (strcmp (property_name, "TestIntProperty") == 0) {
+               return _dbus_test_get_test_int_property (object);
+       }
+       return NULL;
+}
+
+static void
+_dbus_test_set_test_property (Test* self,
+                              GVariant* _value)
+{
+       gchar* value = NULL;
+       value = g_variant_dup_string (_value, NULL);
+       test_set_test_property (self, value);
+       _g_free0 (value);
+}
+
+static void
+_dbus_test_set_test_int_property (Test* self,
+                                  GVariant* _value)
+{
+       gint value = 0;
+       value = g_variant_get_int32 (_value);
+       test_set_test_int_property (self, value);
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GVariant* value,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (property_name, "TestProperty") == 0) {
+               _dbus_test_set_test_property (object, value);
+               return TRUE;
+       } else if (strcmp (property_name, "TestIntProperty") == 0) {
+               _dbus_test_set_test_int_property (object, value);
+               return TRUE;
+       }
+       return FALSE;
+}
+
+guint
+test_register_object (gpointer object,
+                      GDBusConnection* connection,
+                      const gchar* path,
+                      GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+void
+client_exit (GPid pid,
+             gint status)
+{
+       GMainLoop* _tmp0_;
+       _vala_assert (status == 0, "status == 0");
+       _tmp0_ = main_loop;
+       g_main_loop_quit (_tmp0_);
+}
+
+static guint
+_variant_get1 (GVariant* value)
+{
+       return g_variant_get_uint32 (value);
+}
+
+static void
+_client_exit_gchild_watch_func (GPid pid,
+                                gint wait_status,
+                                gpointer self)
+{
+       client_exit (pid, wait_status);
+}
+
+static void
+_vala_main (void)
+{
+       GDBusConnection* conn = NULL;
+       GDBusConnection* _tmp0_;
+       GDBusConnection* _tmp1_;
+       Test* _tmp2_;
+       Test* _tmp3_;
+       GVariant* request_result = NULL;
+       GDBusConnection* _tmp4_;
+       GVariant* _tmp5_;
+       GVariant* _tmp6_;
+       GVariant* _tmp7_;
+       GVariant* _tmp8_;
+       GVariant* _tmp9_;
+       GVariant* _tmp10_;
+       GVariant* _tmp11_;
+       guint _tmp12_;
+       GPid client_pid = 0;
+       gchar* _tmp13_;
+       gchar** _tmp14_;
+       gchar** _tmp15_;
+       gint _tmp15__length1;
+       GPid _tmp16_ = 0;
+       GMainLoop* _tmp17_;
+       GMainLoop* _tmp18_;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &_inner_error0_);
+       conn = _tmp0_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp1_ = conn;
+       _tmp2_ = test_new ();
+       _tmp3_ = _tmp2_;
+       test_register_object (_tmp3_, _tmp1_, "/org/example/test", &_inner_error0_);
+       _g_object_unref0 (_tmp3_);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp4_ = conn;
+       _tmp5_ = g_variant_new ("(su)", "org.example.Test", 0x4, NULL);
+       g_variant_ref_sink (_tmp5_);
+       _tmp6_ = _tmp5_;
+       _tmp7_ = g_dbus_connection_call_sync (_tmp4_, "org.freedesktop.DBus", "/org/freedesktop/DBus", 
"org.freedesktop.DBus", "RequestName", _tmp6_, NULL, 0, -1, NULL, &_inner_error0_);
+       _tmp8_ = _tmp7_;
+       _g_variant_unref0 (_tmp6_);
+       request_result = _tmp8_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp9_ = request_result;
+       _tmp10_ = g_variant_get_child_value (_tmp9_, (gsize) 0);
+       _tmp11_ = _tmp10_;
+       _tmp12_ = _variant_get1 (_tmp11_);
+       _vala_assert (_tmp12_ == ((guint) 1), "(uint) request_result.get_child_value (0) == 1");
+       _g_variant_unref0 (_tmp11_);
+       _tmp13_ = g_strdup ("dbus_basic_types_client");
+       _tmp14_ = g_new0 (gchar*, 1 + 1);
+       _tmp14_[0] = _tmp13_;
+       _tmp15_ = _tmp14_;
+       _tmp15__length1 = 1;
+       g_spawn_async (NULL, _tmp15_, NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &_tmp16_, &_inner_error0_);
+       client_pid = _tmp16_;
+       _tmp15_ = (_vala_array_free (_tmp15_, _tmp15__length1, (GDestroyNotify) g_free), NULL);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_variant_unref0 (request_result);
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       g_child_watch_add_full (G_PRIORITY_DEFAULT_IDLE, client_pid, _client_exit_gchild_watch_func, NULL, 
NULL);
+       _tmp17_ = g_main_loop_new (NULL, FALSE);
+       _g_main_loop_unref0 (main_loop);
+       main_loop = _tmp17_;
+       _tmp18_ = main_loop;
+       g_main_loop_run (_tmp18_);
+       _g_variant_unref0 (request_result);
+       _g_object_unref0 (conn);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/dbus/bug596862.c-expected b/tests/dbus/bug596862.c-expected
new file mode 100644
index 000000000..e85b58e66
--- /dev/null
+++ b/tests/dbus/bug596862.c-expected
@@ -0,0 +1,277 @@
+/* dbus_bug596862.c generated by valac, the Vala compiler
+ * generated from dbus_bug596862.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN guint foo_register_object (void* object,
+                           GDBusConnection* connection,
+                           const gchar* path,
+                           GError** error);
+VALA_EXTERN void foo_do_foo (Foo* self,
+                 GVariant* value);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static GType foo_get_type_once (void);
+static void _dbus_foo_do_foo (Foo* self,
+                       GVariant* _parameters_,
+                       GDBusMethodInvocation* invocation);
+static void foo_dbus_interface_method_call (GDBusConnection* connection,
+                                     const gchar* sender,
+                                     const gchar* object_path,
+                                     const gchar* interface_name,
+                                     const gchar* method_name,
+                                     GVariant* parameters,
+                                     GDBusMethodInvocation* invocation,
+                                     gpointer user_data);
+static GVariant* foo_dbus_interface_get_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GError** error,
+                                           gpointer user_data);
+static gboolean foo_dbus_interface_set_property (GDBusConnection* connection,
+                                          const gchar* sender,
+                                          const gchar* object_path,
+                                          const gchar* interface_name,
+                                          const gchar* property_name,
+                                          GVariant* value,
+                                          GError** error,
+                                          gpointer user_data);
+static void _foo_unregister_object (gpointer user_data);
+static void _vala_main (void);
+
+static const GDBusArgInfo _foo_dbus_arg_info_do_foo_value = {-1, "value", "v", NULL};
+static const GDBusArgInfo * const _foo_dbus_arg_info_do_foo_in[] = {&_foo_dbus_arg_info_do_foo_value, NULL};
+static const GDBusArgInfo * const _foo_dbus_arg_info_do_foo_out[] = {NULL};
+static const GDBusMethodInfo _foo_dbus_method_info_do_foo = {-1, "DoFoo", (GDBusArgInfo **) 
(&_foo_dbus_arg_info_do_foo_in), (GDBusArgInfo **) (&_foo_dbus_arg_info_do_foo_out), NULL};
+static const GDBusMethodInfo * const _foo_dbus_method_info[] = {&_foo_dbus_method_info_do_foo, NULL};
+static const GDBusSignalInfo * const _foo_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo * const _foo_dbus_property_info[] = {NULL};
+static const GDBusInterfaceInfo _foo_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) 
(&_foo_dbus_method_info), (GDBusSignalInfo **) (&_foo_dbus_signal_info), (GDBusPropertyInfo **) 
(&_foo_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _foo_dbus_interface_vtable = {foo_dbus_interface_method_call, 
foo_dbus_interface_get_property, foo_dbus_interface_set_property};
+
+void
+foo_do_foo (Foo* self,
+            GVariant* value)
+{
+       g_return_if_fail (IS_FOO (self));
+       g_return_if_fail (value != NULL);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       g_type_set_qdata (foo_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
foo_register_object);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_dbus_foo_do_foo (Foo* self,
+                  GVariant* _parameters_,
+                  GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       GVariant* value = NULL;
+       GVariant* _tmp0_;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _tmp0_ = g_variant_iter_next_value (&_arguments_iter);
+       value = g_variant_get_variant (_tmp0_);
+       g_variant_unref (_tmp0_);
+       foo_do_foo (self, value);
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+       _g_variant_unref0 (value);
+}
+
+static void
+foo_dbus_interface_method_call (GDBusConnection* connection,
+                                const gchar* sender,
+                                const gchar* object_path,
+                                const gchar* interface_name,
+                                const gchar* method_name,
+                                GVariant* parameters,
+                                GDBusMethodInvocation* invocation,
+                                gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "DoFoo") == 0) {
+               _dbus_foo_do_foo (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+foo_dbus_interface_get_property (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* property_name,
+                                 GError** error,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return NULL;
+}
+
+static gboolean
+foo_dbus_interface_set_property (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* property_name,
+                                 GVariant* value,
+                                 GError** error,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return FALSE;
+}
+
+guint
+foo_register_object (gpointer object,
+                     GDBusConnection* connection,
+                     const gchar* path,
+                     GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_foo_dbus_interface_info), &_foo_dbus_interface_vtable, data, _foo_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       return result;
+}
+
+static void
+_foo_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/dbus/bug602003_client.c-expected b/tests/dbus/bug602003_client.c-expected
new file mode 100644
index 000000000..38836347a
--- /dev/null
+++ b/tests/dbus/bug602003_client.c-expected
@@ -0,0 +1,443 @@
+/* dbus_bug602003_client.c generated by valac, the Vala compiler
+ * generated from dbus_bug602003_client.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <glib.h>
+#include <string.h>
+#include <stdlib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define TEST_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_TEST, TestIface))
+
+typedef struct _Test Test;
+typedef struct _TestIface TestIface;
+
+#define TYPE_TEST_PROXY (test_proxy_get_type ())
+typedef GDBusProxy TestProxy;
+typedef GDBusProxyClass TestProxyClass;
+#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _TestIface {
+       GTypeInterface parent_iface;
+       GVariant* (*test_string) (Test* self, GError** error);
+};
+
+VALA_EXTERN GType test_proxy_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN guint test_register_object (void* object,
+                            GDBusConnection* connection,
+                            const gchar* path,
+                            GError** error);
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN GVariant* test_test_string (Test* self,
+                            GError** error);
+static GType test_get_type_once (void);
+static void test_proxy_g_signal (GDBusProxy* proxy,
+                          const gchar* sender_name,
+                          const gchar* signal_name,
+                          GVariant* parameters);
+static GVariant* test_proxy_test_string (Test* self,
+                                  GError** error);
+static void test_proxy_test_interface_init (TestIface* iface);
+static void _dbus_test_test_string (Test* self,
+                             GVariant* _parameters_,
+                             GDBusMethodInvocation* invocation);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* method_name,
+                                      GVariant* parameters,
+                                      GDBusMethodInvocation* invocation,
+                                      gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+                                            const gchar* sender,
+                                            const gchar* object_path,
+                                            const gchar* interface_name,
+                                            const gchar* property_name,
+                                            GError** error,
+                                            gpointer user_data);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GVariant* value,
+                                           GError** error,
+                                           gpointer user_data);
+static void _test_unregister_object (gpointer user_data);
+static void _vala_main (void);
+static gchar** _variant_get1 (GVariant* value,
+                       gint* result_length1);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static const GDBusArgInfo _test_dbus_arg_info_test_string_result = {-1, "result", "v", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_string_in[] = {NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_string_out[] = 
{&_test_dbus_arg_info_test_string_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_string = {-1, "TestString", (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_string_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_string_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_test_string, NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = {NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) 
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, 
test_dbus_interface_get_property, test_dbus_interface_set_property};
+
+GVariant*
+test_test_string (Test* self,
+                  GError** error)
+{
+       TestIface* _iface_;
+       g_return_val_if_fail (IS_TEST (self), NULL);
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->test_string) {
+               return _iface_->test_string (self, error);
+       }
+       return NULL;
+}
+
+static void
+test_default_init (TestIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType test_type_id;
+       test_type_id = g_type_register_static (G_TYPE_INTERFACE, "Test", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (test_type_id, G_TYPE_OBJECT);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) 
test_proxy_get_type);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), 
"org.example.Test");
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*) 
(&_test_dbus_interface_info));
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_register_object);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_TEST, 
test_proxy_test_interface_init) )
+static void
+test_proxy_class_init (TestProxyClass* klass)
+{
+       G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal;
+}
+
+static void
+test_proxy_g_signal (GDBusProxy* proxy,
+                     const gchar* sender_name,
+                     const gchar* signal_name,
+                     GVariant* parameters)
+{
+}
+
+static void
+test_proxy_init (TestProxy* self)
+{
+       g_dbus_proxy_set_interface_info (G_DBUS_PROXY (self), (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info));
+}
+
+static GVariant*
+test_proxy_test_string (Test* self,
+                        GError** error)
+{
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       GDBusMessage *_reply_message;
+       GVariant *_reply;
+       GVariantIter _reply_iter;
+       GVariant* _result = NULL;
+       GVariant* _tmp0_;
+       G_IO_ERROR;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "TestString");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       _reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout 
((GDBusProxy *) self), NULL, NULL, error);
+       g_object_unref (_message);
+       if (!_reply_message) {
+               return NULL;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, error)) {
+               g_object_unref (_reply_message);
+               return NULL;
+       }
+       _reply = g_dbus_message_get_body (_reply_message);
+       g_variant_iter_init (&_reply_iter, _reply);
+       _tmp0_ = g_variant_iter_next_value (&_reply_iter);
+       _result = g_variant_get_variant (_tmp0_);
+       g_variant_unref (_tmp0_);
+       g_object_unref (_reply_message);
+       return _result;
+}
+
+static void
+test_proxy_test_interface_init (TestIface* iface)
+{
+       iface->test_string = test_proxy_test_string;
+}
+
+static void
+_dbus_test_test_string (Test* self,
+                        GVariant* _parameters_,
+                        GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       GVariant* result;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       result = test_test_string (self, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               return;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_variant (result));
+       _g_variant_unref0 (result);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* method_name,
+                                 GVariant* parameters,
+                                 GDBusMethodInvocation* invocation,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "TestString") == 0) {
+               _dbus_test_test_string (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return NULL;
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GVariant* value,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return FALSE;
+}
+
+guint
+test_register_object (gpointer object,
+                      GDBusConnection* connection,
+                      const gchar* path,
+                      GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+static gchar**
+_variant_get1 (GVariant* value,
+               gint* result_length1)
+{
+       gchar** _tmp5_;
+       gint _tmp5__length;
+       gint _tmp5__size;
+       gint _tmp5__length1;
+       GVariantIter _tmp6_;
+       GVariant* _tmp7_;
+       _tmp5_ = g_new (gchar*, 5);
+       _tmp5__length = 0;
+       _tmp5__size = 4;
+       _tmp5__length1 = 0;
+       g_variant_iter_init (&_tmp6_, value);
+       for (; (_tmp7_ = g_variant_iter_next_value (&_tmp6_)) != NULL; _tmp5__length1++) {
+               if (_tmp5__size == _tmp5__length) {
+                       _tmp5__size = 2 * _tmp5__size;
+                       _tmp5_ = g_renew (gchar*, _tmp5_, _tmp5__size + 1);
+               }
+               _tmp5_[_tmp5__length++] = g_variant_dup_string (_tmp7_, NULL);
+               g_variant_unref (_tmp7_);
+       }
+       *result_length1 = _tmp5__length1;
+       _tmp5_[_tmp5__length] = NULL;
+       return _tmp5_;
+}
+
+static void
+_vala_main (void)
+{
+       Test* test = NULL;
+       Test* _tmp0_;
+       GVariant* v = NULL;
+       Test* _tmp1_;
+       GVariant* _tmp2_;
+       gchar** s = NULL;
+       GVariant* _tmp3_;
+       gchar** _tmp4_ = NULL;
+       gint _tmp4__length1 = 0;
+       gint s_length1;
+       gint _s_size_;
+       gboolean _tmp8_ = FALSE;
+       gchar** _tmp9_;
+       gint _tmp9__length1;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = (Test*) g_initable_new (TYPE_TEST_PROXY, NULL, &_inner_error0_, "g-flags", 0, "g-name", 
"org.example.Test", "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/example/test", 
"g-interface-name", "org.example.Test", NULL);
+       test = (Test*) _tmp0_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp1_ = test;
+       _tmp2_ = test_test_string (_tmp1_, &_inner_error0_);
+       v = _tmp2_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (test);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp3_ = v;
+       _tmp4_ = _variant_get1 (_tmp3_, &_tmp4__length1);
+       s = _tmp4_;
+       s_length1 = _tmp4__length1;
+       _s_size_ = s_length1;
+       _tmp9_ = s;
+       _tmp9__length1 = s_length1;
+       if (_tmp9__length1 == 1) {
+               gchar** _tmp10_;
+               gint _tmp10__length1;
+               const gchar* _tmp11_;
+               _tmp10_ = s;
+               _tmp10__length1 = s_length1;
+               _tmp11_ = _tmp10_[0];
+               _tmp8_ = g_strcmp0 (_tmp11_, "hello") == 0;
+       } else {
+               _tmp8_ = FALSE;
+       }
+       _vala_assert (_tmp8_, "s.length == 1 && s[0] == \"hello\"");
+       s = (_vala_array_free (s, s_length1, (GDestroyNotify) g_free), NULL);
+       _g_variant_unref0 (v);
+       _g_object_unref0 (test);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/dbus/bug602003_server.c-expected b/tests/dbus/bug602003_server.c-expected
new file mode 100644
index 000000000..d3801ff78
--- /dev/null
+++ b/tests/dbus/bug602003_server.c-expected
@@ -0,0 +1,466 @@
+/* dbus_bug602003_server.c generated by valac, the Vala compiler
+ * generated from dbus_bug602003_server.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TEST, TestClass))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define IS_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TEST))
+#define TEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TEST, TestClass))
+
+typedef struct _Test Test;
+typedef struct _TestClass TestClass;
+typedef struct _TestPrivate TestPrivate;
+enum  {
+       TEST_0_PROPERTY,
+       TEST_NUM_PROPERTIES
+};
+static GParamSpec* test_properties[TEST_NUM_PROPERTIES];
+#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Test {
+       GObject parent_instance;
+       TestPrivate * priv;
+};
+
+struct _TestClass {
+       GObjectClass parent_class;
+};
+
+static gpointer test_parent_class = NULL;
+VALA_EXTERN GMainLoop* main_loop;
+GMainLoop* main_loop = NULL;
+
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
+VALA_EXTERN guint test_register_object (void* object,
+                            GDBusConnection* connection,
+                            const gchar* path,
+                            GError** error);
+VALA_EXTERN GVariant* test_test_string (Test* self);
+static GVariant* _variant_new1 (gchar** value,
+                         gint value_length1);
+VALA_EXTERN Test* test_new (void);
+VALA_EXTERN Test* test_construct (GType object_type);
+static GType test_get_type_once (void);
+static void _dbus_test_test_string (Test* self,
+                             GVariant* _parameters_,
+                             GDBusMethodInvocation* invocation);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* method_name,
+                                      GVariant* parameters,
+                                      GDBusMethodInvocation* invocation,
+                                      gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+                                            const gchar* sender,
+                                            const gchar* object_path,
+                                            const gchar* interface_name,
+                                            const gchar* property_name,
+                                            GError** error,
+                                            gpointer user_data);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GVariant* value,
+                                           GError** error,
+                                           gpointer user_data);
+static void _test_unregister_object (gpointer user_data);
+VALA_EXTERN void client_exit (GPid pid,
+                  gint status);
+static void _vala_main (void);
+static guint _variant_get1 (GVariant* value);
+static void _client_exit_gchild_watch_func (GPid pid,
+                                     gint wait_status,
+                                     gpointer self);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static const GDBusArgInfo _test_dbus_arg_info_test_string_result = {-1, "result", "v", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_string_in[] = {NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_string_out[] = 
{&_test_dbus_arg_info_test_string_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_string = {-1, "TestString", (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_string_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_string_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_test_string, NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = {NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) 
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, 
test_dbus_interface_get_property, test_dbus_interface_set_property};
+
+static GVariant*
+_variant_new1 (gchar** value,
+               gint value_length1)
+{
+       gchar** _tmp3_;
+       GVariantBuilder _tmp4_;
+       gint _tmp5_;
+       _tmp3_ = value;
+       g_variant_builder_init (&_tmp4_, G_VARIANT_TYPE ("as"));
+       for (_tmp5_ = 0; _tmp5_ < value_length1; _tmp5_++) {
+               g_variant_builder_add_value (&_tmp4_, g_variant_new_string (*_tmp3_));
+               _tmp3_++;
+       }
+       return g_variant_ref_sink (g_variant_builder_end (&_tmp4_));
+}
+
+GVariant*
+test_test_string (Test* self)
+{
+       gchar** s = NULL;
+       gchar* _tmp0_;
+       gchar** _tmp1_;
+       gint s_length1;
+       gint _s_size_;
+       gchar** _tmp2_;
+       gint _tmp2__length1;
+       GVariant* _tmp6_;
+       GVariant* _tmp7_;
+       GVariant* result = NULL;
+       g_return_val_if_fail (IS_TEST (self), NULL);
+       _tmp0_ = g_strdup ("hello");
+       _tmp1_ = g_new0 (gchar*, 1 + 1);
+       _tmp1_[0] = _tmp0_;
+       s = _tmp1_;
+       s_length1 = 1;
+       _s_size_ = s_length1;
+       _tmp2_ = s;
+       _tmp2__length1 = s_length1;
+       _tmp6_ = _variant_new1 (_tmp2_, s_length1);
+       _tmp7_ = _tmp6_;
+       _tmp2_ = (_vala_array_free (_tmp2_, _tmp2__length1, (GDestroyNotify) g_free), NULL);
+       result = _tmp7_;
+       return result;
+}
+
+Test*
+test_construct (GType object_type)
+{
+       Test * self = NULL;
+       self = (Test*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Test*
+test_new (void)
+{
+       return test_construct (TYPE_TEST);
+}
+
+static void
+test_class_init (TestClass * klass,
+                 gpointer klass_data)
+{
+       test_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+test_instance_init (Test * self,
+                    gpointer klass)
+{
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Test), 
0, (GInstanceInitFunc) test_instance_init, NULL };
+       GType test_type_id;
+       test_type_id = g_type_register_static (G_TYPE_OBJECT, "Test", &g_define_type_info, 0);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_register_object);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+static void
+_dbus_test_test_string (Test* self,
+                        GVariant* _parameters_,
+                        GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       GVariant* result;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       result = test_test_string (self);
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_variant (result));
+       _g_variant_unref0 (result);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* method_name,
+                                 GVariant* parameters,
+                                 GDBusMethodInvocation* invocation,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "TestString") == 0) {
+               _dbus_test_test_string (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return NULL;
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GVariant* value,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return FALSE;
+}
+
+guint
+test_register_object (gpointer object,
+                      GDBusConnection* connection,
+                      const gchar* path,
+                      GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+void
+client_exit (GPid pid,
+             gint status)
+{
+       GMainLoop* _tmp0_;
+       _vala_assert (status == 0, "status == 0");
+       _tmp0_ = main_loop;
+       g_main_loop_quit (_tmp0_);
+}
+
+static guint
+_variant_get1 (GVariant* value)
+{
+       return g_variant_get_uint32 (value);
+}
+
+static void
+_client_exit_gchild_watch_func (GPid pid,
+                                gint wait_status,
+                                gpointer self)
+{
+       client_exit (pid, wait_status);
+}
+
+static void
+_vala_main (void)
+{
+       GDBusConnection* conn = NULL;
+       GDBusConnection* _tmp0_;
+       GDBusConnection* _tmp1_;
+       Test* _tmp2_;
+       Test* _tmp3_;
+       GVariant* request_result = NULL;
+       GDBusConnection* _tmp4_;
+       GVariant* _tmp5_;
+       GVariant* _tmp6_;
+       GVariant* _tmp7_;
+       GVariant* _tmp8_;
+       GVariant* _tmp9_;
+       GVariant* _tmp10_;
+       GVariant* _tmp11_;
+       guint _tmp12_;
+       GPid client_pid = 0;
+       gchar* _tmp13_;
+       gchar** _tmp14_;
+       gchar** _tmp15_;
+       gint _tmp15__length1;
+       GPid _tmp16_ = 0;
+       GMainLoop* _tmp17_;
+       GMainLoop* _tmp18_;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &_inner_error0_);
+       conn = _tmp0_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp1_ = conn;
+       _tmp2_ = test_new ();
+       _tmp3_ = _tmp2_;
+       test_register_object (_tmp3_, _tmp1_, "/org/example/test", &_inner_error0_);
+       _g_object_unref0 (_tmp3_);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp4_ = conn;
+       _tmp5_ = g_variant_new ("(su)", "org.example.Test", 0x4, NULL);
+       g_variant_ref_sink (_tmp5_);
+       _tmp6_ = _tmp5_;
+       _tmp7_ = g_dbus_connection_call_sync (_tmp4_, "org.freedesktop.DBus", "/org/freedesktop/DBus", 
"org.freedesktop.DBus", "RequestName", _tmp6_, NULL, 0, -1, NULL, &_inner_error0_);
+       _tmp8_ = _tmp7_;
+       _g_variant_unref0 (_tmp6_);
+       request_result = _tmp8_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp9_ = request_result;
+       _tmp10_ = g_variant_get_child_value (_tmp9_, (gsize) 0);
+       _tmp11_ = _tmp10_;
+       _tmp12_ = _variant_get1 (_tmp11_);
+       _vala_assert (_tmp12_ == ((guint) 1), "(uint) request_result.get_child_value (0) == 1");
+       _g_variant_unref0 (_tmp11_);
+       _tmp13_ = g_strdup ("dbus_bug602003_client");
+       _tmp14_ = g_new0 (gchar*, 1 + 1);
+       _tmp14_[0] = _tmp13_;
+       _tmp15_ = _tmp14_;
+       _tmp15__length1 = 1;
+       g_spawn_async (NULL, _tmp15_, NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &_tmp16_, &_inner_error0_);
+       client_pid = _tmp16_;
+       _tmp15_ = (_vala_array_free (_tmp15_, _tmp15__length1, (GDestroyNotify) g_free), NULL);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_variant_unref0 (request_result);
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       g_child_watch_add_full (G_PRIORITY_DEFAULT_IDLE, client_pid, _client_exit_gchild_watch_func, NULL, 
NULL);
+       _tmp17_ = g_main_loop_new (NULL, FALSE);
+       _g_main_loop_unref0 (main_loop);
+       main_loop = _tmp17_;
+       _tmp18_ = main_loop;
+       g_main_loop_run (_tmp18_);
+       _g_variant_unref0 (request_result);
+       _g_object_unref0 (conn);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/dbus/bug735437_client.c-expected b/tests/dbus/bug735437_client.c-expected
new file mode 100644
index 000000000..dae32bff8
--- /dev/null
+++ b/tests/dbus/bug735437_client.c-expected
@@ -0,0 +1,1017 @@
+/* dbus_bug735437_client.c generated by valac, the Vala compiler
+ * generated from dbus_bug735437_client.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <glib.h>
+#include <float.h>
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define TEST_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_TEST, TestIface))
+
+typedef struct _Test Test;
+typedef struct _TestIface TestIface;
+
+#define TYPE_TEST_PROXY (test_proxy_get_type ())
+typedef GDBusProxy TestProxy;
+typedef GDBusProxyClass TestProxyClass;
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _TestIface {
+       GTypeInterface parent_iface;
+       gdouble* (*array) (Test* self, gint* result_length1, GError** error);
+       gdouble* (*multi_array) (Test* self, gint* result_length1, gint* result_length2, GError** error);
+       gchar** (*multi_array2) (Test* self, gint* result_length1, gint* result_length2, gint* 
result_length3, GError** error);
+};
+
+VALA_EXTERN GType test_proxy_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN guint test_register_object (void* object,
+                            GDBusConnection* connection,
+                            const gchar* path,
+                            GError** error);
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN gdouble* test_array (Test* self,
+                     gint* result_length1,
+                     GError** error);
+VALA_EXTERN gdouble* test_multi_array (Test* self,
+                           gint* result_length1,
+                           gint* result_length2,
+                           GError** error);
+VALA_EXTERN gchar** test_multi_array2 (Test* self,
+                           gint* result_length1,
+                           gint* result_length2,
+                           gint* result_length3,
+                           GError** error);
+static GType test_get_type_once (void);
+static void test_proxy_g_signal (GDBusProxy* proxy,
+                          const gchar* sender_name,
+                          const gchar* signal_name,
+                          GVariant* parameters);
+static gdouble* test_proxy_array (Test* self,
+                           gint* result_length1,
+                           GError** error);
+static gdouble* test_proxy_multi_array (Test* self,
+                                 gint* result_length1,
+                                 gint* result_length2,
+                                 GError** error);
+static gchar** test_proxy_multi_array2 (Test* self,
+                                 gint* result_length1,
+                                 gint* result_length2,
+                                 gint* result_length3,
+                                 GError** error);
+static void test_proxy_test_interface_init (TestIface* iface);
+static void _dbus_test_array (Test* self,
+                       GVariant* _parameters_,
+                       GDBusMethodInvocation* invocation);
+static void _dbus_test_multi_array (Test* self,
+                             GVariant* _parameters_,
+                             GDBusMethodInvocation* invocation);
+static void _dbus_test_multi_array2 (Test* self,
+                              GVariant* _parameters_,
+                              GDBusMethodInvocation* invocation);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* method_name,
+                                      GVariant* parameters,
+                                      GDBusMethodInvocation* invocation,
+                                      gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+                                            const gchar* sender,
+                                            const gchar* object_path,
+                                            const gchar* interface_name,
+                                            const gchar* property_name,
+                                            GError** error,
+                                            gpointer user_data);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GVariant* value,
+                                           GError** error,
+                                           gpointer user_data);
+static void _test_unregister_object (gpointer user_data);
+static void _vala_main (void);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static const GDBusArgInfo _test_dbus_arg_info_array_result = {-1, "result", "ad", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_array_in[] = {NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_array_out[] = {&_test_dbus_arg_info_array_result, 
NULL};
+static const GDBusMethodInfo _test_dbus_method_info_array = {-1, "Array", (GDBusArgInfo **) 
(&_test_dbus_arg_info_array_in), (GDBusArgInfo **) (&_test_dbus_arg_info_array_out), NULL};
+static const GDBusArgInfo _test_dbus_arg_info_multi_array_result = {-1, "result", "aad", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_multi_array_in[] = {NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_multi_array_out[] = 
{&_test_dbus_arg_info_multi_array_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_multi_array = {-1, "MultiArray", (GDBusArgInfo **) 
(&_test_dbus_arg_info_multi_array_in), (GDBusArgInfo **) (&_test_dbus_arg_info_multi_array_out), NULL};
+static const GDBusArgInfo _test_dbus_arg_info_multi_array2_result = {-1, "result", "aaas", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_multi_array2_in[] = {NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_multi_array2_out[] = 
{&_test_dbus_arg_info_multi_array2_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_multi_array2 = {-1, "MultiArray2", (GDBusArgInfo **) 
(&_test_dbus_arg_info_multi_array2_in), (GDBusArgInfo **) (&_test_dbus_arg_info_multi_array2_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_array, 
&_test_dbus_method_info_multi_array, &_test_dbus_method_info_multi_array2, NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = {NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) 
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, 
test_dbus_interface_get_property, test_dbus_interface_set_property};
+
+gdouble*
+test_array (Test* self,
+            gint* result_length1,
+            GError** error)
+{
+       TestIface* _iface_;
+       g_return_val_if_fail (IS_TEST (self), NULL);
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->array) {
+               return _iface_->array (self, result_length1, error);
+       }
+       return NULL;
+}
+
+gdouble*
+test_multi_array (Test* self,
+                  gint* result_length1,
+                  gint* result_length2,
+                  GError** error)
+{
+       TestIface* _iface_;
+       g_return_val_if_fail (IS_TEST (self), NULL);
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->multi_array) {
+               return _iface_->multi_array (self, result_length1, result_length2, error);
+       }
+       return NULL;
+}
+
+gchar**
+test_multi_array2 (Test* self,
+                   gint* result_length1,
+                   gint* result_length2,
+                   gint* result_length3,
+                   GError** error)
+{
+       TestIface* _iface_;
+       g_return_val_if_fail (IS_TEST (self), NULL);
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->multi_array2) {
+               return _iface_->multi_array2 (self, result_length1, result_length2, result_length3, error);
+       }
+       return NULL;
+}
+
+static void
+test_default_init (TestIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType test_type_id;
+       test_type_id = g_type_register_static (G_TYPE_INTERFACE, "Test", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (test_type_id, G_TYPE_OBJECT);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) 
test_proxy_get_type);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), 
"org.example.Test");
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*) 
(&_test_dbus_interface_info));
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_register_object);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_TEST, 
test_proxy_test_interface_init) )
+static void
+test_proxy_class_init (TestProxyClass* klass)
+{
+       G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal;
+}
+
+static void
+test_proxy_g_signal (GDBusProxy* proxy,
+                     const gchar* sender_name,
+                     const gchar* signal_name,
+                     GVariant* parameters)
+{
+}
+
+static void
+test_proxy_init (TestProxy* self)
+{
+       g_dbus_proxy_set_interface_info (G_DBUS_PROXY (self), (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info));
+}
+
+static gdouble*
+test_proxy_array (Test* self,
+                  gint* result_length1,
+                  GError** error)
+{
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       GDBusMessage *_reply_message;
+       GVariant *_reply;
+       GVariantIter _reply_iter;
+       gdouble* _result = NULL;
+       gint _result_length1;
+       GVariant* _tmp0_;
+       gdouble* _tmp1_;
+       gint _tmp1__length;
+       gint _tmp1__size;
+       gint _tmp1__length1;
+       GVariantIter _tmp2_;
+       GVariant* _tmp3_;
+       G_DBUS_ERROR;
+       G_IO_ERROR;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "Array");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       _reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout 
((GDBusProxy *) self), NULL, NULL, error);
+       g_object_unref (_message);
+       if (!_reply_message) {
+               return NULL;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, error)) {
+               g_object_unref (_reply_message);
+               return NULL;
+       }
+       _reply = g_dbus_message_get_body (_reply_message);
+       g_variant_iter_init (&_reply_iter, _reply);
+       _result_length1 = 0;
+       _tmp0_ = g_variant_iter_next_value (&_reply_iter);
+       _tmp1_ = g_new (gdouble, 5);
+       _tmp1__length = 0;
+       _tmp1__size = 4;
+       _tmp1__length1 = 0;
+       g_variant_iter_init (&_tmp2_, _tmp0_);
+       for (; (_tmp3_ = g_variant_iter_next_value (&_tmp2_)) != NULL; _tmp1__length1++) {
+               if (_tmp1__size == _tmp1__length) {
+                       _tmp1__size = 2 * _tmp1__size;
+                       _tmp1_ = g_renew (gdouble, _tmp1_, _tmp1__size + 1);
+               }
+               _tmp1_[_tmp1__length++] = g_variant_get_double (_tmp3_);
+               g_variant_unref (_tmp3_);
+       }
+       _result_length1 = _tmp1__length1;
+       _result = _tmp1_;
+       g_variant_unref (_tmp0_);
+       *result_length1 = _result_length1;
+       g_object_unref (_reply_message);
+       return _result;
+}
+
+static gdouble*
+test_proxy_multi_array (Test* self,
+                        gint* result_length1,
+                        gint* result_length2,
+                        GError** error)
+{
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       GDBusMessage *_reply_message;
+       GVariant *_reply;
+       GVariantIter _reply_iter;
+       gdouble* _result = NULL;
+       gint _result_length1;
+       gint _result_length2;
+       GVariant* _tmp4_;
+       gdouble* _tmp5_;
+       gint _tmp5__length;
+       gint _tmp5__size;
+       gint _tmp5__length1;
+       GVariantIter _tmp6_;
+       GVariant* _tmp7_;
+       G_DBUS_ERROR;
+       G_IO_ERROR;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "MultiArray");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       _reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout 
((GDBusProxy *) self), NULL, NULL, error);
+       g_object_unref (_message);
+       if (!_reply_message) {
+               return NULL;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, error)) {
+               g_object_unref (_reply_message);
+               return NULL;
+       }
+       _reply = g_dbus_message_get_body (_reply_message);
+       g_variant_iter_init (&_reply_iter, _reply);
+       _result_length1 = 0;
+       _result_length2 = 0;
+       _tmp4_ = g_variant_iter_next_value (&_reply_iter);
+       _tmp5_ = g_new (gdouble, 5);
+       _tmp5__length = 0;
+       _tmp5__size = 4;
+       _tmp5__length1 = 0;
+       g_variant_iter_init (&_tmp6_, _tmp4_);
+       for (; (_tmp7_ = g_variant_iter_next_value (&_tmp6_)) != NULL; _tmp5__length1++) {
+               gint _tmp5__length2;
+               GVariantIter _tmp8_;
+               GVariant* _tmp9_;
+               _tmp5__length2 = 0;
+               g_variant_iter_init (&_tmp8_, _tmp7_);
+               for (; (_tmp9_ = g_variant_iter_next_value (&_tmp8_)) != NULL; _tmp5__length2++) {
+                       if (_tmp5__size == _tmp5__length) {
+                               _tmp5__size = 2 * _tmp5__size;
+                               _tmp5_ = g_renew (gdouble, _tmp5_, _tmp5__size + 1);
+                       }
+                       _tmp5_[_tmp5__length++] = g_variant_get_double (_tmp9_);
+                       g_variant_unref (_tmp9_);
+               }
+               _result_length2 = _tmp5__length2;
+               g_variant_unref (_tmp7_);
+       }
+       _result_length1 = _tmp5__length1;
+       _result = _tmp5_;
+       g_variant_unref (_tmp4_);
+       *result_length1 = _result_length1;
+       *result_length2 = _result_length2;
+       g_object_unref (_reply_message);
+       return _result;
+}
+
+static gchar**
+test_proxy_multi_array2 (Test* self,
+                         gint* result_length1,
+                         gint* result_length2,
+                         gint* result_length3,
+                         GError** error)
+{
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       GDBusMessage *_reply_message;
+       GVariant *_reply;
+       GVariantIter _reply_iter;
+       gchar** _result = NULL;
+       gint _result_length1;
+       gint _result_length2;
+       gint _result_length3;
+       GVariant* _tmp10_;
+       gchar** _tmp11_;
+       gint _tmp11__length;
+       gint _tmp11__size;
+       gint _tmp11__length1;
+       GVariantIter _tmp12_;
+       GVariant* _tmp13_;
+       G_DBUS_ERROR;
+       G_IO_ERROR;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "MultiArray2");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       _reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout 
((GDBusProxy *) self), NULL, NULL, error);
+       g_object_unref (_message);
+       if (!_reply_message) {
+               return NULL;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, error)) {
+               g_object_unref (_reply_message);
+               return NULL;
+       }
+       _reply = g_dbus_message_get_body (_reply_message);
+       g_variant_iter_init (&_reply_iter, _reply);
+       _result_length1 = 0;
+       _result_length2 = 0;
+       _result_length3 = 0;
+       _tmp10_ = g_variant_iter_next_value (&_reply_iter);
+       _tmp11_ = g_new (gchar*, 5);
+       _tmp11__length = 0;
+       _tmp11__size = 4;
+       _tmp11__length1 = 0;
+       g_variant_iter_init (&_tmp12_, _tmp10_);
+       for (; (_tmp13_ = g_variant_iter_next_value (&_tmp12_)) != NULL; _tmp11__length1++) {
+               gint _tmp11__length2;
+               GVariantIter _tmp14_;
+               GVariant* _tmp15_;
+               _tmp11__length2 = 0;
+               g_variant_iter_init (&_tmp14_, _tmp13_);
+               for (; (_tmp15_ = g_variant_iter_next_value (&_tmp14_)) != NULL; _tmp11__length2++) {
+                       gint _tmp11__length3;
+                       GVariantIter _tmp16_;
+                       GVariant* _tmp17_;
+                       _tmp11__length3 = 0;
+                       g_variant_iter_init (&_tmp16_, _tmp15_);
+                       for (; (_tmp17_ = g_variant_iter_next_value (&_tmp16_)) != NULL; _tmp11__length3++) {
+                               if (_tmp11__size == _tmp11__length) {
+                                       _tmp11__size = 2 * _tmp11__size;
+                                       _tmp11_ = g_renew (gchar*, _tmp11_, _tmp11__size + 1);
+                               }
+                               _tmp11_[_tmp11__length++] = g_variant_dup_string (_tmp17_, NULL);
+                               g_variant_unref (_tmp17_);
+                       }
+                       _result_length3 = _tmp11__length3;
+                       g_variant_unref (_tmp15_);
+               }
+               _result_length2 = _tmp11__length2;
+               g_variant_unref (_tmp13_);
+       }
+       _result_length1 = _tmp11__length1;
+       _tmp11_[_tmp11__length] = NULL;
+       _result = _tmp11_;
+       g_variant_unref (_tmp10_);
+       *result_length1 = _result_length1;
+       *result_length2 = _result_length2;
+       *result_length3 = _result_length3;
+       g_object_unref (_reply_message);
+       return _result;
+}
+
+static void
+test_proxy_test_interface_init (TestIface* iface)
+{
+       iface->array = test_proxy_array;
+       iface->multi_array = test_proxy_multi_array;
+       iface->multi_array2 = test_proxy_multi_array2;
+}
+
+static void
+_dbus_test_array (Test* self,
+                  GVariant* _parameters_,
+                  GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       gdouble* result;
+       gint result_length1 = 0;
+       gdouble* _tmp18_;
+       GVariantBuilder _tmp19_;
+       gint _tmp20_;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       result = test_array (self, &result_length1, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               return;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _tmp18_ = result;
+       g_variant_builder_init (&_tmp19_, G_VARIANT_TYPE ("ad"));
+       for (_tmp20_ = 0; _tmp20_ < result_length1; _tmp20_++) {
+               g_variant_builder_add_value (&_tmp19_, g_variant_new_double (*_tmp18_));
+               _tmp18_++;
+       }
+       g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp19_));
+       result = (g_free (result), NULL);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+}
+
+static void
+_dbus_test_multi_array (Test* self,
+                        GVariant* _parameters_,
+                        GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       gdouble* result;
+       gint result_length1 = 0;
+       gint result_length2 = 0;
+       gdouble* _tmp21_;
+       GVariantBuilder _tmp22_;
+       gint _tmp23_;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       result = test_multi_array (self, &result_length1, &result_length2, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               return;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _tmp21_ = result;
+       g_variant_builder_init (&_tmp22_, G_VARIANT_TYPE ("aad"));
+       for (_tmp23_ = 0; _tmp23_ < result_length1; _tmp23_++) {
+               GVariantBuilder _tmp24_;
+               gint _tmp25_;
+               g_variant_builder_init (&_tmp24_, G_VARIANT_TYPE ("ad"));
+               for (_tmp25_ = 0; _tmp25_ < result_length2; _tmp25_++) {
+                       g_variant_builder_add_value (&_tmp24_, g_variant_new_double (*_tmp21_));
+                       _tmp21_++;
+               }
+               g_variant_builder_add_value (&_tmp22_, g_variant_builder_end (&_tmp24_));
+       }
+       g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp22_));
+       result = (g_free (result), NULL);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+}
+
+static void
+_dbus_test_multi_array2 (Test* self,
+                         GVariant* _parameters_,
+                         GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       gchar** result;
+       gint result_length1 = 0;
+       gint result_length2 = 0;
+       gint result_length3 = 0;
+       gchar** _tmp26_;
+       GVariantBuilder _tmp27_;
+       gint _tmp28_;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       result = test_multi_array2 (self, &result_length1, &result_length2, &result_length3, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               return;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _tmp26_ = result;
+       g_variant_builder_init (&_tmp27_, G_VARIANT_TYPE ("aaas"));
+       for (_tmp28_ = 0; _tmp28_ < result_length1; _tmp28_++) {
+               GVariantBuilder _tmp29_;
+               gint _tmp30_;
+               g_variant_builder_init (&_tmp29_, G_VARIANT_TYPE ("aas"));
+               for (_tmp30_ = 0; _tmp30_ < result_length2; _tmp30_++) {
+                       GVariantBuilder _tmp31_;
+                       gint _tmp32_;
+                       g_variant_builder_init (&_tmp31_, G_VARIANT_TYPE ("as"));
+                       for (_tmp32_ = 0; _tmp32_ < result_length3; _tmp32_++) {
+                               g_variant_builder_add_value (&_tmp31_, g_variant_new_string (*_tmp26_));
+                               _tmp26_++;
+                       }
+                       g_variant_builder_add_value (&_tmp29_, g_variant_builder_end (&_tmp31_));
+               }
+               g_variant_builder_add_value (&_tmp27_, g_variant_builder_end (&_tmp29_));
+       }
+       g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp27_));
+       result = (_vala_array_free (result, (result_length1 * result_length2) * result_length3, 
(GDestroyNotify) g_free), NULL);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* method_name,
+                                 GVariant* parameters,
+                                 GDBusMethodInvocation* invocation,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "Array") == 0) {
+               _dbus_test_array (object, parameters, invocation);
+       } else if (strcmp (method_name, "MultiArray") == 0) {
+               _dbus_test_multi_array (object, parameters, invocation);
+       } else if (strcmp (method_name, "MultiArray2") == 0) {
+               _dbus_test_multi_array2 (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return NULL;
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GVariant* value,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return FALSE;
+}
+
+guint
+test_register_object (gpointer object,
+                      GDBusConnection* connection,
+                      const gchar* path,
+                      GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+static void
+_vala_main (void)
+{
+       Test* test = NULL;
+       Test* _tmp0_;
+       gdouble* a = NULL;
+       Test* _tmp1_;
+       gint _tmp2_ = 0;
+       gdouble* _tmp3_;
+       gint a_length1;
+       gint _a_size_;
+       gboolean _tmp4_ = FALSE;
+       gboolean _tmp5_ = FALSE;
+       gdouble* _tmp6_;
+       gint _tmp6__length1;
+       gdouble* b = NULL;
+       Test* _tmp11_;
+       gint _tmp12_ = 0;
+       gint _tmp13_ = 0;
+       gdouble* _tmp14_;
+       gint b_length1;
+       gint b_length2;
+       gboolean _tmp15_ = FALSE;
+       gboolean _tmp16_ = FALSE;
+       gboolean _tmp17_ = FALSE;
+       gboolean _tmp18_ = FALSE;
+       gboolean _tmp19_ = FALSE;
+       gdouble* _tmp20_;
+       gint _tmp20__length1;
+       gint _tmp20__length2;
+       gint _tmp21_;
+       gchar** c = NULL;
+       Test* _tmp32_;
+       gint _tmp33_ = 0;
+       gint _tmp34_ = 0;
+       gint _tmp35_ = 0;
+       gchar** _tmp36_;
+       gint c_length1;
+       gint c_length2;
+       gint c_length3;
+       gboolean _tmp37_ = FALSE;
+       gboolean _tmp38_ = FALSE;
+       gboolean _tmp39_ = FALSE;
+       gboolean _tmp40_ = FALSE;
+       gboolean _tmp41_ = FALSE;
+       gboolean _tmp42_ = FALSE;
+       gchar** _tmp43_;
+       gint _tmp43__length1;
+       gint _tmp43__length2;
+       gint _tmp43__length3;
+       gint _tmp44_;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = (Test*) g_initable_new (TYPE_TEST_PROXY, NULL, &_inner_error0_, "g-flags", 0, "g-name", 
"org.example.Test", "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/example/test", 
"g-interface-name", "org.example.Test", NULL);
+       test = (Test*) _tmp0_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp1_ = test;
+       _tmp3_ = test_array (_tmp1_, &_tmp2_, &_inner_error0_);
+       a = _tmp3_;
+       a_length1 = _tmp2_;
+       _a_size_ = a_length1;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (test);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp6_ = a;
+       _tmp6__length1 = a_length1;
+       if (_tmp6__length1 == 2) {
+               gdouble* _tmp7_;
+               gint _tmp7__length1;
+               gdouble _tmp8_;
+               _tmp7_ = a;
+               _tmp7__length1 = a_length1;
+               _tmp8_ = _tmp7_[0];
+               _tmp5_ = _tmp8_ == 2.0;
+       } else {
+               _tmp5_ = FALSE;
+       }
+       if (_tmp5_) {
+               gdouble* _tmp9_;
+               gint _tmp9__length1;
+               gdouble _tmp10_;
+               _tmp9_ = a;
+               _tmp9__length1 = a_length1;
+               _tmp10_ = _tmp9_[1];
+               _tmp4_ = _tmp10_ == 3.0;
+       } else {
+               _tmp4_ = FALSE;
+       }
+       _vala_assert (_tmp4_, "a.length == 2 && a[0] == 2.0 && a[1] == 3.0");
+       _tmp11_ = test;
+       _tmp14_ = test_multi_array (_tmp11_, &_tmp12_, &_tmp13_, &_inner_error0_);
+       b = _tmp14_;
+       b_length1 = _tmp12_;
+       b_length2 = _tmp13_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               a = (g_free (a), NULL);
+               _g_object_unref0 (test);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp20_ = b;
+       _tmp20__length1 = b_length1;
+       _tmp20__length2 = b_length2;
+       _tmp21_ = _tmp20__length1;
+       if (_tmp21_ == 2) {
+               gdouble* _tmp22_;
+               gint _tmp22__length1;
+               gint _tmp22__length2;
+               gint _tmp23_;
+               _tmp22_ = b;
+               _tmp22__length1 = b_length1;
+               _tmp22__length2 = b_length2;
+               _tmp23_ = _tmp22__length2;
+               _tmp19_ = _tmp23_ == 2;
+       } else {
+               _tmp19_ = FALSE;
+       }
+       if (_tmp19_) {
+               gdouble* _tmp24_;
+               gint _tmp24__length1;
+               gint _tmp24__length2;
+               gdouble _tmp25_;
+               _tmp24_ = b;
+               _tmp24__length1 = b_length1;
+               _tmp24__length2 = b_length2;
+               _tmp25_ = _tmp24_[(0 * _tmp24__length2) + 0];
+               _tmp18_ = _tmp25_ == 2.0;
+       } else {
+               _tmp18_ = FALSE;
+       }
+       if (_tmp18_) {
+               gdouble* _tmp26_;
+               gint _tmp26__length1;
+               gint _tmp26__length2;
+               gdouble _tmp27_;
+               _tmp26_ = b;
+               _tmp26__length1 = b_length1;
+               _tmp26__length2 = b_length2;
+               _tmp27_ = _tmp26_[(0 * _tmp26__length2) + 1];
+               _tmp17_ = _tmp27_ == 3.0;
+       } else {
+               _tmp17_ = FALSE;
+       }
+       if (_tmp17_) {
+               gdouble* _tmp28_;
+               gint _tmp28__length1;
+               gint _tmp28__length2;
+               gdouble _tmp29_;
+               _tmp28_ = b;
+               _tmp28__length1 = b_length1;
+               _tmp28__length2 = b_length2;
+               _tmp29_ = _tmp28_[(1 * _tmp28__length2) + 0];
+               _tmp16_ = _tmp29_ == 4.0;
+       } else {
+               _tmp16_ = FALSE;
+       }
+       if (_tmp16_) {
+               gdouble* _tmp30_;
+               gint _tmp30__length1;
+               gint _tmp30__length2;
+               gdouble _tmp31_;
+               _tmp30_ = b;
+               _tmp30__length1 = b_length1;
+               _tmp30__length2 = b_length2;
+               _tmp31_ = _tmp30_[(1 * _tmp30__length2) + 1];
+               _tmp15_ = _tmp31_ == 5.0;
+       } else {
+               _tmp15_ = FALSE;
+       }
+       _vala_assert (_tmp15_, "b.length[0] == 2 && b.length[1] == 2 && b[0,0] == 2.0 && b[0,1] == 3.0 && 
b[1,0] == 4.0 && b[1,1] == 5.0");
+       _tmp32_ = test;
+       _tmp36_ = test_multi_array2 (_tmp32_, &_tmp33_, &_tmp34_, &_tmp35_, &_inner_error0_);
+       c = _tmp36_;
+       c_length1 = _tmp33_;
+       c_length2 = _tmp34_;
+       c_length3 = _tmp35_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               b = (g_free (b), NULL);
+               a = (g_free (a), NULL);
+               _g_object_unref0 (test);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp43_ = c;
+       _tmp43__length1 = c_length1;
+       _tmp43__length2 = c_length2;
+       _tmp43__length3 = c_length3;
+       _tmp44_ = _tmp43__length1;
+       if (_tmp44_ == 2) {
+               gchar** _tmp45_;
+               gint _tmp45__length1;
+               gint _tmp45__length2;
+               gint _tmp45__length3;
+               gint _tmp46_;
+               _tmp45_ = c;
+               _tmp45__length1 = c_length1;
+               _tmp45__length2 = c_length2;
+               _tmp45__length3 = c_length3;
+               _tmp46_ = _tmp45__length2;
+               _tmp42_ = _tmp46_ == 2;
+       } else {
+               _tmp42_ = FALSE;
+       }
+       if (_tmp42_) {
+               gchar** _tmp47_;
+               gint _tmp47__length1;
+               gint _tmp47__length2;
+               gint _tmp47__length3;
+               gint _tmp48_;
+               _tmp47_ = c;
+               _tmp47__length1 = c_length1;
+               _tmp47__length2 = c_length2;
+               _tmp47__length3 = c_length3;
+               _tmp48_ = _tmp47__length3;
+               _tmp41_ = _tmp48_ == 2;
+       } else {
+               _tmp41_ = FALSE;
+       }
+       if (_tmp41_) {
+               gchar** _tmp49_;
+               gint _tmp49__length1;
+               gint _tmp49__length2;
+               gint _tmp49__length3;
+               const gchar* _tmp50_;
+               _tmp49_ = c;
+               _tmp49__length1 = c_length1;
+               _tmp49__length2 = c_length2;
+               _tmp49__length3 = c_length3;
+               _tmp50_ = _tmp49_[(((0 * _tmp49__length2) + 0) * _tmp49__length3) + 0];
+               _tmp40_ = g_strcmp0 (_tmp50_, "foo") == 0;
+       } else {
+               _tmp40_ = FALSE;
+       }
+       if (_tmp40_) {
+               gchar** _tmp51_;
+               gint _tmp51__length1;
+               gint _tmp51__length2;
+               gint _tmp51__length3;
+               const gchar* _tmp52_;
+               _tmp51_ = c;
+               _tmp51__length1 = c_length1;
+               _tmp51__length2 = c_length2;
+               _tmp51__length3 = c_length3;
+               _tmp52_ = _tmp51_[(((0 * _tmp51__length2) + 0) * _tmp51__length3) + 1];
+               _tmp39_ = g_strcmp0 (_tmp52_, "bar") == 0;
+       } else {
+               _tmp39_ = FALSE;
+       }
+       if (_tmp39_) {
+               gchar** _tmp53_;
+               gint _tmp53__length1;
+               gint _tmp53__length2;
+               gint _tmp53__length3;
+               const gchar* _tmp54_;
+               _tmp53_ = c;
+               _tmp53__length1 = c_length1;
+               _tmp53__length2 = c_length2;
+               _tmp53__length3 = c_length3;
+               _tmp54_ = _tmp53_[(((1 * _tmp53__length2) + 1) * _tmp53__length3) + 0];
+               _tmp38_ = g_strcmp0 (_tmp54_, "baz2") == 0;
+       } else {
+               _tmp38_ = FALSE;
+       }
+       if (_tmp38_) {
+               gchar** _tmp55_;
+               gint _tmp55__length1;
+               gint _tmp55__length2;
+               gint _tmp55__length3;
+               const gchar* _tmp56_;
+               _tmp55_ = c;
+               _tmp55__length1 = c_length1;
+               _tmp55__length2 = c_length2;
+               _tmp55__length3 = c_length3;
+               _tmp56_ = _tmp55_[(((1 * _tmp55__length2) + 1) * _tmp55__length3) + 1];
+               _tmp37_ = g_strcmp0 (_tmp56_, "man2") == 0;
+       } else {
+               _tmp37_ = FALSE;
+       }
+       _vala_assert (_tmp37_, "c.length[0] == 2 && c.length[1] == 2 && c.length[2] == 2 && c[0,0,0] == 
\"foo\" && c[0,0,1] == \"bar\" && c[1,1,0] == \"baz2\" && c[1,1,1] == \"man2\"");
+       c = (_vala_array_free (c, (c_length1 * c_length2) * c_length3, (GDestroyNotify) g_free), NULL);
+       b = (g_free (b), NULL);
+       a = (g_free (a), NULL);
+       _g_object_unref0 (test);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/dbus/bug735437_server.c-expected b/tests/dbus/bug735437_server.c-expected
new file mode 100644
index 000000000..536be463a
--- /dev/null
+++ b/tests/dbus/bug735437_server.c-expected
@@ -0,0 +1,651 @@
+/* dbus_bug735437_server.c generated by valac, the Vala compiler
+ * generated from dbus_bug735437_server.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <glib.h>
+#include <float.h>
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TEST, TestClass))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define IS_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TEST))
+#define TEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TEST, TestClass))
+
+typedef struct _Test Test;
+typedef struct _TestClass TestClass;
+typedef struct _TestPrivate TestPrivate;
+enum  {
+       TEST_0_PROPERTY,
+       TEST_NUM_PROPERTIES
+};
+static GParamSpec* test_properties[TEST_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Test {
+       GObject parent_instance;
+       TestPrivate * priv;
+};
+
+struct _TestClass {
+       GObjectClass parent_class;
+};
+
+static gpointer test_parent_class = NULL;
+VALA_EXTERN GMainLoop* main_loop;
+GMainLoop* main_loop = NULL;
+
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
+VALA_EXTERN guint test_register_object (void* object,
+                            GDBusConnection* connection,
+                            const gchar* path,
+                            GError** error);
+VALA_EXTERN gdouble* test_array (Test* self,
+                     gint* result_length1);
+VALA_EXTERN gdouble* test_multi_array (Test* self,
+                           gint* result_length1,
+                           gint* result_length2);
+VALA_EXTERN gchar** test_multi_array2 (Test* self,
+                           gint* result_length1,
+                           gint* result_length2,
+                           gint* result_length3);
+VALA_EXTERN Test* test_new (void);
+VALA_EXTERN Test* test_construct (GType object_type);
+static GType test_get_type_once (void);
+static void _dbus_test_array (Test* self,
+                       GVariant* _parameters_,
+                       GDBusMethodInvocation* invocation);
+static void _dbus_test_multi_array (Test* self,
+                             GVariant* _parameters_,
+                             GDBusMethodInvocation* invocation);
+static void _dbus_test_multi_array2 (Test* self,
+                              GVariant* _parameters_,
+                              GDBusMethodInvocation* invocation);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* method_name,
+                                      GVariant* parameters,
+                                      GDBusMethodInvocation* invocation,
+                                      gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+                                            const gchar* sender,
+                                            const gchar* object_path,
+                                            const gchar* interface_name,
+                                            const gchar* property_name,
+                                            GError** error,
+                                            gpointer user_data);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GVariant* value,
+                                           GError** error,
+                                           gpointer user_data);
+static void _test_unregister_object (gpointer user_data);
+VALA_EXTERN void client_exit (GPid pid,
+                  gint status);
+static void _vala_main (void);
+static guint _variant_get1 (GVariant* value);
+static void _client_exit_gchild_watch_func (GPid pid,
+                                     gint wait_status,
+                                     gpointer self);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static const GDBusArgInfo _test_dbus_arg_info_array_result = {-1, "result", "ad", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_array_in[] = {NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_array_out[] = {&_test_dbus_arg_info_array_result, 
NULL};
+static const GDBusMethodInfo _test_dbus_method_info_array = {-1, "Array", (GDBusArgInfo **) 
(&_test_dbus_arg_info_array_in), (GDBusArgInfo **) (&_test_dbus_arg_info_array_out), NULL};
+static const GDBusArgInfo _test_dbus_arg_info_multi_array_result = {-1, "result", "aad", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_multi_array_in[] = {NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_multi_array_out[] = 
{&_test_dbus_arg_info_multi_array_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_multi_array = {-1, "MultiArray", (GDBusArgInfo **) 
(&_test_dbus_arg_info_multi_array_in), (GDBusArgInfo **) (&_test_dbus_arg_info_multi_array_out), NULL};
+static const GDBusArgInfo _test_dbus_arg_info_multi_array2_result = {-1, "result", "aaas", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_multi_array2_in[] = {NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_multi_array2_out[] = 
{&_test_dbus_arg_info_multi_array2_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_multi_array2 = {-1, "MultiArray2", (GDBusArgInfo **) 
(&_test_dbus_arg_info_multi_array2_in), (GDBusArgInfo **) (&_test_dbus_arg_info_multi_array2_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_array, 
&_test_dbus_method_info_multi_array, &_test_dbus_method_info_multi_array2, NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = {NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) 
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, 
test_dbus_interface_get_property, test_dbus_interface_set_property};
+
+gdouble*
+test_array (Test* self,
+            gint* result_length1)
+{
+       gdouble* _tmp0_;
+       gdouble* _tmp1_;
+       gint _tmp1__length1;
+       gdouble* result = NULL;
+       g_return_val_if_fail (IS_TEST (self), NULL);
+       _tmp0_ = g_new0 (gdouble, 2);
+       _tmp0_[0] = 2.0;
+       _tmp0_[1] = 3.0;
+       _tmp1_ = _tmp0_;
+       _tmp1__length1 = 2;
+       if (result_length1) {
+               *result_length1 = _tmp1__length1;
+       }
+       result = _tmp1_;
+       return result;
+}
+
+gdouble*
+test_multi_array (Test* self,
+                  gint* result_length1,
+                  gint* result_length2)
+{
+       gdouble* _tmp0_;
+       gdouble* _tmp1_;
+       gint _tmp1__length1;
+       gint _tmp1__length2;
+       gdouble* result = NULL;
+       g_return_val_if_fail (IS_TEST (self), NULL);
+       _tmp0_ = g_new0 (gdouble, 2 * 2);
+       _tmp0_[0] = 2.0;
+       _tmp0_[1] = 3.0;
+       _tmp0_[2] = 4.0;
+       _tmp0_[3] = 5.0;
+       _tmp1_ = _tmp0_;
+       _tmp1__length1 = 2;
+       _tmp1__length2 = 2;
+       if (result_length1) {
+               *result_length1 = _tmp1__length1;
+       }
+       if (result_length2) {
+               *result_length2 = _tmp1__length2;
+       }
+       result = _tmp1_;
+       return result;
+}
+
+gchar**
+test_multi_array2 (Test* self,
+                   gint* result_length1,
+                   gint* result_length2,
+                   gint* result_length3)
+{
+       gchar* _tmp0_;
+       gchar* _tmp1_;
+       gchar* _tmp2_;
+       gchar* _tmp3_;
+       gchar* _tmp4_;
+       gchar* _tmp5_;
+       gchar* _tmp6_;
+       gchar* _tmp7_;
+       gchar** _tmp8_;
+       gchar** _tmp9_;
+       gint _tmp9__length1;
+       gint _tmp9__length2;
+       gint _tmp9__length3;
+       gchar** result = NULL;
+       g_return_val_if_fail (IS_TEST (self), NULL);
+       _tmp0_ = g_strdup ("foo");
+       _tmp1_ = g_strdup ("bar");
+       _tmp2_ = g_strdup ("baz");
+       _tmp3_ = g_strdup ("man");
+       _tmp4_ = g_strdup ("foo2");
+       _tmp5_ = g_strdup ("bar2");
+       _tmp6_ = g_strdup ("baz2");
+       _tmp7_ = g_strdup ("man2");
+       _tmp8_ = g_new0 (gchar*, ((2 * 2) * 2) + 1);
+       _tmp8_[0] = _tmp0_;
+       _tmp8_[1] = _tmp1_;
+       _tmp8_[2] = _tmp2_;
+       _tmp8_[3] = _tmp3_;
+       _tmp8_[4] = _tmp4_;
+       _tmp8_[5] = _tmp5_;
+       _tmp8_[6] = _tmp6_;
+       _tmp8_[7] = _tmp7_;
+       _tmp9_ = _tmp8_;
+       _tmp9__length1 = 2;
+       _tmp9__length2 = 2;
+       _tmp9__length3 = 2;
+       if (result_length1) {
+               *result_length1 = _tmp9__length1;
+       }
+       if (result_length2) {
+               *result_length2 = _tmp9__length2;
+       }
+       if (result_length3) {
+               *result_length3 = _tmp9__length3;
+       }
+       result = _tmp9_;
+       return result;
+}
+
+Test*
+test_construct (GType object_type)
+{
+       Test * self = NULL;
+       self = (Test*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Test*
+test_new (void)
+{
+       return test_construct (TYPE_TEST);
+}
+
+static void
+test_class_init (TestClass * klass,
+                 gpointer klass_data)
+{
+       test_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+test_instance_init (Test * self,
+                    gpointer klass)
+{
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Test), 
0, (GInstanceInitFunc) test_instance_init, NULL };
+       GType test_type_id;
+       test_type_id = g_type_register_static (G_TYPE_OBJECT, "Test", &g_define_type_info, 0);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_register_object);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+static void
+_dbus_test_array (Test* self,
+                  GVariant* _parameters_,
+                  GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       gdouble* result;
+       gint result_length1 = 0;
+       gdouble* _tmp0_;
+       GVariantBuilder _tmp1_;
+       gint _tmp2_;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       result = test_array (self, &result_length1);
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _tmp0_ = result;
+       g_variant_builder_init (&_tmp1_, G_VARIANT_TYPE ("ad"));
+       for (_tmp2_ = 0; _tmp2_ < result_length1; _tmp2_++) {
+               g_variant_builder_add_value (&_tmp1_, g_variant_new_double (*_tmp0_));
+               _tmp0_++;
+       }
+       g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp1_));
+       result = (g_free (result), NULL);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+}
+
+static void
+_dbus_test_multi_array (Test* self,
+                        GVariant* _parameters_,
+                        GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       gdouble* result;
+       gint result_length1 = 0;
+       gint result_length2 = 0;
+       gdouble* _tmp3_;
+       GVariantBuilder _tmp4_;
+       gint _tmp5_;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       result = test_multi_array (self, &result_length1, &result_length2);
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _tmp3_ = result;
+       g_variant_builder_init (&_tmp4_, G_VARIANT_TYPE ("aad"));
+       for (_tmp5_ = 0; _tmp5_ < result_length1; _tmp5_++) {
+               GVariantBuilder _tmp6_;
+               gint _tmp7_;
+               g_variant_builder_init (&_tmp6_, G_VARIANT_TYPE ("ad"));
+               for (_tmp7_ = 0; _tmp7_ < result_length2; _tmp7_++) {
+                       g_variant_builder_add_value (&_tmp6_, g_variant_new_double (*_tmp3_));
+                       _tmp3_++;
+               }
+               g_variant_builder_add_value (&_tmp4_, g_variant_builder_end (&_tmp6_));
+       }
+       g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp4_));
+       result = (g_free (result), NULL);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+}
+
+static void
+_dbus_test_multi_array2 (Test* self,
+                         GVariant* _parameters_,
+                         GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       gchar** result;
+       gint result_length1 = 0;
+       gint result_length2 = 0;
+       gint result_length3 = 0;
+       gchar** _tmp8_;
+       GVariantBuilder _tmp9_;
+       gint _tmp10_;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       result = test_multi_array2 (self, &result_length1, &result_length2, &result_length3);
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _tmp8_ = result;
+       g_variant_builder_init (&_tmp9_, G_VARIANT_TYPE ("aaas"));
+       for (_tmp10_ = 0; _tmp10_ < result_length1; _tmp10_++) {
+               GVariantBuilder _tmp11_;
+               gint _tmp12_;
+               g_variant_builder_init (&_tmp11_, G_VARIANT_TYPE ("aas"));
+               for (_tmp12_ = 0; _tmp12_ < result_length2; _tmp12_++) {
+                       GVariantBuilder _tmp13_;
+                       gint _tmp14_;
+                       g_variant_builder_init (&_tmp13_, G_VARIANT_TYPE ("as"));
+                       for (_tmp14_ = 0; _tmp14_ < result_length3; _tmp14_++) {
+                               g_variant_builder_add_value (&_tmp13_, g_variant_new_string (*_tmp8_));
+                               _tmp8_++;
+                       }
+                       g_variant_builder_add_value (&_tmp11_, g_variant_builder_end (&_tmp13_));
+               }
+               g_variant_builder_add_value (&_tmp9_, g_variant_builder_end (&_tmp11_));
+       }
+       g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp9_));
+       result = (_vala_array_free (result, (result_length1 * result_length2) * result_length3, 
(GDestroyNotify) g_free), NULL);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* method_name,
+                                 GVariant* parameters,
+                                 GDBusMethodInvocation* invocation,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "Array") == 0) {
+               _dbus_test_array (object, parameters, invocation);
+       } else if (strcmp (method_name, "MultiArray") == 0) {
+               _dbus_test_multi_array (object, parameters, invocation);
+       } else if (strcmp (method_name, "MultiArray2") == 0) {
+               _dbus_test_multi_array2 (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return NULL;
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GVariant* value,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return FALSE;
+}
+
+guint
+test_register_object (gpointer object,
+                      GDBusConnection* connection,
+                      const gchar* path,
+                      GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+void
+client_exit (GPid pid,
+             gint status)
+{
+       GMainLoop* _tmp0_;
+       _vala_assert (status == 0, "status == 0");
+       _tmp0_ = main_loop;
+       g_main_loop_quit (_tmp0_);
+}
+
+static guint
+_variant_get1 (GVariant* value)
+{
+       return g_variant_get_uint32 (value);
+}
+
+static void
+_client_exit_gchild_watch_func (GPid pid,
+                                gint wait_status,
+                                gpointer self)
+{
+       client_exit (pid, wait_status);
+}
+
+static void
+_vala_main (void)
+{
+       GDBusConnection* conn = NULL;
+       GDBusConnection* _tmp0_;
+       GDBusConnection* _tmp1_;
+       Test* _tmp2_;
+       Test* _tmp3_;
+       GVariant* request_result = NULL;
+       GDBusConnection* _tmp4_;
+       GVariant* _tmp5_;
+       GVariant* _tmp6_;
+       GVariant* _tmp7_;
+       GVariant* _tmp8_;
+       GVariant* _tmp9_;
+       GVariant* _tmp10_;
+       GVariant* _tmp11_;
+       guint _tmp12_;
+       GPid client_pid = 0;
+       gchar* _tmp13_;
+       gchar** _tmp14_;
+       gchar** _tmp15_;
+       gint _tmp15__length1;
+       GPid _tmp16_ = 0;
+       GMainLoop* _tmp17_;
+       GMainLoop* _tmp18_;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &_inner_error0_);
+       conn = _tmp0_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp1_ = conn;
+       _tmp2_ = test_new ();
+       _tmp3_ = _tmp2_;
+       test_register_object (_tmp3_, _tmp1_, "/org/example/test", &_inner_error0_);
+       _g_object_unref0 (_tmp3_);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp4_ = conn;
+       _tmp5_ = g_variant_new ("(su)", "org.example.Test", 0x4, NULL);
+       g_variant_ref_sink (_tmp5_);
+       _tmp6_ = _tmp5_;
+       _tmp7_ = g_dbus_connection_call_sync (_tmp4_, "org.freedesktop.DBus", "/org/freedesktop/DBus", 
"org.freedesktop.DBus", "RequestName", _tmp6_, NULL, 0, -1, NULL, &_inner_error0_);
+       _tmp8_ = _tmp7_;
+       _g_variant_unref0 (_tmp6_);
+       request_result = _tmp8_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp9_ = request_result;
+       _tmp10_ = g_variant_get_child_value (_tmp9_, (gsize) 0);
+       _tmp11_ = _tmp10_;
+       _tmp12_ = _variant_get1 (_tmp11_);
+       _vala_assert (_tmp12_ == ((guint) 1), "(uint) request_result.get_child_value (0) == 1");
+       _g_variant_unref0 (_tmp11_);
+       _tmp13_ = g_strdup ("dbus_bug735437_client");
+       _tmp14_ = g_new0 (gchar*, 1 + 1);
+       _tmp14_[0] = _tmp13_;
+       _tmp15_ = _tmp14_;
+       _tmp15__length1 = 1;
+       g_spawn_async (NULL, _tmp15_, NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &_tmp16_, &_inner_error0_);
+       client_pid = _tmp16_;
+       _tmp15_ = (_vala_array_free (_tmp15_, _tmp15__length1, (GDestroyNotify) g_free), NULL);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_variant_unref0 (request_result);
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       g_child_watch_add_full (G_PRIORITY_DEFAULT_IDLE, client_pid, _client_exit_gchild_watch_func, NULL, 
NULL);
+       _tmp17_ = g_main_loop_new (NULL, FALSE);
+       _g_main_loop_unref0 (main_loop);
+       main_loop = _tmp17_;
+       _tmp18_ = main_loop;
+       g_main_loop_run (_tmp18_);
+       _g_variant_unref0 (request_result);
+       _g_object_unref0 (conn);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/dbus/bug782719_client.c-expected b/tests/dbus/bug782719_client.c-expected
new file mode 100644
index 000000000..a5883c89f
--- /dev/null
+++ b/tests/dbus/bug782719_client.c-expected
@@ -0,0 +1,527 @@
+/* dbus_bug782719_client.c generated by valac, the Vala compiler
+ * generated from dbus_bug782719_client.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define TEST_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_TEST, TestIface))
+
+typedef struct _Test Test;
+typedef struct _TestIface TestIface;
+
+#define TYPE_TEST_PROXY (test_proxy_get_type ())
+typedef GDBusProxy TestProxy;
+typedef GDBusProxyClass TestProxyClass;
+#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _TestIface {
+       GTypeInterface parent_iface;
+       GHashTable* (*test_nested_dict) (Test* self, GError** error);
+};
+
+VALA_EXTERN GType test_proxy_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN guint test_register_object (void* object,
+                            GDBusConnection* connection,
+                            const gchar* path,
+                            GError** error);
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN GHashTable* test_test_nested_dict (Test* self,
+                                   GError** error);
+static GType test_get_type_once (void);
+static void test_proxy_g_signal (GDBusProxy* proxy,
+                          const gchar* sender_name,
+                          const gchar* signal_name,
+                          GVariant* parameters);
+static GHashTable* test_proxy_test_nested_dict (Test* self,
+                                         GError** error);
+static void test_proxy_test_interface_init (TestIface* iface);
+static void _dbus_test_test_nested_dict (Test* self,
+                                  GVariant* _parameters_,
+                                  GDBusMethodInvocation* invocation);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* method_name,
+                                      GVariant* parameters,
+                                      GDBusMethodInvocation* invocation,
+                                      gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+                                            const gchar* sender,
+                                            const gchar* object_path,
+                                            const gchar* interface_name,
+                                            const gchar* property_name,
+                                            GError** error,
+                                            gpointer user_data);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GVariant* value,
+                                           GError** error,
+                                           gpointer user_data);
+static void _test_unregister_object (gpointer user_data);
+static void _vala_main (void);
+static gchar** _variant_get1 (GVariant* value,
+                       gint* result_length1);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static const GDBusArgInfo _test_dbus_arg_info_test_nested_dict_result = {-1, "result", "a{sa{sv}}", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_nested_dict_in[] = {NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_nested_dict_out[] = 
{&_test_dbus_arg_info_test_nested_dict_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_nested_dict = {-1, "TestNestedDict", (GDBusArgInfo 
**) (&_test_dbus_arg_info_test_nested_dict_in), (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_nested_dict_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_test_nested_dict, 
NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = {NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) 
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, 
test_dbus_interface_get_property, test_dbus_interface_set_property};
+
+GHashTable*
+test_test_nested_dict (Test* self,
+                       GError** error)
+{
+       TestIface* _iface_;
+       g_return_val_if_fail (IS_TEST (self), NULL);
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->test_nested_dict) {
+               return _iface_->test_nested_dict (self, error);
+       }
+       return NULL;
+}
+
+static void
+test_default_init (TestIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType test_type_id;
+       test_type_id = g_type_register_static (G_TYPE_INTERFACE, "Test", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (test_type_id, G_TYPE_OBJECT);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) 
test_proxy_get_type);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), 
"org.example.Test");
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*) 
(&_test_dbus_interface_info));
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_register_object);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_TEST, 
test_proxy_test_interface_init) )
+static void
+test_proxy_class_init (TestProxyClass* klass)
+{
+       G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal;
+}
+
+static void
+test_proxy_g_signal (GDBusProxy* proxy,
+                     const gchar* sender_name,
+                     const gchar* signal_name,
+                     GVariant* parameters)
+{
+}
+
+static void
+test_proxy_init (TestProxy* self)
+{
+       g_dbus_proxy_set_interface_info (G_DBUS_PROXY (self), (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info));
+}
+
+static GHashTable*
+test_proxy_test_nested_dict (Test* self,
+                             GError** error)
+{
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       GDBusMessage *_reply_message;
+       GVariant *_reply;
+       GVariantIter _reply_iter;
+       GHashTable* _result = NULL;
+       GVariant* _tmp0_;
+       GHashTable* _tmp1_;
+       GVariantIter _tmp2_;
+       GVariant* _tmp3_;
+       GVariant* _tmp4_;
+       G_IO_ERROR;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "TestNestedDict");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       _reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout 
((GDBusProxy *) self), NULL, NULL, error);
+       g_object_unref (_message);
+       if (!_reply_message) {
+               return NULL;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, error)) {
+               g_object_unref (_reply_message);
+               return NULL;
+       }
+       _reply = g_dbus_message_get_body (_reply_message);
+       g_variant_iter_init (&_reply_iter, _reply);
+       _tmp0_ = g_variant_iter_next_value (&_reply_iter);
+       _tmp1_ = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_hash_table_unref);
+       g_variant_iter_init (&_tmp2_, _tmp0_);
+       while (g_variant_iter_loop (&_tmp2_, "{?*}", &_tmp3_, &_tmp4_)) {
+               GHashTable* _tmp5_;
+               GVariantIter _tmp6_;
+               GVariant* _tmp7_;
+               GVariant* _tmp8_;
+               _tmp5_ = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) 
g_variant_unref);
+               g_variant_iter_init (&_tmp6_, _tmp4_);
+               while (g_variant_iter_loop (&_tmp6_, "{?*}", &_tmp7_, &_tmp8_)) {
+                       g_hash_table_insert (_tmp5_, g_variant_dup_string (_tmp7_, NULL), 
g_variant_get_variant (_tmp8_));
+               }
+               g_hash_table_insert (_tmp1_, g_variant_dup_string (_tmp3_, NULL), _tmp5_);
+       }
+       _result = _tmp1_;
+       g_variant_unref (_tmp0_);
+       g_object_unref (_reply_message);
+       return _result;
+}
+
+static void
+test_proxy_test_interface_init (TestIface* iface)
+{
+       iface->test_nested_dict = test_proxy_test_nested_dict;
+}
+
+static void
+_dbus_test_test_nested_dict (Test* self,
+                             GVariant* _parameters_,
+                             GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       GHashTable* result;
+       GVariantBuilder _tmp9_;
+       GHashTableIter _tmp10_;
+       gpointer _tmp11_;
+       gpointer _tmp12_;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       result = test_test_nested_dict (self, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               return;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       g_hash_table_iter_init (&_tmp10_, result);
+       g_variant_builder_init (&_tmp9_, G_VARIANT_TYPE ("a{sa{sv}}"));
+       while (g_hash_table_iter_next (&_tmp10_, &_tmp11_, &_tmp12_)) {
+               gchar* _key;
+               GHashTable* _value;
+               GVariantBuilder _tmp13_;
+               GHashTableIter _tmp14_;
+               gpointer _tmp15_;
+               gpointer _tmp16_;
+               _key = (gchar*) _tmp11_;
+               _value = (GHashTable*) _tmp12_;
+               g_hash_table_iter_init (&_tmp14_, _value);
+               g_variant_builder_init (&_tmp13_, G_VARIANT_TYPE ("a{sv}"));
+               while (g_hash_table_iter_next (&_tmp14_, &_tmp15_, &_tmp16_)) {
+                       gchar* _key;
+                       GVariant* _value;
+                       _key = (gchar*) _tmp15_;
+                       _value = (GVariant*) _tmp16_;
+                       g_variant_builder_add (&_tmp13_, "{?*}", g_variant_new_string (_key), 
g_variant_new_variant (_value));
+               }
+               g_variant_builder_add (&_tmp9_, "{?*}", g_variant_new_string (_key), g_variant_builder_end 
(&_tmp13_));
+       }
+       g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp9_));
+       _g_hash_table_unref0 (result);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* method_name,
+                                 GVariant* parameters,
+                                 GDBusMethodInvocation* invocation,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "TestNestedDict") == 0) {
+               _dbus_test_test_nested_dict (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return NULL;
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GVariant* value,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return FALSE;
+}
+
+guint
+test_register_object (gpointer object,
+                      GDBusConnection* connection,
+                      const gchar* path,
+                      GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+static gpointer
+_g_hash_table_ref0 (gpointer self)
+{
+       return self ? g_hash_table_ref (self) : NULL;
+}
+
+static gpointer
+_g_variant_ref0 (gpointer self)
+{
+       return self ? g_variant_ref (self) : NULL;
+}
+
+static gchar**
+_variant_get1 (GVariant* value,
+               gint* result_length1)
+{
+       gchar** _tmp14_;
+       gint _tmp14__length;
+       gint _tmp14__size;
+       gint _tmp14__length1;
+       GVariantIter _tmp15_;
+       GVariant* _tmp16_;
+       _tmp14_ = g_new (gchar*, 5);
+       _tmp14__length = 0;
+       _tmp14__size = 4;
+       _tmp14__length1 = 0;
+       g_variant_iter_init (&_tmp15_, value);
+       for (; (_tmp16_ = g_variant_iter_next_value (&_tmp15_)) != NULL; _tmp14__length1++) {
+               if (_tmp14__size == _tmp14__length) {
+                       _tmp14__size = 2 * _tmp14__size;
+                       _tmp14_ = g_renew (gchar*, _tmp14_, _tmp14__size + 1);
+               }
+               _tmp14_[_tmp14__length++] = g_variant_dup_string (_tmp16_, NULL);
+               g_variant_unref (_tmp16_);
+       }
+       *result_length1 = _tmp14__length1;
+       _tmp14_[_tmp14__length] = NULL;
+       return _tmp14_;
+}
+
+static void
+_vala_main (void)
+{
+       Test* test = NULL;
+       Test* _tmp0_;
+       GHashTable* dict = NULL;
+       Test* _tmp1_;
+       GHashTable* _tmp2_;
+       GHashTable* _tmp3_;
+       GHashTable* nested_dict = NULL;
+       GHashTable* _tmp4_;
+       gconstpointer _tmp5_;
+       GHashTable* _tmp6_;
+       GHashTable* _tmp7_;
+       GVariant* v = NULL;
+       GHashTable* _tmp8_;
+       gconstpointer _tmp9_;
+       GVariant* _tmp10_;
+       GVariant* _tmp11_;
+       gchar** s = NULL;
+       GVariant* _tmp12_;
+       gchar** _tmp13_ = NULL;
+       gint _tmp13__length1 = 0;
+       gint s_length1;
+       gint _s_size_;
+       gboolean _tmp17_ = FALSE;
+       gchar** _tmp18_;
+       gint _tmp18__length1;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = (Test*) g_initable_new (TYPE_TEST_PROXY, NULL, &_inner_error0_, "g-flags", 0, "g-name", 
"org.example.Test", "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/example/test", 
"g-interface-name", "org.example.Test", NULL);
+       test = (Test*) _tmp0_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp1_ = test;
+       _tmp2_ = test_test_nested_dict (_tmp1_, &_inner_error0_);
+       dict = _tmp2_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (test);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp3_ = dict;
+       _vala_assert (g_hash_table_size (_tmp3_) == ((guint) 1), "dict.size () == 1");
+       _tmp4_ = dict;
+       _tmp5_ = g_hash_table_lookup (_tmp4_, "hello");
+       _tmp6_ = _g_hash_table_ref0 ((GHashTable*) _tmp5_);
+       nested_dict = _tmp6_;
+       _tmp7_ = nested_dict;
+       _vala_assert (_tmp7_ != NULL, "nested_dict != null");
+       _tmp8_ = nested_dict;
+       _tmp9_ = g_hash_table_lookup (_tmp8_, "hello");
+       _tmp10_ = _g_variant_ref0 ((GVariant*) _tmp9_);
+       v = _tmp10_;
+       _tmp11_ = v;
+       _vala_assert (_tmp11_ != NULL, "v != null");
+       _tmp12_ = v;
+       _tmp13_ = _variant_get1 (_tmp12_, &_tmp13__length1);
+       s = _tmp13_;
+       s_length1 = _tmp13__length1;
+       _s_size_ = s_length1;
+       _tmp18_ = s;
+       _tmp18__length1 = s_length1;
+       if (_tmp18__length1 == 1) {
+               gchar** _tmp19_;
+               gint _tmp19__length1;
+               const gchar* _tmp20_;
+               _tmp19_ = s;
+               _tmp19__length1 = s_length1;
+               _tmp20_ = _tmp19_[0];
+               _tmp17_ = g_strcmp0 (_tmp20_, "hello") == 0;
+       } else {
+               _tmp17_ = FALSE;
+       }
+       _vala_assert (_tmp17_, "s.length == 1 && s[0] == \"hello\"");
+       s = (_vala_array_free (s, s_length1, (GDestroyNotify) g_free), NULL);
+       _g_variant_unref0 (v);
+       _g_hash_table_unref0 (nested_dict);
+       _g_hash_table_unref0 (dict);
+       _g_object_unref0 (test);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/dbus/bug782719_server.c-expected b/tests/dbus/bug782719_server.c-expected
new file mode 100644
index 000000000..1022c606e
--- /dev/null
+++ b/tests/dbus/bug782719_server.c-expected
@@ -0,0 +1,535 @@
+/* dbus_bug782719_server.c generated by valac, the Vala compiler
+ * generated from dbus_bug782719_server.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TEST, TestClass))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define IS_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TEST))
+#define TEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TEST, TestClass))
+
+typedef struct _Test Test;
+typedef struct _TestClass TestClass;
+typedef struct _TestPrivate TestPrivate;
+enum  {
+       TEST_0_PROPERTY,
+       TEST_NUM_PROPERTIES
+};
+static GParamSpec* test_properties[TEST_NUM_PROPERTIES];
+#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Test {
+       GObject parent_instance;
+       TestPrivate * priv;
+};
+
+struct _TestClass {
+       GObjectClass parent_class;
+};
+
+static gpointer test_parent_class = NULL;
+VALA_EXTERN GMainLoop* main_loop;
+GMainLoop* main_loop = NULL;
+
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
+VALA_EXTERN guint test_register_object (void* object,
+                            GDBusConnection* connection,
+                            const gchar* path,
+                            GError** error);
+VALA_EXTERN GHashTable* test_test_nested_dict (Test* self);
+static void _g_free0_ (gpointer var);
+static void _g_variant_unref0_ (gpointer var);
+static GVariant* _variant_new1 (gchar** value,
+                         gint value_length1);
+static void _g_hash_table_unref0_ (gpointer var);
+VALA_EXTERN Test* test_new (void);
+VALA_EXTERN Test* test_construct (GType object_type);
+static GType test_get_type_once (void);
+static void _dbus_test_test_nested_dict (Test* self,
+                                  GVariant* _parameters_,
+                                  GDBusMethodInvocation* invocation);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* method_name,
+                                      GVariant* parameters,
+                                      GDBusMethodInvocation* invocation,
+                                      gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+                                            const gchar* sender,
+                                            const gchar* object_path,
+                                            const gchar* interface_name,
+                                            const gchar* property_name,
+                                            GError** error,
+                                            gpointer user_data);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GVariant* value,
+                                           GError** error,
+                                           gpointer user_data);
+static void _test_unregister_object (gpointer user_data);
+VALA_EXTERN void client_exit (GPid pid,
+                  gint status);
+static void _vala_main (void);
+static guint _variant_get1 (GVariant* value);
+static void _client_exit_gchild_watch_func (GPid pid,
+                                     gint wait_status,
+                                     gpointer self);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static const GDBusArgInfo _test_dbus_arg_info_test_nested_dict_result = {-1, "result", "a{sa{sv}}", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_nested_dict_in[] = {NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_nested_dict_out[] = 
{&_test_dbus_arg_info_test_nested_dict_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_nested_dict = {-1, "TestNestedDict", (GDBusArgInfo 
**) (&_test_dbus_arg_info_test_nested_dict_in), (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_nested_dict_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_test_nested_dict, 
NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = {NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) 
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, 
test_dbus_interface_get_property, test_dbus_interface_set_property};
+
+static void
+_g_free0_ (gpointer var)
+{
+       var = (g_free (var), NULL);
+}
+
+static void
+_g_variant_unref0_ (gpointer var)
+{
+       (var == NULL) ? NULL : (var = (g_variant_unref (var), NULL));
+}
+
+static GVariant*
+_variant_new1 (gchar** value,
+               gint value_length1)
+{
+       gchar** _tmp5_;
+       GVariantBuilder _tmp6_;
+       gint _tmp7_;
+       _tmp5_ = value;
+       g_variant_builder_init (&_tmp6_, G_VARIANT_TYPE ("as"));
+       for (_tmp7_ = 0; _tmp7_ < value_length1; _tmp7_++) {
+               g_variant_builder_add_value (&_tmp6_, g_variant_new_string (*_tmp5_));
+               _tmp5_++;
+       }
+       return g_variant_ref_sink (g_variant_builder_end (&_tmp6_));
+}
+
+static void
+_g_hash_table_unref0_ (gpointer var)
+{
+       (var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL));
+}
+
+static gpointer
+_g_hash_table_ref0 (gpointer self)
+{
+       return self ? g_hash_table_ref (self) : NULL;
+}
+
+GHashTable*
+test_test_nested_dict (Test* self)
+{
+       gchar** s = NULL;
+       gchar* _tmp0_;
+       gchar** _tmp1_;
+       gint s_length1;
+       gint _s_size_;
+       GHashTable* nested_dict = NULL;
+       GHashFunc _tmp2_;
+       GHashTable* _tmp3_;
+       gchar* _tmp4_;
+       GVariant* _tmp8_;
+       GHashTable* dict = NULL;
+       GHashFunc _tmp9_;
+       GHashTable* _tmp10_;
+       gchar* _tmp11_;
+       GHashTable* _tmp12_;
+       GHashTable* result = NULL;
+       g_return_val_if_fail (IS_TEST (self), NULL);
+       _tmp0_ = g_strdup ("hello");
+       _tmp1_ = g_new0 (gchar*, 1 + 1);
+       _tmp1_[0] = _tmp0_;
+       s = _tmp1_;
+       s_length1 = 1;
+       _s_size_ = s_length1;
+       _tmp2_ = g_str_hash;
+       _tmp3_ = g_hash_table_new_full (_tmp2_, NULL, _g_free0_, _g_variant_unref0_);
+       nested_dict = _tmp3_;
+       _tmp4_ = g_strdup ("hello");
+       _tmp8_ = _variant_new1 (s, s_length1);
+       g_hash_table_insert (nested_dict, _tmp4_, _tmp8_);
+       _tmp9_ = g_str_hash;
+       _tmp10_ = g_hash_table_new_full (_tmp9_, NULL, _g_free0_, _g_hash_table_unref0_);
+       dict = _tmp10_;
+       _tmp11_ = g_strdup ("hello");
+       _tmp12_ = _g_hash_table_ref0 (nested_dict);
+       g_hash_table_insert (dict, _tmp11_, _tmp12_);
+       result = dict;
+       _g_hash_table_unref0 (nested_dict);
+       s = (_vala_array_free (s, s_length1, (GDestroyNotify) g_free), NULL);
+       return result;
+}
+
+Test*
+test_construct (GType object_type)
+{
+       Test * self = NULL;
+       self = (Test*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Test*
+test_new (void)
+{
+       return test_construct (TYPE_TEST);
+}
+
+static void
+test_class_init (TestClass * klass,
+                 gpointer klass_data)
+{
+       test_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+test_instance_init (Test * self,
+                    gpointer klass)
+{
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Test), 
0, (GInstanceInitFunc) test_instance_init, NULL };
+       GType test_type_id;
+       test_type_id = g_type_register_static (G_TYPE_OBJECT, "Test", &g_define_type_info, 0);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_register_object);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+static void
+_dbus_test_test_nested_dict (Test* self,
+                             GVariant* _parameters_,
+                             GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       GHashTable* result;
+       GVariantBuilder _tmp0_;
+       GHashTableIter _tmp1_;
+       gpointer _tmp2_;
+       gpointer _tmp3_;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       result = test_test_nested_dict (self);
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       g_hash_table_iter_init (&_tmp1_, result);
+       g_variant_builder_init (&_tmp0_, G_VARIANT_TYPE ("a{sa{sv}}"));
+       while (g_hash_table_iter_next (&_tmp1_, &_tmp2_, &_tmp3_)) {
+               gchar* _key;
+               GHashTable* _value;
+               GVariantBuilder _tmp4_;
+               GHashTableIter _tmp5_;
+               gpointer _tmp6_;
+               gpointer _tmp7_;
+               _key = (gchar*) _tmp2_;
+               _value = (GHashTable*) _tmp3_;
+               g_hash_table_iter_init (&_tmp5_, _value);
+               g_variant_builder_init (&_tmp4_, G_VARIANT_TYPE ("a{sv}"));
+               while (g_hash_table_iter_next (&_tmp5_, &_tmp6_, &_tmp7_)) {
+                       gchar* _key;
+                       GVariant* _value;
+                       _key = (gchar*) _tmp6_;
+                       _value = (GVariant*) _tmp7_;
+                       g_variant_builder_add (&_tmp4_, "{?*}", g_variant_new_string (_key), 
g_variant_new_variant (_value));
+               }
+               g_variant_builder_add (&_tmp0_, "{?*}", g_variant_new_string (_key), g_variant_builder_end 
(&_tmp4_));
+       }
+       g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp0_));
+       _g_hash_table_unref0 (result);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* method_name,
+                                 GVariant* parameters,
+                                 GDBusMethodInvocation* invocation,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "TestNestedDict") == 0) {
+               _dbus_test_test_nested_dict (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return NULL;
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GVariant* value,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return FALSE;
+}
+
+guint
+test_register_object (gpointer object,
+                      GDBusConnection* connection,
+                      const gchar* path,
+                      GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+void
+client_exit (GPid pid,
+             gint status)
+{
+       GMainLoop* _tmp0_;
+       _vala_assert (status == 0, "status == 0");
+       _tmp0_ = main_loop;
+       g_main_loop_quit (_tmp0_);
+}
+
+static guint
+_variant_get1 (GVariant* value)
+{
+       return g_variant_get_uint32 (value);
+}
+
+static void
+_client_exit_gchild_watch_func (GPid pid,
+                                gint wait_status,
+                                gpointer self)
+{
+       client_exit (pid, wait_status);
+}
+
+static void
+_vala_main (void)
+{
+       GDBusConnection* conn = NULL;
+       GDBusConnection* _tmp0_;
+       GDBusConnection* _tmp1_;
+       Test* _tmp2_;
+       Test* _tmp3_;
+       GVariant* request_result = NULL;
+       GDBusConnection* _tmp4_;
+       GVariant* _tmp5_;
+       GVariant* _tmp6_;
+       GVariant* _tmp7_;
+       GVariant* _tmp8_;
+       GVariant* _tmp9_;
+       GVariant* _tmp10_;
+       GVariant* _tmp11_;
+       guint _tmp12_;
+       GPid client_pid = 0;
+       gchar* _tmp13_;
+       gchar** _tmp14_;
+       gchar** _tmp15_;
+       gint _tmp15__length1;
+       GPid _tmp16_ = 0;
+       GMainLoop* _tmp17_;
+       GMainLoop* _tmp18_;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &_inner_error0_);
+       conn = _tmp0_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp1_ = conn;
+       _tmp2_ = test_new ();
+       _tmp3_ = _tmp2_;
+       test_register_object (_tmp3_, _tmp1_, "/org/example/test", &_inner_error0_);
+       _g_object_unref0 (_tmp3_);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp4_ = conn;
+       _tmp5_ = g_variant_new ("(su)", "org.example.Test", 0x4, NULL);
+       g_variant_ref_sink (_tmp5_);
+       _tmp6_ = _tmp5_;
+       _tmp7_ = g_dbus_connection_call_sync (_tmp4_, "org.freedesktop.DBus", "/org/freedesktop/DBus", 
"org.freedesktop.DBus", "RequestName", _tmp6_, NULL, 0, -1, NULL, &_inner_error0_);
+       _tmp8_ = _tmp7_;
+       _g_variant_unref0 (_tmp6_);
+       request_result = _tmp8_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp9_ = request_result;
+       _tmp10_ = g_variant_get_child_value (_tmp9_, (gsize) 0);
+       _tmp11_ = _tmp10_;
+       _tmp12_ = _variant_get1 (_tmp11_);
+       _vala_assert (_tmp12_ == ((guint) 1), "(uint) request_result.get_child_value (0) == 1");
+       _g_variant_unref0 (_tmp11_);
+       _tmp13_ = g_strdup ("dbus_bug782719_client");
+       _tmp14_ = g_new0 (gchar*, 1 + 1);
+       _tmp14_[0] = _tmp13_;
+       _tmp15_ = _tmp14_;
+       _tmp15__length1 = 1;
+       g_spawn_async (NULL, _tmp15_, NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &_tmp16_, &_inner_error0_);
+       client_pid = _tmp16_;
+       _tmp15_ = (_vala_array_free (_tmp15_, _tmp15__length1, (GDestroyNotify) g_free), NULL);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_variant_unref0 (request_result);
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       g_child_watch_add_full (G_PRIORITY_DEFAULT_IDLE, client_pid, _client_exit_gchild_watch_func, NULL, 
NULL);
+       _tmp17_ = g_main_loop_new (NULL, FALSE);
+       _g_main_loop_unref0 (main_loop);
+       main_loop = _tmp17_;
+       _tmp18_ = main_loop;
+       g_main_loop_run (_tmp18_);
+       _g_variant_unref0 (request_result);
+       _g_object_unref0 (conn);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/dbus/bug783002_client.c-expected b/tests/dbus/bug783002_client.c-expected
new file mode 100644
index 000000000..f87ad4c6a
--- /dev/null
+++ b/tests/dbus/bug783002_client.c-expected
@@ -0,0 +1,633 @@
+/* dbus_bug783002_client.c generated by valac, the Vala compiler
+ * generated from dbus_bug783002_client.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define TEST_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_TEST, TestIface))
+
+typedef struct _Test Test;
+typedef struct _TestIface TestIface;
+
+#define TYPE_TEST_PROXY (test_proxy_get_type ())
+typedef GDBusProxy TestProxy;
+typedef GDBusProxyClass TestProxyClass;
+typedef struct _TestTestArrayLifetimeReadyData TestTestArrayLifetimeReadyData;
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+typedef struct _RunData RunData;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _TestIface {
+       GTypeInterface parent_iface;
+       void (*test_array_lifetime) (Test* self, gchar** items, gint items_length1, GAsyncReadyCallback 
_callback_, gpointer _user_data_);
+       gchar* (*test_array_lifetime_finish) (Test* self, GAsyncResult* _res_, GError** error);
+};
+
+struct _TestTestArrayLifetimeReadyData {
+       GDBusMethodInvocation* _invocation_;
+       gchar** items;
+       gint items_length1;
+};
+
+struct _RunData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Test* test;
+       Test* _tmp0_;
+       gchar* _result_;
+       Test* _tmp1_;
+       gchar* _tmp2_;
+       gchar* _tmp3_;
+       gchar* _tmp4_;
+       gchar** _tmp5_;
+       gchar** _tmp6_;
+       gint _tmp6__length1;
+       gchar* _tmp7_;
+       gchar* _tmp8_;
+       const gchar* _tmp9_;
+       GMainLoop* _tmp10_;
+       GError* _inner_error0_;
+};
+
+VALA_EXTERN GMainLoop* main_loop;
+GMainLoop* main_loop = NULL;
+
+VALA_EXTERN GType test_proxy_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN guint test_register_object (void* object,
+                            GDBusConnection* connection,
+                            const gchar* path,
+                            GError** error);
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN void test_test_array_lifetime (Test* self,
+                               gchar** items,
+                               gint items_length1,
+                               GAsyncReadyCallback _callback_,
+                               gpointer _user_data_);
+VALA_EXTERN gchar* test_test_array_lifetime_finish (Test* self,
+                                        GAsyncResult* _res_,
+                                        GError** error);
+static GType test_get_type_once (void);
+static void test_proxy_g_signal (GDBusProxy* proxy,
+                          const gchar* sender_name,
+                          const gchar* signal_name,
+                          GVariant* parameters);
+static void _vala_g_async_ready_callback (GObject *source_object,
+                                   GAsyncResult *res,
+                                   void *user_data);
+static void test_proxy_test_array_lifetime_async (Test* self,
+                                           gchar** items,
+                                           gint items_length1,
+                                           GAsyncReadyCallback _callback_,
+                                           gpointer _user_data_);
+static gchar* test_proxy_test_array_lifetime_finish (Test* self,
+                                              GAsyncResult* _res_,
+                                              GError** error);
+static void test_proxy_test_interface_init (TestIface* iface);
+static void _dbus_test_test_array_lifetime (Test* self,
+                                     GVariant* _parameters_,
+                                     GDBusMethodInvocation* invocation);
+static void _dbus_test_test_array_lifetime_ready (GObject * source_object,
+                                           GAsyncResult * _res_,
+                                           gpointer _user_data_);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* method_name,
+                                      GVariant* parameters,
+                                      GDBusMethodInvocation* invocation,
+                                      gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+                                            const gchar* sender,
+                                            const gchar* object_path,
+                                            const gchar* interface_name,
+                                            const gchar* property_name,
+                                            GError** error,
+                                            gpointer user_data);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GVariant* value,
+                                           GError** error,
+                                           gpointer user_data);
+static void _test_unregister_object (gpointer user_data);
+static void _vala_main (void);
+VALA_EXTERN void run (GAsyncReadyCallback _callback_,
+          gpointer _user_data_);
+VALA_EXTERN void run_finish (GAsyncResult* _res_);
+static void run_data_free (gpointer _data);
+static gboolean run_co (RunData* _data_);
+static void run_ready (GObject* source_object,
+                GAsyncResult* _res_,
+                gpointer _user_data_);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static const GDBusArgInfo _test_dbus_arg_info_test_array_lifetime_items = {-1, "items", "as", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_array_lifetime_result = {-1, "result", "s", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_array_lifetime_in[] = 
{&_test_dbus_arg_info_test_array_lifetime_items, NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_array_lifetime_out[] = 
{&_test_dbus_arg_info_test_array_lifetime_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_array_lifetime = {-1, "TestArrayLifetime", 
(GDBusArgInfo **) (&_test_dbus_arg_info_test_array_lifetime_in), (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_array_lifetime_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = 
{&_test_dbus_method_info_test_array_lifetime, NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = {NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) 
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, 
test_dbus_interface_get_property, test_dbus_interface_set_property};
+
+void
+test_test_array_lifetime (Test* self,
+                          gchar** items,
+                          gint items_length1,
+                          GAsyncReadyCallback _callback_,
+                          gpointer _user_data_)
+{
+       TestIface* _iface_;
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->test_array_lifetime) {
+               _iface_->test_array_lifetime (self, items, items_length1, _callback_, _user_data_);
+       }
+}
+
+gchar*
+test_test_array_lifetime_finish (Test* self,
+                                 GAsyncResult* _res_,
+                                 GError** error)
+{
+       TestIface* _iface_;
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->test_array_lifetime_finish) {
+               return _iface_->test_array_lifetime_finish (self, _res_, error);
+       }
+       return NULL;
+}
+
+static void
+test_default_init (TestIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType test_type_id;
+       test_type_id = g_type_register_static (G_TYPE_INTERFACE, "Test", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (test_type_id, G_TYPE_OBJECT);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) 
test_proxy_get_type);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), 
"org.example.Test");
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*) 
(&_test_dbus_interface_info));
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_register_object);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_TEST, 
test_proxy_test_interface_init) )
+static void
+test_proxy_class_init (TestProxyClass* klass)
+{
+       G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal;
+}
+
+static void
+test_proxy_g_signal (GDBusProxy* proxy,
+                     const gchar* sender_name,
+                     const gchar* signal_name,
+                     GVariant* parameters)
+{
+}
+
+static void
+test_proxy_init (TestProxy* self)
+{
+       g_dbus_proxy_set_interface_info (G_DBUS_PROXY (self), (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info));
+}
+
+static void
+_vala_g_async_ready_callback (GObject *source_object,
+                              GAsyncResult *res,
+                              void *user_data)
+{
+       g_task_return_pointer (user_data, g_object_ref (res), g_object_unref);
+       g_object_unref (user_data);
+}
+
+static void
+test_proxy_test_array_lifetime_async (Test* self,
+                                      gchar** items,
+                                      gint items_length1,
+                                      GAsyncReadyCallback _callback_,
+                                      gpointer _user_data_)
+{
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       gchar** _tmp0_;
+       GVariantBuilder _tmp1_;
+       gint _tmp2_;
+       G_IO_ERROR;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "TestArrayLifetime");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       _tmp0_ = items;
+       g_variant_builder_init (&_tmp1_, G_VARIANT_TYPE ("as"));
+       for (_tmp2_ = 0; _tmp2_ < items_length1; _tmp2_++) {
+               g_variant_builder_add_value (&_tmp1_, g_variant_new_string (*_tmp0_));
+               _tmp0_++;
+       }
+       g_variant_builder_add_value (&_arguments_builder, g_variant_builder_end (&_tmp1_));
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       if (_callback_ != NULL) {
+               g_dbus_connection_send_message_with_reply (g_dbus_proxy_get_connection ((GDBusProxy *) self), 
_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout ((GDBusProxy *) self), NULL, NULL, 
_vala_g_async_ready_callback, g_task_new ((GObject *) self, NULL, _callback_, _user_data_));
+       } else {
+               g_dbus_message_set_flags (_message, G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED);
+               g_dbus_connection_send_message (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       }
+       g_object_unref (_message);
+}
+
+static gchar*
+test_proxy_test_array_lifetime_finish (Test* self,
+                                       GAsyncResult* _res_,
+                                       GError** error)
+{
+       GAsyncResult *_inner_res;
+       GDBusMessage *_reply_message;
+       GVariant *_reply;
+       GVariantIter _reply_iter;
+       gchar* _result = NULL;
+       GVariant* _tmp3_;
+       _inner_res = g_task_propagate_pointer ((GTask *) _res_, NULL);
+       _reply_message = g_dbus_connection_send_message_with_reply_finish (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _inner_res, error);
+       g_object_unref (_inner_res);
+       if (!_reply_message) {
+               return NULL;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, error)) {
+               g_object_unref (_reply_message);
+               return NULL;
+       }
+       _reply = g_dbus_message_get_body (_reply_message);
+       g_variant_iter_init (&_reply_iter, _reply);
+       _tmp3_ = g_variant_iter_next_value (&_reply_iter);
+       _result = g_variant_dup_string (_tmp3_, NULL);
+       g_variant_unref (_tmp3_);
+       g_object_unref (_reply_message);
+       return _result;
+}
+
+static void
+test_proxy_test_interface_init (TestIface* iface)
+{
+       iface->test_array_lifetime = test_proxy_test_array_lifetime_async;
+       iface->test_array_lifetime_finish = test_proxy_test_array_lifetime_finish;
+}
+
+static void
+_dbus_test_test_array_lifetime (Test* self,
+                                GVariant* _parameters_,
+                                GDBusMethodInvocation* invocation)
+{
+       GVariantIter _arguments_iter;
+       TestTestArrayLifetimeReadyData* _ready_data;
+       GVariant* _tmp4_;
+       gchar** _tmp5_;
+       gint _tmp5__length;
+       gint _tmp5__size;
+       gint _tmp5__length1;
+       GVariantIter _tmp6_;
+       GVariant* _tmp7_;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _ready_data = g_slice_new0 (TestTestArrayLifetimeReadyData);
+       _ready_data->_invocation_ = invocation;
+       _tmp4_ = g_variant_iter_next_value (&_arguments_iter);
+       _tmp5_ = g_new (gchar*, 5);
+       _tmp5__length = 0;
+       _tmp5__size = 4;
+       _tmp5__length1 = 0;
+       g_variant_iter_init (&_tmp6_, _tmp4_);
+       for (; (_tmp7_ = g_variant_iter_next_value (&_tmp6_)) != NULL; _tmp5__length1++) {
+               if (_tmp5__size == _tmp5__length) {
+                       _tmp5__size = 2 * _tmp5__size;
+                       _tmp5_ = g_renew (gchar*, _tmp5_, _tmp5__size + 1);
+               }
+               _tmp5_[_tmp5__length++] = g_variant_dup_string (_tmp7_, NULL);
+               g_variant_unref (_tmp7_);
+       }
+       _ready_data->items_length1 = _tmp5__length1;
+       _tmp5_[_tmp5__length] = NULL;
+       _ready_data->items = _tmp5_;
+       g_variant_unref (_tmp4_);
+       test_test_array_lifetime (self, _ready_data->items, _ready_data->items_length1, (GAsyncReadyCallback) 
_dbus_test_test_array_lifetime_ready, _ready_data);
+       _error:
+       ;
+}
+
+static void
+_dbus_test_test_array_lifetime_ready (GObject * source_object,
+                                      GAsyncResult * _res_,
+                                      gpointer _user_data_)
+{
+       TestTestArrayLifetimeReadyData* _ready_data;
+       GDBusMethodInvocation* invocation;
+       GError* error = NULL;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       gchar* result;
+       _ready_data = _user_data_;
+       invocation = _ready_data->_invocation_;
+       result = test_test_array_lifetime_finish ((Test*) source_object, _res_, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               goto _error;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_string (result));
+       _g_free0 (result);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+       _error:
+       _ready_data->items = (_vala_array_free (_ready_data->items, _ready_data->items_length1, 
(GDestroyNotify) g_free), NULL);
+       g_slice_free (TestTestArrayLifetimeReadyData, _ready_data);
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* method_name,
+                                 GVariant* parameters,
+                                 GDBusMethodInvocation* invocation,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "TestArrayLifetime") == 0) {
+               _dbus_test_test_array_lifetime (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return NULL;
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GVariant* value,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return FALSE;
+}
+
+guint
+test_register_object (gpointer object,
+                      GDBusConnection* connection,
+                      const gchar* path,
+                      GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+static void
+_vala_main (void)
+{
+       GMainLoop* _tmp0_;
+       GMainLoop* _tmp1_;
+       _tmp0_ = g_main_loop_new (NULL, FALSE);
+       _g_main_loop_unref0 (main_loop);
+       main_loop = _tmp0_;
+       run (NULL, NULL);
+       _tmp1_ = main_loop;
+       g_main_loop_run (_tmp1_);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+run_data_free (gpointer _data)
+{
+       RunData* _data_;
+       _data_ = _data;
+       g_slice_free (RunData, _data_);
+}
+
+void
+run (GAsyncReadyCallback _callback_,
+     gpointer _user_data_)
+{
+       RunData* _data_;
+       _data_ = g_slice_new0 (RunData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, run_data_free);
+       run_co (_data_);
+}
+
+void
+run_finish (GAsyncResult* _res_)
+{
+       RunData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static void
+run_ready (GObject* source_object,
+           GAsyncResult* _res_,
+           gpointer _user_data_)
+{
+       RunData* _data_;
+       _data_ = _user_data_;
+       _data_->_source_object_ = source_object;
+       _data_->_res_ = _res_;
+       run_co (_data_);
+}
+
+static gboolean
+run_co (RunData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               case 1:
+               goto _state_1;
+               case 2:
+               goto _state_2;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->_state_ = 1;
+       g_async_initable_new_async (TYPE_TEST_PROXY, 0, NULL, run_ready, _data_, "g-flags", 0, "g-name", 
"org.example.Test", "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/example/test", 
"g-interface-name", "org.example.Test", NULL);
+       return FALSE;
+       _state_1:
+       _data_->_tmp0_ = (Test*) g_async_initable_new_finish ((GAsyncInitable *) _data_->_source_object_, 
_data_->_res_, &_data_->_inner_error0_);
+       _data_->test = (Test*) _data_->_tmp0_;
+       if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), 
_data_->_inner_error0_->code);
+               g_clear_error (&_data_->_inner_error0_);
+               g_object_unref (_data_->_async_result);
+               return FALSE;
+       }
+       _data_->_tmp1_ = _data_->test;
+       _data_->_tmp2_ = g_strdup ("Badger");
+       _data_->_tmp3_ = g_strdup ("Snake");
+       _data_->_tmp4_ = g_strdup ("Mushroom");
+       _data_->_tmp5_ = g_new0 (gchar*, 3 + 1);
+       _data_->_tmp5_[0] = _data_->_tmp2_;
+       _data_->_tmp5_[1] = _data_->_tmp3_;
+       _data_->_tmp5_[2] = _data_->_tmp4_;
+       _data_->_tmp6_ = _data_->_tmp5_;
+       _data_->_tmp6__length1 = 3;
+       _data_->_state_ = 2;
+       test_test_array_lifetime (_data_->_tmp1_, _data_->_tmp6_, (gint) 3, run_ready, _data_);
+       return FALSE;
+       _state_2:
+       _data_->_tmp7_ = test_test_array_lifetime_finish (_data_->_tmp1_, _data_->_res_, 
&_data_->_inner_error0_);
+       _data_->_tmp8_ = _data_->_tmp7_;
+       _data_->_tmp6_ = (_vala_array_free (_data_->_tmp6_, _data_->_tmp6__length1, (GDestroyNotify) g_free), 
NULL);
+       _data_->_result_ = _data_->_tmp8_;
+       if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+               _g_object_unref0 (_data_->test);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), 
_data_->_inner_error0_->code);
+               g_clear_error (&_data_->_inner_error0_);
+               g_object_unref (_data_->_async_result);
+               return FALSE;
+       }
+       _data_->_tmp9_ = _data_->_result_;
+       _vala_assert (g_strcmp0 (_data_->_tmp9_, "BadgerSnakeMushroom") == 0, "result == 
\"BadgerSnakeMushroom\"");
+       _data_->_tmp10_ = main_loop;
+       g_main_loop_quit (_data_->_tmp10_);
+       _g_free0 (_data_->_result_);
+       _g_object_unref0 (_data_->test);
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/dbus/bug783002_server.c-expected b/tests/dbus/bug783002_server.c-expected
new file mode 100644
index 000000000..3b2a6e4a0
--- /dev/null
+++ b/tests/dbus/bug783002_server.c-expected
@@ -0,0 +1,680 @@
+/* dbus_bug783002_server.c generated by valac, the Vala compiler
+ * generated from dbus_bug783002_server.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TEST, TestClass))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define IS_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TEST))
+#define TEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TEST, TestClass))
+
+typedef struct _Test Test;
+typedef struct _TestClass TestClass;
+typedef struct _TestPrivate TestPrivate;
+enum  {
+       TEST_0_PROPERTY,
+       TEST_NUM_PROPERTIES
+};
+static GParamSpec* test_properties[TEST_NUM_PROPERTIES];
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+typedef struct _Block1Data Block1Data;
+#define _g_string_free0(var) ((var == NULL) ? NULL : (var = (g_string_free (var, TRUE), NULL)))
+typedef struct _TestTestArrayLifetimeData TestTestArrayLifetimeData;
+typedef struct _TestTestArrayLifetimeReadyData TestTestArrayLifetimeReadyData;
+#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Test {
+       GObject parent_instance;
+       TestPrivate * priv;
+};
+
+struct _TestClass {
+       GObjectClass parent_class;
+};
+
+struct _Block1Data {
+       int _ref_count_;
+       Test* self;
+       gpointer _async_data_;
+};
+
+struct _TestTestArrayLifetimeData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Test* self;
+       gchar** items;
+       gint items_length1;
+       gchar* result;
+       Block1Data* _data1_;
+       GString* _result_;
+       GString* _tmp0_;
+       gchar** item_collection;
+       gint item_collection_length1;
+       gint _item_collection_size_;
+       gint item_it;
+       gchar* _tmp1_;
+       gchar* item;
+       GString* _tmp2_;
+       const gchar* _tmp3_;
+       GString* _tmp4_;
+       const gchar* _tmp5_;
+       GString* _tmp6_;
+       const gchar* _tmp7_;
+       gchar* _tmp8_;
+};
+
+struct _TestTestArrayLifetimeReadyData {
+       GDBusMethodInvocation* _invocation_;
+       gchar** items;
+       gint items_length1;
+};
+
+static gpointer test_parent_class = NULL;
+VALA_EXTERN GMainLoop* main_loop;
+GMainLoop* main_loop = NULL;
+
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
+VALA_EXTERN guint test_register_object (void* object,
+                            GDBusConnection* connection,
+                            const gchar* path,
+                            GError** error);
+static void test_test_array_lifetime_data_free (gpointer _data);
+VALA_EXTERN void test_test_array_lifetime (Test* self,
+                               gchar** items,
+                               gint items_length1,
+                               GAsyncReadyCallback _callback_,
+                               gpointer _user_data_);
+VALA_EXTERN gchar* test_test_array_lifetime_finish (Test* self,
+                                        GAsyncResult* _res_,
+                                        GError** error);
+static gboolean test_test_array_lifetime_co (TestTestArrayLifetimeData* _data_);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static gboolean __lambda4_ (Block1Data* _data1_);
+static gboolean ___lambda4__gsource_func (gpointer self);
+VALA_EXTERN Test* test_new (void);
+VALA_EXTERN Test* test_construct (GType object_type);
+static GType test_get_type_once (void);
+static void _dbus_test_test_array_lifetime (Test* self,
+                                     GVariant* _parameters_,
+                                     GDBusMethodInvocation* invocation);
+static void _dbus_test_test_array_lifetime_ready (GObject * source_object,
+                                           GAsyncResult * _res_,
+                                           gpointer _user_data_);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* method_name,
+                                      GVariant* parameters,
+                                      GDBusMethodInvocation* invocation,
+                                      gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+                                            const gchar* sender,
+                                            const gchar* object_path,
+                                            const gchar* interface_name,
+                                            const gchar* property_name,
+                                            GError** error,
+                                            gpointer user_data);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GVariant* value,
+                                           GError** error,
+                                           gpointer user_data);
+static void _test_unregister_object (gpointer user_data);
+VALA_EXTERN void on_client_exit (GPid pid,
+                     gint status);
+static void _vala_main (void);
+static guint _variant_get1 (GVariant* value);
+static void _on_client_exit_gchild_watch_func (GPid pid,
+                                        gint wait_status,
+                                        gpointer self);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static const GDBusArgInfo _test_dbus_arg_info_test_array_lifetime_items = {-1, "items", "as", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_array_lifetime_result = {-1, "result", "s", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_array_lifetime_in[] = 
{&_test_dbus_arg_info_test_array_lifetime_items, NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_array_lifetime_out[] = 
{&_test_dbus_arg_info_test_array_lifetime_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_array_lifetime = {-1, "TestArrayLifetime", 
(GDBusArgInfo **) (&_test_dbus_arg_info_test_array_lifetime_in), (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_array_lifetime_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = 
{&_test_dbus_method_info_test_array_lifetime, NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = {NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) 
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, 
test_dbus_interface_get_property, test_dbus_interface_set_property};
+
+static void
+test_test_array_lifetime_data_free (gpointer _data)
+{
+       TestTestArrayLifetimeData* _data_;
+       _data_ = _data;
+       _g_free0 (_data_->result);
+       _g_object_unref0 (_data_->self);
+       g_slice_free (TestTestArrayLifetimeData, _data_);
+}
+
+static gpointer
+_g_object_ref0 (gpointer self)
+{
+       return self ? g_object_ref (self) : NULL;
+}
+
+void
+test_test_array_lifetime (Test* self,
+                          gchar** items,
+                          gint items_length1,
+                          GAsyncReadyCallback _callback_,
+                          gpointer _user_data_)
+{
+       TestTestArrayLifetimeData* _data_;
+       Test* _tmp0_;
+       g_return_if_fail (IS_TEST (self));
+       _data_ = g_slice_new0 (TestTestArrayLifetimeData);
+       _data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, test_test_array_lifetime_data_free);
+       _tmp0_ = _g_object_ref0 (self);
+       _data_->self = _tmp0_;
+       _data_->items = items;
+       _data_->items_length1 = items_length1;
+       test_test_array_lifetime_co (_data_);
+}
+
+gchar*
+test_test_array_lifetime_finish (Test* self,
+                                 GAsyncResult* _res_,
+                                 GError** error)
+{
+       gchar* result;
+       TestTestArrayLifetimeData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), error);
+       if (NULL == _data_) {
+               return NULL;
+       }
+       result = _data_->result;
+       _data_->result = NULL;
+       return result;
+}
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               Test* self;
+               self = _data1_->self;
+               _g_object_unref0 (self);
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static gboolean
+__lambda4_ (Block1Data* _data1_)
+{
+       Test* self;
+       gboolean result = FALSE;
+       self = _data1_->self;
+       test_test_array_lifetime_co (_data1_->_async_data_);
+       result = FALSE;
+       return result;
+}
+
+static gboolean
+___lambda4__gsource_func (gpointer self)
+{
+       gboolean result;
+       result = __lambda4_ (self);
+       return result;
+}
+
+static gboolean
+test_test_array_lifetime_co (TestTestArrayLifetimeData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               case 1:
+               goto _state_1;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->_data1_ = g_slice_new0 (Block1Data);
+       _data_->_data1_->_ref_count_ = 1;
+       _data_->_data1_->self = g_object_ref (_data_->self);
+       _data_->_data1_->_async_data_ = _data_;
+       g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, ___lambda4__gsource_func, block1_data_ref 
(_data_->_data1_), block1_data_unref);
+       _data_->_state_ = 1;
+       return FALSE;
+       _state_1:
+       ;
+       _data_->_tmp0_ = g_string_new ("");
+       _data_->_result_ = _data_->_tmp0_;
+       {
+               _data_->item_collection_length1 = 0;
+               _data_->_item_collection_size_ = 0;
+               _data_->item_collection = _data_->items;
+               _data_->item_collection_length1 = _data_->items_length1;
+               for (_data_->item_it = 0; _data_->item_it < _data_->item_collection_length1; _data_->item_it 
= _data_->item_it + 1) {
+                       _data_->_tmp1_ = g_strdup (_data_->item_collection[_data_->item_it]);
+                       _data_->item = _data_->_tmp1_;
+                       {
+                               _data_->_tmp2_ = _data_->_result_;
+                               _data_->_tmp3_ = _data_->item;
+                               g_string_append (_data_->_tmp2_, _data_->_tmp3_);
+                               _g_free0 (_data_->item);
+                       }
+               }
+       }
+       _data_->_tmp4_ = _data_->_result_;
+       _data_->_tmp5_ = _data_->_tmp4_->str;
+       _vala_assert (g_strcmp0 (_data_->_tmp5_, "BadgerSnakeMushroom") == 0, "result.str == 
\"BadgerSnakeMushroom\"");
+       _data_->_tmp6_ = _data_->_result_;
+       _data_->_tmp7_ = _data_->_tmp6_->str;
+       _data_->_tmp8_ = g_strdup (_data_->_tmp7_);
+       _data_->result = _data_->_tmp8_;
+       _g_string_free0 (_data_->_result_);
+       block1_data_unref (_data_->_data1_);
+       _data_->_data1_ = NULL;
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+Test*
+test_construct (GType object_type)
+{
+       Test * self = NULL;
+       self = (Test*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Test*
+test_new (void)
+{
+       return test_construct (TYPE_TEST);
+}
+
+static void
+test_class_init (TestClass * klass,
+                 gpointer klass_data)
+{
+       test_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+test_instance_init (Test * self,
+                    gpointer klass)
+{
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Test), 
0, (GInstanceInitFunc) test_instance_init, NULL };
+       GType test_type_id;
+       test_type_id = g_type_register_static (G_TYPE_OBJECT, "Test", &g_define_type_info, 0);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_register_object);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+static void
+_dbus_test_test_array_lifetime (Test* self,
+                                GVariant* _parameters_,
+                                GDBusMethodInvocation* invocation)
+{
+       GVariantIter _arguments_iter;
+       TestTestArrayLifetimeReadyData* _ready_data;
+       GVariant* _tmp0_;
+       gchar** _tmp1_;
+       gint _tmp1__length;
+       gint _tmp1__size;
+       gint _tmp1__length1;
+       GVariantIter _tmp2_;
+       GVariant* _tmp3_;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _ready_data = g_slice_new0 (TestTestArrayLifetimeReadyData);
+       _ready_data->_invocation_ = invocation;
+       _tmp0_ = g_variant_iter_next_value (&_arguments_iter);
+       _tmp1_ = g_new (gchar*, 5);
+       _tmp1__length = 0;
+       _tmp1__size = 4;
+       _tmp1__length1 = 0;
+       g_variant_iter_init (&_tmp2_, _tmp0_);
+       for (; (_tmp3_ = g_variant_iter_next_value (&_tmp2_)) != NULL; _tmp1__length1++) {
+               if (_tmp1__size == _tmp1__length) {
+                       _tmp1__size = 2 * _tmp1__size;
+                       _tmp1_ = g_renew (gchar*, _tmp1_, _tmp1__size + 1);
+               }
+               _tmp1_[_tmp1__length++] = g_variant_dup_string (_tmp3_, NULL);
+               g_variant_unref (_tmp3_);
+       }
+       _ready_data->items_length1 = _tmp1__length1;
+       _tmp1_[_tmp1__length] = NULL;
+       _ready_data->items = _tmp1_;
+       g_variant_unref (_tmp0_);
+       test_test_array_lifetime (self, _ready_data->items, _ready_data->items_length1, (GAsyncReadyCallback) 
_dbus_test_test_array_lifetime_ready, _ready_data);
+       _error:
+       ;
+}
+
+static void
+_dbus_test_test_array_lifetime_ready (GObject * source_object,
+                                      GAsyncResult * _res_,
+                                      gpointer _user_data_)
+{
+       TestTestArrayLifetimeReadyData* _ready_data;
+       GDBusMethodInvocation* invocation;
+       GError* error = NULL;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       gchar* result;
+       _ready_data = _user_data_;
+       invocation = _ready_data->_invocation_;
+       result = test_test_array_lifetime_finish ((Test*) source_object, _res_, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               goto _error;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_string (result));
+       _g_free0 (result);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+       _error:
+       _ready_data->items = (_vala_array_free (_ready_data->items, _ready_data->items_length1, 
(GDestroyNotify) g_free), NULL);
+       g_slice_free (TestTestArrayLifetimeReadyData, _ready_data);
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* method_name,
+                                 GVariant* parameters,
+                                 GDBusMethodInvocation* invocation,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "TestArrayLifetime") == 0) {
+               _dbus_test_test_array_lifetime (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return NULL;
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GVariant* value,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return FALSE;
+}
+
+guint
+test_register_object (gpointer object,
+                      GDBusConnection* connection,
+                      const gchar* path,
+                      GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+void
+on_client_exit (GPid pid,
+                gint status)
+{
+       GMainLoop* _tmp0_;
+       _vala_assert (status == 0, "status == 0");
+       _tmp0_ = main_loop;
+       g_main_loop_quit (_tmp0_);
+}
+
+static guint
+_variant_get1 (GVariant* value)
+{
+       return g_variant_get_uint32 (value);
+}
+
+static void
+_on_client_exit_gchild_watch_func (GPid pid,
+                                   gint wait_status,
+                                   gpointer self)
+{
+       on_client_exit (pid, wait_status);
+}
+
+static void
+_vala_main (void)
+{
+       GDBusConnection* conn = NULL;
+       GDBusConnection* _tmp0_;
+       GDBusConnection* _tmp1_;
+       Test* _tmp2_;
+       Test* _tmp3_;
+       GVariant* request_result = NULL;
+       GDBusConnection* _tmp4_;
+       GVariant* _tmp5_;
+       GVariant* _tmp6_;
+       GVariant* _tmp7_;
+       GVariant* _tmp8_;
+       GVariant* _tmp9_;
+       GVariant* _tmp10_;
+       GVariant* _tmp11_;
+       guint _tmp12_;
+       GPid client_pid = 0;
+       gchar* _tmp13_;
+       gchar** _tmp14_;
+       gchar** _tmp15_;
+       gint _tmp15__length1;
+       GPid _tmp16_ = 0;
+       GMainLoop* _tmp17_;
+       GMainLoop* _tmp18_;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &_inner_error0_);
+       conn = _tmp0_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp1_ = conn;
+       _tmp2_ = test_new ();
+       _tmp3_ = _tmp2_;
+       test_register_object (_tmp3_, _tmp1_, "/org/example/test", &_inner_error0_);
+       _g_object_unref0 (_tmp3_);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp4_ = conn;
+       _tmp5_ = g_variant_new ("(su)", "org.example.Test", 0x4, NULL);
+       g_variant_ref_sink (_tmp5_);
+       _tmp6_ = _tmp5_;
+       _tmp7_ = g_dbus_connection_call_sync (_tmp4_, "org.freedesktop.DBus", "/org/freedesktop/DBus", 
"org.freedesktop.DBus", "RequestName", _tmp6_, NULL, 0, -1, NULL, &_inner_error0_);
+       _tmp8_ = _tmp7_;
+       _g_variant_unref0 (_tmp6_);
+       request_result = _tmp8_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp9_ = request_result;
+       _tmp10_ = g_variant_get_child_value (_tmp9_, (gsize) 0);
+       _tmp11_ = _tmp10_;
+       _tmp12_ = _variant_get1 (_tmp11_);
+       _vala_assert (_tmp12_ == ((guint) 1), "(uint) request_result.get_child_value (0) == 1");
+       _g_variant_unref0 (_tmp11_);
+       _tmp13_ = g_strdup ("dbus_bug783002_client");
+       _tmp14_ = g_new0 (gchar*, 1 + 1);
+       _tmp14_[0] = _tmp13_;
+       _tmp15_ = _tmp14_;
+       _tmp15__length1 = 1;
+       g_spawn_async (NULL, _tmp15_, NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &_tmp16_, &_inner_error0_);
+       client_pid = _tmp16_;
+       _tmp15_ = (_vala_array_free (_tmp15_, _tmp15__length1, (GDestroyNotify) g_free), NULL);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_variant_unref0 (request_result);
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       g_child_watch_add_full (G_PRIORITY_DEFAULT_IDLE, client_pid, _on_client_exit_gchild_watch_func, NULL, 
NULL);
+       _tmp17_ = g_main_loop_new (NULL, FALSE);
+       _g_main_loop_unref0 (main_loop);
+       main_loop = _tmp17_;
+       _tmp18_ = main_loop;
+       g_main_loop_run (_tmp18_);
+       _g_variant_unref0 (request_result);
+       _g_object_unref0 (conn);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/dbus/bug792277.c-expected b/tests/dbus/bug792277.c-expected
new file mode 100644
index 000000000..63cea38d3
--- /dev/null
+++ b/tests/dbus/bug792277.c-expected
@@ -0,0 +1,712 @@
+/* dbus_bug792277.c generated by valac, the Vala compiler
+ * generated from dbus_bug792277.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_IFOO (ifoo_get_type ())
+#define IFOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IFOO, IFoo))
+#define IS_IFOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IFOO))
+#define IFOO_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_IFOO, IFooIface))
+
+typedef struct _IFoo IFoo;
+typedef struct _IFooIface IFooIface;
+
+#define TYPE_IFOO_PROXY (ifoo_proxy_get_type ())
+typedef GDBusProxy IFooProxy;
+typedef GDBusProxyClass IFooProxyClass;
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+
+struct _IFooIface {
+       GTypeInterface parent_iface;
+       void (*method0) (IFoo* self, GError** error);
+       void (*method1) (IFoo* self, GError** error);
+       void (*method2) (IFoo* self);
+};
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType ifoo_proxy_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN guint ifoo_register_object (void* object,
+                            GDBusConnection* connection,
+                            const gchar* path,
+                            GError** error);
+VALA_EXTERN GType ifoo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN void ifoo_method0 (IFoo* self,
+                   GError** error);
+VALA_EXTERN void ifoo_method1 (IFoo* self,
+                   GError** error);
+VALA_EXTERN void ifoo_method2 (IFoo* self);
+static GType ifoo_get_type_once (void);
+static void ifoo_proxy_g_signal (GDBusProxy* proxy,
+                          const gchar* sender_name,
+                          const gchar* signal_name,
+                          GVariant* parameters);
+static void ifoo_proxy_method0 (IFoo* self,
+                         GError** error);
+static void ifoo_proxy_method1 (IFoo* self,
+                         GError** error);
+static void ifoo_proxy_method2 (IFoo* self);
+static void ifoo_proxy_ifoo_interface_init (IFooIface* iface);
+static void _dbus_ifoo_method0 (IFoo* self,
+                         GVariant* _parameters_,
+                         GDBusMethodInvocation* invocation);
+static void _dbus_ifoo_method1 (IFoo* self,
+                         GVariant* _parameters_,
+                         GDBusMethodInvocation* invocation);
+static void ifoo_dbus_interface_method_call (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* method_name,
+                                      GVariant* parameters,
+                                      GDBusMethodInvocation* invocation,
+                                      gpointer user_data);
+static GVariant* ifoo_dbus_interface_get_property (GDBusConnection* connection,
+                                            const gchar* sender,
+                                            const gchar* object_path,
+                                            const gchar* interface_name,
+                                            const gchar* property_name,
+                                            GError** error,
+                                            gpointer user_data);
+static gboolean ifoo_dbus_interface_set_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GVariant* value,
+                                           GError** error,
+                                           gpointer user_data);
+static void _ifoo_unregister_object (gpointer user_data);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN guint foo_register_object (void* object,
+                           GDBusConnection* connection,
+                           const gchar* path,
+                           GError** error);
+VALA_EXTERN void foo_method0 (Foo* self,
+                  GError** error);
+VALA_EXTERN void foo_method1 (Foo* self,
+                  GError** error);
+VALA_EXTERN void foo_method2 (Foo* self);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static GType foo_get_type_once (void);
+static void _dbus_foo_method0 (Foo* self,
+                        GVariant* _parameters_,
+                        GDBusMethodInvocation* invocation);
+static void _dbus_foo_method1 (Foo* self,
+                        GVariant* _parameters_,
+                        GDBusMethodInvocation* invocation);
+static void foo_dbus_interface_method_call (GDBusConnection* connection,
+                                     const gchar* sender,
+                                     const gchar* object_path,
+                                     const gchar* interface_name,
+                                     const gchar* method_name,
+                                     GVariant* parameters,
+                                     GDBusMethodInvocation* invocation,
+                                     gpointer user_data);
+static GVariant* foo_dbus_interface_get_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GError** error,
+                                           gpointer user_data);
+static gboolean foo_dbus_interface_set_property (GDBusConnection* connection,
+                                          const gchar* sender,
+                                          const gchar* object_path,
+                                          const gchar* interface_name,
+                                          const gchar* property_name,
+                                          GVariant* value,
+                                          GError** error,
+                                          gpointer user_data);
+static void _foo_unregister_object (gpointer user_data);
+static void _vala_main (void);
+
+static const GDBusArgInfo * const _ifoo_dbus_arg_info_method0_in[] = {NULL};
+static const GDBusArgInfo * const _ifoo_dbus_arg_info_method0_out[] = {NULL};
+static const GDBusMethodInfo _ifoo_dbus_method_info_method0 = {-1, "Method0", (GDBusArgInfo **) 
(&_ifoo_dbus_arg_info_method0_in), (GDBusArgInfo **) (&_ifoo_dbus_arg_info_method0_out), NULL};
+static const GDBusArgInfo * const _ifoo_dbus_arg_info_method1_in[] = {NULL};
+static const GDBusArgInfo * const _ifoo_dbus_arg_info_method1_out[] = {NULL};
+static const GDBusMethodInfo _ifoo_dbus_method_info_method1 = {-1, "Method1", (GDBusArgInfo **) 
(&_ifoo_dbus_arg_info_method1_in), (GDBusArgInfo **) (&_ifoo_dbus_arg_info_method1_out), NULL};
+static const GDBusMethodInfo * const _ifoo_dbus_method_info[] = {&_ifoo_dbus_method_info_method0, 
&_ifoo_dbus_method_info_method1, NULL};
+static const GDBusSignalInfo * const _ifoo_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo * const _ifoo_dbus_property_info[] = {NULL};
+static const GDBusInterfaceInfo _ifoo_dbus_interface_info = {-1, "org.example.IFoo", (GDBusMethodInfo **) 
(&_ifoo_dbus_method_info), (GDBusSignalInfo **) (&_ifoo_dbus_signal_info), (GDBusPropertyInfo **) 
(&_ifoo_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _ifoo_dbus_interface_vtable = {ifoo_dbus_interface_method_call, 
ifoo_dbus_interface_get_property, ifoo_dbus_interface_set_property};
+static const GDBusArgInfo * const _foo_dbus_arg_info_method0_in[] = {NULL};
+static const GDBusArgInfo * const _foo_dbus_arg_info_method0_out[] = {NULL};
+static const GDBusMethodInfo _foo_dbus_method_info_method0 = {-1, "Method0", (GDBusArgInfo **) 
(&_foo_dbus_arg_info_method0_in), (GDBusArgInfo **) (&_foo_dbus_arg_info_method0_out), NULL};
+static const GDBusArgInfo * const _foo_dbus_arg_info_method1_in[] = {NULL};
+static const GDBusArgInfo * const _foo_dbus_arg_info_method1_out[] = {NULL};
+static const GDBusMethodInfo _foo_dbus_method_info_method1 = {-1, "Method1", (GDBusArgInfo **) 
(&_foo_dbus_arg_info_method1_in), (GDBusArgInfo **) (&_foo_dbus_arg_info_method1_out), NULL};
+static const GDBusMethodInfo * const _foo_dbus_method_info[] = {&_foo_dbus_method_info_method0, 
&_foo_dbus_method_info_method1, NULL};
+static const GDBusSignalInfo * const _foo_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo * const _foo_dbus_property_info[] = {NULL};
+static const GDBusInterfaceInfo _foo_dbus_interface_info = {-1, "org.example.Foo", (GDBusMethodInfo **) 
(&_foo_dbus_method_info), (GDBusSignalInfo **) (&_foo_dbus_signal_info), (GDBusPropertyInfo **) 
(&_foo_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _foo_dbus_interface_vtable = {foo_dbus_interface_method_call, 
foo_dbus_interface_get_property, foo_dbus_interface_set_property};
+
+void
+ifoo_method0 (IFoo* self,
+              GError** error)
+{
+       IFooIface* _iface_;
+       g_return_if_fail (IS_IFOO (self));
+       _iface_ = IFOO_GET_INTERFACE (self);
+       if (_iface_->method0) {
+               _iface_->method0 (self, error);
+       }
+}
+
+void
+ifoo_method1 (IFoo* self,
+              GError** error)
+{
+       IFooIface* _iface_;
+       g_return_if_fail (IS_IFOO (self));
+       _iface_ = IFOO_GET_INTERFACE (self);
+       if (_iface_->method1) {
+               _iface_->method1 (self, error);
+       }
+}
+
+void
+ifoo_method2 (IFoo* self)
+{
+       IFooIface* _iface_;
+       g_return_if_fail (IS_IFOO (self));
+       _iface_ = IFOO_GET_INTERFACE (self);
+       if (_iface_->method2) {
+               _iface_->method2 (self);
+       }
+}
+
+static void
+ifoo_default_init (IFooIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+ifoo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (IFooIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) ifoo_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType ifoo_type_id;
+       ifoo_type_id = g_type_register_static (G_TYPE_INTERFACE, "IFoo", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (ifoo_type_id, G_TYPE_OBJECT);
+       g_type_set_qdata (ifoo_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) 
ifoo_proxy_get_type);
+       g_type_set_qdata (ifoo_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), 
"org.example.IFoo");
+       g_type_set_qdata (ifoo_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*) 
(&_ifoo_dbus_interface_info));
+       g_type_set_qdata (ifoo_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
ifoo_register_object);
+       return ifoo_type_id;
+}
+
+GType
+ifoo_get_type (void)
+{
+       static volatile gsize ifoo_type_id__volatile = 0;
+       if (g_once_init_enter (&ifoo_type_id__volatile)) {
+               GType ifoo_type_id;
+               ifoo_type_id = ifoo_get_type_once ();
+               g_once_init_leave (&ifoo_type_id__volatile, ifoo_type_id);
+       }
+       return ifoo_type_id__volatile;
+}
+
+G_DEFINE_TYPE_EXTENDED (IFooProxy, ifoo_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_IFOO, 
ifoo_proxy_ifoo_interface_init) )
+static void
+ifoo_proxy_class_init (IFooProxyClass* klass)
+{
+       G_DBUS_PROXY_CLASS (klass)->g_signal = ifoo_proxy_g_signal;
+}
+
+static void
+ifoo_proxy_g_signal (GDBusProxy* proxy,
+                     const gchar* sender_name,
+                     const gchar* signal_name,
+                     GVariant* parameters)
+{
+}
+
+static void
+ifoo_proxy_init (IFooProxy* self)
+{
+       g_dbus_proxy_set_interface_info (G_DBUS_PROXY (self), (GDBusInterfaceInfo *) 
(&_ifoo_dbus_interface_info));
+}
+
+static void
+ifoo_proxy_method0 (IFoo* self,
+                    GError** error)
+{
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       GDBusMessage *_reply_message;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.IFoo", "Method0");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       _reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout 
((GDBusProxy *) self), NULL, NULL, error);
+       g_object_unref (_message);
+       if (!_reply_message) {
+               return;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, error)) {
+               g_object_unref (_reply_message);
+               return;
+       }
+       g_object_unref (_reply_message);
+}
+
+static void
+ifoo_proxy_method1 (IFoo* self,
+                    GError** error)
+{
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       GDBusMessage *_reply_message;
+       G_DBUS_ERROR;
+       G_IO_ERROR;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.IFoo", "Method1");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       _reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout 
((GDBusProxy *) self), NULL, NULL, error);
+       g_object_unref (_message);
+       if (!_reply_message) {
+               return;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, error)) {
+               g_object_unref (_reply_message);
+               return;
+       }
+       g_object_unref (_reply_message);
+}
+
+static void
+ifoo_proxy_method2 (IFoo* self)
+{
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       GDBusMessage *_reply_message;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.IFoo", "Method2");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       _reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout 
((GDBusProxy *) self), NULL, NULL, NULL);
+       g_object_unref (_message);
+       if (!_reply_message) {
+               return;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, NULL)) {
+               g_object_unref (_reply_message);
+               return;
+       }
+       g_object_unref (_reply_message);
+}
+
+static void
+ifoo_proxy_ifoo_interface_init (IFooIface* iface)
+{
+       iface->method0 = ifoo_proxy_method0;
+       iface->method1 = ifoo_proxy_method1;
+       iface->method2 = ifoo_proxy_method2;
+}
+
+static void
+_dbus_ifoo_method0 (IFoo* self,
+                    GVariant* _parameters_,
+                    GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       ifoo_method0 (self, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               return;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+}
+
+static void
+_dbus_ifoo_method1 (IFoo* self,
+                    GVariant* _parameters_,
+                    GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       ifoo_method1 (self, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               return;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+}
+
+static void
+ifoo_dbus_interface_method_call (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* method_name,
+                                 GVariant* parameters,
+                                 GDBusMethodInvocation* invocation,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "Method0") == 0) {
+               _dbus_ifoo_method0 (object, parameters, invocation);
+       } else if (strcmp (method_name, "Method1") == 0) {
+               _dbus_ifoo_method1 (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+ifoo_dbus_interface_get_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return NULL;
+}
+
+static gboolean
+ifoo_dbus_interface_set_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GVariant* value,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return FALSE;
+}
+
+guint
+ifoo_register_object (gpointer object,
+                      GDBusConnection* connection,
+                      const gchar* path,
+                      GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_ifoo_dbus_interface_info), &_ifoo_dbus_interface_vtable, data, _ifoo_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       return result;
+}
+
+static void
+_ifoo_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+void
+foo_method0 (Foo* self,
+             GError** error)
+{
+       g_return_if_fail (IS_FOO (self));
+}
+
+void
+foo_method1 (Foo* self,
+             GError** error)
+{
+       g_return_if_fail (IS_FOO (self));
+}
+
+void
+foo_method2 (Foo* self)
+{
+       g_return_if_fail (IS_FOO (self));
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       g_type_set_qdata (foo_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
foo_register_object);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_dbus_foo_method0 (Foo* self,
+                   GVariant* _parameters_,
+                   GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       foo_method0 (self, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               return;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+}
+
+static void
+_dbus_foo_method1 (Foo* self,
+                   GVariant* _parameters_,
+                   GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       foo_method1 (self, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               return;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+}
+
+static void
+foo_dbus_interface_method_call (GDBusConnection* connection,
+                                const gchar* sender,
+                                const gchar* object_path,
+                                const gchar* interface_name,
+                                const gchar* method_name,
+                                GVariant* parameters,
+                                GDBusMethodInvocation* invocation,
+                                gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "Method0") == 0) {
+               _dbus_foo_method0 (object, parameters, invocation);
+       } else if (strcmp (method_name, "Method1") == 0) {
+               _dbus_foo_method1 (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+foo_dbus_interface_get_property (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* property_name,
+                                 GError** error,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return NULL;
+}
+
+static gboolean
+foo_dbus_interface_set_property (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* property_name,
+                                 GVariant* value,
+                                 GError** error,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return FALSE;
+}
+
+guint
+foo_register_object (gpointer object,
+                     GDBusConnection* connection,
+                     const gchar* path,
+                     GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_foo_dbus_interface_info), &_foo_dbus_interface_vtable, data, _foo_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       return result;
+}
+
+static void
+_foo_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/dbus/connection_client.c-expected b/tests/dbus/connection_client.c-expected
new file mode 100644
index 000000000..d25dbb971
--- /dev/null
+++ b/tests/dbus/connection_client.c-expected
@@ -0,0 +1,366 @@
+/* dbus_connection_client.c generated by valac, the Vala compiler
+ * generated from dbus_connection_client.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define TEST_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_TEST, TestIface))
+
+typedef struct _Test Test;
+typedef struct _TestIface TestIface;
+
+#define TYPE_TEST_PROXY (test_proxy_get_type ())
+typedef GDBusProxy TestProxy;
+typedef GDBusProxyClass TestProxyClass;
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _TestIface {
+       GTypeInterface parent_iface;
+       gint (*get_test) (Test* self, GError** error);
+};
+
+VALA_EXTERN GType test_proxy_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN guint test_register_object (void* object,
+                            GDBusConnection* connection,
+                            const gchar* path,
+                            GError** error);
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN gint test_get_test (Test* self,
+                    GError** error);
+static GType test_get_type_once (void);
+static void test_proxy_g_signal (GDBusProxy* proxy,
+                          const gchar* sender_name,
+                          const gchar* signal_name,
+                          GVariant* parameters);
+static gint test_proxy_get_test (Test* self,
+                          GError** error);
+static void test_proxy_test_interface_init (TestIface* iface);
+static void _dbus_test_get_test (Test* self,
+                          GVariant* _parameters_,
+                          GDBusMethodInvocation* invocation);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* method_name,
+                                      GVariant* parameters,
+                                      GDBusMethodInvocation* invocation,
+                                      gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+                                            const gchar* sender,
+                                            const gchar* object_path,
+                                            const gchar* interface_name,
+                                            const gchar* property_name,
+                                            GError** error,
+                                            gpointer user_data);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GVariant* value,
+                                           GError** error,
+                                           gpointer user_data);
+static void _test_unregister_object (gpointer user_data);
+static void _vala_main (void);
+
+static const GDBusArgInfo _test_dbus_arg_info_get_test_result = {-1, "result", "i", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_get_test_in[] = {NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_get_test_out[] = 
{&_test_dbus_arg_info_get_test_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_get_test = {-1, "GetTest", (GDBusArgInfo **) 
(&_test_dbus_arg_info_get_test_in), (GDBusArgInfo **) (&_test_dbus_arg_info_get_test_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_get_test, NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = {NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) 
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, 
test_dbus_interface_get_property, test_dbus_interface_set_property};
+
+gint
+test_get_test (Test* self,
+               GError** error)
+{
+       TestIface* _iface_;
+       g_return_val_if_fail (IS_TEST (self), 0);
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->get_test) {
+               return _iface_->get_test (self, error);
+       }
+       return -1;
+}
+
+static void
+test_default_init (TestIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType test_type_id;
+       test_type_id = g_type_register_static (G_TYPE_INTERFACE, "Test", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (test_type_id, G_TYPE_OBJECT);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) 
test_proxy_get_type);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), 
"org.example.Test");
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*) 
(&_test_dbus_interface_info));
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_register_object);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_TEST, 
test_proxy_test_interface_init) )
+static void
+test_proxy_class_init (TestProxyClass* klass)
+{
+       G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal;
+}
+
+static void
+test_proxy_g_signal (GDBusProxy* proxy,
+                     const gchar* sender_name,
+                     const gchar* signal_name,
+                     GVariant* parameters)
+{
+}
+
+static void
+test_proxy_init (TestProxy* self)
+{
+       g_dbus_proxy_set_interface_info (G_DBUS_PROXY (self), (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info));
+}
+
+static gint
+test_proxy_get_test (Test* self,
+                     GError** error)
+{
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       GDBusMessage *_reply_message;
+       GVariant *_reply;
+       GVariantIter _reply_iter;
+       gint _result = 0;
+       GVariant* _tmp2_;
+       G_DBUS_ERROR;
+       G_IO_ERROR;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "GetTest");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       _reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout 
((GDBusProxy *) self), NULL, NULL, error);
+       g_object_unref (_message);
+       if (!_reply_message) {
+               gint _tmp0_ = 0;
+               return _tmp0_;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, error)) {
+               gint _tmp1_ = 0;
+               g_object_unref (_reply_message);
+               return _tmp1_;
+       }
+       _reply = g_dbus_message_get_body (_reply_message);
+       g_variant_iter_init (&_reply_iter, _reply);
+       _tmp2_ = g_variant_iter_next_value (&_reply_iter);
+       _result = g_variant_get_int32 (_tmp2_);
+       g_variant_unref (_tmp2_);
+       g_object_unref (_reply_message);
+       return _result;
+}
+
+static void
+test_proxy_test_interface_init (TestIface* iface)
+{
+       iface->get_test = test_proxy_get_test;
+}
+
+static void
+_dbus_test_get_test (Test* self,
+                     GVariant* _parameters_,
+                     GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       gint result;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       result = test_get_test (self, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               return;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_int32 (result));
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* method_name,
+                                 GVariant* parameters,
+                                 GDBusMethodInvocation* invocation,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "GetTest") == 0) {
+               _dbus_test_get_test (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return NULL;
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GVariant* value,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return FALSE;
+}
+
+guint
+test_register_object (gpointer object,
+                      GDBusConnection* connection,
+                      const gchar* path,
+                      GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+static void
+_vala_main (void)
+{
+       GDBusConnection* conn = NULL;
+       GDBusConnection* _tmp0_;
+       Test* test = NULL;
+       GDBusConnection* _tmp1_;
+       Test* _tmp2_;
+       gint _tmp3_ = 0;
+       Test* _tmp4_;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &_inner_error0_);
+       conn = _tmp0_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp1_ = conn;
+       _tmp2_ = (Test*) g_initable_new (TYPE_TEST_PROXY, NULL, &_inner_error0_, "g-flags", 0, "g-name", 
"org.example.Test", "g-connection", _tmp1_, "g-object-path", "/org/example/test", "g-interface-name", 
"org.example.Test", NULL);
+       test = (Test*) _tmp2_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp4_ = test;
+       _tmp3_ = test_get_test (_tmp4_, &_inner_error0_);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (test);
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _vala_assert (_tmp3_ == 4711, "test.get_test () == 4711");
+       _g_object_unref0 (test);
+       _g_object_unref0 (conn);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/dbus/connection_server.c-expected b/tests/dbus/connection_server.c-expected
new file mode 100644
index 000000000..3dabf4b27
--- /dev/null
+++ b/tests/dbus/connection_server.c-expected
@@ -0,0 +1,434 @@
+/* dbus_connection_server.c generated by valac, the Vala compiler
+ * generated from dbus_connection_server.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <glib.h>
+#include <string.h>
+#include <stdlib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TEST, TestClass))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define IS_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TEST))
+#define TEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TEST, TestClass))
+
+typedef struct _Test Test;
+typedef struct _TestClass TestClass;
+typedef struct _TestPrivate TestPrivate;
+enum  {
+       TEST_0_PROPERTY,
+       TEST_NUM_PROPERTIES
+};
+static GParamSpec* test_properties[TEST_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Test {
+       GObject parent_instance;
+       TestPrivate * priv;
+};
+
+struct _TestClass {
+       GObjectClass parent_class;
+};
+
+static gpointer test_parent_class = NULL;
+VALA_EXTERN GMainLoop* main_loop;
+GMainLoop* main_loop = NULL;
+
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
+VALA_EXTERN guint test_register_object (void* object,
+                            GDBusConnection* connection,
+                            const gchar* path,
+                            GError** error);
+VALA_EXTERN gint test_get_test (Test* self,
+                    GError** error);
+VALA_EXTERN Test* test_new (void);
+VALA_EXTERN Test* test_construct (GType object_type);
+static GType test_get_type_once (void);
+static void _dbus_test_get_test (Test* self,
+                          GVariant* _parameters_,
+                          GDBusMethodInvocation* invocation);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* method_name,
+                                      GVariant* parameters,
+                                      GDBusMethodInvocation* invocation,
+                                      gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+                                            const gchar* sender,
+                                            const gchar* object_path,
+                                            const gchar* interface_name,
+                                            const gchar* property_name,
+                                            GError** error,
+                                            gpointer user_data);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GVariant* value,
+                                           GError** error,
+                                           gpointer user_data);
+static void _test_unregister_object (gpointer user_data);
+VALA_EXTERN void client_exit (GPid pid,
+                  gint status);
+static void _vala_main (void);
+static guint _variant_get1 (GVariant* value);
+static void _client_exit_gchild_watch_func (GPid pid,
+                                     gint wait_status,
+                                     gpointer self);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static const GDBusArgInfo _test_dbus_arg_info_get_test_result = {-1, "result", "i", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_get_test_in[] = {NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_get_test_out[] = 
{&_test_dbus_arg_info_get_test_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_get_test = {-1, "GetTest", (GDBusArgInfo **) 
(&_test_dbus_arg_info_get_test_in), (GDBusArgInfo **) (&_test_dbus_arg_info_get_test_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_get_test, NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = {NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) 
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, 
test_dbus_interface_get_property, test_dbus_interface_set_property};
+
+gint
+test_get_test (Test* self,
+               GError** error)
+{
+       gint result = 0;
+       g_return_val_if_fail (IS_TEST (self), 0);
+       result = 4711;
+       return result;
+}
+
+Test*
+test_construct (GType object_type)
+{
+       Test * self = NULL;
+       self = (Test*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Test*
+test_new (void)
+{
+       return test_construct (TYPE_TEST);
+}
+
+static void
+test_class_init (TestClass * klass,
+                 gpointer klass_data)
+{
+       test_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+test_instance_init (Test * self,
+                    gpointer klass)
+{
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Test), 
0, (GInstanceInitFunc) test_instance_init, NULL };
+       GType test_type_id;
+       test_type_id = g_type_register_static (G_TYPE_OBJECT, "Test", &g_define_type_info, 0);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_register_object);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+static void
+_dbus_test_get_test (Test* self,
+                     GVariant* _parameters_,
+                     GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       gint result;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       result = test_get_test (self, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               return;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_int32 (result));
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* method_name,
+                                 GVariant* parameters,
+                                 GDBusMethodInvocation* invocation,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "GetTest") == 0) {
+               _dbus_test_get_test (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return NULL;
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GVariant* value,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return FALSE;
+}
+
+guint
+test_register_object (gpointer object,
+                      GDBusConnection* connection,
+                      const gchar* path,
+                      GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+void
+client_exit (GPid pid,
+             gint status)
+{
+       GMainLoop* _tmp0_;
+       _vala_assert (status == 0, "status == 0");
+       _tmp0_ = main_loop;
+       g_main_loop_quit (_tmp0_);
+}
+
+static guint
+_variant_get1 (GVariant* value)
+{
+       return g_variant_get_uint32 (value);
+}
+
+static void
+_client_exit_gchild_watch_func (GPid pid,
+                                gint wait_status,
+                                gpointer self)
+{
+       client_exit (pid, wait_status);
+}
+
+static void
+_vala_main (void)
+{
+       GDBusConnection* conn = NULL;
+       GDBusConnection* _tmp0_;
+       GDBusConnection* _tmp1_;
+       Test* _tmp2_;
+       Test* _tmp3_;
+       GVariant* request_result = NULL;
+       GDBusConnection* _tmp4_;
+       GVariant* _tmp5_;
+       GVariant* _tmp6_;
+       GVariant* _tmp7_;
+       GVariant* _tmp8_;
+       GVariant* _tmp9_;
+       GVariant* _tmp10_;
+       GVariant* _tmp11_;
+       guint _tmp12_;
+       GPid client_pid = 0;
+       gchar* _tmp13_;
+       gchar** _tmp14_;
+       gchar** _tmp15_;
+       gint _tmp15__length1;
+       GPid _tmp16_ = 0;
+       GMainLoop* _tmp17_;
+       GMainLoop* _tmp18_;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &_inner_error0_);
+       conn = _tmp0_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp1_ = conn;
+       _tmp2_ = test_new ();
+       _tmp3_ = _tmp2_;
+       test_register_object (_tmp3_, _tmp1_, "/org/example/test", &_inner_error0_);
+       _g_object_unref0 (_tmp3_);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp4_ = conn;
+       _tmp5_ = g_variant_new ("(su)", "org.example.Test", 0x4, NULL);
+       g_variant_ref_sink (_tmp5_);
+       _tmp6_ = _tmp5_;
+       _tmp7_ = g_dbus_connection_call_sync (_tmp4_, "org.freedesktop.DBus", "/org/freedesktop/DBus", 
"org.freedesktop.DBus", "RequestName", _tmp6_, NULL, 0, -1, NULL, &_inner_error0_);
+       _tmp8_ = _tmp7_;
+       _g_variant_unref0 (_tmp6_);
+       request_result = _tmp8_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp9_ = request_result;
+       _tmp10_ = g_variant_get_child_value (_tmp9_, (gsize) 0);
+       _tmp11_ = _tmp10_;
+       _tmp12_ = _variant_get1 (_tmp11_);
+       _vala_assert (_tmp12_ == ((guint) 1), "(uint) request_result.get_child_value (0) == 1");
+       _g_variant_unref0 (_tmp11_);
+       _tmp13_ = g_strdup ("dbus_connection_client");
+       _tmp14_ = g_new0 (gchar*, 1 + 1);
+       _tmp14_[0] = _tmp13_;
+       _tmp15_ = _tmp14_;
+       _tmp15__length1 = 1;
+       g_spawn_async (NULL, _tmp15_, NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &_tmp16_, &_inner_error0_);
+       client_pid = _tmp16_;
+       _tmp15_ = (_vala_array_free (_tmp15_, _tmp15__length1, (GDestroyNotify) g_free), NULL);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_variant_unref0 (request_result);
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       g_child_watch_add_full (G_PRIORITY_DEFAULT_IDLE, client_pid, _client_exit_gchild_watch_func, NULL, 
NULL);
+       _tmp17_ = g_main_loop_new (NULL, FALSE);
+       _g_main_loop_unref0 (main_loop);
+       main_loop = _tmp17_;
+       _tmp18_ = main_loop;
+       g_main_loop_run (_tmp18_);
+       _g_variant_unref0 (request_result);
+       _g_object_unref0 (conn);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/dbus/dicts_client.c-expected b/tests/dbus/dicts_client.c-expected
new file mode 100644
index 000000000..d7de6e2fc
--- /dev/null
+++ b/tests/dbus/dicts_client.c-expected
@@ -0,0 +1,487 @@
+/* dbus_dicts_client.c generated by valac, the Vala compiler
+ * generated from dbus_dicts_client.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define TEST_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_TEST, TestIface))
+
+typedef struct _Test Test;
+typedef struct _TestIface TestIface;
+
+#define TYPE_TEST_PROXY (test_proxy_get_type ())
+typedef GDBusProxy TestProxy;
+typedef GDBusProxyClass TestProxyClass;
+#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _TestIface {
+       GTypeInterface parent_iface;
+       GHashTable* (*test_dict) (Test* self, GError** error);
+};
+
+VALA_EXTERN GType test_proxy_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN guint test_register_object (void* object,
+                            GDBusConnection* connection,
+                            const gchar* path,
+                            GError** error);
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN GHashTable* test_test_dict (Test* self,
+                            GError** error);
+static GType test_get_type_once (void);
+static void test_proxy_g_signal (GDBusProxy* proxy,
+                          const gchar* sender_name,
+                          const gchar* signal_name,
+                          GVariant* parameters);
+static GHashTable* test_proxy_test_dict (Test* self,
+                                  GError** error);
+static void test_proxy_test_interface_init (TestIface* iface);
+static void _dbus_test_test_dict (Test* self,
+                           GVariant* _parameters_,
+                           GDBusMethodInvocation* invocation);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* method_name,
+                                      GVariant* parameters,
+                                      GDBusMethodInvocation* invocation,
+                                      gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+                                            const gchar* sender,
+                                            const gchar* object_path,
+                                            const gchar* interface_name,
+                                            const gchar* property_name,
+                                            GError** error,
+                                            gpointer user_data);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GVariant* value,
+                                           GError** error,
+                                           gpointer user_data);
+static void _test_unregister_object (gpointer user_data);
+static void _vala_main (void);
+static gchar** _variant_get1 (GVariant* value,
+                       gint* result_length1);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static const GDBusArgInfo _test_dbus_arg_info_test_dict_result = {-1, "result", "a{sv}", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_dict_in[] = {NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_dict_out[] = 
{&_test_dbus_arg_info_test_dict_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_dict = {-1, "TestDict", (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_dict_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_dict_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_test_dict, NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = {NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) 
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, 
test_dbus_interface_get_property, test_dbus_interface_set_property};
+
+GHashTable*
+test_test_dict (Test* self,
+                GError** error)
+{
+       TestIface* _iface_;
+       g_return_val_if_fail (IS_TEST (self), NULL);
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->test_dict) {
+               return _iface_->test_dict (self, error);
+       }
+       return NULL;
+}
+
+static void
+test_default_init (TestIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType test_type_id;
+       test_type_id = g_type_register_static (G_TYPE_INTERFACE, "Test", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (test_type_id, G_TYPE_OBJECT);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) 
test_proxy_get_type);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), 
"org.example.Test");
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*) 
(&_test_dbus_interface_info));
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_register_object);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_TEST, 
test_proxy_test_interface_init) )
+static void
+test_proxy_class_init (TestProxyClass* klass)
+{
+       G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal;
+}
+
+static void
+test_proxy_g_signal (GDBusProxy* proxy,
+                     const gchar* sender_name,
+                     const gchar* signal_name,
+                     GVariant* parameters)
+{
+}
+
+static void
+test_proxy_init (TestProxy* self)
+{
+       g_dbus_proxy_set_interface_info (G_DBUS_PROXY (self), (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info));
+}
+
+static GHashTable*
+test_proxy_test_dict (Test* self,
+                      GError** error)
+{
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       GDBusMessage *_reply_message;
+       GVariant *_reply;
+       GVariantIter _reply_iter;
+       GHashTable* _result = NULL;
+       GVariant* _tmp0_;
+       GHashTable* _tmp1_;
+       GVariantIter _tmp2_;
+       GVariant* _tmp3_;
+       GVariant* _tmp4_;
+       G_IO_ERROR;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "TestDict");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       _reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout 
((GDBusProxy *) self), NULL, NULL, error);
+       g_object_unref (_message);
+       if (!_reply_message) {
+               return NULL;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, error)) {
+               g_object_unref (_reply_message);
+               return NULL;
+       }
+       _reply = g_dbus_message_get_body (_reply_message);
+       g_variant_iter_init (&_reply_iter, _reply);
+       _tmp0_ = g_variant_iter_next_value (&_reply_iter);
+       _tmp1_ = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_variant_unref);
+       g_variant_iter_init (&_tmp2_, _tmp0_);
+       while (g_variant_iter_loop (&_tmp2_, "{?*}", &_tmp3_, &_tmp4_)) {
+               g_hash_table_insert (_tmp1_, g_variant_dup_string (_tmp3_, NULL), g_variant_get_variant 
(_tmp4_));
+       }
+       _result = _tmp1_;
+       g_variant_unref (_tmp0_);
+       g_object_unref (_reply_message);
+       return _result;
+}
+
+static void
+test_proxy_test_interface_init (TestIface* iface)
+{
+       iface->test_dict = test_proxy_test_dict;
+}
+
+static void
+_dbus_test_test_dict (Test* self,
+                      GVariant* _parameters_,
+                      GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       GHashTable* result;
+       GVariantBuilder _tmp5_;
+       GHashTableIter _tmp6_;
+       gpointer _tmp7_;
+       gpointer _tmp8_;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       result = test_test_dict (self, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               return;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       g_hash_table_iter_init (&_tmp6_, result);
+       g_variant_builder_init (&_tmp5_, G_VARIANT_TYPE ("a{sv}"));
+       while (g_hash_table_iter_next (&_tmp6_, &_tmp7_, &_tmp8_)) {
+               gchar* _key;
+               GVariant* _value;
+               _key = (gchar*) _tmp7_;
+               _value = (GVariant*) _tmp8_;
+               g_variant_builder_add (&_tmp5_, "{?*}", g_variant_new_string (_key), g_variant_new_variant 
(_value));
+       }
+       g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp5_));
+       _g_hash_table_unref0 (result);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* method_name,
+                                 GVariant* parameters,
+                                 GDBusMethodInvocation* invocation,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "TestDict") == 0) {
+               _dbus_test_test_dict (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return NULL;
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GVariant* value,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return FALSE;
+}
+
+guint
+test_register_object (gpointer object,
+                      GDBusConnection* connection,
+                      const gchar* path,
+                      GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+static gpointer
+_g_variant_ref0 (gpointer self)
+{
+       return self ? g_variant_ref (self) : NULL;
+}
+
+static gchar**
+_variant_get1 (GVariant* value,
+               gint* result_length1)
+{
+       gchar** _tmp10_;
+       gint _tmp10__length;
+       gint _tmp10__size;
+       gint _tmp10__length1;
+       GVariantIter _tmp11_;
+       GVariant* _tmp12_;
+       _tmp10_ = g_new (gchar*, 5);
+       _tmp10__length = 0;
+       _tmp10__size = 4;
+       _tmp10__length1 = 0;
+       g_variant_iter_init (&_tmp11_, value);
+       for (; (_tmp12_ = g_variant_iter_next_value (&_tmp11_)) != NULL; _tmp10__length1++) {
+               if (_tmp10__size == _tmp10__length) {
+                       _tmp10__size = 2 * _tmp10__size;
+                       _tmp10_ = g_renew (gchar*, _tmp10_, _tmp10__size + 1);
+               }
+               _tmp10_[_tmp10__length++] = g_variant_dup_string (_tmp12_, NULL);
+               g_variant_unref (_tmp12_);
+       }
+       *result_length1 = _tmp10__length1;
+       _tmp10_[_tmp10__length] = NULL;
+       return _tmp10_;
+}
+
+static void
+_vala_main (void)
+{
+       Test* test = NULL;
+       Test* _tmp0_;
+       GHashTable* dict = NULL;
+       Test* _tmp1_;
+       GHashTable* _tmp2_;
+       GHashTable* _tmp3_;
+       GVariant* v = NULL;
+       GHashTable* _tmp4_;
+       gconstpointer _tmp5_;
+       GVariant* _tmp6_;
+       GVariant* _tmp7_;
+       gchar** s = NULL;
+       GVariant* _tmp8_;
+       gchar** _tmp9_ = NULL;
+       gint _tmp9__length1 = 0;
+       gint s_length1;
+       gint _s_size_;
+       gboolean _tmp13_ = FALSE;
+       gchar** _tmp14_;
+       gint _tmp14__length1;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = (Test*) g_initable_new (TYPE_TEST_PROXY, NULL, &_inner_error0_, "g-flags", 0, "g-name", 
"org.example.Test", "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/example/test", 
"g-interface-name", "org.example.Test", NULL);
+       test = (Test*) _tmp0_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp1_ = test;
+       _tmp2_ = test_test_dict (_tmp1_, &_inner_error0_);
+       dict = _tmp2_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (test);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp3_ = dict;
+       _vala_assert (g_hash_table_size (_tmp3_) == ((guint) 1), "dict.size () == 1");
+       _tmp4_ = dict;
+       _tmp5_ = g_hash_table_lookup (_tmp4_, "hello");
+       _tmp6_ = _g_variant_ref0 ((GVariant*) _tmp5_);
+       v = _tmp6_;
+       _tmp7_ = v;
+       _vala_assert (_tmp7_ != NULL, "v != null");
+       _tmp8_ = v;
+       _tmp9_ = _variant_get1 (_tmp8_, &_tmp9__length1);
+       s = _tmp9_;
+       s_length1 = _tmp9__length1;
+       _s_size_ = s_length1;
+       _tmp14_ = s;
+       _tmp14__length1 = s_length1;
+       if (_tmp14__length1 == 1) {
+               gchar** _tmp15_;
+               gint _tmp15__length1;
+               const gchar* _tmp16_;
+               _tmp15_ = s;
+               _tmp15__length1 = s_length1;
+               _tmp16_ = _tmp15_[0];
+               _tmp13_ = g_strcmp0 (_tmp16_, "hello") == 0;
+       } else {
+               _tmp13_ = FALSE;
+       }
+       _vala_assert (_tmp13_, "s.length == 1 && s[0] == \"hello\"");
+       s = (_vala_array_free (s, s_length1, (GDestroyNotify) g_free), NULL);
+       _g_variant_unref0 (v);
+       _g_hash_table_unref0 (dict);
+       _g_object_unref0 (test);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/dbus/dicts_server.c-expected b/tests/dbus/dicts_server.c-expected
new file mode 100644
index 000000000..90cafa765
--- /dev/null
+++ b/tests/dbus/dicts_server.c-expected
@@ -0,0 +1,917 @@
+/* dbus_dicts_server.c generated by valac, the Vala compiler
+ * generated from dbus_dicts_server.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TEST, TestClass))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define IS_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TEST))
+#define TEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TEST, TestClass))
+
+typedef struct _Test Test;
+typedef struct _TestClass TestClass;
+typedef struct _TestPrivate TestPrivate;
+enum  {
+       TEST_0_PROPERTY,
+       TEST_NUM_PROPERTIES
+};
+static GParamSpec* test_properties[TEST_NUM_PROPERTIES];
+#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
+
+#define TEST_INTERFACE_TYPE_BAR (test_interface_bar_get_type ())
+#define TEST_INTERFACE_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEST_INTERFACE_TYPE_BAR, 
TestInterfaceBar))
+#define TEST_INTERFACE_IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEST_INTERFACE_TYPE_BAR))
+#define TEST_INTERFACE_BAR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), 
TEST_INTERFACE_TYPE_BAR, TestInterfaceBarIface))
+
+typedef struct _TestInterfaceBar TestInterfaceBar;
+typedef struct _TestInterfaceBarIface TestInterfaceBarIface;
+
+#define TEST_INTERFACE_TYPE_BAR_PROXY (test_interface_bar_proxy_get_type ())
+typedef GDBusProxy TestInterfaceBarProxy;
+typedef GDBusProxyClass TestInterfaceBarProxyClass;
+
+#define TEST_INTERFACE_TYPE_FOO (test_interface_foo_get_type ())
+#define TEST_INTERFACE_FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEST_INTERFACE_TYPE_FOO, 
TestInterfaceFoo))
+#define TEST_INTERFACE_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEST_INTERFACE_TYPE_FOO, 
TestInterfaceFooClass))
+#define TEST_INTERFACE_IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEST_INTERFACE_TYPE_FOO))
+#define TEST_INTERFACE_IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TEST_INTERFACE_TYPE_FOO))
+#define TEST_INTERFACE_FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEST_INTERFACE_TYPE_FOO, 
TestInterfaceFooClass))
+
+typedef struct _TestInterfaceFoo TestInterfaceFoo;
+typedef struct _TestInterfaceFooClass TestInterfaceFooClass;
+typedef struct _TestInterfaceFooPrivate TestInterfaceFooPrivate;
+enum  {
+       TEST_INTERFACE_FOO_0_PROPERTY,
+       TEST_INTERFACE_FOO_NUM_PROPERTIES
+};
+static GParamSpec* test_interface_foo_properties[TEST_INTERFACE_FOO_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Test {
+       GObject parent_instance;
+       TestPrivate * priv;
+};
+
+struct _TestClass {
+       GObjectClass parent_class;
+};
+
+struct _TestInterfaceBarIface {
+       GTypeInterface parent_iface;
+       GHashTable* (*foo) (TestInterfaceBar* self, GError** error);
+};
+
+struct _TestInterfaceFoo {
+       GDBusProxy parent_instance;
+       TestInterfaceFooPrivate * priv;
+};
+
+struct _TestInterfaceFooClass {
+       GDBusProxyClass parent_class;
+};
+
+static gpointer test_parent_class = NULL;
+static gpointer test_interface_foo_parent_class = NULL;
+static TestInterfaceBarIface * test_interface_foo_test_interface_bar_parent_iface = NULL;
+VALA_EXTERN GMainLoop* main_loop;
+GMainLoop* main_loop = NULL;
+
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
+VALA_EXTERN guint test_register_object (void* object,
+                            GDBusConnection* connection,
+                            const gchar* path,
+                            GError** error);
+VALA_EXTERN GHashTable* test_test_dict (Test* self);
+static void _g_free0_ (gpointer var);
+static void _g_variant_unref0_ (gpointer var);
+static GVariant* _variant_new1 (gchar** value,
+                         gint value_length1);
+VALA_EXTERN Test* test_new (void);
+VALA_EXTERN Test* test_construct (GType object_type);
+static GType test_get_type_once (void);
+static void _dbus_test_test_dict (Test* self,
+                           GVariant* _parameters_,
+                           GDBusMethodInvocation* invocation);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* method_name,
+                                      GVariant* parameters,
+                                      GDBusMethodInvocation* invocation,
+                                      gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+                                            const gchar* sender,
+                                            const gchar* object_path,
+                                            const gchar* interface_name,
+                                            const gchar* property_name,
+                                            GError** error,
+                                            gpointer user_data);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GVariant* value,
+                                           GError** error,
+                                           gpointer user_data);
+static void _test_unregister_object (gpointer user_data);
+VALA_EXTERN GType test_interface_bar_proxy_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN guint test_interface_bar_register_object (void* object,
+                                          GDBusConnection* connection,
+                                          const gchar* path,
+                                          GError** error);
+VALA_EXTERN GType test_interface_bar_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN GHashTable* test_interface_bar_foo (TestInterfaceBar* self,
+                                    GError** error);
+static GType test_interface_bar_get_type_once (void);
+static void test_interface_bar_proxy_g_signal (GDBusProxy* proxy,
+                                        const gchar* sender_name,
+                                        const gchar* signal_name,
+                                        GVariant* parameters);
+static GHashTable* test_interface_bar_proxy_foo (TestInterfaceBar* self,
+                                          GError** error);
+static void test_interface_bar_proxy_test_interface_bar_interface_init (TestInterfaceBarIface* iface);
+static void _dbus_test_interface_bar_foo (TestInterfaceBar* self,
+                                   GVariant* _parameters_,
+                                   GDBusMethodInvocation* invocation);
+static void test_interface_bar_dbus_interface_method_call (GDBusConnection* connection,
+                                                    const gchar* sender,
+                                                    const gchar* object_path,
+                                                    const gchar* interface_name,
+                                                    const gchar* method_name,
+                                                    GVariant* parameters,
+                                                    GDBusMethodInvocation* invocation,
+                                                    gpointer user_data);
+static GVariant* test_interface_bar_dbus_interface_get_property (GDBusConnection* connection,
+                                                          const gchar* sender,
+                                                          const gchar* object_path,
+                                                          const gchar* interface_name,
+                                                          const gchar* property_name,
+                                                          GError** error,
+                                                          gpointer user_data);
+static gboolean test_interface_bar_dbus_interface_set_property (GDBusConnection* connection,
+                                                         const gchar* sender,
+                                                         const gchar* object_path,
+                                                         const gchar* interface_name,
+                                                         const gchar* property_name,
+                                                         GVariant* value,
+                                                         GError** error,
+                                                         gpointer user_data);
+static void _test_interface_bar_unregister_object (gpointer user_data);
+VALA_EXTERN GType test_interface_foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (TestInterfaceFoo, g_object_unref)
+static GHashTable* test_interface_foo_real_foo (TestInterfaceBar* base,
+                                         GError** error);
+VALA_EXTERN TestInterfaceFoo* test_interface_foo_new (void);
+VALA_EXTERN TestInterfaceFoo* test_interface_foo_construct (GType object_type);
+static GType test_interface_foo_get_type_once (void);
+VALA_EXTERN void client_exit (GPid pid,
+                  gint status);
+static void _vala_main (void);
+static guint _variant_get1 (GVariant* value);
+static void _client_exit_gchild_watch_func (GPid pid,
+                                     gint wait_status,
+                                     gpointer self);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static const GDBusArgInfo _test_dbus_arg_info_test_dict_result = {-1, "result", "a{sv}", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_dict_in[] = {NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_dict_out[] = 
{&_test_dbus_arg_info_test_dict_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_dict = {-1, "TestDict", (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_dict_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_dict_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_test_dict, NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = {NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) 
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, 
test_dbus_interface_get_property, test_dbus_interface_set_property};
+static const GDBusArgInfo _test_interface_bar_dbus_arg_info_foo_result = {-1, "result", "a{sv}", NULL};
+static const GDBusArgInfo * const _test_interface_bar_dbus_arg_info_foo_in[] = {NULL};
+static const GDBusArgInfo * const _test_interface_bar_dbus_arg_info_foo_out[] = 
{&_test_interface_bar_dbus_arg_info_foo_result, NULL};
+static const GDBusMethodInfo _test_interface_bar_dbus_method_info_foo = {-1, "Foo", (GDBusArgInfo **) 
(&_test_interface_bar_dbus_arg_info_foo_in), (GDBusArgInfo **) (&_test_interface_bar_dbus_arg_info_foo_out), 
NULL};
+static const GDBusMethodInfo * const _test_interface_bar_dbus_method_info[] = 
{&_test_interface_bar_dbus_method_info_foo, NULL};
+static const GDBusSignalInfo * const _test_interface_bar_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo * const _test_interface_bar_dbus_property_info[] = {NULL};
+static const GDBusInterfaceInfo _test_interface_bar_dbus_interface_info = {-1, "org.vala.Test.Bar", 
(GDBusMethodInfo **) (&_test_interface_bar_dbus_method_info), (GDBusSignalInfo **) 
(&_test_interface_bar_dbus_signal_info), (GDBusPropertyInfo **) (&_test_interface_bar_dbus_property_info), 
NULL};
+static const GDBusInterfaceVTable _test_interface_bar_dbus_interface_vtable = 
{test_interface_bar_dbus_interface_method_call, test_interface_bar_dbus_interface_get_property, 
test_interface_bar_dbus_interface_set_property};
+
+static void
+_g_free0_ (gpointer var)
+{
+       var = (g_free (var), NULL);
+}
+
+static void
+_g_variant_unref0_ (gpointer var)
+{
+       (var == NULL) ? NULL : (var = (g_variant_unref (var), NULL));
+}
+
+static GVariant*
+_variant_new1 (gchar** value,
+               gint value_length1)
+{
+       gchar** _tmp5_;
+       GVariantBuilder _tmp6_;
+       gint _tmp7_;
+       _tmp5_ = value;
+       g_variant_builder_init (&_tmp6_, G_VARIANT_TYPE ("as"));
+       for (_tmp7_ = 0; _tmp7_ < value_length1; _tmp7_++) {
+               g_variant_builder_add_value (&_tmp6_, g_variant_new_string (*_tmp5_));
+               _tmp5_++;
+       }
+       return g_variant_ref_sink (g_variant_builder_end (&_tmp6_));
+}
+
+GHashTable*
+test_test_dict (Test* self)
+{
+       gchar** s = NULL;
+       gchar* _tmp0_;
+       gchar** _tmp1_;
+       gint s_length1;
+       gint _s_size_;
+       GHashTable* dict = NULL;
+       GHashFunc _tmp2_;
+       GHashTable* _tmp3_;
+       gchar* _tmp4_;
+       GVariant* _tmp8_;
+       GHashTable* result = NULL;
+       g_return_val_if_fail (IS_TEST (self), NULL);
+       _tmp0_ = g_strdup ("hello");
+       _tmp1_ = g_new0 (gchar*, 1 + 1);
+       _tmp1_[0] = _tmp0_;
+       s = _tmp1_;
+       s_length1 = 1;
+       _s_size_ = s_length1;
+       _tmp2_ = g_str_hash;
+       _tmp3_ = g_hash_table_new_full (_tmp2_, NULL, _g_free0_, _g_variant_unref0_);
+       dict = _tmp3_;
+       _tmp4_ = g_strdup ("hello");
+       _tmp8_ = _variant_new1 (s, s_length1);
+       g_hash_table_insert (dict, _tmp4_, _tmp8_);
+       result = dict;
+       s = (_vala_array_free (s, s_length1, (GDestroyNotify) g_free), NULL);
+       return result;
+}
+
+Test*
+test_construct (GType object_type)
+{
+       Test * self = NULL;
+       self = (Test*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Test*
+test_new (void)
+{
+       return test_construct (TYPE_TEST);
+}
+
+static void
+test_class_init (TestClass * klass,
+                 gpointer klass_data)
+{
+       test_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+test_instance_init (Test * self,
+                    gpointer klass)
+{
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Test), 
0, (GInstanceInitFunc) test_instance_init, NULL };
+       GType test_type_id;
+       test_type_id = g_type_register_static (G_TYPE_OBJECT, "Test", &g_define_type_info, 0);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_register_object);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+static void
+_dbus_test_test_dict (Test* self,
+                      GVariant* _parameters_,
+                      GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       GHashTable* result;
+       GVariantBuilder _tmp0_;
+       GHashTableIter _tmp1_;
+       gpointer _tmp2_;
+       gpointer _tmp3_;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       result = test_test_dict (self);
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       g_hash_table_iter_init (&_tmp1_, result);
+       g_variant_builder_init (&_tmp0_, G_VARIANT_TYPE ("a{sv}"));
+       while (g_hash_table_iter_next (&_tmp1_, &_tmp2_, &_tmp3_)) {
+               gchar* _key;
+               GVariant* _value;
+               _key = (gchar*) _tmp2_;
+               _value = (GVariant*) _tmp3_;
+               g_variant_builder_add (&_tmp0_, "{?*}", g_variant_new_string (_key), g_variant_new_variant 
(_value));
+       }
+       g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp0_));
+       _g_hash_table_unref0 (result);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* method_name,
+                                 GVariant* parameters,
+                                 GDBusMethodInvocation* invocation,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "TestDict") == 0) {
+               _dbus_test_test_dict (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return NULL;
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GVariant* value,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return FALSE;
+}
+
+guint
+test_register_object (gpointer object,
+                      GDBusConnection* connection,
+                      const gchar* path,
+                      GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+GHashTable*
+test_interface_bar_foo (TestInterfaceBar* self,
+                        GError** error)
+{
+       TestInterfaceBarIface* _iface_;
+       g_return_val_if_fail (TEST_INTERFACE_IS_BAR (self), NULL);
+       _iface_ = TEST_INTERFACE_BAR_GET_INTERFACE (self);
+       if (_iface_->foo) {
+               return _iface_->foo (self, error);
+       }
+       return NULL;
+}
+
+static void
+test_interface_bar_default_init (TestInterfaceBarIface * iface,
+                                 gpointer iface_data)
+{
+}
+
+static GType
+test_interface_bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestInterfaceBarIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_interface_bar_default_init, (GClassFinalizeFunc) NULL, NULL, 
0, 0, (GInstanceInitFunc) NULL, NULL };
+       GType test_interface_bar_type_id;
+       test_interface_bar_type_id = g_type_register_static (G_TYPE_INTERFACE, "TestInterfaceBar", 
&g_define_type_info, 0);
+       g_type_interface_add_prerequisite (test_interface_bar_type_id, G_TYPE_OBJECT);
+       g_type_set_qdata (test_interface_bar_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), 
(void*) test_interface_bar_proxy_get_type);
+       g_type_set_qdata (test_interface_bar_type_id, g_quark_from_static_string 
("vala-dbus-interface-name"), "org.vala.Test.Bar");
+       g_type_set_qdata (test_interface_bar_type_id, g_quark_from_static_string 
("vala-dbus-interface-info"), (void*) (&_test_interface_bar_dbus_interface_info));
+       g_type_set_qdata (test_interface_bar_type_id, g_quark_from_static_string 
("vala-dbus-register-object"), (void*) test_interface_bar_register_object);
+       return test_interface_bar_type_id;
+}
+
+GType
+test_interface_bar_get_type (void)
+{
+       static volatile gsize test_interface_bar_type_id__volatile = 0;
+       if (g_once_init_enter (&test_interface_bar_type_id__volatile)) {
+               GType test_interface_bar_type_id;
+               test_interface_bar_type_id = test_interface_bar_get_type_once ();
+               g_once_init_leave (&test_interface_bar_type_id__volatile, test_interface_bar_type_id);
+       }
+       return test_interface_bar_type_id__volatile;
+}
+
+G_DEFINE_TYPE_EXTENDED (TestInterfaceBarProxy, test_interface_bar_proxy, G_TYPE_DBUS_PROXY, 0, 
G_IMPLEMENT_INTERFACE (TEST_INTERFACE_TYPE_BAR, test_interface_bar_proxy_test_interface_bar_interface_init) )
+static void
+test_interface_bar_proxy_class_init (TestInterfaceBarProxyClass* klass)
+{
+       G_DBUS_PROXY_CLASS (klass)->g_signal = test_interface_bar_proxy_g_signal;
+}
+
+static void
+test_interface_bar_proxy_g_signal (GDBusProxy* proxy,
+                                   const gchar* sender_name,
+                                   const gchar* signal_name,
+                                   GVariant* parameters)
+{
+}
+
+static void
+test_interface_bar_proxy_init (TestInterfaceBarProxy* self)
+{
+       g_dbus_proxy_set_interface_info (G_DBUS_PROXY (self), (GDBusInterfaceInfo *) 
(&_test_interface_bar_dbus_interface_info));
+}
+
+static GHashTable*
+test_interface_bar_proxy_foo (TestInterfaceBar* self,
+                              GError** error)
+{
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       GDBusMessage *_reply_message;
+       GVariant *_reply;
+       GVariantIter _reply_iter;
+       GHashTable* _result = NULL;
+       GVariant* _tmp4_;
+       GHashTable* _tmp5_;
+       GVariantIter _tmp6_;
+       GVariant* _tmp7_;
+       GVariant* _tmp8_;
+       G_IO_ERROR;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.vala.Test.Bar", "Foo");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       _reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout 
((GDBusProxy *) self), NULL, NULL, error);
+       g_object_unref (_message);
+       if (!_reply_message) {
+               return NULL;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, error)) {
+               g_object_unref (_reply_message);
+               return NULL;
+       }
+       _reply = g_dbus_message_get_body (_reply_message);
+       g_variant_iter_init (&_reply_iter, _reply);
+       _tmp4_ = g_variant_iter_next_value (&_reply_iter);
+       _tmp5_ = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_variant_unref);
+       g_variant_iter_init (&_tmp6_, _tmp4_);
+       while (g_variant_iter_loop (&_tmp6_, "{?*}", &_tmp7_, &_tmp8_)) {
+               g_hash_table_insert (_tmp5_, g_variant_dup_string (_tmp7_, NULL), g_variant_get_variant 
(_tmp8_));
+       }
+       _result = _tmp5_;
+       g_variant_unref (_tmp4_);
+       g_object_unref (_reply_message);
+       return _result;
+}
+
+static void
+test_interface_bar_proxy_test_interface_bar_interface_init (TestInterfaceBarIface* iface)
+{
+       iface->foo = test_interface_bar_proxy_foo;
+}
+
+static void
+_dbus_test_interface_bar_foo (TestInterfaceBar* self,
+                              GVariant* _parameters_,
+                              GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       GHashTable* result;
+       GVariantBuilder _tmp9_;
+       GHashTableIter _tmp10_;
+       gpointer _tmp11_;
+       gpointer _tmp12_;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       result = test_interface_bar_foo (self, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               return;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       g_hash_table_iter_init (&_tmp10_, result);
+       g_variant_builder_init (&_tmp9_, G_VARIANT_TYPE ("a{sv}"));
+       while (g_hash_table_iter_next (&_tmp10_, &_tmp11_, &_tmp12_)) {
+               gchar* _key;
+               GVariant* _value;
+               _key = (gchar*) _tmp11_;
+               _value = (GVariant*) _tmp12_;
+               g_variant_builder_add (&_tmp9_, "{?*}", g_variant_new_string (_key), g_variant_new_variant 
(_value));
+       }
+       g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp9_));
+       _g_hash_table_unref0 (result);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+}
+
+static void
+test_interface_bar_dbus_interface_method_call (GDBusConnection* connection,
+                                               const gchar* sender,
+                                               const gchar* object_path,
+                                               const gchar* interface_name,
+                                               const gchar* method_name,
+                                               GVariant* parameters,
+                                               GDBusMethodInvocation* invocation,
+                                               gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "Foo") == 0) {
+               _dbus_test_interface_bar_foo (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+test_interface_bar_dbus_interface_get_property (GDBusConnection* connection,
+                                                const gchar* sender,
+                                                const gchar* object_path,
+                                                const gchar* interface_name,
+                                                const gchar* property_name,
+                                                GError** error,
+                                                gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return NULL;
+}
+
+static gboolean
+test_interface_bar_dbus_interface_set_property (GDBusConnection* connection,
+                                                const gchar* sender,
+                                                const gchar* object_path,
+                                                const gchar* interface_name,
+                                                const gchar* property_name,
+                                                GVariant* value,
+                                                GError** error,
+                                                gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return FALSE;
+}
+
+guint
+test_interface_bar_register_object (gpointer object,
+                                    GDBusConnection* connection,
+                                    const gchar* path,
+                                    GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_interface_bar_dbus_interface_info), &_test_interface_bar_dbus_interface_vtable, data, 
_test_interface_bar_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       return result;
+}
+
+static void
+_test_interface_bar_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+static GHashTable*
+test_interface_foo_real_foo (TestInterfaceBar* base,
+                             GError** error)
+{
+       TestInterfaceFoo * self;
+       GHashFunc _tmp0_;
+       GEqualFunc _tmp1_;
+       GHashTable* _tmp2_;
+       GHashTable* result = NULL;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TEST_INTERFACE_TYPE_FOO, TestInterfaceFoo);
+       _tmp0_ = g_str_hash;
+       _tmp1_ = g_str_equal;
+       _tmp2_ = g_hash_table_new_full (_tmp0_, _tmp1_, _g_free0_, _g_variant_unref0_);
+       result = _tmp2_;
+       return result;
+}
+
+TestInterfaceFoo*
+test_interface_foo_construct (GType object_type)
+{
+       TestInterfaceFoo * self = NULL;
+       self = (TestInterfaceFoo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+TestInterfaceFoo*
+test_interface_foo_new (void)
+{
+       return test_interface_foo_construct (TEST_INTERFACE_TYPE_FOO);
+}
+
+static void
+test_interface_foo_class_init (TestInterfaceFooClass * klass,
+                               gpointer klass_data)
+{
+       test_interface_foo_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+test_interface_foo_test_interface_bar_interface_init (TestInterfaceBarIface * iface,
+                                                      gpointer iface_data)
+{
+       test_interface_foo_test_interface_bar_parent_iface = g_type_interface_peek_parent (iface);
+       iface->foo = (GHashTable* (*) (TestInterfaceBar*, GError**)) test_interface_foo_real_foo;
+}
+
+static void
+test_interface_foo_instance_init (TestInterfaceFoo * self,
+                                  gpointer klass)
+{
+}
+
+static GType
+test_interface_foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestInterfaceFooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_interface_foo_class_init, (GClassFinalizeFunc) NULL, NULL, 
sizeof (TestInterfaceFoo), 0, (GInstanceInitFunc) test_interface_foo_instance_init, NULL };
+       static const GInterfaceInfo test_interface_bar_info = { (GInterfaceInitFunc) 
test_interface_foo_test_interface_bar_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
+       GType test_interface_foo_type_id;
+       test_interface_foo_type_id = g_type_register_static (g_dbus_proxy_get_type (), "TestInterfaceFoo", 
&g_define_type_info, 0);
+       g_type_add_interface_static (test_interface_foo_type_id, TEST_INTERFACE_TYPE_BAR, 
&test_interface_bar_info);
+       return test_interface_foo_type_id;
+}
+
+GType
+test_interface_foo_get_type (void)
+{
+       static volatile gsize test_interface_foo_type_id__volatile = 0;
+       if (g_once_init_enter (&test_interface_foo_type_id__volatile)) {
+               GType test_interface_foo_type_id;
+               test_interface_foo_type_id = test_interface_foo_get_type_once ();
+               g_once_init_leave (&test_interface_foo_type_id__volatile, test_interface_foo_type_id);
+       }
+       return test_interface_foo_type_id__volatile;
+}
+
+void
+client_exit (GPid pid,
+             gint status)
+{
+       GMainLoop* _tmp0_;
+       _vala_assert (status == 0, "status == 0");
+       _tmp0_ = main_loop;
+       g_main_loop_quit (_tmp0_);
+}
+
+static guint
+_variant_get1 (GVariant* value)
+{
+       return g_variant_get_uint32 (value);
+}
+
+static void
+_client_exit_gchild_watch_func (GPid pid,
+                                gint wait_status,
+                                gpointer self)
+{
+       client_exit (pid, wait_status);
+}
+
+static void
+_vala_main (void)
+{
+       GDBusConnection* conn = NULL;
+       GDBusConnection* _tmp0_;
+       GDBusConnection* _tmp1_;
+       Test* _tmp2_;
+       Test* _tmp3_;
+       GVariant* request_result = NULL;
+       GDBusConnection* _tmp4_;
+       GVariant* _tmp5_;
+       GVariant* _tmp6_;
+       GVariant* _tmp7_;
+       GVariant* _tmp8_;
+       GVariant* _tmp9_;
+       GVariant* _tmp10_;
+       GVariant* _tmp11_;
+       guint _tmp12_;
+       GPid client_pid = 0;
+       gchar* _tmp13_;
+       gchar** _tmp14_;
+       gchar** _tmp15_;
+       gint _tmp15__length1;
+       GPid _tmp16_ = 0;
+       GMainLoop* _tmp17_;
+       GMainLoop* _tmp18_;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &_inner_error0_);
+       conn = _tmp0_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp1_ = conn;
+       _tmp2_ = test_new ();
+       _tmp3_ = _tmp2_;
+       test_register_object (_tmp3_, _tmp1_, "/org/example/test", &_inner_error0_);
+       _g_object_unref0 (_tmp3_);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp4_ = conn;
+       _tmp5_ = g_variant_new ("(su)", "org.example.Test", 0x4, NULL);
+       g_variant_ref_sink (_tmp5_);
+       _tmp6_ = _tmp5_;
+       _tmp7_ = g_dbus_connection_call_sync (_tmp4_, "org.freedesktop.DBus", "/org/freedesktop/DBus", 
"org.freedesktop.DBus", "RequestName", _tmp6_, NULL, 0, -1, NULL, &_inner_error0_);
+       _tmp8_ = _tmp7_;
+       _g_variant_unref0 (_tmp6_);
+       request_result = _tmp8_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp9_ = request_result;
+       _tmp10_ = g_variant_get_child_value (_tmp9_, (gsize) 0);
+       _tmp11_ = _tmp10_;
+       _tmp12_ = _variant_get1 (_tmp11_);
+       _vala_assert (_tmp12_ == ((guint) 1), "(uint) request_result.get_child_value (0) == 1");
+       _g_variant_unref0 (_tmp11_);
+       _tmp13_ = g_strdup ("dbus_dicts_client");
+       _tmp14_ = g_new0 (gchar*, 1 + 1);
+       _tmp14_[0] = _tmp13_;
+       _tmp15_ = _tmp14_;
+       _tmp15__length1 = 1;
+       g_spawn_async (NULL, _tmp15_, NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &_tmp16_, &_inner_error0_);
+       client_pid = _tmp16_;
+       _tmp15_ = (_vala_array_free (_tmp15_, _tmp15__length1, (GDestroyNotify) g_free), NULL);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_variant_unref0 (request_result);
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       g_child_watch_add_full (G_PRIORITY_DEFAULT_IDLE, client_pid, _client_exit_gchild_watch_func, NULL, 
NULL);
+       _tmp17_ = g_main_loop_new (NULL, FALSE);
+       _g_main_loop_unref0 (main_loop);
+       main_loop = _tmp17_;
+       _tmp18_ = main_loop;
+       g_main_loop_run (_tmp18_);
+       _g_variant_unref0 (request_result);
+       _g_object_unref0 (conn);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/dbus/dynamic-method_client.c-expected b/tests/dbus/dynamic-method_client.c-expected
new file mode 100644
index 000000000..92af699b4
--- /dev/null
+++ b/tests/dbus/dynamic-method_client.c-expected
@@ -0,0 +1,250 @@
+/* dbus_dynamic_method_client.c generated by valac, the Vala compiler
+ * generated from dbus_dynamic_method_client.vala, do not modify */
+
+#include <gio/gio.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _g_free0(var) (var = (g_free (var), NULL))
+typedef struct _RunData RunData;
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _RunData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       GDBusConnection* bus;
+       GDBusConnection* _tmp0_;
+       GDBusProxy* test;
+       GDBusConnection* _tmp1_;
+       GDBusConnection* _tmp2_;
+       const gchar* _tmp3_;
+       GDBusProxy* _tmp4_;
+       gchar* s;
+       gint i;
+       GDBusProxy* _tmp5_;
+       gchar* _tmp10_;
+       gint _tmp11_;
+       const gchar* _tmp12_;
+       GMainLoop* _tmp13_;
+       GError* _inner_error0_;
+};
+
+VALA_EXTERN GMainLoop* main_loop;
+GMainLoop* main_loop = NULL;
+
+static void run_data_free (gpointer _data);
+VALA_EXTERN void run (GAsyncReadyCallback _callback_,
+          gpointer _user_data_);
+VALA_EXTERN void run_finish (GAsyncResult* _res_);
+static gboolean run_co (RunData* _data_);
+static void run_ready (GObject* source_object,
+                GAsyncResult* _res_,
+                gpointer _user_data_);
+static gint _dynamic_do_foo0 (GDBusProxy* self,
+                       gint param1,
+                       gchar* * param2,
+                       GError** error);
+static void _vala_main (void);
+
+static void
+run_data_free (gpointer _data)
+{
+       RunData* _data_;
+       _data_ = _data;
+       g_slice_free (RunData, _data_);
+}
+
+void
+run (GAsyncReadyCallback _callback_,
+     gpointer _user_data_)
+{
+       RunData* _data_;
+       _data_ = g_slice_new0 (RunData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, run_data_free);
+       run_co (_data_);
+}
+
+void
+run_finish (GAsyncResult* _res_)
+{
+       RunData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static void
+run_ready (GObject* source_object,
+           GAsyncResult* _res_,
+           gpointer _user_data_)
+{
+       RunData* _data_;
+       _data_ = _user_data_;
+       _data_->_source_object_ = source_object;
+       _data_->_res_ = _res_;
+       run_co (_data_);
+}
+
+static gint
+_dynamic_do_foo0 (GDBusProxy* self,
+                  gint param1,
+                  gchar* * param2,
+                  GError** error)
+{
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       GDBusMessage *_reply_message;
+       GVariant *_reply;
+       GVariantIter _reply_iter;
+       gchar* _vala_param2 = NULL;
+       GVariant* _tmp8_;
+       gint _result = 0;
+       GVariant* _tmp9_;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), g_dbus_proxy_get_interface_name ((GDBusProxy *) self), 
"do_foo");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_arguments_builder, g_variant_new_int32 (param1));
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       _reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout 
((GDBusProxy *) self), NULL, NULL, error);
+       g_object_unref (_message);
+       if (!_reply_message) {
+               gint _tmp6_ = 0;
+               return _tmp6_;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, error)) {
+               gint _tmp7_ = 0;
+               g_object_unref (_reply_message);
+               return _tmp7_;
+       }
+       _reply = g_dbus_message_get_body (_reply_message);
+       g_variant_iter_init (&_reply_iter, _reply);
+       _tmp8_ = g_variant_iter_next_value (&_reply_iter);
+       _vala_param2 = g_variant_dup_string (_tmp8_, NULL);
+       g_variant_unref (_tmp8_);
+       *param2 = _vala_param2;
+       _tmp9_ = g_variant_iter_next_value (&_reply_iter);
+       _result = g_variant_get_int32 (_tmp9_);
+       g_variant_unref (_tmp9_);
+       g_object_unref (_reply_message);
+       return _result;
+}
+
+static gboolean
+run_co (RunData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               case 1:
+               goto _state_1;
+               case 2:
+               goto _state_2;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       {
+               _data_->_state_ = 1;
+               g_bus_get (G_BUS_TYPE_SESSION, NULL, run_ready, _data_);
+               return FALSE;
+               _state_1:
+               _data_->_tmp0_ = g_bus_get_finish (_data_->_res_, &_data_->_inner_error0_);
+               _data_->bus = _data_->_tmp0_;
+               if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+                       goto __catch0_g_error;
+               }
+               _data_->_tmp1_ = _data_->bus;
+               _data_->_tmp2_ = _data_->bus;
+               _data_->_tmp3_ = g_dbus_connection_get_unique_name (_data_->_tmp2_);
+               _data_->_state_ = 2;
+               g_dbus_proxy_new (_data_->_tmp1_, G_DBUS_PROXY_FLAGS_NONE, NULL, _data_->_tmp3_, 
"/org/example/test", "org.example.Test", NULL, run_ready, _data_);
+               return FALSE;
+               _state_2:
+               _data_->_tmp4_ = g_dbus_proxy_new_finish (_data_->_res_, &_data_->_inner_error0_);
+               _data_->test = _data_->_tmp4_;
+               if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+                       _g_object_unref0 (_data_->bus);
+                       goto __catch0_g_error;
+               }
+               _data_->_tmp5_ = _data_->test;
+               _data_->_tmp10_ = NULL;
+               _data_->_tmp11_ = _dynamic_do_foo0 (_data_->_tmp5_, 42, &_data_->_tmp10_, 
&_data_->_inner_error0_);
+               _g_free0 (_data_->s);
+               _data_->s = _data_->_tmp10_;
+               _data_->i = _data_->_tmp11_;
+               if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+                       _g_free0 (_data_->s);
+                       _g_object_unref0 (_data_->test);
+                       _g_object_unref0 (_data_->bus);
+                       goto __catch0_g_error;
+               }
+               _vala_assert (_data_->i == 23, "i == 23");
+               _data_->_tmp12_ = _data_->s;
+               _vala_assert (g_strcmp0 (_data_->_tmp12_, "foo") == 0, "s == \"foo\"");
+               _g_free0 (_data_->s);
+               _g_object_unref0 (_data_->test);
+               _g_object_unref0 (_data_->bus);
+       }
+       goto __finally0;
+       __catch0_g_error:
+       {
+               g_clear_error (&_data_->_inner_error0_);
+       }
+       __finally0:
+       if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), 
_data_->_inner_error0_->code);
+               g_clear_error (&_data_->_inner_error0_);
+               g_object_unref (_data_->_async_result);
+               return FALSE;
+       }
+       _data_->_tmp13_ = main_loop;
+       g_main_loop_quit (_data_->_tmp13_);
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+_vala_main (void)
+{
+       GMainLoop* _tmp0_;
+       GMainLoop* _tmp1_;
+       _tmp0_ = g_main_loop_new (NULL, FALSE);
+       _g_main_loop_unref0 (main_loop);
+       main_loop = _tmp0_;
+       run (NULL, NULL);
+       _tmp1_ = main_loop;
+       g_main_loop_run (_tmp1_);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/dbus/dynamic-method_server.c-expected b/tests/dbus/dynamic-method_server.c-expected
new file mode 100644
index 000000000..f8864be40
--- /dev/null
+++ b/tests/dbus/dynamic-method_server.c-expected
@@ -0,0 +1,460 @@
+/* dbus_dynamic_method_server.c generated by valac, the Vala compiler
+ * generated from dbus_dynamic_method_server.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TEST, TestClass))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define IS_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TEST))
+#define TEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TEST, TestClass))
+
+typedef struct _Test Test;
+typedef struct _TestClass TestClass;
+typedef struct _TestPrivate TestPrivate;
+enum  {
+       TEST_0_PROPERTY,
+       TEST_NUM_PROPERTIES
+};
+static GParamSpec* test_properties[TEST_NUM_PROPERTIES];
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Test {
+       GObject parent_instance;
+       TestPrivate * priv;
+};
+
+struct _TestClass {
+       GObjectClass parent_class;
+};
+
+static gpointer test_parent_class = NULL;
+VALA_EXTERN GMainLoop* main_loop;
+GMainLoop* main_loop = NULL;
+
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
+VALA_EXTERN guint test_register_object (void* object,
+                            GDBusConnection* connection,
+                            const gchar* path,
+                            GError** error);
+VALA_EXTERN gint test_do_foo (Test* self,
+                  gint i,
+                  gchar* * s,
+                  GError** error);
+VALA_EXTERN Test* test_new (void);
+VALA_EXTERN Test* test_construct (GType object_type);
+static GType test_get_type_once (void);
+static void _dbus_test_do_foo (Test* self,
+                        GVariant* _parameters_,
+                        GDBusMethodInvocation* invocation);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* method_name,
+                                      GVariant* parameters,
+                                      GDBusMethodInvocation* invocation,
+                                      gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+                                            const gchar* sender,
+                                            const gchar* object_path,
+                                            const gchar* interface_name,
+                                            const gchar* property_name,
+                                            GError** error,
+                                            gpointer user_data);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GVariant* value,
+                                           GError** error,
+                                           gpointer user_data);
+static void _test_unregister_object (gpointer user_data);
+VALA_EXTERN void client_exit (GPid pid,
+                  gint status);
+static void _vala_main (void);
+static guint _variant_get1 (GVariant* value);
+static void _client_exit_gchild_watch_func (GPid pid,
+                                     gint wait_status,
+                                     gpointer self);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static const GDBusArgInfo _test_dbus_arg_info_do_foo_i = {-1, "i", "i", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_do_foo_s = {-1, "s", "s", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_do_foo_result = {-1, "result", "i", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_do_foo_in[] = {&_test_dbus_arg_info_do_foo_i, NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_do_foo_out[] = {&_test_dbus_arg_info_do_foo_s, 
&_test_dbus_arg_info_do_foo_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_do_foo = {-1, "DoFoo", (GDBusArgInfo **) 
(&_test_dbus_arg_info_do_foo_in), (GDBusArgInfo **) (&_test_dbus_arg_info_do_foo_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_do_foo, NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = {NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) 
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, 
test_dbus_interface_get_property, test_dbus_interface_set_property};
+
+gint
+test_do_foo (Test* self,
+             gint i,
+             gchar* * s,
+             GError** error)
+{
+       gchar* _vala_s = NULL;
+       gchar* _tmp0_;
+       gint result = 0;
+       g_return_val_if_fail (IS_TEST (self), 0);
+       _vala_assert (i == 42, "i == 42");
+       _tmp0_ = g_strdup ("foo");
+       _g_free0 (_vala_s);
+       _vala_s = _tmp0_;
+       result = 23;
+       if (s) {
+               *s = _vala_s;
+       } else {
+               _g_free0 (_vala_s);
+       }
+       return result;
+}
+
+Test*
+test_construct (GType object_type)
+{
+       Test * self = NULL;
+       self = (Test*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Test*
+test_new (void)
+{
+       return test_construct (TYPE_TEST);
+}
+
+static void
+test_class_init (TestClass * klass,
+                 gpointer klass_data)
+{
+       test_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+test_instance_init (Test * self,
+                    gpointer klass)
+{
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Test), 
0, (GInstanceInitFunc) test_instance_init, NULL };
+       GType test_type_id;
+       test_type_id = g_type_register_static (G_TYPE_OBJECT, "Test", &g_define_type_info, 0);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_register_object);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+static void
+_dbus_test_do_foo (Test* self,
+                   GVariant* _parameters_,
+                   GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       gint i = 0;
+       GVariant* _tmp0_;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       gchar* s = NULL;
+       gint result;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _tmp0_ = g_variant_iter_next_value (&_arguments_iter);
+       i = g_variant_get_int32 (_tmp0_);
+       g_variant_unref (_tmp0_);
+       result = test_do_foo (self, i, &s, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               return;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_string (s));
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_int32 (result));
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+       _g_free0 (s);
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* method_name,
+                                 GVariant* parameters,
+                                 GDBusMethodInvocation* invocation,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "DoFoo") == 0) {
+               _dbus_test_do_foo (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return NULL;
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GVariant* value,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return FALSE;
+}
+
+guint
+test_register_object (gpointer object,
+                      GDBusConnection* connection,
+                      const gchar* path,
+                      GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+void
+client_exit (GPid pid,
+             gint status)
+{
+       GMainLoop* _tmp0_;
+       _vala_assert (status == 0, "status == 0");
+       _tmp0_ = main_loop;
+       g_main_loop_quit (_tmp0_);
+}
+
+static guint
+_variant_get1 (GVariant* value)
+{
+       return g_variant_get_uint32 (value);
+}
+
+static void
+_client_exit_gchild_watch_func (GPid pid,
+                                gint wait_status,
+                                gpointer self)
+{
+       client_exit (pid, wait_status);
+}
+
+static void
+_vala_main (void)
+{
+       GDBusConnection* conn = NULL;
+       GDBusConnection* _tmp0_;
+       GDBusConnection* _tmp1_;
+       Test* _tmp2_;
+       Test* _tmp3_;
+       GVariant* request_result = NULL;
+       GDBusConnection* _tmp4_;
+       GVariant* _tmp5_;
+       GVariant* _tmp6_;
+       GVariant* _tmp7_;
+       GVariant* _tmp8_;
+       GVariant* _tmp9_;
+       GVariant* _tmp10_;
+       GVariant* _tmp11_;
+       guint _tmp12_;
+       GPid client_pid = 0;
+       gchar* _tmp13_;
+       gchar** _tmp14_;
+       gchar** _tmp15_;
+       gint _tmp15__length1;
+       GPid _tmp16_ = 0;
+       GMainLoop* _tmp17_;
+       GMainLoop* _tmp18_;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &_inner_error0_);
+       conn = _tmp0_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp1_ = conn;
+       _tmp2_ = test_new ();
+       _tmp3_ = _tmp2_;
+       test_register_object (_tmp3_, _tmp1_, "/org/example/test", &_inner_error0_);
+       _g_object_unref0 (_tmp3_);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp4_ = conn;
+       _tmp5_ = g_variant_new ("(su)", "org.example.Test", 0x4, NULL);
+       g_variant_ref_sink (_tmp5_);
+       _tmp6_ = _tmp5_;
+       _tmp7_ = g_dbus_connection_call_sync (_tmp4_, "org.freedesktop.DBus", "/org/freedesktop/DBus", 
"org.freedesktop.DBus", "RequestName", _tmp6_, NULL, 0, -1, NULL, &_inner_error0_);
+       _tmp8_ = _tmp7_;
+       _g_variant_unref0 (_tmp6_);
+       request_result = _tmp8_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp9_ = request_result;
+       _tmp10_ = g_variant_get_child_value (_tmp9_, (gsize) 0);
+       _tmp11_ = _tmp10_;
+       _tmp12_ = _variant_get1 (_tmp11_);
+       _vala_assert (_tmp12_ == ((guint) 1), "(uint) request_result.get_child_value (0) == 1");
+       _g_variant_unref0 (_tmp11_);
+       _tmp13_ = g_strdup ("dbus_dynamic_method_client");
+       _tmp14_ = g_new0 (gchar*, 1 + 1);
+       _tmp14_[0] = _tmp13_;
+       _tmp15_ = _tmp14_;
+       _tmp15__length1 = 1;
+       g_spawn_async (NULL, _tmp15_, NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &_tmp16_, &_inner_error0_);
+       client_pid = _tmp16_;
+       _tmp15_ = (_vala_array_free (_tmp15_, _tmp15__length1, (GDestroyNotify) g_free), NULL);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_variant_unref0 (request_result);
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       g_child_watch_add_full (G_PRIORITY_DEFAULT_IDLE, client_pid, _client_exit_gchild_watch_func, NULL, 
NULL);
+       _tmp17_ = g_main_loop_new (NULL, FALSE);
+       _g_main_loop_unref0 (main_loop);
+       main_loop = _tmp17_;
+       _tmp18_ = main_loop;
+       g_main_loop_run (_tmp18_);
+       _g_variant_unref0 (request_result);
+       _g_object_unref0 (conn);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/dbus/enum-string-marshalling.c-expected b/tests/dbus/enum-string-marshalling.c-expected
new file mode 100644
index 000000000..bf75b7b5a
--- /dev/null
+++ b/tests/dbus/enum-string-marshalling.c-expected
@@ -0,0 +1,901 @@
+/* dbus_enum_string_marshalling.c generated by valac, the Vala compiler
+ * generated from dbus_enum_string_marshalling.vala, do not modify */
+
+#include <glib-object.h>
+#include <string.h>
+#include <gio/gio.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef enum  {
+       FOO_ENUM_BAR
+} FooEnum;
+
+#define TYPE_FOO_ENUM (foo_enum_get_type ())
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define TEST_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_TEST, TestIface))
+
+typedef struct _Test Test;
+typedef struct _TestIface TestIface;
+
+#define TYPE_TEST_PROXY (test_proxy_get_type ())
+typedef GDBusProxy TestProxy;
+typedef GDBusProxyClass TestProxyClass;
+typedef struct _TestTest1ReadyData TestTest1ReadyData;
+typedef struct _TestTest5ReadyData TestTest5ReadyData;
+
+struct _TestIface {
+       GTypeInterface parent_iface;
+       void (*test1) (Test* self, FooEnum e, GAsyncReadyCallback _callback_, gpointer _user_data_);
+       void (*test1_finish) (Test* self, GAsyncResult* _res_, GError** error);
+       void (*test2) (Test* self, FooEnum e, GError** error);
+       void (*test3) (Test* self, FooEnum e1, gint fd, FooEnum e2, GError** error);
+       void (*test4) (Test* self, FooEnum e);
+       void (*test5) (Test* self, FooEnum e, GAsyncReadyCallback _callback_, gpointer _user_data_);
+       void (*test5_finish) (Test* self, GAsyncResult* _res_);
+};
+
+struct _TestTest1ReadyData {
+       GDBusMethodInvocation* _invocation_;
+       FooEnum e;
+};
+
+struct _TestTest5ReadyData {
+       GDBusMethodInvocation* _invocation_;
+       FooEnum e;
+};
+
+VALA_EXTERN GType foo_enum_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN FooEnum foo_enum_from_string (const char* str,
+                              GError** error);
+VALA_EXTERN const char* foo_enum_to_string (FooEnum value);
+VALA_EXTERN GType test_proxy_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN guint test_register_object (void* object,
+                            GDBusConnection* connection,
+                            const gchar* path,
+                            GError** error);
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN void test_test1 (Test* self,
+                 FooEnum e,
+                 GAsyncReadyCallback _callback_,
+                 gpointer _user_data_);
+VALA_EXTERN void test_test1_finish (Test* self,
+                        GAsyncResult* _res_,
+                        GError** error);
+VALA_EXTERN void test_test2 (Test* self,
+                 FooEnum e,
+                 GError** error);
+VALA_EXTERN void test_test3 (Test* self,
+                 FooEnum e1,
+                 gint fd,
+                 FooEnum e2,
+                 GError** error);
+VALA_EXTERN void test_test4 (Test* self,
+                 FooEnum e);
+VALA_EXTERN void test_test5 (Test* self,
+                 FooEnum e,
+                 GAsyncReadyCallback _callback_,
+                 gpointer _user_data_);
+VALA_EXTERN void test_test5_finish (Test* self,
+                        GAsyncResult* _res_);
+static GType test_get_type_once (void);
+static void test_proxy_g_signal (GDBusProxy* proxy,
+                          const gchar* sender_name,
+                          const gchar* signal_name,
+                          GVariant* parameters);
+static void _vala_g_async_ready_callback (GObject *source_object,
+                                   GAsyncResult *res,
+                                   void *user_data);
+static void test_proxy_test1_async (Test* self,
+                             FooEnum e,
+                             GAsyncReadyCallback _callback_,
+                             gpointer _user_data_);
+static void test_proxy_test1_finish (Test* self,
+                              GAsyncResult* _res_,
+                              GError** error);
+static void test_proxy_test2 (Test* self,
+                       FooEnum e,
+                       GError** error);
+static void test_proxy_test3 (Test* self,
+                       FooEnum e1,
+                       gint fd,
+                       FooEnum e2,
+                       GError** error);
+static void test_proxy_test4 (Test* self,
+                       FooEnum e);
+static void test_proxy_test5_async (Test* self,
+                             FooEnum e,
+                             GAsyncReadyCallback _callback_,
+                             gpointer _user_data_);
+static void test_proxy_test5_finish (Test* self,
+                              GAsyncResult* _res_);
+static void test_proxy_test_interface_init (TestIface* iface);
+static void _dbus_test_test1 (Test* self,
+                       GVariant* _parameters_,
+                       GDBusMethodInvocation* invocation);
+static void _dbus_test_test1_ready (GObject * source_object,
+                             GAsyncResult * _res_,
+                             gpointer _user_data_);
+static void _dbus_test_test2 (Test* self,
+                       GVariant* _parameters_,
+                       GDBusMethodInvocation* invocation);
+static void _dbus_test_test3 (Test* self,
+                       GVariant* _parameters_,
+                       GDBusMethodInvocation* invocation);
+static void _dbus_test_test4 (Test* self,
+                       GVariant* _parameters_,
+                       GDBusMethodInvocation* invocation);
+static void _dbus_test_test5 (Test* self,
+                       GVariant* _parameters_,
+                       GDBusMethodInvocation* invocation);
+static void _dbus_test_test5_ready (GObject * source_object,
+                             GAsyncResult * _res_,
+                             gpointer _user_data_);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* method_name,
+                                      GVariant* parameters,
+                                      GDBusMethodInvocation* invocation,
+                                      gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+                                            const gchar* sender,
+                                            const gchar* object_path,
+                                            const gchar* interface_name,
+                                            const gchar* property_name,
+                                            GError** error,
+                                            gpointer user_data);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GVariant* value,
+                                           GError** error,
+                                           gpointer user_data);
+static void _test_unregister_object (gpointer user_data);
+static void _vala_main (void);
+
+static const GDBusArgInfo _test_dbus_arg_info_test1_e = {-1, "e", "s", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test1_in[] = {&_test_dbus_arg_info_test1_e, NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test1_out[] = {NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test1 = {-1, "Test1", (GDBusArgInfo **) 
(&_test_dbus_arg_info_test1_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test1_out), NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test2_e = {-1, "e", "s", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test2_in[] = {&_test_dbus_arg_info_test2_e, NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test2_out[] = {NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test2 = {-1, "Test2", (GDBusArgInfo **) 
(&_test_dbus_arg_info_test2_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test2_out), NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test3_e1 = {-1, "e1", "s", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test3_fd = {-1, "fd", "i", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test3_e2 = {-1, "e2", "s", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test3_in[] = {&_test_dbus_arg_info_test3_e1, 
&_test_dbus_arg_info_test3_fd, &_test_dbus_arg_info_test3_e2, NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test3_out[] = {NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test3 = {-1, "Test3", (GDBusArgInfo **) 
(&_test_dbus_arg_info_test3_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test3_out), NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test4_e = {-1, "e", "s", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test4_in[] = {&_test_dbus_arg_info_test4_e, NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test4_out[] = {NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test4 = {-1, "Test4", (GDBusArgInfo **) 
(&_test_dbus_arg_info_test4_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test4_out), NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test5_e = {-1, "e", "s", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test5_in[] = {&_test_dbus_arg_info_test5_e, NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test5_out[] = {NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test5 = {-1, "Test5", (GDBusArgInfo **) 
(&_test_dbus_arg_info_test5_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test5_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_test1, 
&_test_dbus_method_info_test2, &_test_dbus_method_info_test3, &_test_dbus_method_info_test4, 
&_test_dbus_method_info_test5, NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = {NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) 
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, 
test_dbus_interface_get_property, test_dbus_interface_set_property};
+
+static GType
+foo_enum_get_type_once (void)
+{
+       static const GEnumValue values[] = {{FOO_ENUM_BAR, "FOO_ENUM_BAR", "bar"}, {0, NULL, NULL}};
+       GType foo_enum_type_id;
+       foo_enum_type_id = g_enum_register_static ("FooEnum", values);
+       return foo_enum_type_id;
+}
+
+GType
+foo_enum_get_type (void)
+{
+       static volatile gsize foo_enum_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_enum_type_id__volatile)) {
+               GType foo_enum_type_id;
+               foo_enum_type_id = foo_enum_get_type_once ();
+               g_once_init_leave (&foo_enum_type_id__volatile, foo_enum_type_id);
+       }
+       return foo_enum_type_id__volatile;
+}
+
+FooEnum
+foo_enum_from_string (const char* str,
+                      GError** error)
+{
+       FooEnum value = 0;
+       if (strcmp (str, "BAR") == 0) {
+               value = FOO_ENUM_BAR;
+       } else {
+               g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "Invalid value for enum 
`FooEnum'");
+       }
+       return value;
+}
+
+const char*
+foo_enum_to_string (FooEnum value)
+{
+       const char * str;
+       switch (value) {
+               case FOO_ENUM_BAR:
+               str = "BAR";
+               break;
+       }
+       return str;
+}
+
+void
+test_test1 (Test* self,
+            FooEnum e,
+            GAsyncReadyCallback _callback_,
+            gpointer _user_data_)
+{
+       TestIface* _iface_;
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->test1) {
+               _iface_->test1 (self, e, _callback_, _user_data_);
+       }
+}
+
+void
+test_test1_finish (Test* self,
+                   GAsyncResult* _res_,
+                   GError** error)
+{
+       TestIface* _iface_;
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->test1_finish) {
+               _iface_->test1_finish (self, _res_, error);
+       }
+}
+
+void
+test_test2 (Test* self,
+            FooEnum e,
+            GError** error)
+{
+       TestIface* _iface_;
+       g_return_if_fail (IS_TEST (self));
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->test2) {
+               _iface_->test2 (self, e, error);
+       }
+}
+
+void
+test_test3 (Test* self,
+            FooEnum e1,
+            gint fd,
+            FooEnum e2,
+            GError** error)
+{
+       TestIface* _iface_;
+       g_return_if_fail (IS_TEST (self));
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->test3) {
+               _iface_->test3 (self, e1, fd, e2, error);
+       }
+}
+
+void
+test_test4 (Test* self,
+            FooEnum e)
+{
+       TestIface* _iface_;
+       g_return_if_fail (IS_TEST (self));
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->test4) {
+               _iface_->test4 (self, e);
+       }
+}
+
+void
+test_test5 (Test* self,
+            FooEnum e,
+            GAsyncReadyCallback _callback_,
+            gpointer _user_data_)
+{
+       TestIface* _iface_;
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->test5) {
+               _iface_->test5 (self, e, _callback_, _user_data_);
+       }
+}
+
+void
+test_test5_finish (Test* self,
+                   GAsyncResult* _res_)
+{
+       TestIface* _iface_;
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->test5_finish) {
+               _iface_->test5_finish (self, _res_);
+       }
+}
+
+static void
+test_default_init (TestIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType test_type_id;
+       test_type_id = g_type_register_static (G_TYPE_INTERFACE, "Test", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (test_type_id, G_TYPE_OBJECT);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) 
test_proxy_get_type);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), 
"org.example.Test");
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*) 
(&_test_dbus_interface_info));
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_register_object);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_TEST, 
test_proxy_test_interface_init) )
+static void
+test_proxy_class_init (TestProxyClass* klass)
+{
+       G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal;
+}
+
+static void
+test_proxy_g_signal (GDBusProxy* proxy,
+                     const gchar* sender_name,
+                     const gchar* signal_name,
+                     GVariant* parameters)
+{
+}
+
+static void
+test_proxy_init (TestProxy* self)
+{
+       g_dbus_proxy_set_interface_info (G_DBUS_PROXY (self), (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info));
+}
+
+static void
+_vala_g_async_ready_callback (GObject *source_object,
+                              GAsyncResult *res,
+                              void *user_data)
+{
+       g_task_return_pointer (user_data, g_object_ref (res), g_object_unref);
+       g_object_unref (user_data);
+}
+
+static void
+test_proxy_test1_async (Test* self,
+                        FooEnum e,
+                        GAsyncReadyCallback _callback_,
+                        gpointer _user_data_)
+{
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       G_DBUS_ERROR;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "Test1");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (foo_enum_to_string (e)));
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       if (_callback_ != NULL) {
+               g_dbus_connection_send_message_with_reply (g_dbus_proxy_get_connection ((GDBusProxy *) self), 
_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout ((GDBusProxy *) self), NULL, NULL, 
_vala_g_async_ready_callback, g_task_new ((GObject *) self, NULL, _callback_, _user_data_));
+       } else {
+               g_dbus_message_set_flags (_message, G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED);
+               g_dbus_connection_send_message (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       }
+       g_object_unref (_message);
+}
+
+static void
+test_proxy_test1_finish (Test* self,
+                         GAsyncResult* _res_,
+                         GError** error)
+{
+       GAsyncResult *_inner_res;
+       GDBusMessage *_reply_message;
+       _inner_res = g_task_propagate_pointer ((GTask *) _res_, NULL);
+       _reply_message = g_dbus_connection_send_message_with_reply_finish (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _inner_res, error);
+       g_object_unref (_inner_res);
+       if (!_reply_message) {
+               return;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, error)) {
+               g_object_unref (_reply_message);
+               return;
+       }
+       g_object_unref (_reply_message);
+}
+
+static void
+test_proxy_test2 (Test* self,
+                  FooEnum e,
+                  GError** error)
+{
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       GDBusMessage *_reply_message;
+       G_DBUS_ERROR;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "Test2");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (foo_enum_to_string (e)));
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       _reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout 
((GDBusProxy *) self), NULL, NULL, error);
+       g_object_unref (_message);
+       if (!_reply_message) {
+               return;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, error)) {
+               g_object_unref (_reply_message);
+               return;
+       }
+       g_object_unref (_reply_message);
+}
+
+static void
+test_proxy_test3 (Test* self,
+                  FooEnum e1,
+                  gint fd,
+                  FooEnum e2,
+                  GError** error)
+{
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       GDBusMessage *_reply_message;
+       G_DBUS_ERROR;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "Test3");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (foo_enum_to_string (e1)));
+       g_variant_builder_add_value (&_arguments_builder, g_variant_new_int32 (fd));
+       g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (foo_enum_to_string (e2)));
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       _reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout 
((GDBusProxy *) self), NULL, NULL, error);
+       g_object_unref (_message);
+       if (!_reply_message) {
+               return;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, error)) {
+               g_object_unref (_reply_message);
+               return;
+       }
+       g_object_unref (_reply_message);
+}
+
+static void
+test_proxy_test4 (Test* self,
+                  FooEnum e)
+{
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       GDBusMessage *_reply_message;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "Test4");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (foo_enum_to_string (e)));
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       _reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout 
((GDBusProxy *) self), NULL, NULL, NULL);
+       g_object_unref (_message);
+       if (!_reply_message) {
+               return;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, NULL)) {
+               g_object_unref (_reply_message);
+               return;
+       }
+       g_object_unref (_reply_message);
+}
+
+static void
+test_proxy_test5_async (Test* self,
+                        FooEnum e,
+                        GAsyncReadyCallback _callback_,
+                        gpointer _user_data_)
+{
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "Test5");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (foo_enum_to_string (e)));
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       if (_callback_ != NULL) {
+               g_dbus_connection_send_message_with_reply (g_dbus_proxy_get_connection ((GDBusProxy *) self), 
_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout ((GDBusProxy *) self), NULL, NULL, 
_vala_g_async_ready_callback, g_task_new ((GObject *) self, NULL, _callback_, _user_data_));
+       } else {
+               g_dbus_message_set_flags (_message, G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED);
+               g_dbus_connection_send_message (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       }
+       g_object_unref (_message);
+}
+
+static void
+test_proxy_test5_finish (Test* self,
+                         GAsyncResult* _res_)
+{
+       GAsyncResult *_inner_res;
+       GDBusMessage *_reply_message;
+       _inner_res = g_task_propagate_pointer ((GTask *) _res_, NULL);
+       _reply_message = g_dbus_connection_send_message_with_reply_finish (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _inner_res, NULL);
+       g_object_unref (_inner_res);
+       if (!_reply_message) {
+               return;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, NULL)) {
+               g_object_unref (_reply_message);
+               return;
+       }
+       g_object_unref (_reply_message);
+}
+
+static void
+test_proxy_test_interface_init (TestIface* iface)
+{
+       iface->test1 = test_proxy_test1_async;
+       iface->test1_finish = test_proxy_test1_finish;
+       iface->test2 = test_proxy_test2;
+       iface->test3 = test_proxy_test3;
+       iface->test4 = test_proxy_test4;
+       iface->test5 = test_proxy_test5_async;
+       iface->test5_finish = test_proxy_test5_finish;
+}
+
+static void
+_dbus_test_test1 (Test* self,
+                  GVariant* _parameters_,
+                  GDBusMethodInvocation* invocation)
+{
+       GVariantIter _arguments_iter;
+       TestTest1ReadyData* _ready_data;
+       GVariant* _tmp0_;
+       GError* error = NULL;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _ready_data = g_slice_new0 (TestTest1ReadyData);
+       _ready_data->_invocation_ = invocation;
+       _tmp0_ = g_variant_iter_next_value (&_arguments_iter);
+       _ready_data->e = foo_enum_from_string (g_variant_get_string (_tmp0_, NULL), &error);
+       g_variant_unref (_tmp0_);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               return;
+       }
+       test_test1 (self, _ready_data->e, (GAsyncReadyCallback) _dbus_test_test1_ready, _ready_data);
+}
+
+static void
+_dbus_test_test1_ready (GObject * source_object,
+                        GAsyncResult * _res_,
+                        gpointer _user_data_)
+{
+       TestTest1ReadyData* _ready_data;
+       GDBusMethodInvocation* invocation;
+       GError* error = NULL;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       _ready_data = _user_data_;
+       invocation = _ready_data->_invocation_;
+       test_test1_finish ((Test*) source_object, _res_, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               goto _error;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+       _error:
+       g_slice_free (TestTest1ReadyData, _ready_data);
+}
+
+static void
+_dbus_test_test2 (Test* self,
+                  GVariant* _parameters_,
+                  GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       FooEnum e = 0;
+       GVariant* _tmp1_;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _tmp1_ = g_variant_iter_next_value (&_arguments_iter);
+       e = foo_enum_from_string (g_variant_get_string (_tmp1_, NULL), &error);
+       g_variant_unref (_tmp1_);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               return;
+       }
+       test_test2 (self, e, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               return;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+}
+
+static void
+_dbus_test_test3 (Test* self,
+                  GVariant* _parameters_,
+                  GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       FooEnum e1 = 0;
+       GVariant* _tmp2_;
+       gint fd = 0;
+       GVariant* _tmp3_;
+       FooEnum e2 = 0;
+       GVariant* _tmp4_;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _tmp2_ = g_variant_iter_next_value (&_arguments_iter);
+       e1 = foo_enum_from_string (g_variant_get_string (_tmp2_, NULL), &error);
+       g_variant_unref (_tmp2_);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               return;
+       }
+       _tmp3_ = g_variant_iter_next_value (&_arguments_iter);
+       fd = g_variant_get_int32 (_tmp3_);
+       g_variant_unref (_tmp3_);
+       _tmp4_ = g_variant_iter_next_value (&_arguments_iter);
+       e2 = foo_enum_from_string (g_variant_get_string (_tmp4_, NULL), &error);
+       g_variant_unref (_tmp4_);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               return;
+       }
+       test_test3 (self, e1, fd, e2, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               return;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+}
+
+static void
+_dbus_test_test4 (Test* self,
+                  GVariant* _parameters_,
+                  GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       FooEnum e = 0;
+       GVariant* _tmp5_;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _tmp5_ = g_variant_iter_next_value (&_arguments_iter);
+       e = foo_enum_from_string (g_variant_get_string (_tmp5_, NULL), &error);
+       g_variant_unref (_tmp5_);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               return;
+       }
+       test_test4 (self, e);
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+}
+
+static void
+_dbus_test_test5 (Test* self,
+                  GVariant* _parameters_,
+                  GDBusMethodInvocation* invocation)
+{
+       GVariantIter _arguments_iter;
+       TestTest5ReadyData* _ready_data;
+       GVariant* _tmp6_;
+       GError* error = NULL;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _ready_data = g_slice_new0 (TestTest5ReadyData);
+       _ready_data->_invocation_ = invocation;
+       _tmp6_ = g_variant_iter_next_value (&_arguments_iter);
+       _ready_data->e = foo_enum_from_string (g_variant_get_string (_tmp6_, NULL), &error);
+       g_variant_unref (_tmp6_);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               return;
+       }
+       test_test5 (self, _ready_data->e, (GAsyncReadyCallback) _dbus_test_test5_ready, _ready_data);
+}
+
+static void
+_dbus_test_test5_ready (GObject * source_object,
+                        GAsyncResult * _res_,
+                        gpointer _user_data_)
+{
+       TestTest5ReadyData* _ready_data;
+       GDBusMethodInvocation* invocation;
+       GError* error = NULL;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       _ready_data = _user_data_;
+       invocation = _ready_data->_invocation_;
+       test_test5_finish ((Test*) source_object, _res_);
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+       _error:
+       g_slice_free (TestTest5ReadyData, _ready_data);
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* method_name,
+                                 GVariant* parameters,
+                                 GDBusMethodInvocation* invocation,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "Test1") == 0) {
+               _dbus_test_test1 (object, parameters, invocation);
+       } else if (strcmp (method_name, "Test2") == 0) {
+               _dbus_test_test2 (object, parameters, invocation);
+       } else if (strcmp (method_name, "Test3") == 0) {
+               _dbus_test_test3 (object, parameters, invocation);
+       } else if (strcmp (method_name, "Test4") == 0) {
+               _dbus_test_test4 (object, parameters, invocation);
+       } else if (strcmp (method_name, "Test5") == 0) {
+               _dbus_test_test5 (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return NULL;
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GVariant* value,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return FALSE;
+}
+
+guint
+test_register_object (gpointer object,
+                      GDBusConnection* connection,
+                      const gchar* path,
+                      GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/dbus/errors_client.c-expected b/tests/dbus/errors_client.c-expected
new file mode 100644
index 000000000..f8f2acc04
--- /dev/null
+++ b/tests/dbus/errors_client.c-expected
@@ -0,0 +1,890 @@
+/* dbus_errors_client.c generated by valac, the Vala compiler
+ * generated from dbus_errors_client.vala, do not modify */
+
+#include <gio/gio.h>
+#include <glib.h>
+#include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define TEST_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_TEST, TestIface))
+
+typedef struct _Test Test;
+typedef struct _TestIface TestIface;
+
+#define TYPE_TEST_PROXY (test_proxy_get_type ())
+typedef GDBusProxy TestProxy;
+typedef GDBusProxyClass TestProxyClass;
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+typedef enum  {
+       TEST_ERROR_NOT_SO_GOOD,
+       TEST_ERROR_BAD,
+       TEST_ERROR_WORSE
+} TestError;
+#define TEST_ERROR test_error_quark ()
+struct _TestIface {
+       GTypeInterface parent_iface;
+       void (*test_void) (Test* self, GError** error);
+       gint (*test_int) (Test* self, gint i, gint* j, GError** error);
+       gchar* (*test_string) (Test* self, const gchar* s, gchar* * t, GError** error);
+       void (*test_cancellable) (Test* self, GCancellable* cancellable, GError** error);
+       void (*test_custom_error) (Test* self, GError** error);
+};
+
+VALA_EXTERN GQuark test_error_quark (void);
+VALA_EXTERN GType test_proxy_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN guint test_register_object (void* object,
+                            GDBusConnection* connection,
+                            const gchar* path,
+                            GError** error);
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN void test_test_void (Test* self,
+                     GError** error);
+VALA_EXTERN gint test_test_int (Test* self,
+                    gint i,
+                    gint* j,
+                    GError** error);
+VALA_EXTERN gchar* test_test_string (Test* self,
+                         const gchar* s,
+                         gchar* * t,
+                         GError** error);
+VALA_EXTERN void test_test_cancellable (Test* self,
+                            GCancellable* cancellable,
+                            GError** error);
+VALA_EXTERN void test_test_custom_error (Test* self,
+                             GError** error);
+static GType test_get_type_once (void);
+static void test_proxy_g_signal (GDBusProxy* proxy,
+                          const gchar* sender_name,
+                          const gchar* signal_name,
+                          GVariant* parameters);
+static void test_proxy_test_void (Test* self,
+                           GError** error);
+static gint test_proxy_test_int (Test* self,
+                          gint i,
+                          gint* j,
+                          GError** error);
+static gchar* test_proxy_test_string (Test* self,
+                               const gchar* s,
+                               gchar* * t,
+                               GError** error);
+static void test_proxy_test_cancellable (Test* self,
+                                  GCancellable* cancellable,
+                                  GError** error);
+static void test_proxy_test_custom_error (Test* self,
+                                   GError** error);
+static void test_proxy_test_interface_init (TestIface* iface);
+static void _dbus_test_test_void (Test* self,
+                           GVariant* _parameters_,
+                           GDBusMethodInvocation* invocation);
+static void _dbus_test_test_int (Test* self,
+                          GVariant* _parameters_,
+                          GDBusMethodInvocation* invocation);
+static void _dbus_test_test_string (Test* self,
+                             GVariant* _parameters_,
+                             GDBusMethodInvocation* invocation);
+static void _dbus_test_test_cancellable (Test* self,
+                                  GVariant* _parameters_,
+                                  GDBusMethodInvocation* invocation);
+static void _dbus_test_test_custom_error (Test* self,
+                                   GVariant* _parameters_,
+                                   GDBusMethodInvocation* invocation);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* method_name,
+                                      GVariant* parameters,
+                                      GDBusMethodInvocation* invocation,
+                                      gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+                                            const gchar* sender,
+                                            const gchar* object_path,
+                                            const gchar* interface_name,
+                                            const gchar* property_name,
+                                            GError** error,
+                                            gpointer user_data);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GVariant* value,
+                                           GError** error,
+                                           gpointer user_data);
+static void _test_unregister_object (gpointer user_data);
+static void _vala_main (void);
+
+static const GDBusErrorEntry test_error_entries[] = {{TEST_ERROR_NOT_SO_GOOD, 
"org.example.TestError.NotSoGood"}, {TEST_ERROR_BAD, "org.example.TestError.Bad"}, {TEST_ERROR_WORSE, 
"org.example.TestError.Worse"}};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_void_in[] = {NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_void_out[] = {NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_void = {-1, "TestVoid", (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_void_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_void_out), NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_int_i = {-1, "i", "i", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_int_j = {-1, "j", "i", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_int_result = {-1, "result", "i", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_int_in[] = {&_test_dbus_arg_info_test_int_i, 
NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_int_out[] = {&_test_dbus_arg_info_test_int_j, 
&_test_dbus_arg_info_test_int_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_int = {-1, "TestInt", (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_int_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_int_out), NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_string_s = {-1, "s", "s", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_string_t = {-1, "t", "s", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_string_result = {-1, "result", "s", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_string_in[] = 
{&_test_dbus_arg_info_test_string_s, NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_string_out[] = 
{&_test_dbus_arg_info_test_string_t, &_test_dbus_arg_info_test_string_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_string = {-1, "TestString", (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_string_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_string_out), NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_cancellable_in[] = {NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_cancellable_out[] = {NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_cancellable = {-1, "TestCancellable", (GDBusArgInfo 
**) (&_test_dbus_arg_info_test_cancellable_in), (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_cancellable_out), NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_custom_error_in[] = {NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_custom_error_out[] = {NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_custom_error = {-1, "TestCustomError", 
(GDBusArgInfo **) (&_test_dbus_arg_info_test_custom_error_in), (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_custom_error_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_test_void, 
&_test_dbus_method_info_test_int, &_test_dbus_method_info_test_string, 
&_test_dbus_method_info_test_cancellable, &_test_dbus_method_info_test_custom_error, NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = {NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) 
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, 
test_dbus_interface_get_property, test_dbus_interface_set_property};
+
+GQuark
+test_error_quark (void)
+{
+       static volatile gsize test_error_quark_volatile = 0;
+       g_dbus_error_register_error_domain ("test-error-quark", &test_error_quark_volatile, 
test_error_entries, G_N_ELEMENTS (test_error_entries));
+       return (GQuark) test_error_quark_volatile;
+}
+
+void
+test_test_void (Test* self,
+                GError** error)
+{
+       TestIface* _iface_;
+       g_return_if_fail (IS_TEST (self));
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->test_void) {
+               _iface_->test_void (self, error);
+       }
+}
+
+gint
+test_test_int (Test* self,
+               gint i,
+               gint* j,
+               GError** error)
+{
+       TestIface* _iface_;
+       g_return_val_if_fail (IS_TEST (self), 0);
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->test_int) {
+               return _iface_->test_int (self, i, j, error);
+       }
+       return -1;
+}
+
+gchar*
+test_test_string (Test* self,
+                  const gchar* s,
+                  gchar* * t,
+                  GError** error)
+{
+       TestIface* _iface_;
+       g_return_val_if_fail (IS_TEST (self), NULL);
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->test_string) {
+               return _iface_->test_string (self, s, t, error);
+       }
+       return NULL;
+}
+
+void
+test_test_cancellable (Test* self,
+                       GCancellable* cancellable,
+                       GError** error)
+{
+       TestIface* _iface_;
+       g_return_if_fail (IS_TEST (self));
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->test_cancellable) {
+               _iface_->test_cancellable (self, cancellable, error);
+       }
+}
+
+void
+test_test_custom_error (Test* self,
+                        GError** error)
+{
+       TestIface* _iface_;
+       g_return_if_fail (IS_TEST (self));
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->test_custom_error) {
+               _iface_->test_custom_error (self, error);
+       }
+}
+
+static void
+test_default_init (TestIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType test_type_id;
+       test_type_id = g_type_register_static (G_TYPE_INTERFACE, "Test", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (test_type_id, G_TYPE_OBJECT);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) 
test_proxy_get_type);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), 
"org.example.Test");
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*) 
(&_test_dbus_interface_info));
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_register_object);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_TEST, 
test_proxy_test_interface_init) )
+static void
+test_proxy_class_init (TestProxyClass* klass)
+{
+       G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal;
+}
+
+static void
+test_proxy_g_signal (GDBusProxy* proxy,
+                     const gchar* sender_name,
+                     const gchar* signal_name,
+                     GVariant* parameters)
+{
+}
+
+static void
+test_proxy_init (TestProxy* self)
+{
+       g_dbus_proxy_set_interface_info (G_DBUS_PROXY (self), (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info));
+}
+
+static void
+test_proxy_test_void (Test* self,
+                      GError** error)
+{
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       GDBusMessage *_reply_message;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "TestVoid");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       _reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout 
((GDBusProxy *) self), NULL, NULL, error);
+       g_object_unref (_message);
+       if (!_reply_message) {
+               return;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, error)) {
+               g_object_unref (_reply_message);
+               return;
+       }
+       g_object_unref (_reply_message);
+}
+
+static gint
+test_proxy_test_int (Test* self,
+                     gint i,
+                     gint* j,
+                     GError** error)
+{
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       GDBusMessage *_reply_message;
+       GVariant *_reply;
+       GVariantIter _reply_iter;
+       gint _vala_j = 0;
+       GVariant* _tmp2_;
+       gint _result = 0;
+       GVariant* _tmp3_;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "TestInt");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_arguments_builder, g_variant_new_int32 (i));
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       _reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout 
((GDBusProxy *) self), NULL, NULL, error);
+       g_object_unref (_message);
+       if (!_reply_message) {
+               gint _tmp0_ = 0;
+               return _tmp0_;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, error)) {
+               gint _tmp1_ = 0;
+               g_object_unref (_reply_message);
+               return _tmp1_;
+       }
+       _reply = g_dbus_message_get_body (_reply_message);
+       g_variant_iter_init (&_reply_iter, _reply);
+       _tmp2_ = g_variant_iter_next_value (&_reply_iter);
+       _vala_j = g_variant_get_int32 (_tmp2_);
+       g_variant_unref (_tmp2_);
+       *j = _vala_j;
+       _tmp3_ = g_variant_iter_next_value (&_reply_iter);
+       _result = g_variant_get_int32 (_tmp3_);
+       g_variant_unref (_tmp3_);
+       g_object_unref (_reply_message);
+       return _result;
+}
+
+static gchar*
+test_proxy_test_string (Test* self,
+                        const gchar* s,
+                        gchar* * t,
+                        GError** error)
+{
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       GDBusMessage *_reply_message;
+       GVariant *_reply;
+       GVariantIter _reply_iter;
+       gchar* _vala_t = NULL;
+       GVariant* _tmp4_;
+       gchar* _result = NULL;
+       GVariant* _tmp5_;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "TestString");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (s));
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       _reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout 
((GDBusProxy *) self), NULL, NULL, error);
+       g_object_unref (_message);
+       if (!_reply_message) {
+               return NULL;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, error)) {
+               g_object_unref (_reply_message);
+               return NULL;
+       }
+       _reply = g_dbus_message_get_body (_reply_message);
+       g_variant_iter_init (&_reply_iter, _reply);
+       _tmp4_ = g_variant_iter_next_value (&_reply_iter);
+       _vala_t = g_variant_dup_string (_tmp4_, NULL);
+       g_variant_unref (_tmp4_);
+       *t = _vala_t;
+       _tmp5_ = g_variant_iter_next_value (&_reply_iter);
+       _result = g_variant_dup_string (_tmp5_, NULL);
+       g_variant_unref (_tmp5_);
+       g_object_unref (_reply_message);
+       return _result;
+}
+
+static void
+test_proxy_test_cancellable (Test* self,
+                             GCancellable* cancellable,
+                             GError** error)
+{
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       GDBusMessage *_reply_message;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "TestCancellable");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       _reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout 
((GDBusProxy *) self), NULL, cancellable, error);
+       g_object_unref (_message);
+       if (!_reply_message) {
+               return;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, error)) {
+               g_object_unref (_reply_message);
+               return;
+       }
+       g_object_unref (_reply_message);
+}
+
+static void
+test_proxy_test_custom_error (Test* self,
+                              GError** error)
+{
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       GDBusMessage *_reply_message;
+       TEST_ERROR;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "TestCustomError");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       _reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout 
((GDBusProxy *) self), NULL, NULL, error);
+       g_object_unref (_message);
+       if (!_reply_message) {
+               return;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, error)) {
+               g_object_unref (_reply_message);
+               return;
+       }
+       g_object_unref (_reply_message);
+}
+
+static void
+test_proxy_test_interface_init (TestIface* iface)
+{
+       iface->test_void = test_proxy_test_void;
+       iface->test_int = test_proxy_test_int;
+       iface->test_string = test_proxy_test_string;
+       iface->test_cancellable = test_proxy_test_cancellable;
+       iface->test_custom_error = test_proxy_test_custom_error;
+}
+
+static void
+_dbus_test_test_void (Test* self,
+                      GVariant* _parameters_,
+                      GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       test_test_void (self, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               return;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+}
+
+static void
+_dbus_test_test_int (Test* self,
+                     GVariant* _parameters_,
+                     GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       gint i = 0;
+       GVariant* _tmp6_;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       gint j = 0;
+       gint result;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _tmp6_ = g_variant_iter_next_value (&_arguments_iter);
+       i = g_variant_get_int32 (_tmp6_);
+       g_variant_unref (_tmp6_);
+       result = test_test_int (self, i, &j, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               return;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_int32 (j));
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_int32 (result));
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+}
+
+static void
+_dbus_test_test_string (Test* self,
+                        GVariant* _parameters_,
+                        GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       gchar* s = NULL;
+       GVariant* _tmp7_;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       gchar* t = NULL;
+       gchar* result;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _tmp7_ = g_variant_iter_next_value (&_arguments_iter);
+       s = g_variant_dup_string (_tmp7_, NULL);
+       g_variant_unref (_tmp7_);
+       result = test_test_string (self, s, &t, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               goto _error;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_string (t));
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_string (result));
+       _g_free0 (result);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+       _error:
+       _g_free0 (s);
+       _g_free0 (t);
+       ;
+}
+
+static void
+_dbus_test_test_cancellable (Test* self,
+                             GVariant* _parameters_,
+                             GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       test_test_cancellable (self, NULL, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               return;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+}
+
+static void
+_dbus_test_test_custom_error (Test* self,
+                              GVariant* _parameters_,
+                              GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       test_test_custom_error (self, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               return;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* method_name,
+                                 GVariant* parameters,
+                                 GDBusMethodInvocation* invocation,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "TestVoid") == 0) {
+               _dbus_test_test_void (object, parameters, invocation);
+       } else if (strcmp (method_name, "TestInt") == 0) {
+               _dbus_test_test_int (object, parameters, invocation);
+       } else if (strcmp (method_name, "TestString") == 0) {
+               _dbus_test_test_string (object, parameters, invocation);
+       } else if (strcmp (method_name, "TestCancellable") == 0) {
+               _dbus_test_test_cancellable (object, parameters, invocation);
+       } else if (strcmp (method_name, "TestCustomError") == 0) {
+               _dbus_test_test_custom_error (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return NULL;
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GVariant* value,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return FALSE;
+}
+
+guint
+test_register_object (gpointer object,
+                      GDBusConnection* connection,
+                      const gchar* path,
+                      GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+static void
+_vala_main (void)
+{
+       Test* test = NULL;
+       Test* _tmp0_;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = (Test*) g_initable_new (TYPE_TEST_PROXY, NULL, &_inner_error0_, "g-flags", 0, "g-name", 
"org.example.Test", "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/example/test", 
"g-interface-name", "org.example.Test", NULL);
+       test = (Test*) _tmp0_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       {
+               test_test_void (test, &_inner_error0_);
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       goto __catch0_g_error;
+               }
+               g_assert_not_reached ();
+       }
+       goto __finally0;
+       __catch0_g_error:
+       {
+               g_clear_error (&_inner_error0_);
+       }
+       __finally0:
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (test);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       {
+               gint j = 0;
+               gint k = 0;
+               gint _tmp1_ = 0;
+               gint _tmp2_ = 0;
+               gint _tmp3_;
+               _tmp3_ = test_test_int (test, 42, &_tmp2_, &_inner_error0_);
+               j = _tmp2_;
+               _tmp1_ = _tmp3_;
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       goto __catch1_g_error;
+               }
+               k = _tmp1_;
+               g_assert_not_reached ();
+       }
+       goto __finally1;
+       __catch1_g_error:
+       {
+               g_clear_error (&_inner_error0_);
+       }
+       __finally1:
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (test);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       {
+               gchar* t = NULL;
+               gchar* u = NULL;
+               gchar* _tmp4_ = NULL;
+               gchar* _tmp5_ = NULL;
+               gchar* _tmp6_;
+               gchar* _tmp7_;
+               const gchar* _tmp8_;
+               _tmp6_ = test_test_string (test, "hello", &_tmp5_, &_inner_error0_);
+               _g_free0 (t);
+               t = _tmp5_;
+               _tmp4_ = _tmp6_;
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       _g_free0 (u);
+                       _g_free0 (t);
+                       goto __catch2_g_error;
+               }
+               _tmp7_ = _tmp4_;
+               _tmp4_ = NULL;
+               _g_free0 (u);
+               u = _tmp7_;
+               _tmp8_ = t;
+               _vala_assert (g_strcmp0 (_tmp8_, "world") == 0, "t == \"world\"");
+               _vala_assert (g_strcmp0 (u, "vala") == 0, "u == \"vala\"");
+               g_assert_not_reached ();
+               _g_free0 (_tmp4_);
+               _g_free0 (u);
+               _g_free0 (t);
+       }
+       goto __finally2;
+       __catch2_g_error:
+       {
+               g_clear_error (&_inner_error0_);
+       }
+       __finally2:
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (test);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       {
+               GCancellable* cancellable = NULL;
+               GCancellable* _tmp9_;
+               GCancellable* _tmp10_;
+               GCancellable* _tmp11_;
+               _tmp9_ = g_cancellable_new ();
+               cancellable = _tmp9_;
+               _tmp10_ = cancellable;
+               g_cancellable_cancel (_tmp10_);
+               _tmp11_ = cancellable;
+               test_test_cancellable (test, _tmp11_, &_inner_error0_);
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       _g_object_unref0 (cancellable);
+                       goto __catch3_g_error;
+               }
+               g_assert_not_reached ();
+               _g_object_unref0 (cancellable);
+       }
+       goto __finally3;
+       __catch3_g_error:
+       {
+               g_clear_error (&_inner_error0_);
+       }
+       __finally3:
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (test);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       {
+               test_test_custom_error (test, &_inner_error0_);
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       if (_inner_error0_->domain == TEST_ERROR) {
+                               goto __catch4_test_error;
+                       }
+                       goto __catch4_g_error;
+               }
+               g_assert_not_reached ();
+       }
+       goto __finally4;
+       __catch4_test_error:
+       {
+               GError* e = NULL;
+               GError* _tmp12_;
+               GError* _tmp13_;
+               const gchar* _tmp14_;
+               e = _inner_error0_;
+               _inner_error0_ = NULL;
+               _tmp12_ = e;
+               _vala_assert (g_error_matches (_tmp12_, TEST_ERROR, TEST_ERROR_BAD), "e is TestError.BAD");
+               _tmp13_ = e;
+               _tmp14_ = _tmp13_->message;
+               _vala_assert (g_strcmp0 (_tmp14_, "GDBus.Error:org.example.TestError.Bad: Something failed 
badly") == 0, "e.message == \"GDBus.Error:org.example.TestError.Bad: Something failed badly\"");
+               _g_error_free0 (e);
+       }
+       goto __finally4;
+       __catch4_g_error:
+       {
+               g_clear_error (&_inner_error0_);
+               g_assert_not_reached ();
+       }
+       __finally4:
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (test);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _g_object_unref0 (test);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/dbus/errors_server.c-expected b/tests/dbus/errors_server.c-expected
new file mode 100644
index 000000000..805cf6aae
--- /dev/null
+++ b/tests/dbus/errors_server.c-expected
@@ -0,0 +1,692 @@
+/* dbus_errors_server.c generated by valac, the Vala compiler
+ * generated from dbus_errors_server.vala, do not modify */
+
+#include <gio/gio.h>
+#include <glib.h>
+#include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TEST, TestClass))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define IS_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TEST))
+#define TEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TEST, TestClass))
+
+typedef struct _Test Test;
+typedef struct _TestClass TestClass;
+typedef struct _TestPrivate TestPrivate;
+enum  {
+       TEST_0_PROPERTY,
+       TEST_NUM_PROPERTIES
+};
+static GParamSpec* test_properties[TEST_NUM_PROPERTIES];
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+typedef enum  {
+       TEST_ERROR_NOT_SO_GOOD,
+       TEST_ERROR_BAD,
+       TEST_ERROR_WORSE
+} TestError;
+#define TEST_ERROR test_error_quark ()
+struct _Test {
+       GObject parent_instance;
+       TestPrivate * priv;
+};
+
+struct _TestClass {
+       GObjectClass parent_class;
+};
+
+static gpointer test_parent_class = NULL;
+VALA_EXTERN GMainLoop* main_loop;
+GMainLoop* main_loop = NULL;
+
+VALA_EXTERN GQuark test_error_quark (void);
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
+VALA_EXTERN guint test_register_object (void* object,
+                            GDBusConnection* connection,
+                            const gchar* path,
+                            GError** error);
+VALA_EXTERN void test_test_void (Test* self,
+                     GError** error);
+VALA_EXTERN gint test_test_int (Test* self,
+                    gint i,
+                    gint* j,
+                    GError** error);
+VALA_EXTERN gchar* test_test_string (Test* self,
+                         const gchar* s,
+                         gchar* * t,
+                         GError** error);
+VALA_EXTERN void test_test_cancellable (Test* self,
+                            GCancellable* cancellable,
+                            GError** error);
+VALA_EXTERN void test_test_custom_error (Test* self,
+                             GError** error);
+VALA_EXTERN Test* test_new (void);
+VALA_EXTERN Test* test_construct (GType object_type);
+static GType test_get_type_once (void);
+static void _dbus_test_test_void (Test* self,
+                           GVariant* _parameters_,
+                           GDBusMethodInvocation* invocation);
+static void _dbus_test_test_int (Test* self,
+                          GVariant* _parameters_,
+                          GDBusMethodInvocation* invocation);
+static void _dbus_test_test_string (Test* self,
+                             GVariant* _parameters_,
+                             GDBusMethodInvocation* invocation);
+static void _dbus_test_test_cancellable (Test* self,
+                                  GVariant* _parameters_,
+                                  GDBusMethodInvocation* invocation);
+static void _dbus_test_test_custom_error (Test* self,
+                                   GVariant* _parameters_,
+                                   GDBusMethodInvocation* invocation);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* method_name,
+                                      GVariant* parameters,
+                                      GDBusMethodInvocation* invocation,
+                                      gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+                                            const gchar* sender,
+                                            const gchar* object_path,
+                                            const gchar* interface_name,
+                                            const gchar* property_name,
+                                            GError** error,
+                                            gpointer user_data);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GVariant* value,
+                                           GError** error,
+                                           gpointer user_data);
+static void _test_unregister_object (gpointer user_data);
+VALA_EXTERN void client_exit (GPid pid,
+                  gint status);
+static void _vala_main (void);
+static guint _variant_get1 (GVariant* value);
+static void _client_exit_gchild_watch_func (GPid pid,
+                                     gint wait_status,
+                                     gpointer self);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static const GDBusErrorEntry test_error_entries[] = {{TEST_ERROR_NOT_SO_GOOD, 
"org.example.TestError.NotSoGood"}, {TEST_ERROR_BAD, "org.example.TestError.Bad"}, {TEST_ERROR_WORSE, 
"org.example.TestError.Worse"}};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_void_in[] = {NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_void_out[] = {NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_void = {-1, "TestVoid", (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_void_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_void_out), NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_int_i = {-1, "i", "i", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_int_j = {-1, "j", "i", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_int_result = {-1, "result", "i", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_int_in[] = {&_test_dbus_arg_info_test_int_i, 
NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_int_out[] = {&_test_dbus_arg_info_test_int_j, 
&_test_dbus_arg_info_test_int_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_int = {-1, "TestInt", (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_int_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_int_out), NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_string_s = {-1, "s", "s", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_string_t = {-1, "t", "s", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_string_result = {-1, "result", "s", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_string_in[] = 
{&_test_dbus_arg_info_test_string_s, NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_string_out[] = 
{&_test_dbus_arg_info_test_string_t, &_test_dbus_arg_info_test_string_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_string = {-1, "TestString", (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_string_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_string_out), NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_cancellable_in[] = {NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_cancellable_out[] = {NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_cancellable = {-1, "TestCancellable", (GDBusArgInfo 
**) (&_test_dbus_arg_info_test_cancellable_in), (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_cancellable_out), NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_custom_error_in[] = {NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_custom_error_out[] = {NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_custom_error = {-1, "TestCustomError", 
(GDBusArgInfo **) (&_test_dbus_arg_info_test_custom_error_in), (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_custom_error_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_test_void, 
&_test_dbus_method_info_test_int, &_test_dbus_method_info_test_string, 
&_test_dbus_method_info_test_cancellable, &_test_dbus_method_info_test_custom_error, NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = {NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) 
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, 
test_dbus_interface_get_property, test_dbus_interface_set_property};
+
+GQuark
+test_error_quark (void)
+{
+       static volatile gsize test_error_quark_volatile = 0;
+       g_dbus_error_register_error_domain ("test-error-quark", &test_error_quark_volatile, 
test_error_entries, G_N_ELEMENTS (test_error_entries));
+       return (GQuark) test_error_quark_volatile;
+}
+
+void
+test_test_void (Test* self,
+                GError** error)
+{
+       GError* _tmp0_;
+       GError* _inner_error0_ = NULL;
+       g_return_if_fail (IS_TEST (self));
+       _tmp0_ = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, "Operation failed");
+       _inner_error0_ = _tmp0_;
+       g_propagate_error (error, _inner_error0_);
+       return;
+}
+
+gint
+test_test_int (Test* self,
+               gint i,
+               gint* j,
+               GError** error)
+{
+       gint _vala_j = 0;
+       GError* _tmp0_;
+       gint _tmp1_ = -1;
+       GError* _inner_error0_ = NULL;
+       g_return_val_if_fail (IS_TEST (self), 0);
+       _tmp0_ = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, "Operation failed");
+       _inner_error0_ = _tmp0_;
+       g_propagate_error (error, _inner_error0_);
+       return _tmp1_;
+}
+
+gchar*
+test_test_string (Test* self,
+                  const gchar* s,
+                  gchar* * t,
+                  GError** error)
+{
+       gchar* _vala_t = NULL;
+       GError* _tmp0_;
+       GError* _inner_error0_ = NULL;
+       g_return_val_if_fail (IS_TEST (self), NULL);
+       g_return_val_if_fail (s != NULL, NULL);
+       _tmp0_ = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, "Operation failed");
+       _inner_error0_ = _tmp0_;
+       g_propagate_error (error, _inner_error0_);
+       _g_free0 (_vala_t);
+       return NULL;
+}
+
+void
+test_test_cancellable (Test* self,
+                       GCancellable* cancellable,
+                       GError** error)
+{
+       g_return_if_fail (IS_TEST (self));
+       g_return_if_fail ((cancellable == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (cancellable, 
g_cancellable_get_type ()));
+}
+
+void
+test_test_custom_error (Test* self,
+                        GError** error)
+{
+       GError* _tmp0_;
+       GError* _inner_error0_ = NULL;
+       g_return_if_fail (IS_TEST (self));
+       _tmp0_ = g_error_new_literal (TEST_ERROR, TEST_ERROR_BAD, "Something failed badly");
+       _inner_error0_ = _tmp0_;
+       if (_inner_error0_->domain == TEST_ERROR) {
+               g_propagate_error (error, _inner_error0_);
+               return;
+       } else {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+}
+
+Test*
+test_construct (GType object_type)
+{
+       Test * self = NULL;
+       self = (Test*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Test*
+test_new (void)
+{
+       return test_construct (TYPE_TEST);
+}
+
+static void
+test_class_init (TestClass * klass,
+                 gpointer klass_data)
+{
+       test_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+test_instance_init (Test * self,
+                    gpointer klass)
+{
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Test), 
0, (GInstanceInitFunc) test_instance_init, NULL };
+       GType test_type_id;
+       test_type_id = g_type_register_static (G_TYPE_OBJECT, "Test", &g_define_type_info, 0);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_register_object);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+static void
+_dbus_test_test_void (Test* self,
+                      GVariant* _parameters_,
+                      GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       test_test_void (self, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               return;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+}
+
+static void
+_dbus_test_test_int (Test* self,
+                     GVariant* _parameters_,
+                     GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       gint i = 0;
+       GVariant* _tmp0_;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       gint j = 0;
+       gint result;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _tmp0_ = g_variant_iter_next_value (&_arguments_iter);
+       i = g_variant_get_int32 (_tmp0_);
+       g_variant_unref (_tmp0_);
+       result = test_test_int (self, i, &j, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               return;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_int32 (j));
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_int32 (result));
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+}
+
+static void
+_dbus_test_test_string (Test* self,
+                        GVariant* _parameters_,
+                        GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       gchar* s = NULL;
+       GVariant* _tmp1_;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       gchar* t = NULL;
+       gchar* result;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _tmp1_ = g_variant_iter_next_value (&_arguments_iter);
+       s = g_variant_dup_string (_tmp1_, NULL);
+       g_variant_unref (_tmp1_);
+       result = test_test_string (self, s, &t, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               goto _error;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_string (t));
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_string (result));
+       _g_free0 (result);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+       _error:
+       _g_free0 (s);
+       _g_free0 (t);
+       ;
+}
+
+static void
+_dbus_test_test_cancellable (Test* self,
+                             GVariant* _parameters_,
+                             GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       test_test_cancellable (self, NULL, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               return;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+}
+
+static void
+_dbus_test_test_custom_error (Test* self,
+                              GVariant* _parameters_,
+                              GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       test_test_custom_error (self, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               return;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* method_name,
+                                 GVariant* parameters,
+                                 GDBusMethodInvocation* invocation,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "TestVoid") == 0) {
+               _dbus_test_test_void (object, parameters, invocation);
+       } else if (strcmp (method_name, "TestInt") == 0) {
+               _dbus_test_test_int (object, parameters, invocation);
+       } else if (strcmp (method_name, "TestString") == 0) {
+               _dbus_test_test_string (object, parameters, invocation);
+       } else if (strcmp (method_name, "TestCancellable") == 0) {
+               _dbus_test_test_cancellable (object, parameters, invocation);
+       } else if (strcmp (method_name, "TestCustomError") == 0) {
+               _dbus_test_test_custom_error (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return NULL;
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GVariant* value,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return FALSE;
+}
+
+guint
+test_register_object (gpointer object,
+                      GDBusConnection* connection,
+                      const gchar* path,
+                      GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+void
+client_exit (GPid pid,
+             gint status)
+{
+       GMainLoop* _tmp0_;
+       _vala_assert (status == 0, "status == 0");
+       _tmp0_ = main_loop;
+       g_main_loop_quit (_tmp0_);
+}
+
+static guint
+_variant_get1 (GVariant* value)
+{
+       return g_variant_get_uint32 (value);
+}
+
+static void
+_client_exit_gchild_watch_func (GPid pid,
+                                gint wait_status,
+                                gpointer self)
+{
+       client_exit (pid, wait_status);
+}
+
+static void
+_vala_main (void)
+{
+       GDBusConnection* conn = NULL;
+       GDBusConnection* _tmp0_;
+       GDBusConnection* _tmp1_;
+       Test* _tmp2_;
+       Test* _tmp3_;
+       GVariant* request_result = NULL;
+       GDBusConnection* _tmp4_;
+       GVariant* _tmp5_;
+       GVariant* _tmp6_;
+       GVariant* _tmp7_;
+       GVariant* _tmp8_;
+       GVariant* _tmp9_;
+       GVariant* _tmp10_;
+       GVariant* _tmp11_;
+       guint _tmp12_;
+       GPid client_pid = 0;
+       gchar* _tmp13_;
+       gchar** _tmp14_;
+       gchar** _tmp15_;
+       gint _tmp15__length1;
+       GPid _tmp16_ = 0;
+       GMainLoop* _tmp17_;
+       GMainLoop* _tmp18_;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &_inner_error0_);
+       conn = _tmp0_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp1_ = conn;
+       _tmp2_ = test_new ();
+       _tmp3_ = _tmp2_;
+       test_register_object (_tmp3_, _tmp1_, "/org/example/test", &_inner_error0_);
+       _g_object_unref0 (_tmp3_);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp4_ = conn;
+       _tmp5_ = g_variant_new ("(su)", "org.example.Test", 0x4, NULL);
+       g_variant_ref_sink (_tmp5_);
+       _tmp6_ = _tmp5_;
+       _tmp7_ = g_dbus_connection_call_sync (_tmp4_, "org.freedesktop.DBus", "/org/freedesktop/DBus", 
"org.freedesktop.DBus", "RequestName", _tmp6_, NULL, 0, -1, NULL, &_inner_error0_);
+       _tmp8_ = _tmp7_;
+       _g_variant_unref0 (_tmp6_);
+       request_result = _tmp8_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp9_ = request_result;
+       _tmp10_ = g_variant_get_child_value (_tmp9_, (gsize) 0);
+       _tmp11_ = _tmp10_;
+       _tmp12_ = _variant_get1 (_tmp11_);
+       _vala_assert (_tmp12_ == ((guint) 1), "(uint) request_result.get_child_value (0) == 1");
+       _g_variant_unref0 (_tmp11_);
+       _tmp13_ = g_strdup ("dbus_errors_client");
+       _tmp14_ = g_new0 (gchar*, 1 + 1);
+       _tmp14_[0] = _tmp13_;
+       _tmp15_ = _tmp14_;
+       _tmp15__length1 = 1;
+       g_spawn_async (NULL, _tmp15_, NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &_tmp16_, &_inner_error0_);
+       client_pid = _tmp16_;
+       _tmp15_ = (_vala_array_free (_tmp15_, _tmp15__length1, (GDestroyNotify) g_free), NULL);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_variant_unref0 (request_result);
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       g_child_watch_add_full (G_PRIORITY_DEFAULT_IDLE, client_pid, _client_exit_gchild_watch_func, NULL, 
NULL);
+       _tmp17_ = g_main_loop_new (NULL, FALSE);
+       _g_main_loop_unref0 (main_loop);
+       main_loop = _tmp17_;
+       _tmp18_ = main_loop;
+       g_main_loop_run (_tmp18_);
+       _g_variant_unref0 (request_result);
+       _g_object_unref0 (conn);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/dbus/filedescriptor-async_client.c-expected 
b/tests/dbus/filedescriptor-async_client.c-expected
new file mode 100644
index 000000000..0c6bcb8d0
--- /dev/null
+++ b/tests/dbus/filedescriptor-async_client.c-expected
@@ -0,0 +1,740 @@
+/* dbus_filedescriptor_async_client.c generated by valac, the Vala compiler
+ * generated from dbus_filedescriptor_async_client.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <gio/gunixinputstream.h>
+#include <gio/gunixfdlist.h>
+#include <string.h>
+#include <glib.h>
+#include <unistd.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define TEST_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_TEST, TestIface))
+
+typedef struct _Test Test;
+typedef struct _TestIface TestIface;
+
+#define TYPE_TEST_PROXY (test_proxy_get_type ())
+typedef GDBusProxy TestProxy;
+typedef GDBusProxyClass TestProxyClass;
+typedef struct _TestTestInReadyData TestTestInReadyData;
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+typedef struct _RunData RunData;
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _TestIface {
+       GTypeInterface parent_iface;
+       void (*test_in) (Test* self, GUnixInputStream* i, GAsyncReadyCallback _callback_, gpointer 
_user_data_);
+       GUnixInputStream* (*test_in_finish) (Test* self, GAsyncResult* _res_, GUnixInputStream* * j, GError** 
error);
+};
+
+struct _TestTestInReadyData {
+       GDBusMethodInvocation* _invocation_;
+       GUnixInputStream* i;
+};
+
+struct _RunData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Test* test;
+       Test* _tmp0_;
+       guint8* buffer;
+       guint8* _tmp1_;
+       gint buffer_length1;
+       gint _buffer_size_;
+       gint* pipe1;
+       gint* _tmp2_;
+       gint pipe1_length1;
+       gint _pipe1_size_;
+       gint* _tmp3_;
+       gint _tmp3__length1;
+       guint8* _tmp4_;
+       gint _tmp4__length1;
+       gint* _tmp5_;
+       gint _tmp5__length1;
+       gint _tmp6_;
+       guint8* _tmp7_;
+       gint _tmp7__length1;
+       gint* _tmp8_;
+       gint _tmp8__length1;
+       gint _tmp9_;
+       GUnixInputStream* j;
+       GUnixInputStream* k;
+       GUnixInputStream* _tmp10_;
+       Test* _tmp11_;
+       gint* _tmp12_;
+       gint _tmp12__length1;
+       gint _tmp13_;
+       GUnixInputStream* _tmp14_;
+       GUnixInputStream* _tmp15_;
+       GUnixInputStream* _tmp16_;
+       GUnixInputStream* _tmp17_;
+       GUnixInputStream* _tmp18_;
+       GUnixInputStream* _tmp19_;
+       gssize _tmp20_;
+       GUnixInputStream* _tmp21_;
+       guint8* _tmp22_;
+       gint _tmp22__length1;
+       guint8* _tmp23_;
+       gint _tmp23__length1;
+       guint8 _tmp24_;
+       gssize _tmp25_;
+       GUnixInputStream* _tmp26_;
+       guint8* _tmp27_;
+       gint _tmp27__length1;
+       guint8* _tmp28_;
+       gint _tmp28__length1;
+       guint8 _tmp29_;
+       GMainLoop* _tmp30_;
+       GError* _inner_error0_;
+};
+
+VALA_EXTERN GMainLoop* main_loop;
+GMainLoop* main_loop = NULL;
+
+VALA_EXTERN GType test_proxy_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN guint test_register_object (void* object,
+                            GDBusConnection* connection,
+                            const gchar* path,
+                            GError** error);
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN void test_test_in (Test* self,
+                   GUnixInputStream* i,
+                   GAsyncReadyCallback _callback_,
+                   gpointer _user_data_);
+VALA_EXTERN GUnixInputStream* test_test_in_finish (Test* self,
+                                       GAsyncResult* _res_,
+                                       GUnixInputStream* * j,
+                                       GError** error);
+static GType test_get_type_once (void);
+static void test_proxy_g_signal (GDBusProxy* proxy,
+                          const gchar* sender_name,
+                          const gchar* signal_name,
+                          GVariant* parameters);
+static void _vala_g_async_ready_callback (GObject *source_object,
+                                   GAsyncResult *res,
+                                   void *user_data);
+static void test_proxy_test_in_async (Test* self,
+                               GUnixInputStream* i,
+                               GAsyncReadyCallback _callback_,
+                               gpointer _user_data_);
+static GUnixInputStream* test_proxy_test_in_finish (Test* self,
+                                             GAsyncResult* _res_,
+                                             GUnixInputStream* * j,
+                                             GError** error);
+static void test_proxy_test_interface_init (TestIface* iface);
+static void _dbus_test_test_in (Test* self,
+                         GVariant* _parameters_,
+                         GDBusMethodInvocation* invocation);
+static void _dbus_test_test_in_ready (GObject * source_object,
+                               GAsyncResult * _res_,
+                               gpointer _user_data_);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* method_name,
+                                      GVariant* parameters,
+                                      GDBusMethodInvocation* invocation,
+                                      gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+                                            const gchar* sender,
+                                            const gchar* object_path,
+                                            const gchar* interface_name,
+                                            const gchar* property_name,
+                                            GError** error,
+                                            gpointer user_data);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GVariant* value,
+                                           GError** error,
+                                           gpointer user_data);
+static void _test_unregister_object (gpointer user_data);
+static void run_data_free (gpointer _data);
+VALA_EXTERN void run (GAsyncReadyCallback _callback_,
+          gpointer _user_data_);
+VALA_EXTERN void run_finish (GAsyncResult* _res_);
+static gboolean run_co (RunData* _data_);
+static void run_ready (GObject* source_object,
+                GAsyncResult* _res_,
+                gpointer _user_data_);
+static void _vala_main (void);
+
+static const GDBusArgInfo _test_dbus_arg_info_test_in_i = {-1, "i", "h", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_in_j = {-1, "j", "h", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_in_result = {-1, "result", "h", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_in_in[] = {&_test_dbus_arg_info_test_in_i, NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_in_out[] = {&_test_dbus_arg_info_test_in_j, 
&_test_dbus_arg_info_test_in_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_in = {-1, "TestIn", (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_in_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_in_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_test_in, NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = {NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) 
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, 
test_dbus_interface_get_property, test_dbus_interface_set_property};
+
+void
+test_test_in (Test* self,
+              GUnixInputStream* i,
+              GAsyncReadyCallback _callback_,
+              gpointer _user_data_)
+{
+       TestIface* _iface_;
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->test_in) {
+               _iface_->test_in (self, i, _callback_, _user_data_);
+       }
+}
+
+GUnixInputStream*
+test_test_in_finish (Test* self,
+                     GAsyncResult* _res_,
+                     GUnixInputStream* * j,
+                     GError** error)
+{
+       TestIface* _iface_;
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->test_in_finish) {
+               return _iface_->test_in_finish (self, _res_, j, error);
+       }
+       return NULL;
+}
+
+static void
+test_default_init (TestIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType test_type_id;
+       test_type_id = g_type_register_static (G_TYPE_INTERFACE, "Test", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (test_type_id, G_TYPE_OBJECT);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) 
test_proxy_get_type);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), 
"org.example.Test");
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*) 
(&_test_dbus_interface_info));
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_register_object);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_TEST, 
test_proxy_test_interface_init) )
+static void
+test_proxy_class_init (TestProxyClass* klass)
+{
+       G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal;
+}
+
+static void
+test_proxy_g_signal (GDBusProxy* proxy,
+                     const gchar* sender_name,
+                     const gchar* signal_name,
+                     GVariant* parameters)
+{
+}
+
+static void
+test_proxy_init (TestProxy* self)
+{
+       g_dbus_proxy_set_interface_info (G_DBUS_PROXY (self), (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info));
+}
+
+static void
+_vala_g_async_ready_callback (GObject *source_object,
+                              GAsyncResult *res,
+                              void *user_data)
+{
+       g_task_return_pointer (user_data, g_object_ref (res), g_object_unref);
+       g_object_unref (user_data);
+}
+
+static void
+test_proxy_test_in_async (Test* self,
+                          GUnixInputStream* i,
+                          GAsyncReadyCallback _callback_,
+                          gpointer _user_data_)
+{
+       GUnixFDList* _fd_list;
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       G_IO_ERROR;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "TestIn");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       _fd_list = g_unix_fd_list_new ();
+       g_variant_builder_add (&_arguments_builder, "h", g_unix_fd_list_append (_fd_list, 
g_unix_input_stream_get_fd (i), NULL));
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       g_dbus_message_set_unix_fd_list (_message, _fd_list);
+       g_object_unref (_fd_list);
+       if (_callback_ != NULL) {
+               g_dbus_connection_send_message_with_reply (g_dbus_proxy_get_connection ((GDBusProxy *) self), 
_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout ((GDBusProxy *) self), NULL, NULL, 
_vala_g_async_ready_callback, g_task_new ((GObject *) self, NULL, _callback_, _user_data_));
+       } else {
+               g_dbus_message_set_flags (_message, G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED);
+               g_dbus_connection_send_message (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       }
+       g_object_unref (_message);
+}
+
+static GUnixInputStream*
+test_proxy_test_in_finish (Test* self,
+                           GAsyncResult* _res_,
+                           GUnixInputStream* * j,
+                           GError** error)
+{
+       GUnixFDList* _fd_list;
+       GAsyncResult *_inner_res;
+       GDBusMessage *_reply_message;
+       gint _fd_index = 0;
+       gint _fd;
+       GVariant *_reply;
+       GVariantIter _reply_iter;
+       GUnixInputStream* _vala_j = NULL;
+       GUnixInputStream* _result = NULL;
+       _inner_res = g_task_propagate_pointer ((GTask *) _res_, NULL);
+       _reply_message = g_dbus_connection_send_message_with_reply_finish (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _inner_res, error);
+       g_object_unref (_inner_res);
+       if (!_reply_message) {
+               return NULL;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, error)) {
+               g_object_unref (_reply_message);
+               return NULL;
+       }
+       _reply = g_dbus_message_get_body (_reply_message);
+       g_variant_iter_init (&_reply_iter, _reply);
+       _fd_list = g_dbus_message_get_unix_fd_list (_reply_message);
+       if (_fd_list) {
+               g_variant_iter_next (&_reply_iter, "h", &_fd_index);
+               _fd = g_unix_fd_list_get (_fd_list, _fd_index, error);
+               if (_fd >= 0) {
+                       _vala_j = (GUnixInputStream *) g_unix_input_stream_new (_fd, TRUE);
+               }
+       } else {
+               g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, "FD List is NULL");
+       }
+       *j = _vala_j;
+       if (error && (*error)) {
+               g_object_unref (_reply_message);
+               return NULL;
+       }
+       _fd_list = g_dbus_message_get_unix_fd_list (_reply_message);
+       if (_fd_list) {
+               g_variant_iter_next (&_reply_iter, "h", &_fd_index);
+               _fd = g_unix_fd_list_get (_fd_list, _fd_index, error);
+               if (_fd >= 0) {
+                       _result = (GUnixInputStream *) g_unix_input_stream_new (_fd, TRUE);
+               }
+       } else {
+               g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, "FD List is NULL");
+       }
+       if (error && (*error)) {
+               g_object_unref (_reply_message);
+               return NULL;
+       }
+       g_object_unref (_reply_message);
+       return _result;
+}
+
+static void
+test_proxy_test_interface_init (TestIface* iface)
+{
+       iface->test_in = test_proxy_test_in_async;
+       iface->test_in_finish = test_proxy_test_in_finish;
+}
+
+static void
+_dbus_test_test_in (Test* self,
+                    GVariant* _parameters_,
+                    GDBusMethodInvocation* invocation)
+{
+       GUnixFDList* _fd_list;
+       GVariantIter _arguments_iter;
+       gint _fd_index = 0;
+       gint _fd;
+       TestTestInReadyData* _ready_data;
+       GError* error = NULL;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _ready_data = g_slice_new0 (TestTestInReadyData);
+       _ready_data->_invocation_ = invocation;
+       _fd_list = g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation));
+       if (_fd_list) {
+               g_variant_iter_next (&_arguments_iter, "h", &_fd_index);
+               _fd = g_unix_fd_list_get (_fd_list, _fd_index, &error);
+               if (_fd >= 0) {
+                       _ready_data->i = (GUnixInputStream *) g_unix_input_stream_new (_fd, TRUE);
+               }
+       } else {
+               g_set_error_literal (&error, G_IO_ERROR, G_IO_ERROR_FAILED, "FD List is NULL");
+       }
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               goto _error;
+       }
+       test_test_in (self, _ready_data->i, (GAsyncReadyCallback) _dbus_test_test_in_ready, _ready_data);
+       _error:
+       ;
+}
+
+static void
+_dbus_test_test_in_ready (GObject * source_object,
+                          GAsyncResult * _res_,
+                          gpointer _user_data_)
+{
+       TestTestInReadyData* _ready_data;
+       GDBusMethodInvocation* invocation;
+       GUnixFDList* _fd_list;
+       GError* error = NULL;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       GUnixInputStream* j = NULL;
+       GUnixInputStream* result;
+       _ready_data = _user_data_;
+       invocation = _ready_data->_invocation_;
+       result = test_test_in_finish ((Test*) source_object, _res_, &j, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               goto _error;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _fd_list = g_unix_fd_list_new ();
+       g_variant_builder_add (&_reply_builder, "h", g_unix_fd_list_append (_fd_list, 
g_unix_input_stream_get_fd (j), NULL));
+       g_variant_builder_add (&_reply_builder, "h", g_unix_fd_list_append (_fd_list, 
g_unix_input_stream_get_fd (result), NULL));
+       _g_object_unref0 (result);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_message_set_unix_fd_list (_reply_message, _fd_list);
+       g_object_unref (_fd_list);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+       _error:
+       _g_object_unref0 (_ready_data->i);
+       _g_object_unref0 (j);
+       g_slice_free (TestTestInReadyData, _ready_data);
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* method_name,
+                                 GVariant* parameters,
+                                 GDBusMethodInvocation* invocation,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "TestIn") == 0) {
+               _dbus_test_test_in (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return NULL;
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GVariant* value,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return FALSE;
+}
+
+guint
+test_register_object (gpointer object,
+                      GDBusConnection* connection,
+                      const gchar* path,
+                      GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+static void
+run_data_free (gpointer _data)
+{
+       RunData* _data_;
+       _data_ = _data;
+       g_slice_free (RunData, _data_);
+}
+
+void
+run (GAsyncReadyCallback _callback_,
+     gpointer _user_data_)
+{
+       RunData* _data_;
+       _data_ = g_slice_new0 (RunData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, run_data_free);
+       run_co (_data_);
+}
+
+void
+run_finish (GAsyncResult* _res_)
+{
+       RunData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static void
+run_ready (GObject* source_object,
+           GAsyncResult* _res_,
+           gpointer _user_data_)
+{
+       RunData* _data_;
+       _data_ = _user_data_;
+       _data_->_source_object_ = source_object;
+       _data_->_res_ = _res_;
+       run_co (_data_);
+}
+
+static gboolean
+run_co (RunData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               case 1:
+               goto _state_1;
+               case 2:
+               goto _state_2;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->_state_ = 1;
+       g_async_initable_new_async (TYPE_TEST_PROXY, 0, NULL, run_ready, _data_, "g-flags", 0, "g-name", 
"org.example.Test", "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/example/test", 
"g-interface-name", "org.example.Test", NULL);
+       return FALSE;
+       _state_1:
+       _data_->_tmp0_ = (Test*) g_async_initable_new_finish ((GAsyncInitable *) _data_->_source_object_, 
_data_->_res_, &_data_->_inner_error0_);
+       _data_->test = (Test*) _data_->_tmp0_;
+       if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), 
_data_->_inner_error0_->code);
+               g_clear_error (&_data_->_inner_error0_);
+               g_object_unref (_data_->_async_result);
+               return FALSE;
+       }
+       _data_->_tmp1_ = g_new0 (guint8, 1);
+       _data_->buffer = _data_->_tmp1_;
+       _data_->buffer_length1 = 1;
+       _data_->_buffer_size_ = _data_->buffer_length1;
+       _data_->_tmp2_ = g_new0 (gint, 2);
+       _data_->pipe1 = _data_->_tmp2_;
+       _data_->pipe1_length1 = 2;
+       _data_->_pipe1_size_ = _data_->pipe1_length1;
+       _data_->_tmp3_ = _data_->pipe1;
+       _data_->_tmp3__length1 = _data_->pipe1_length1;
+       _vala_assert (pipe (_data_->_tmp3_) == 0, "Posix.pipe (pipe1) == 0");
+       _data_->_tmp4_ = _data_->buffer;
+       _data_->_tmp4__length1 = _data_->buffer_length1;
+       _data_->_tmp4_[0] = (guint8) 42;
+       _data_->_tmp5_ = _data_->pipe1;
+       _data_->_tmp5__length1 = _data_->pipe1_length1;
+       _data_->_tmp6_ = _data_->_tmp5_[1];
+       _data_->_tmp7_ = _data_->buffer;
+       _data_->_tmp7__length1 = _data_->buffer_length1;
+       _vala_assert (write (_data_->_tmp6_, _data_->_tmp7_, (gsize) 1) == ((gssize) 1), "Posix.write 
(pipe1[1], buffer, 1) == 1");
+       _data_->_tmp8_ = _data_->pipe1;
+       _data_->_tmp8__length1 = _data_->pipe1_length1;
+       _data_->_tmp9_ = _data_->_tmp8_[1];
+       close (_data_->_tmp9_);
+       _data_->_tmp11_ = _data_->test;
+       _data_->_tmp12_ = _data_->pipe1;
+       _data_->_tmp12__length1 = _data_->pipe1_length1;
+       _data_->_tmp13_ = _data_->_tmp12_[0];
+       _data_->_tmp14_ = (GUnixInputStream*) g_unix_input_stream_new (_data_->_tmp13_, TRUE);
+       _data_->_tmp15_ = _data_->_tmp14_;
+       _data_->_tmp16_ = NULL;
+       _data_->_state_ = 2;
+       test_test_in (_data_->_tmp11_, _data_->_tmp15_, run_ready, _data_);
+       return FALSE;
+       _state_2:
+       _data_->_tmp17_ = test_test_in_finish (_data_->_tmp11_, _data_->_res_, &_data_->_tmp16_, 
&_data_->_inner_error0_);
+       _g_object_unref0 (_data_->j);
+       _data_->j = _data_->_tmp16_;
+       _data_->_tmp18_ = _data_->_tmp17_;
+       _g_object_unref0 (_data_->_tmp15_);
+       _data_->_tmp10_ = _data_->_tmp18_;
+       if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+               _g_object_unref0 (_data_->k);
+               _g_object_unref0 (_data_->j);
+               _data_->pipe1 = (g_free (_data_->pipe1), NULL);
+               _data_->buffer = (g_free (_data_->buffer), NULL);
+               _g_object_unref0 (_data_->test);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), 
_data_->_inner_error0_->code);
+               g_clear_error (&_data_->_inner_error0_);
+               g_object_unref (_data_->_async_result);
+               return FALSE;
+       }
+       _data_->_tmp19_ = _data_->_tmp10_;
+       _data_->_tmp10_ = NULL;
+       _g_object_unref0 (_data_->k);
+       _data_->k = _data_->_tmp19_;
+       _data_->_tmp21_ = _data_->j;
+       _data_->_tmp22_ = _data_->buffer;
+       _data_->_tmp22__length1 = _data_->buffer_length1;
+       _data_->_tmp20_ = g_input_stream_read (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp21_, 
g_input_stream_get_type (), GInputStream), _data_->_tmp22_, (gsize) _data_->_tmp22__length1, NULL, 
&_data_->_inner_error0_);
+       if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+               _g_object_unref0 (_data_->_tmp10_);
+               _g_object_unref0 (_data_->k);
+               _g_object_unref0 (_data_->j);
+               _data_->pipe1 = (g_free (_data_->pipe1), NULL);
+               _data_->buffer = (g_free (_data_->buffer), NULL);
+               _g_object_unref0 (_data_->test);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), 
_data_->_inner_error0_->code);
+               g_clear_error (&_data_->_inner_error0_);
+               g_object_unref (_data_->_async_result);
+               return FALSE;
+       }
+       _vala_assert (_data_->_tmp20_ == ((gssize) 1), "j.read (buffer) == 1");
+       _data_->_tmp23_ = _data_->buffer;
+       _data_->_tmp23__length1 = _data_->buffer_length1;
+       _data_->_tmp24_ = _data_->_tmp23_[0];
+       _vala_assert (((gint) _data_->_tmp24_) == 23, "buffer[0] == 23");
+       _data_->_tmp26_ = _data_->k;
+       _data_->_tmp27_ = _data_->buffer;
+       _data_->_tmp27__length1 = _data_->buffer_length1;
+       _data_->_tmp25_ = g_input_stream_read (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp26_, 
g_input_stream_get_type (), GInputStream), _data_->_tmp27_, (gsize) _data_->_tmp27__length1, NULL, 
&_data_->_inner_error0_);
+       if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+               _g_object_unref0 (_data_->_tmp10_);
+               _g_object_unref0 (_data_->k);
+               _g_object_unref0 (_data_->j);
+               _data_->pipe1 = (g_free (_data_->pipe1), NULL);
+               _data_->buffer = (g_free (_data_->buffer), NULL);
+               _g_object_unref0 (_data_->test);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), 
_data_->_inner_error0_->code);
+               g_clear_error (&_data_->_inner_error0_);
+               g_object_unref (_data_->_async_result);
+               return FALSE;
+       }
+       _vala_assert (_data_->_tmp25_ == ((gssize) 1), "k.read (buffer) == 1");
+       _data_->_tmp28_ = _data_->buffer;
+       _data_->_tmp28__length1 = _data_->buffer_length1;
+       _data_->_tmp29_ = _data_->_tmp28_[0];
+       _vala_assert (((gint) _data_->_tmp29_) == 11, "buffer[0] == 11");
+       _data_->_tmp30_ = main_loop;
+       g_main_loop_quit (_data_->_tmp30_);
+       _g_object_unref0 (_data_->_tmp10_);
+       _g_object_unref0 (_data_->k);
+       _g_object_unref0 (_data_->j);
+       _data_->pipe1 = (g_free (_data_->pipe1), NULL);
+       _data_->buffer = (g_free (_data_->buffer), NULL);
+       _g_object_unref0 (_data_->test);
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+_vala_main (void)
+{
+       GMainLoop* _tmp0_;
+       GMainLoop* _tmp1_;
+       run (NULL, NULL);
+       _tmp0_ = g_main_loop_new (NULL, FALSE);
+       _g_main_loop_unref0 (main_loop);
+       main_loop = _tmp0_;
+       _tmp1_ = main_loop;
+       g_main_loop_run (_tmp1_);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/dbus/filedescriptor-async_server.c-expected 
b/tests/dbus/filedescriptor-async_server.c-expected
new file mode 100644
index 000000000..33898dab0
--- /dev/null
+++ b/tests/dbus/filedescriptor-async_server.c-expected
@@ -0,0 +1,712 @@
+/* dbus_filedescriptor_async_server.c generated by valac, the Vala compiler
+ * generated from dbus_filedescriptor_async_server.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <gio/gunixinputstream.h>
+#include <glib.h>
+#include <unistd.h>
+#include <string.h>
+#include <gio/gunixfdlist.h>
+#include <stdlib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TEST, TestClass))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define IS_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TEST))
+#define TEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TEST, TestClass))
+
+typedef struct _Test Test;
+typedef struct _TestClass TestClass;
+typedef struct _TestPrivate TestPrivate;
+enum  {
+       TEST_0_PROPERTY,
+       TEST_NUM_PROPERTIES
+};
+static GParamSpec* test_properties[TEST_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+typedef struct _TestTestInData TestTestInData;
+typedef struct _TestTestInReadyData TestTestInReadyData;
+#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Test {
+       GObject parent_instance;
+       TestPrivate * priv;
+};
+
+struct _TestClass {
+       GObjectClass parent_class;
+};
+
+struct _TestTestInData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Test* self;
+       GUnixInputStream* i;
+       GUnixInputStream* j;
+       GUnixInputStream* result;
+       guint8* buffer;
+       guint8* _tmp0_;
+       gint buffer_length1;
+       gint _buffer_size_;
+       gssize _tmp1_;
+       guint8 _tmp2_;
+       gint* pipe1;
+       gint* _tmp3_;
+       gint pipe1_length1;
+       gint _pipe1_size_;
+       gint* _tmp4_;
+       gint _tmp4__length1;
+       gint* _tmp5_;
+       gint _tmp5__length1;
+       gint _tmp6_;
+       gint* _tmp7_;
+       gint _tmp7__length1;
+       gint _tmp8_;
+       gint* pipe2;
+       gint* _tmp9_;
+       gint pipe2_length1;
+       gint _pipe2_size_;
+       gint* _tmp10_;
+       gint _tmp10__length1;
+       gint* _tmp11_;
+       gint _tmp11__length1;
+       gint _tmp12_;
+       gint* _tmp13_;
+       gint _tmp13__length1;
+       gint _tmp14_;
+       gint* _tmp15_;
+       gint _tmp15__length1;
+       gint _tmp16_;
+       GUnixInputStream* _tmp17_;
+       gint* _tmp18_;
+       gint _tmp18__length1;
+       gint _tmp19_;
+       GUnixInputStream* _tmp20_;
+       GError* _inner_error0_;
+};
+
+struct _TestTestInReadyData {
+       GDBusMethodInvocation* _invocation_;
+       GUnixInputStream* i;
+};
+
+static gpointer test_parent_class = NULL;
+VALA_EXTERN GMainLoop* main_loop;
+GMainLoop* main_loop = NULL;
+
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
+VALA_EXTERN guint test_register_object (void* object,
+                            GDBusConnection* connection,
+                            const gchar* path,
+                            GError** error);
+static void test_test_in_data_free (gpointer _data);
+VALA_EXTERN void test_test_in (Test* self,
+                   GUnixInputStream* i,
+                   GAsyncReadyCallback _callback_,
+                   gpointer _user_data_);
+VALA_EXTERN GUnixInputStream* test_test_in_finish (Test* self,
+                                       GAsyncResult* _res_,
+                                       GUnixInputStream* * j,
+                                       GError** error);
+static gboolean test_test_in_co (TestTestInData* _data_);
+static gboolean _test_test_in_co_gsource_func (gpointer self);
+VALA_EXTERN Test* test_new (void);
+VALA_EXTERN Test* test_construct (GType object_type);
+static GType test_get_type_once (void);
+static void _dbus_test_test_in (Test* self,
+                         GVariant* _parameters_,
+                         GDBusMethodInvocation* invocation);
+static void _dbus_test_test_in_ready (GObject * source_object,
+                               GAsyncResult * _res_,
+                               gpointer _user_data_);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* method_name,
+                                      GVariant* parameters,
+                                      GDBusMethodInvocation* invocation,
+                                      gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+                                            const gchar* sender,
+                                            const gchar* object_path,
+                                            const gchar* interface_name,
+                                            const gchar* property_name,
+                                            GError** error,
+                                            gpointer user_data);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GVariant* value,
+                                           GError** error,
+                                           gpointer user_data);
+static void _test_unregister_object (gpointer user_data);
+VALA_EXTERN void client_exit (GPid pid,
+                  gint status);
+static void _vala_main (void);
+static guint _variant_get1 (GVariant* value);
+static void _client_exit_gchild_watch_func (GPid pid,
+                                     gint wait_status,
+                                     gpointer self);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static const GDBusArgInfo _test_dbus_arg_info_test_in_i = {-1, "i", "h", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_in_j = {-1, "j", "h", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_in_result = {-1, "result", "h", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_in_in[] = {&_test_dbus_arg_info_test_in_i, NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_in_out[] = {&_test_dbus_arg_info_test_in_j, 
&_test_dbus_arg_info_test_in_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_in = {-1, "TestIn", (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_in_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_in_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_test_in, NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = {NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) 
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, 
test_dbus_interface_get_property, test_dbus_interface_set_property};
+
+static void
+test_test_in_data_free (gpointer _data)
+{
+       TestTestInData* _data_;
+       _data_ = _data;
+       _g_object_unref0 (_data_->i);
+       _g_object_unref0 (_data_->result);
+       _g_object_unref0 (_data_->self);
+       g_slice_free (TestTestInData, _data_);
+}
+
+static gpointer
+_g_object_ref0 (gpointer self)
+{
+       return self ? g_object_ref (self) : NULL;
+}
+
+void
+test_test_in (Test* self,
+              GUnixInputStream* i,
+              GAsyncReadyCallback _callback_,
+              gpointer _user_data_)
+{
+       TestTestInData* _data_;
+       Test* _tmp0_;
+       GUnixInputStream* _tmp1_;
+       g_return_if_fail (IS_TEST (self));
+       g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (i, G_TYPE_UNIX_INPUT_STREAM));
+       _data_ = g_slice_new0 (TestTestInData);
+       _data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, test_test_in_data_free);
+       _tmp0_ = _g_object_ref0 (self);
+       _data_->self = _tmp0_;
+       _tmp1_ = _g_object_ref0 (i);
+       _g_object_unref0 (_data_->i);
+       _data_->i = _tmp1_;
+       test_test_in_co (_data_);
+}
+
+GUnixInputStream*
+test_test_in_finish (Test* self,
+                     GAsyncResult* _res_,
+                     GUnixInputStream* * j,
+                     GError** error)
+{
+       GUnixInputStream* result;
+       TestTestInData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), error);
+       if (NULL == _data_) {
+               return NULL;
+       }
+       if (j) {
+               *j = _data_->j;
+       } else {
+               _g_object_unref0 (_data_->j);
+       }
+       _data_->j = NULL;
+       result = _data_->result;
+       _data_->result = NULL;
+       return result;
+}
+
+static gboolean
+_test_test_in_co_gsource_func (gpointer self)
+{
+       gboolean result;
+       result = test_test_in_co (self);
+       return result;
+}
+
+static gboolean
+test_test_in_co (TestTestInData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               case 1:
+               goto _state_1;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->_tmp0_ = g_new0 (guint8, 1);
+       _data_->buffer = _data_->_tmp0_;
+       _data_->buffer_length1 = 1;
+       _data_->_buffer_size_ = _data_->buffer_length1;
+       _data_->_tmp1_ = g_input_stream_read (G_TYPE_CHECK_INSTANCE_CAST (_data_->i, g_input_stream_get_type 
(), GInputStream), _data_->buffer, (gsize) _data_->buffer_length1, NULL, &_data_->_inner_error0_);
+       if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+               if (_data_->_inner_error0_->domain == G_IO_ERROR) {
+                       g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
+                       _data_->buffer = (g_free (_data_->buffer), NULL);
+                       _g_object_unref0 (_data_->j);
+                       g_object_unref (_data_->_async_result);
+                       return FALSE;
+               } else {
+                       _data_->buffer = (g_free (_data_->buffer), NULL);
+                       _g_object_unref0 (_data_->j);
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), 
_data_->_inner_error0_->code);
+                       g_clear_error (&_data_->_inner_error0_);
+                       g_object_unref (_data_->_async_result);
+                       return FALSE;
+               }
+       }
+       _vala_assert (_data_->_tmp1_ == ((gssize) 1), "i.read (buffer) == 1");
+       _data_->_tmp2_ = _data_->buffer[0];
+       _vala_assert (((gint) _data_->_tmp2_) == 42, "buffer[0] == 42");
+       _data_->_tmp3_ = g_new0 (gint, 2);
+       _data_->pipe1 = _data_->_tmp3_;
+       _data_->pipe1_length1 = 2;
+       _data_->_pipe1_size_ = _data_->pipe1_length1;
+       _data_->_tmp4_ = _data_->pipe1;
+       _data_->_tmp4__length1 = _data_->pipe1_length1;
+       _vala_assert (pipe (_data_->_tmp4_) == 0, "Posix.pipe (pipe1) == 0");
+       _data_->buffer[0] = (guint8) 23;
+       _data_->_tmp5_ = _data_->pipe1;
+       _data_->_tmp5__length1 = _data_->pipe1_length1;
+       _data_->_tmp6_ = _data_->_tmp5_[1];
+       _vala_assert (write (_data_->_tmp6_, _data_->buffer, (gsize) 1) == ((gssize) 1), "Posix.write 
(pipe1[1], buffer, 1) == 1");
+       _data_->_tmp7_ = _data_->pipe1;
+       _data_->_tmp7__length1 = _data_->pipe1_length1;
+       _data_->_tmp8_ = _data_->_tmp7_[1];
+       close (_data_->_tmp8_);
+       _data_->_tmp9_ = g_new0 (gint, 2);
+       _data_->pipe2 = _data_->_tmp9_;
+       _data_->pipe2_length1 = 2;
+       _data_->_pipe2_size_ = _data_->pipe2_length1;
+       _data_->_tmp10_ = _data_->pipe2;
+       _data_->_tmp10__length1 = _data_->pipe2_length1;
+       _vala_assert (pipe (_data_->_tmp10_) == 0, "Posix.pipe (pipe2) == 0");
+       _data_->buffer[0] = (guint8) 11;
+       _data_->_tmp11_ = _data_->pipe2;
+       _data_->_tmp11__length1 = _data_->pipe2_length1;
+       _data_->_tmp12_ = _data_->_tmp11_[1];
+       _vala_assert (write (_data_->_tmp12_, _data_->buffer, (gsize) 1) == ((gssize) 1), "Posix.write 
(pipe2[1], buffer, 1) == 1");
+       _data_->_tmp13_ = _data_->pipe2;
+       _data_->_tmp13__length1 = _data_->pipe2_length1;
+       _data_->_tmp14_ = _data_->_tmp13_[1];
+       close (_data_->_tmp14_);
+       g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _test_test_in_co_gsource_func, _data_, NULL);
+       _data_->_state_ = 1;
+       return FALSE;
+       _state_1:
+       ;
+       _data_->_tmp15_ = _data_->pipe1;
+       _data_->_tmp15__length1 = _data_->pipe1_length1;
+       _data_->_tmp16_ = _data_->_tmp15_[0];
+       _data_->_tmp17_ = (GUnixInputStream*) g_unix_input_stream_new (_data_->_tmp16_, TRUE);
+       _g_object_unref0 (_data_->j);
+       _data_->j = _data_->_tmp17_;
+       _data_->_tmp18_ = _data_->pipe2;
+       _data_->_tmp18__length1 = _data_->pipe2_length1;
+       _data_->_tmp19_ = _data_->_tmp18_[0];
+       _data_->_tmp20_ = (GUnixInputStream*) g_unix_input_stream_new (_data_->_tmp19_, TRUE);
+       _data_->result = _data_->_tmp20_;
+       _data_->pipe2 = (g_free (_data_->pipe2), NULL);
+       _data_->pipe1 = (g_free (_data_->pipe1), NULL);
+       _data_->buffer = (g_free (_data_->buffer), NULL);
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+Test*
+test_construct (GType object_type)
+{
+       Test * self = NULL;
+       self = (Test*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Test*
+test_new (void)
+{
+       return test_construct (TYPE_TEST);
+}
+
+static void
+test_class_init (TestClass * klass,
+                 gpointer klass_data)
+{
+       test_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+test_instance_init (Test * self,
+                    gpointer klass)
+{
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Test), 
0, (GInstanceInitFunc) test_instance_init, NULL };
+       GType test_type_id;
+       test_type_id = g_type_register_static (G_TYPE_OBJECT, "Test", &g_define_type_info, 0);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_register_object);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+static void
+_dbus_test_test_in (Test* self,
+                    GVariant* _parameters_,
+                    GDBusMethodInvocation* invocation)
+{
+       GUnixFDList* _fd_list;
+       GVariantIter _arguments_iter;
+       gint _fd_index = 0;
+       gint _fd;
+       TestTestInReadyData* _ready_data;
+       GError* error = NULL;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _ready_data = g_slice_new0 (TestTestInReadyData);
+       _ready_data->_invocation_ = invocation;
+       _fd_list = g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation));
+       if (_fd_list) {
+               g_variant_iter_next (&_arguments_iter, "h", &_fd_index);
+               _fd = g_unix_fd_list_get (_fd_list, _fd_index, &error);
+               if (_fd >= 0) {
+                       _ready_data->i = (GUnixInputStream *) g_unix_input_stream_new (_fd, TRUE);
+               }
+       } else {
+               g_set_error_literal (&error, G_IO_ERROR, G_IO_ERROR_FAILED, "FD List is NULL");
+       }
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               goto _error;
+       }
+       test_test_in (self, _ready_data->i, (GAsyncReadyCallback) _dbus_test_test_in_ready, _ready_data);
+       _error:
+       ;
+}
+
+static void
+_dbus_test_test_in_ready (GObject * source_object,
+                          GAsyncResult * _res_,
+                          gpointer _user_data_)
+{
+       TestTestInReadyData* _ready_data;
+       GDBusMethodInvocation* invocation;
+       GUnixFDList* _fd_list;
+       GError* error = NULL;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       GUnixInputStream* j = NULL;
+       GUnixInputStream* result;
+       _ready_data = _user_data_;
+       invocation = _ready_data->_invocation_;
+       result = test_test_in_finish ((Test*) source_object, _res_, &j, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               goto _error;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _fd_list = g_unix_fd_list_new ();
+       g_variant_builder_add (&_reply_builder, "h", g_unix_fd_list_append (_fd_list, 
g_unix_input_stream_get_fd (j), NULL));
+       g_variant_builder_add (&_reply_builder, "h", g_unix_fd_list_append (_fd_list, 
g_unix_input_stream_get_fd (result), NULL));
+       _g_object_unref0 (result);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_message_set_unix_fd_list (_reply_message, _fd_list);
+       g_object_unref (_fd_list);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+       _error:
+       _g_object_unref0 (_ready_data->i);
+       _g_object_unref0 (j);
+       g_slice_free (TestTestInReadyData, _ready_data);
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* method_name,
+                                 GVariant* parameters,
+                                 GDBusMethodInvocation* invocation,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "TestIn") == 0) {
+               _dbus_test_test_in (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return NULL;
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GVariant* value,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return FALSE;
+}
+
+guint
+test_register_object (gpointer object,
+                      GDBusConnection* connection,
+                      const gchar* path,
+                      GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+void
+client_exit (GPid pid,
+             gint status)
+{
+       GMainLoop* _tmp0_;
+       _vala_assert (status == 0, "status == 0");
+       _tmp0_ = main_loop;
+       g_main_loop_quit (_tmp0_);
+}
+
+static guint
+_variant_get1 (GVariant* value)
+{
+       return g_variant_get_uint32 (value);
+}
+
+static void
+_client_exit_gchild_watch_func (GPid pid,
+                                gint wait_status,
+                                gpointer self)
+{
+       client_exit (pid, wait_status);
+}
+
+static void
+_vala_main (void)
+{
+       GDBusConnection* conn = NULL;
+       GDBusConnection* _tmp0_;
+       GDBusConnection* _tmp1_;
+       Test* _tmp2_;
+       Test* _tmp3_;
+       GVariant* request_result = NULL;
+       GDBusConnection* _tmp4_;
+       GVariant* _tmp5_;
+       GVariant* _tmp6_;
+       GVariant* _tmp7_;
+       GVariant* _tmp8_;
+       GVariant* _tmp9_;
+       GVariant* _tmp10_;
+       GVariant* _tmp11_;
+       guint _tmp12_;
+       GPid client_pid = 0;
+       gchar* _tmp13_;
+       gchar** _tmp14_;
+       gchar** _tmp15_;
+       gint _tmp15__length1;
+       GPid _tmp16_ = 0;
+       GMainLoop* _tmp17_;
+       GMainLoop* _tmp18_;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &_inner_error0_);
+       conn = _tmp0_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp1_ = conn;
+       _tmp2_ = test_new ();
+       _tmp3_ = _tmp2_;
+       test_register_object (_tmp3_, _tmp1_, "/org/example/test", &_inner_error0_);
+       _g_object_unref0 (_tmp3_);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp4_ = conn;
+       _tmp5_ = g_variant_new ("(su)", "org.example.Test", 0x4, NULL);
+       g_variant_ref_sink (_tmp5_);
+       _tmp6_ = _tmp5_;
+       _tmp7_ = g_dbus_connection_call_sync (_tmp4_, "org.freedesktop.DBus", "/org/freedesktop/DBus", 
"org.freedesktop.DBus", "RequestName", _tmp6_, NULL, 0, -1, NULL, &_inner_error0_);
+       _tmp8_ = _tmp7_;
+       _g_variant_unref0 (_tmp6_);
+       request_result = _tmp8_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp9_ = request_result;
+       _tmp10_ = g_variant_get_child_value (_tmp9_, (gsize) 0);
+       _tmp11_ = _tmp10_;
+       _tmp12_ = _variant_get1 (_tmp11_);
+       _vala_assert (_tmp12_ == ((guint) 1), "(uint) request_result.get_child_value (0) == 1");
+       _g_variant_unref0 (_tmp11_);
+       _tmp13_ = g_strdup ("dbus_filedescriptor_async_client");
+       _tmp14_ = g_new0 (gchar*, 1 + 1);
+       _tmp14_[0] = _tmp13_;
+       _tmp15_ = _tmp14_;
+       _tmp15__length1 = 1;
+       g_spawn_async (NULL, _tmp15_, NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &_tmp16_, &_inner_error0_);
+       client_pid = _tmp16_;
+       _tmp15_ = (_vala_array_free (_tmp15_, _tmp15__length1, (GDestroyNotify) g_free), NULL);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_variant_unref0 (request_result);
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       g_child_watch_add_full (G_PRIORITY_DEFAULT_IDLE, client_pid, _client_exit_gchild_watch_func, NULL, 
NULL);
+       _tmp17_ = g_main_loop_new (NULL, FALSE);
+       _g_main_loop_unref0 (main_loop);
+       main_loop = _tmp17_;
+       _tmp18_ = main_loop;
+       g_main_loop_run (_tmp18_);
+       _g_variant_unref0 (request_result);
+       _g_object_unref0 (conn);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/dbus/filedescriptor-errors_client.c-expected 
b/tests/dbus/filedescriptor-errors_client.c-expected
new file mode 100644
index 000000000..dde04e5dd
--- /dev/null
+++ b/tests/dbus/filedescriptor-errors_client.c-expected
@@ -0,0 +1,479 @@
+/* dbus_filedescriptor_errors_client.c generated by valac, the Vala compiler
+ * generated from dbus_filedescriptor_errors_client.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <gio/gunixoutputstream.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+#include <gio/gunixfdlist.h>
+#include <gio/gunixinputstream.h>
+#include <unistd.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define TEST_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_TEST, TestIface))
+
+typedef struct _Test Test;
+typedef struct _TestIface TestIface;
+
+#define TYPE_TEST_PROXY (test_proxy_get_type ())
+typedef GDBusProxy TestProxy;
+typedef GDBusProxyClass TestProxyClass;
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+
+struct _TestIface {
+       GTypeInterface parent_iface;
+       gchar* (*test) (Test* self, GUnixOutputStream* output_stream, GError** error);
+};
+
+VALA_EXTERN GType test_proxy_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN guint test_register_object (void* object,
+                            GDBusConnection* connection,
+                            const gchar* path,
+                            GError** error);
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN gchar* test_test (Test* self,
+                  GUnixOutputStream* output_stream,
+                  GError** error);
+static GType test_get_type_once (void);
+static void test_proxy_g_signal (GDBusProxy* proxy,
+                          const gchar* sender_name,
+                          const gchar* signal_name,
+                          GVariant* parameters);
+static gchar* test_proxy_test (Test* self,
+                        GUnixOutputStream* output_stream,
+                        GError** error);
+static void test_proxy_test_interface_init (TestIface* iface);
+static void _dbus_test_test (Test* self,
+                      GVariant* _parameters_,
+                      GDBusMethodInvocation* invocation);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* method_name,
+                                      GVariant* parameters,
+                                      GDBusMethodInvocation* invocation,
+                                      gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+                                            const gchar* sender,
+                                            const gchar* object_path,
+                                            const gchar* interface_name,
+                                            const gchar* property_name,
+                                            GError** error,
+                                            gpointer user_data);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GVariant* value,
+                                           GError** error,
+                                           gpointer user_data);
+static void _test_unregister_object (gpointer user_data);
+VALA_EXTERN void create_streams (GUnixInputStream* * input,
+                     GUnixOutputStream* * output,
+                     GError** error);
+static void _vala_main (void);
+
+static const GDBusArgInfo _test_dbus_arg_info_test_output_stream = {-1, "output_stream", "h", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_result = {-1, "result", "s", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_in[] = {&_test_dbus_arg_info_test_output_stream, 
NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_out[] = {&_test_dbus_arg_info_test_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test = {-1, "Test", (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_test, NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = {NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) 
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, 
test_dbus_interface_get_property, test_dbus_interface_set_property};
+
+gchar*
+test_test (Test* self,
+           GUnixOutputStream* output_stream,
+           GError** error)
+{
+       TestIface* _iface_;
+       g_return_val_if_fail (IS_TEST (self), NULL);
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->test) {
+               return _iface_->test (self, output_stream, error);
+       }
+       return NULL;
+}
+
+static void
+test_default_init (TestIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType test_type_id;
+       test_type_id = g_type_register_static (G_TYPE_INTERFACE, "Test", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (test_type_id, G_TYPE_OBJECT);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) 
test_proxy_get_type);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), 
"org.example.Test");
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*) 
(&_test_dbus_interface_info));
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_register_object);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_TEST, 
test_proxy_test_interface_init) )
+static void
+test_proxy_class_init (TestProxyClass* klass)
+{
+       G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal;
+}
+
+static void
+test_proxy_g_signal (GDBusProxy* proxy,
+                     const gchar* sender_name,
+                     const gchar* signal_name,
+                     GVariant* parameters)
+{
+}
+
+static void
+test_proxy_init (TestProxy* self)
+{
+       g_dbus_proxy_set_interface_info (G_DBUS_PROXY (self), (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info));
+}
+
+static gchar*
+test_proxy_test (Test* self,
+                 GUnixOutputStream* output_stream,
+                 GError** error)
+{
+       GUnixFDList* _fd_list;
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       GDBusMessage *_reply_message;
+       gint _fd_index = 0;
+       gint _fd;
+       GVariant *_reply;
+       GVariantIter _reply_iter;
+       gchar* _result = NULL;
+       GVariant* _tmp0_;
+       G_IO_ERROR;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "Test");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       _fd_list = g_unix_fd_list_new ();
+       g_variant_builder_add (&_arguments_builder, "h", g_unix_fd_list_append (_fd_list, 
g_unix_output_stream_get_fd (output_stream), NULL));
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       g_dbus_message_set_unix_fd_list (_message, _fd_list);
+       g_object_unref (_fd_list);
+       _reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout 
((GDBusProxy *) self), NULL, NULL, error);
+       g_object_unref (_message);
+       if (!_reply_message) {
+               return NULL;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, error)) {
+               g_object_unref (_reply_message);
+               return NULL;
+       }
+       _reply = g_dbus_message_get_body (_reply_message);
+       g_variant_iter_init (&_reply_iter, _reply);
+       _tmp0_ = g_variant_iter_next_value (&_reply_iter);
+       _result = g_variant_dup_string (_tmp0_, NULL);
+       g_variant_unref (_tmp0_);
+       g_object_unref (_reply_message);
+       return _result;
+}
+
+static void
+test_proxy_test_interface_init (TestIface* iface)
+{
+       iface->test = test_proxy_test;
+}
+
+static void
+_dbus_test_test (Test* self,
+                 GVariant* _parameters_,
+                 GDBusMethodInvocation* invocation)
+{
+       GUnixFDList* _fd_list;
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       gint _fd_index = 0;
+       gint _fd;
+       GUnixOutputStream* output_stream = NULL;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       gchar* result;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _fd_list = g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation));
+       if (_fd_list) {
+               g_variant_iter_next (&_arguments_iter, "h", &_fd_index);
+               _fd = g_unix_fd_list_get (_fd_list, _fd_index, &error);
+               if (_fd >= 0) {
+                       output_stream = (GUnixOutputStream *) g_unix_output_stream_new (_fd, TRUE);
+               }
+       } else {
+               g_set_error_literal (&error, G_IO_ERROR, G_IO_ERROR_FAILED, "FD List is NULL");
+       }
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               goto _error;
+       }
+       result = test_test (self, output_stream, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               goto _error;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _fd_list = g_unix_fd_list_new ();
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_string (result));
+       _g_free0 (result);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_message_set_unix_fd_list (_reply_message, _fd_list);
+       g_object_unref (_fd_list);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+       _error:
+       _g_object_unref0 (output_stream);
+       ;
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* method_name,
+                                 GVariant* parameters,
+                                 GDBusMethodInvocation* invocation,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "Test") == 0) {
+               _dbus_test_test (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return NULL;
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GVariant* value,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return FALSE;
+}
+
+guint
+test_register_object (gpointer object,
+                      GDBusConnection* connection,
+                      const gchar* path,
+                      GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+void
+create_streams (GUnixInputStream* * input,
+                GUnixOutputStream* * output,
+                GError** error)
+{
+       GUnixInputStream* _vala_input = NULL;
+       GUnixOutputStream* _vala_output = NULL;
+       gint pipefd[2] = {0};
+       gint _tmp1_;
+       GUnixInputStream* _tmp2_;
+       gint _tmp3_;
+       GUnixOutputStream* _tmp4_;
+       GError* _inner_error0_ = NULL;
+       if (pipe (pipefd) < 0) {
+               GError* _tmp0_;
+               _tmp0_ = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, "Pipe creation failed");
+               _inner_error0_ = _tmp0_;
+               if (_inner_error0_->domain == G_IO_ERROR) {
+                       g_propagate_error (error, _inner_error0_);
+                       _g_object_unref0 (_vala_input);
+                       _g_object_unref0 (_vala_output);
+                       return;
+               } else {
+                       _g_object_unref0 (_vala_input);
+                       _g_object_unref0 (_vala_output);
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+       }
+       _tmp1_ = pipefd[0];
+       _tmp2_ = (GUnixInputStream*) g_unix_input_stream_new (_tmp1_, TRUE);
+       _g_object_unref0 (_vala_input);
+       _vala_input = _tmp2_;
+       _tmp3_ = pipefd[1];
+       _tmp4_ = (GUnixOutputStream*) g_unix_output_stream_new (_tmp3_, TRUE);
+       _g_object_unref0 (_vala_output);
+       _vala_output = _tmp4_;
+       if (input) {
+               *input = _vala_input;
+       } else {
+               _g_object_unref0 (_vala_input);
+       }
+       if (output) {
+               *output = _vala_output;
+       } else {
+               _g_object_unref0 (_vala_output);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Test* test = NULL;
+       Test* _tmp0_;
+       GUnixInputStream* i = NULL;
+       GUnixOutputStream* o = NULL;
+       GUnixInputStream* _tmp1_ = NULL;
+       GUnixOutputStream* _tmp2_ = NULL;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = (Test*) g_initable_new (TYPE_TEST_PROXY, NULL, &_inner_error0_, "g-flags", 0, "g-name", 
"org.example.Test", "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/example/test", 
"g-interface-name", "org.example.Test", NULL);
+       test = (Test*) _tmp0_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       create_streams (&_tmp1_, &_tmp2_, &_inner_error0_);
+       _g_object_unref0 (i);
+       i = _tmp1_;
+       _g_object_unref0 (o);
+       o = _tmp2_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (o);
+               _g_object_unref0 (i);
+               _g_object_unref0 (test);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       {
+               Test* _tmp3_;
+               GUnixOutputStream* _tmp4_;
+               gchar* _tmp5_;
+               gchar* _tmp6_;
+               _tmp3_ = test;
+               _tmp4_ = o;
+               _tmp5_ = test_test (_tmp3_, _tmp4_, &_inner_error0_);
+               _tmp6_ = _tmp5_;
+               _g_free0 (_tmp6_);
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       goto __catch0_g_error;
+               }
+               g_assert_not_reached ();
+       }
+       goto __finally0;
+       __catch0_g_error:
+       {
+               g_clear_error (&_inner_error0_);
+       }
+       __finally0:
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (o);
+               _g_object_unref0 (i);
+               _g_object_unref0 (test);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _g_object_unref0 (o);
+       _g_object_unref0 (i);
+       _g_object_unref0 (test);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/dbus/filedescriptor-errors_server.c-expected 
b/tests/dbus/filedescriptor-errors_server.c-expected
new file mode 100644
index 000000000..6067ff0bb
--- /dev/null
+++ b/tests/dbus/filedescriptor-errors_server.c-expected
@@ -0,0 +1,493 @@
+/* dbus_filedescriptor_errors_server.c generated by valac, the Vala compiler
+ * generated from dbus_filedescriptor_errors_server.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <gio/gunixoutputstream.h>
+#include <glib.h>
+#include <string.h>
+#include <gio/gunixfdlist.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <sys/types.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TEST, TestClass))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define IS_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TEST))
+#define TEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TEST, TestClass))
+
+typedef struct _Test Test;
+typedef struct _TestClass TestClass;
+typedef struct _TestPrivate TestPrivate;
+enum  {
+       TEST_0_PROPERTY,
+       TEST_NUM_PROPERTIES
+};
+static GParamSpec* test_properties[TEST_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Test {
+       GObject parent_instance;
+       TestPrivate * priv;
+};
+
+struct _TestClass {
+       GObjectClass parent_class;
+};
+
+static gpointer test_parent_class = NULL;
+VALA_EXTERN GMainLoop* main_loop;
+GMainLoop* main_loop = NULL;
+
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
+VALA_EXTERN guint test_register_object (void* object,
+                            GDBusConnection* connection,
+                            const gchar* path,
+                            GError** error);
+VALA_EXTERN void test_test (Test* self,
+                GUnixOutputStream* output_stream,
+                GError** error);
+VALA_EXTERN Test* test_new (void);
+VALA_EXTERN Test* test_construct (GType object_type);
+static GType test_get_type_once (void);
+static void _dbus_test_test (Test* self,
+                      GVariant* _parameters_,
+                      GDBusMethodInvocation* invocation);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* method_name,
+                                      GVariant* parameters,
+                                      GDBusMethodInvocation* invocation,
+                                      gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+                                            const gchar* sender,
+                                            const gchar* object_path,
+                                            const gchar* interface_name,
+                                            const gchar* property_name,
+                                            GError** error,
+                                            gpointer user_data);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GVariant* value,
+                                           GError** error,
+                                           gpointer user_data);
+static void _test_unregister_object (gpointer user_data);
+VALA_EXTERN void client_exit (GPid pid,
+                  gint status);
+static void _vala_main (void);
+static guint _variant_get1 (GVariant* value);
+static void _client_exit_gchild_watch_func (GPid pid,
+                                     gint wait_status,
+                                     gpointer self);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static const GDBusArgInfo _test_dbus_arg_info_test_output_stream = {-1, "output_stream", "h", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_in[] = {&_test_dbus_arg_info_test_output_stream, 
NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_out[] = {NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test = {-1, "Test", (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_test, NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = {NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) 
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, 
test_dbus_interface_get_property, test_dbus_interface_set_property};
+
+void
+test_test (Test* self,
+           GUnixOutputStream* output_stream,
+           GError** error)
+{
+       guint8* buffer = NULL;
+       guint8* _tmp0_;
+       gint buffer_length1;
+       gint _buffer_size_;
+       GError* _inner_error0_ = NULL;
+       g_return_if_fail (IS_TEST (self));
+       g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (output_stream, G_TYPE_UNIX_OUTPUT_STREAM));
+       _tmp0_ = g_new0 (guint8, 1);
+       buffer = _tmp0_;
+       buffer_length1 = 1;
+       _buffer_size_ = buffer_length1;
+       buffer[0] = (guint8) 42;
+       g_output_stream_write (G_TYPE_CHECK_INSTANCE_CAST (output_stream, g_output_stream_get_type (), 
GOutputStream), buffer, (gsize) buffer_length1, NULL, &_inner_error0_);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               if (_inner_error0_->domain == G_IO_ERROR) {
+                       g_propagate_error (error, _inner_error0_);
+                       buffer = (g_free (buffer), NULL);
+                       return;
+               } else {
+                       buffer = (g_free (buffer), NULL);
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+       }
+       buffer = (g_free (buffer), NULL);
+}
+
+Test*
+test_construct (GType object_type)
+{
+       Test * self = NULL;
+       self = (Test*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Test*
+test_new (void)
+{
+       return test_construct (TYPE_TEST);
+}
+
+static void
+test_class_init (TestClass * klass,
+                 gpointer klass_data)
+{
+       test_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+test_instance_init (Test * self,
+                    gpointer klass)
+{
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Test), 
0, (GInstanceInitFunc) test_instance_init, NULL };
+       GType test_type_id;
+       test_type_id = g_type_register_static (G_TYPE_OBJECT, "Test", &g_define_type_info, 0);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_register_object);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+static void
+_dbus_test_test (Test* self,
+                 GVariant* _parameters_,
+                 GDBusMethodInvocation* invocation)
+{
+       GUnixFDList* _fd_list;
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       gint _fd_index = 0;
+       gint _fd;
+       GUnixOutputStream* output_stream = NULL;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _fd_list = g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation));
+       if (_fd_list) {
+               g_variant_iter_next (&_arguments_iter, "h", &_fd_index);
+               _fd = g_unix_fd_list_get (_fd_list, _fd_index, &error);
+               if (_fd >= 0) {
+                       output_stream = (GUnixOutputStream *) g_unix_output_stream_new (_fd, TRUE);
+               }
+       } else {
+               g_set_error_literal (&error, G_IO_ERROR, G_IO_ERROR_FAILED, "FD List is NULL");
+       }
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               goto _error;
+       }
+       test_test (self, output_stream, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               goto _error;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _fd_list = g_unix_fd_list_new ();
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_message_set_unix_fd_list (_reply_message, _fd_list);
+       g_object_unref (_fd_list);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+       _error:
+       _g_object_unref0 (output_stream);
+       ;
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* method_name,
+                                 GVariant* parameters,
+                                 GDBusMethodInvocation* invocation,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "Test") == 0) {
+               _dbus_test_test (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return NULL;
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GVariant* value,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return FALSE;
+}
+
+guint
+test_register_object (gpointer object,
+                      GDBusConnection* connection,
+                      const gchar* path,
+                      GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+void
+client_exit (GPid pid,
+             gint status)
+{
+       GMainLoop* _tmp0_;
+       _vala_assert (status == 0, "status == 0");
+       _tmp0_ = main_loop;
+       g_main_loop_quit (_tmp0_);
+}
+
+static guint
+_variant_get1 (GVariant* value)
+{
+       return g_variant_get_uint32 (value);
+}
+
+static void
+_client_exit_gchild_watch_func (GPid pid,
+                                gint wait_status,
+                                gpointer self)
+{
+       client_exit (pid, wait_status);
+}
+
+static void
+_vala_main (void)
+{
+       GDBusConnection* conn = NULL;
+       GDBusConnection* _tmp0_;
+       GDBusConnection* _tmp1_;
+       Test* _tmp2_;
+       Test* _tmp3_;
+       GVariant* request_result = NULL;
+       GDBusConnection* _tmp4_;
+       GVariant* _tmp5_;
+       GVariant* _tmp6_;
+       GVariant* _tmp7_;
+       GVariant* _tmp8_;
+       GVariant* _tmp9_;
+       GVariant* _tmp10_;
+       GVariant* _tmp11_;
+       guint _tmp12_;
+       GPid client_pid = 0;
+       gchar* _tmp13_;
+       gchar** _tmp14_;
+       gchar** _tmp15_;
+       gint _tmp15__length1;
+       GPid _tmp16_ = 0;
+       GMainLoop* _tmp17_;
+       gint fd = 0;
+       GMainLoop* _tmp18_;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &_inner_error0_);
+       conn = _tmp0_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp1_ = conn;
+       _tmp2_ = test_new ();
+       _tmp3_ = _tmp2_;
+       test_register_object (_tmp3_, _tmp1_, "/org/example/test", &_inner_error0_);
+       _g_object_unref0 (_tmp3_);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp4_ = conn;
+       _tmp5_ = g_variant_new ("(su)", "org.example.Test", 0x4, NULL);
+       g_variant_ref_sink (_tmp5_);
+       _tmp6_ = _tmp5_;
+       _tmp7_ = g_dbus_connection_call_sync (_tmp4_, "org.freedesktop.DBus", "/org/freedesktop/DBus", 
"org.freedesktop.DBus", "RequestName", _tmp6_, NULL, 0, -1, NULL, &_inner_error0_);
+       _tmp8_ = _tmp7_;
+       _g_variant_unref0 (_tmp6_);
+       request_result = _tmp8_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp9_ = request_result;
+       _tmp10_ = g_variant_get_child_value (_tmp9_, (gsize) 0);
+       _tmp11_ = _tmp10_;
+       _tmp12_ = _variant_get1 (_tmp11_);
+       _vala_assert (_tmp12_ == ((guint) 1), "(uint) request_result.get_child_value (0) == 1");
+       _g_variant_unref0 (_tmp11_);
+       _tmp13_ = g_strdup ("dbus_filedescriptor_errors_client");
+       _tmp14_ = g_new0 (gchar*, 1 + 1);
+       _tmp14_[0] = _tmp13_;
+       _tmp15_ = _tmp14_;
+       _tmp15__length1 = 1;
+       g_spawn_async (NULL, _tmp15_, NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &_tmp16_, &_inner_error0_);
+       client_pid = _tmp16_;
+       _tmp15_ = (_vala_array_free (_tmp15_, _tmp15__length1, (GDestroyNotify) g_free), NULL);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_variant_unref0 (request_result);
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       g_child_watch_add_full (G_PRIORITY_DEFAULT_IDLE, client_pid, _client_exit_gchild_watch_func, NULL, 
NULL);
+       _tmp17_ = g_main_loop_new (NULL, FALSE);
+       _g_main_loop_unref0 (main_loop);
+       main_loop = _tmp17_;
+       fd = 0;
+       while (TRUE) {
+               if (!(fd >= 0)) {
+                       break;
+               }
+               fd = open ("/", 0, (mode_t) 0);
+       }
+       _tmp18_ = main_loop;
+       g_main_loop_run (_tmp18_);
+       _g_variant_unref0 (request_result);
+       _g_object_unref0 (conn);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/dbus/filedescriptor_client.c-expected b/tests/dbus/filedescriptor_client.c-expected
new file mode 100644
index 000000000..d22be7c38
--- /dev/null
+++ b/tests/dbus/filedescriptor_client.c-expected
@@ -0,0 +1,555 @@
+/* dbus_filedescriptor_client.c generated by valac, the Vala compiler
+ * generated from dbus_filedescriptor_client.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <gio/gunixinputstream.h>
+#include <glib.h>
+#include <gio/gunixfdlist.h>
+#include <string.h>
+#include <unistd.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define TEST_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_TEST, TestIface))
+
+typedef struct _Test Test;
+typedef struct _TestIface TestIface;
+
+#define TYPE_TEST_PROXY (test_proxy_get_type ())
+typedef GDBusProxy TestProxy;
+typedef GDBusProxyClass TestProxyClass;
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _TestIface {
+       GTypeInterface parent_iface;
+       GUnixInputStream* (*test_in) (Test* self, GUnixInputStream* i, GUnixInputStream* * j, GError** error);
+};
+
+VALA_EXTERN GType test_proxy_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN guint test_register_object (void* object,
+                            GDBusConnection* connection,
+                            const gchar* path,
+                            GError** error);
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN GUnixInputStream* test_test_in (Test* self,
+                                GUnixInputStream* i,
+                                GUnixInputStream* * j,
+                                GError** error);
+static GType test_get_type_once (void);
+static void test_proxy_g_signal (GDBusProxy* proxy,
+                          const gchar* sender_name,
+                          const gchar* signal_name,
+                          GVariant* parameters);
+static GUnixInputStream* test_proxy_test_in (Test* self,
+                                      GUnixInputStream* i,
+                                      GUnixInputStream* * j,
+                                      GError** error);
+static void test_proxy_test_interface_init (TestIface* iface);
+static void _dbus_test_test_in (Test* self,
+                         GVariant* _parameters_,
+                         GDBusMethodInvocation* invocation);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* method_name,
+                                      GVariant* parameters,
+                                      GDBusMethodInvocation* invocation,
+                                      gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+                                            const gchar* sender,
+                                            const gchar* object_path,
+                                            const gchar* interface_name,
+                                            const gchar* property_name,
+                                            GError** error,
+                                            gpointer user_data);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GVariant* value,
+                                           GError** error,
+                                           gpointer user_data);
+static void _test_unregister_object (gpointer user_data);
+static void _vala_main (void);
+
+static const GDBusArgInfo _test_dbus_arg_info_test_in_i = {-1, "i", "h", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_in_j = {-1, "j", "h", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_in_result = {-1, "result", "h", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_in_in[] = {&_test_dbus_arg_info_test_in_i, NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_in_out[] = {&_test_dbus_arg_info_test_in_j, 
&_test_dbus_arg_info_test_in_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_in = {-1, "TestIn", (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_in_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_in_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_test_in, NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = {NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) 
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, 
test_dbus_interface_get_property, test_dbus_interface_set_property};
+
+GUnixInputStream*
+test_test_in (Test* self,
+              GUnixInputStream* i,
+              GUnixInputStream* * j,
+              GError** error)
+{
+       TestIface* _iface_;
+       g_return_val_if_fail (IS_TEST (self), NULL);
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->test_in) {
+               return _iface_->test_in (self, i, j, error);
+       }
+       return NULL;
+}
+
+static void
+test_default_init (TestIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType test_type_id;
+       test_type_id = g_type_register_static (G_TYPE_INTERFACE, "Test", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (test_type_id, G_TYPE_OBJECT);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) 
test_proxy_get_type);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), 
"org.example.Test");
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*) 
(&_test_dbus_interface_info));
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_register_object);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_TEST, 
test_proxy_test_interface_init) )
+static void
+test_proxy_class_init (TestProxyClass* klass)
+{
+       G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal;
+}
+
+static void
+test_proxy_g_signal (GDBusProxy* proxy,
+                     const gchar* sender_name,
+                     const gchar* signal_name,
+                     GVariant* parameters)
+{
+}
+
+static void
+test_proxy_init (TestProxy* self)
+{
+       g_dbus_proxy_set_interface_info (G_DBUS_PROXY (self), (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info));
+}
+
+static GUnixInputStream*
+test_proxy_test_in (Test* self,
+                    GUnixInputStream* i,
+                    GUnixInputStream* * j,
+                    GError** error)
+{
+       GUnixFDList* _fd_list;
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       GDBusMessage *_reply_message;
+       gint _fd_index = 0;
+       gint _fd;
+       GVariant *_reply;
+       GVariantIter _reply_iter;
+       GUnixInputStream* _vala_j = NULL;
+       GUnixInputStream* _result = NULL;
+       G_IO_ERROR;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "TestIn");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       _fd_list = g_unix_fd_list_new ();
+       g_variant_builder_add (&_arguments_builder, "h", g_unix_fd_list_append (_fd_list, 
g_unix_input_stream_get_fd (i), NULL));
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       g_dbus_message_set_unix_fd_list (_message, _fd_list);
+       g_object_unref (_fd_list);
+       _reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout 
((GDBusProxy *) self), NULL, NULL, error);
+       g_object_unref (_message);
+       if (!_reply_message) {
+               return NULL;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, error)) {
+               g_object_unref (_reply_message);
+               return NULL;
+       }
+       _reply = g_dbus_message_get_body (_reply_message);
+       g_variant_iter_init (&_reply_iter, _reply);
+       _fd_list = g_dbus_message_get_unix_fd_list (_reply_message);
+       if (_fd_list) {
+               g_variant_iter_next (&_reply_iter, "h", &_fd_index);
+               _fd = g_unix_fd_list_get (_fd_list, _fd_index, error);
+               if (_fd >= 0) {
+                       _vala_j = (GUnixInputStream *) g_unix_input_stream_new (_fd, TRUE);
+               }
+       } else {
+               g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, "FD List is NULL");
+       }
+       *j = _vala_j;
+       if (error && (*error)) {
+               g_object_unref (_reply_message);
+               return NULL;
+       }
+       _fd_list = g_dbus_message_get_unix_fd_list (_reply_message);
+       if (_fd_list) {
+               g_variant_iter_next (&_reply_iter, "h", &_fd_index);
+               _fd = g_unix_fd_list_get (_fd_list, _fd_index, error);
+               if (_fd >= 0) {
+                       _result = (GUnixInputStream *) g_unix_input_stream_new (_fd, TRUE);
+               }
+       } else {
+               g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, "FD List is NULL");
+       }
+       if (error && (*error)) {
+               g_object_unref (_reply_message);
+               return NULL;
+       }
+       g_object_unref (_reply_message);
+       return _result;
+}
+
+static void
+test_proxy_test_interface_init (TestIface* iface)
+{
+       iface->test_in = test_proxy_test_in;
+}
+
+static void
+_dbus_test_test_in (Test* self,
+                    GVariant* _parameters_,
+                    GDBusMethodInvocation* invocation)
+{
+       GUnixFDList* _fd_list;
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       gint _fd_index = 0;
+       gint _fd;
+       GUnixInputStream* i = NULL;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       GUnixInputStream* j = NULL;
+       GUnixInputStream* result;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _fd_list = g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation));
+       if (_fd_list) {
+               g_variant_iter_next (&_arguments_iter, "h", &_fd_index);
+               _fd = g_unix_fd_list_get (_fd_list, _fd_index, &error);
+               if (_fd >= 0) {
+                       i = (GUnixInputStream *) g_unix_input_stream_new (_fd, TRUE);
+               }
+       } else {
+               g_set_error_literal (&error, G_IO_ERROR, G_IO_ERROR_FAILED, "FD List is NULL");
+       }
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               goto _error;
+       }
+       result = test_test_in (self, i, &j, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               goto _error;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _fd_list = g_unix_fd_list_new ();
+       g_variant_builder_add (&_reply_builder, "h", g_unix_fd_list_append (_fd_list, 
g_unix_input_stream_get_fd (j), NULL));
+       g_variant_builder_add (&_reply_builder, "h", g_unix_fd_list_append (_fd_list, 
g_unix_input_stream_get_fd (result), NULL));
+       _g_object_unref0 (result);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_message_set_unix_fd_list (_reply_message, _fd_list);
+       g_object_unref (_fd_list);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+       _error:
+       _g_object_unref0 (i);
+       _g_object_unref0 (j);
+       ;
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* method_name,
+                                 GVariant* parameters,
+                                 GDBusMethodInvocation* invocation,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "TestIn") == 0) {
+               _dbus_test_test_in (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return NULL;
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GVariant* value,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return FALSE;
+}
+
+guint
+test_register_object (gpointer object,
+                      GDBusConnection* connection,
+                      const gchar* path,
+                      GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+static void
+_vala_main (void)
+{
+       Test* test = NULL;
+       Test* _tmp0_;
+       guint8* buffer = NULL;
+       guint8* _tmp1_;
+       gint buffer_length1;
+       gint _buffer_size_;
+       gint* pipe1 = NULL;
+       gint* _tmp2_;
+       gint pipe1_length1;
+       gint _pipe1_size_;
+       gint* _tmp3_;
+       gint _tmp3__length1;
+       guint8* _tmp4_;
+       gint _tmp4__length1;
+       gint* _tmp5_;
+       gint _tmp5__length1;
+       gint _tmp6_;
+       guint8* _tmp7_;
+       gint _tmp7__length1;
+       gint* _tmp8_;
+       gint _tmp8__length1;
+       gint _tmp9_;
+       GUnixInputStream* j = NULL;
+       GUnixInputStream* k = NULL;
+       GUnixInputStream* _tmp10_ = NULL;
+       Test* _tmp11_;
+       gint* _tmp12_;
+       gint _tmp12__length1;
+       gint _tmp13_;
+       GUnixInputStream* _tmp14_;
+       GUnixInputStream* _tmp15_;
+       GUnixInputStream* _tmp16_ = NULL;
+       GUnixInputStream* _tmp17_;
+       GUnixInputStream* _tmp18_;
+       GUnixInputStream* _tmp19_;
+       gssize _tmp20_ = 0L;
+       GUnixInputStream* _tmp21_;
+       guint8* _tmp22_;
+       gint _tmp22__length1;
+       guint8* _tmp23_;
+       gint _tmp23__length1;
+       guint8 _tmp24_;
+       gssize _tmp25_ = 0L;
+       GUnixInputStream* _tmp26_;
+       guint8* _tmp27_;
+       gint _tmp27__length1;
+       guint8* _tmp28_;
+       gint _tmp28__length1;
+       guint8 _tmp29_;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = (Test*) g_initable_new (TYPE_TEST_PROXY, NULL, &_inner_error0_, "g-flags", 0, "g-name", 
"org.example.Test", "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/example/test", 
"g-interface-name", "org.example.Test", NULL);
+       test = (Test*) _tmp0_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp1_ = g_new0 (guint8, 1);
+       buffer = _tmp1_;
+       buffer_length1 = 1;
+       _buffer_size_ = buffer_length1;
+       _tmp2_ = g_new0 (gint, 2);
+       pipe1 = _tmp2_;
+       pipe1_length1 = 2;
+       _pipe1_size_ = pipe1_length1;
+       _tmp3_ = pipe1;
+       _tmp3__length1 = pipe1_length1;
+       _vala_assert (pipe (_tmp3_) == 0, "Posix.pipe (pipe1) == 0");
+       _tmp4_ = buffer;
+       _tmp4__length1 = buffer_length1;
+       _tmp4_[0] = (guint8) 42;
+       _tmp5_ = pipe1;
+       _tmp5__length1 = pipe1_length1;
+       _tmp6_ = _tmp5_[1];
+       _tmp7_ = buffer;
+       _tmp7__length1 = buffer_length1;
+       _vala_assert (write (_tmp6_, _tmp7_, (gsize) 1) == ((gssize) 1), "Posix.write (pipe1[1], buffer, 1) 
== 1");
+       _tmp8_ = pipe1;
+       _tmp8__length1 = pipe1_length1;
+       _tmp9_ = _tmp8_[1];
+       close (_tmp9_);
+       _tmp11_ = test;
+       _tmp12_ = pipe1;
+       _tmp12__length1 = pipe1_length1;
+       _tmp13_ = _tmp12_[0];
+       _tmp14_ = (GUnixInputStream*) g_unix_input_stream_new (_tmp13_, TRUE);
+       _tmp15_ = _tmp14_;
+       _tmp17_ = test_test_in (_tmp11_, _tmp15_, &_tmp16_, &_inner_error0_);
+       _g_object_unref0 (j);
+       j = _tmp16_;
+       _tmp18_ = _tmp17_;
+       _g_object_unref0 (_tmp15_);
+       _tmp10_ = _tmp18_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (k);
+               _g_object_unref0 (j);
+               pipe1 = (g_free (pipe1), NULL);
+               buffer = (g_free (buffer), NULL);
+               _g_object_unref0 (test);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp19_ = _tmp10_;
+       _tmp10_ = NULL;
+       _g_object_unref0 (k);
+       k = _tmp19_;
+       _tmp21_ = j;
+       _tmp22_ = buffer;
+       _tmp22__length1 = buffer_length1;
+       _tmp20_ = g_input_stream_read (G_TYPE_CHECK_INSTANCE_CAST (_tmp21_, g_input_stream_get_type (), 
GInputStream), _tmp22_, (gsize) _tmp22__length1, NULL, &_inner_error0_);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (_tmp10_);
+               _g_object_unref0 (k);
+               _g_object_unref0 (j);
+               pipe1 = (g_free (pipe1), NULL);
+               buffer = (g_free (buffer), NULL);
+               _g_object_unref0 (test);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _vala_assert (_tmp20_ == ((gssize) 1), "j.read (buffer) == 1");
+       _tmp23_ = buffer;
+       _tmp23__length1 = buffer_length1;
+       _tmp24_ = _tmp23_[0];
+       _vala_assert (((gint) _tmp24_) == 23, "buffer[0] == 23");
+       _tmp26_ = k;
+       _tmp27_ = buffer;
+       _tmp27__length1 = buffer_length1;
+       _tmp25_ = g_input_stream_read (G_TYPE_CHECK_INSTANCE_CAST (_tmp26_, g_input_stream_get_type (), 
GInputStream), _tmp27_, (gsize) _tmp27__length1, NULL, &_inner_error0_);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (_tmp10_);
+               _g_object_unref0 (k);
+               _g_object_unref0 (j);
+               pipe1 = (g_free (pipe1), NULL);
+               buffer = (g_free (buffer), NULL);
+               _g_object_unref0 (test);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _vala_assert (_tmp25_ == ((gssize) 1), "k.read (buffer) == 1");
+       _tmp28_ = buffer;
+       _tmp28__length1 = buffer_length1;
+       _tmp29_ = _tmp28_[0];
+       _vala_assert (((gint) _tmp29_) == 11, "buffer[0] == 11");
+       _g_object_unref0 (_tmp10_);
+       _g_object_unref0 (k);
+       _g_object_unref0 (j);
+       pipe1 = (g_free (pipe1), NULL);
+       buffer = (g_free (buffer), NULL);
+       _g_object_unref0 (test);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/dbus/filedescriptor_server.c-expected b/tests/dbus/filedescriptor_server.c-expected
new file mode 100644
index 000000000..86a6b71c3
--- /dev/null
+++ b/tests/dbus/filedescriptor_server.c-expected
@@ -0,0 +1,585 @@
+/* dbus_filedescriptor_server.c generated by valac, the Vala compiler
+ * generated from dbus_filedescriptor_server.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <gio/gunixinputstream.h>
+#include <glib.h>
+#include <unistd.h>
+#include <string.h>
+#include <gio/gunixfdlist.h>
+#include <stdlib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TEST, TestClass))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define IS_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TEST))
+#define TEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TEST, TestClass))
+
+typedef struct _Test Test;
+typedef struct _TestClass TestClass;
+typedef struct _TestPrivate TestPrivate;
+enum  {
+       TEST_0_PROPERTY,
+       TEST_NUM_PROPERTIES
+};
+static GParamSpec* test_properties[TEST_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Test {
+       GObject parent_instance;
+       TestPrivate * priv;
+};
+
+struct _TestClass {
+       GObjectClass parent_class;
+};
+
+static gpointer test_parent_class = NULL;
+VALA_EXTERN GMainLoop* main_loop;
+GMainLoop* main_loop = NULL;
+
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
+VALA_EXTERN guint test_register_object (void* object,
+                            GDBusConnection* connection,
+                            const gchar* path,
+                            GError** error);
+VALA_EXTERN GUnixInputStream* test_test_in (Test* self,
+                                GUnixInputStream* i,
+                                GUnixInputStream* * j,
+                                GError** error);
+VALA_EXTERN Test* test_new (void);
+VALA_EXTERN Test* test_construct (GType object_type);
+static GType test_get_type_once (void);
+static void _dbus_test_test_in (Test* self,
+                         GVariant* _parameters_,
+                         GDBusMethodInvocation* invocation);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* method_name,
+                                      GVariant* parameters,
+                                      GDBusMethodInvocation* invocation,
+                                      gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+                                            const gchar* sender,
+                                            const gchar* object_path,
+                                            const gchar* interface_name,
+                                            const gchar* property_name,
+                                            GError** error,
+                                            gpointer user_data);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GVariant* value,
+                                           GError** error,
+                                           gpointer user_data);
+static void _test_unregister_object (gpointer user_data);
+VALA_EXTERN void client_exit (GPid pid,
+                  gint status);
+static void _vala_main (void);
+static guint _variant_get1 (GVariant* value);
+static void _client_exit_gchild_watch_func (GPid pid,
+                                     gint wait_status,
+                                     gpointer self);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static const GDBusArgInfo _test_dbus_arg_info_test_in_i = {-1, "i", "h", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_in_j = {-1, "j", "h", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_in_result = {-1, "result", "h", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_in_in[] = {&_test_dbus_arg_info_test_in_i, NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_in_out[] = {&_test_dbus_arg_info_test_in_j, 
&_test_dbus_arg_info_test_in_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_in = {-1, "TestIn", (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_in_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_in_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_test_in, NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = {NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) 
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, 
test_dbus_interface_get_property, test_dbus_interface_set_property};
+
+GUnixInputStream*
+test_test_in (Test* self,
+              GUnixInputStream* i,
+              GUnixInputStream* * j,
+              GError** error)
+{
+       GUnixInputStream* _vala_j = NULL;
+       guint8* buffer = NULL;
+       guint8* _tmp0_;
+       gint buffer_length1;
+       gint _buffer_size_;
+       gssize _tmp1_ = 0L;
+       guint8 _tmp2_;
+       gint* pipe1 = NULL;
+       gint* _tmp3_;
+       gint pipe1_length1;
+       gint _pipe1_size_;
+       gint* _tmp4_;
+       gint _tmp4__length1;
+       gint* _tmp5_;
+       gint _tmp5__length1;
+       gint _tmp6_;
+       gint* _tmp7_;
+       gint _tmp7__length1;
+       gint _tmp8_;
+       gint* pipe2 = NULL;
+       gint* _tmp9_;
+       gint pipe2_length1;
+       gint _pipe2_size_;
+       gint* _tmp10_;
+       gint _tmp10__length1;
+       gint* _tmp11_;
+       gint _tmp11__length1;
+       gint _tmp12_;
+       gint* _tmp13_;
+       gint _tmp13__length1;
+       gint _tmp14_;
+       gint* _tmp15_;
+       gint _tmp15__length1;
+       gint _tmp16_;
+       GUnixInputStream* _tmp17_;
+       gint* _tmp18_;
+       gint _tmp18__length1;
+       gint _tmp19_;
+       GUnixInputStream* _tmp20_;
+       GError* _inner_error0_ = NULL;
+       GUnixInputStream* result = NULL;
+       g_return_val_if_fail (IS_TEST (self), NULL);
+       g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (i, G_TYPE_UNIX_INPUT_STREAM), NULL);
+       _tmp0_ = g_new0 (guint8, 1);
+       buffer = _tmp0_;
+       buffer_length1 = 1;
+       _buffer_size_ = buffer_length1;
+       _tmp1_ = g_input_stream_read (G_TYPE_CHECK_INSTANCE_CAST (i, g_input_stream_get_type (), 
GInputStream), buffer, (gsize) buffer_length1, NULL, &_inner_error0_);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               if (_inner_error0_->domain == G_IO_ERROR) {
+                       g_propagate_error (error, _inner_error0_);
+                       buffer = (g_free (buffer), NULL);
+                       _g_object_unref0 (_vala_j);
+                       return NULL;
+               } else {
+                       buffer = (g_free (buffer), NULL);
+                       _g_object_unref0 (_vala_j);
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return NULL;
+               }
+       }
+       _vala_assert (_tmp1_ == ((gssize) 1), "i.read (buffer) == 1");
+       _tmp2_ = buffer[0];
+       _vala_assert (((gint) _tmp2_) == 42, "buffer[0] == 42");
+       _tmp3_ = g_new0 (gint, 2);
+       pipe1 = _tmp3_;
+       pipe1_length1 = 2;
+       _pipe1_size_ = pipe1_length1;
+       _tmp4_ = pipe1;
+       _tmp4__length1 = pipe1_length1;
+       _vala_assert (pipe (_tmp4_) == 0, "Posix.pipe (pipe1) == 0");
+       buffer[0] = (guint8) 23;
+       _tmp5_ = pipe1;
+       _tmp5__length1 = pipe1_length1;
+       _tmp6_ = _tmp5_[1];
+       _vala_assert (write (_tmp6_, buffer, (gsize) 1) == ((gssize) 1), "Posix.write (pipe1[1], buffer, 1) 
== 1");
+       _tmp7_ = pipe1;
+       _tmp7__length1 = pipe1_length1;
+       _tmp8_ = _tmp7_[1];
+       close (_tmp8_);
+       _tmp9_ = g_new0 (gint, 2);
+       pipe2 = _tmp9_;
+       pipe2_length1 = 2;
+       _pipe2_size_ = pipe2_length1;
+       _tmp10_ = pipe2;
+       _tmp10__length1 = pipe2_length1;
+       _vala_assert (pipe (_tmp10_) == 0, "Posix.pipe (pipe2) == 0");
+       buffer[0] = (guint8) 11;
+       _tmp11_ = pipe2;
+       _tmp11__length1 = pipe2_length1;
+       _tmp12_ = _tmp11_[1];
+       _vala_assert (write (_tmp12_, buffer, (gsize) 1) == ((gssize) 1), "Posix.write (pipe2[1], buffer, 1) 
== 1");
+       _tmp13_ = pipe2;
+       _tmp13__length1 = pipe2_length1;
+       _tmp14_ = _tmp13_[1];
+       close (_tmp14_);
+       _tmp15_ = pipe1;
+       _tmp15__length1 = pipe1_length1;
+       _tmp16_ = _tmp15_[0];
+       _tmp17_ = (GUnixInputStream*) g_unix_input_stream_new (_tmp16_, TRUE);
+       _g_object_unref0 (_vala_j);
+       _vala_j = _tmp17_;
+       _tmp18_ = pipe2;
+       _tmp18__length1 = pipe2_length1;
+       _tmp19_ = _tmp18_[0];
+       _tmp20_ = (GUnixInputStream*) g_unix_input_stream_new (_tmp19_, TRUE);
+       result = _tmp20_;
+       pipe2 = (g_free (pipe2), NULL);
+       pipe1 = (g_free (pipe1), NULL);
+       buffer = (g_free (buffer), NULL);
+       if (j) {
+               *j = _vala_j;
+       } else {
+               _g_object_unref0 (_vala_j);
+       }
+       return result;
+}
+
+Test*
+test_construct (GType object_type)
+{
+       Test * self = NULL;
+       self = (Test*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Test*
+test_new (void)
+{
+       return test_construct (TYPE_TEST);
+}
+
+static void
+test_class_init (TestClass * klass,
+                 gpointer klass_data)
+{
+       test_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+test_instance_init (Test * self,
+                    gpointer klass)
+{
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Test), 
0, (GInstanceInitFunc) test_instance_init, NULL };
+       GType test_type_id;
+       test_type_id = g_type_register_static (G_TYPE_OBJECT, "Test", &g_define_type_info, 0);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_register_object);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+static void
+_dbus_test_test_in (Test* self,
+                    GVariant* _parameters_,
+                    GDBusMethodInvocation* invocation)
+{
+       GUnixFDList* _fd_list;
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       gint _fd_index = 0;
+       gint _fd;
+       GUnixInputStream* i = NULL;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       GUnixInputStream* j = NULL;
+       GUnixInputStream* result;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _fd_list = g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation));
+       if (_fd_list) {
+               g_variant_iter_next (&_arguments_iter, "h", &_fd_index);
+               _fd = g_unix_fd_list_get (_fd_list, _fd_index, &error);
+               if (_fd >= 0) {
+                       i = (GUnixInputStream *) g_unix_input_stream_new (_fd, TRUE);
+               }
+       } else {
+               g_set_error_literal (&error, G_IO_ERROR, G_IO_ERROR_FAILED, "FD List is NULL");
+       }
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               goto _error;
+       }
+       result = test_test_in (self, i, &j, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               goto _error;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _fd_list = g_unix_fd_list_new ();
+       g_variant_builder_add (&_reply_builder, "h", g_unix_fd_list_append (_fd_list, 
g_unix_input_stream_get_fd (j), NULL));
+       g_variant_builder_add (&_reply_builder, "h", g_unix_fd_list_append (_fd_list, 
g_unix_input_stream_get_fd (result), NULL));
+       _g_object_unref0 (result);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_message_set_unix_fd_list (_reply_message, _fd_list);
+       g_object_unref (_fd_list);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+       _error:
+       _g_object_unref0 (i);
+       _g_object_unref0 (j);
+       ;
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* method_name,
+                                 GVariant* parameters,
+                                 GDBusMethodInvocation* invocation,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "TestIn") == 0) {
+               _dbus_test_test_in (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return NULL;
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GVariant* value,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return FALSE;
+}
+
+guint
+test_register_object (gpointer object,
+                      GDBusConnection* connection,
+                      const gchar* path,
+                      GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+void
+client_exit (GPid pid,
+             gint status)
+{
+       GMainLoop* _tmp0_;
+       _vala_assert (status == 0, "status == 0");
+       _tmp0_ = main_loop;
+       g_main_loop_quit (_tmp0_);
+}
+
+static guint
+_variant_get1 (GVariant* value)
+{
+       return g_variant_get_uint32 (value);
+}
+
+static void
+_client_exit_gchild_watch_func (GPid pid,
+                                gint wait_status,
+                                gpointer self)
+{
+       client_exit (pid, wait_status);
+}
+
+static void
+_vala_main (void)
+{
+       GDBusConnection* conn = NULL;
+       GDBusConnection* _tmp0_;
+       GDBusConnection* _tmp1_;
+       Test* _tmp2_;
+       Test* _tmp3_;
+       GVariant* request_result = NULL;
+       GDBusConnection* _tmp4_;
+       GVariant* _tmp5_;
+       GVariant* _tmp6_;
+       GVariant* _tmp7_;
+       GVariant* _tmp8_;
+       GVariant* _tmp9_;
+       GVariant* _tmp10_;
+       GVariant* _tmp11_;
+       guint _tmp12_;
+       GPid client_pid = 0;
+       gchar* _tmp13_;
+       gchar** _tmp14_;
+       gchar** _tmp15_;
+       gint _tmp15__length1;
+       GPid _tmp16_ = 0;
+       GMainLoop* _tmp17_;
+       GMainLoop* _tmp18_;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &_inner_error0_);
+       conn = _tmp0_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp1_ = conn;
+       _tmp2_ = test_new ();
+       _tmp3_ = _tmp2_;
+       test_register_object (_tmp3_, _tmp1_, "/org/example/test", &_inner_error0_);
+       _g_object_unref0 (_tmp3_);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp4_ = conn;
+       _tmp5_ = g_variant_new ("(su)", "org.example.Test", 0x4, NULL);
+       g_variant_ref_sink (_tmp5_);
+       _tmp6_ = _tmp5_;
+       _tmp7_ = g_dbus_connection_call_sync (_tmp4_, "org.freedesktop.DBus", "/org/freedesktop/DBus", 
"org.freedesktop.DBus", "RequestName", _tmp6_, NULL, 0, -1, NULL, &_inner_error0_);
+       _tmp8_ = _tmp7_;
+       _g_variant_unref0 (_tmp6_);
+       request_result = _tmp8_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp9_ = request_result;
+       _tmp10_ = g_variant_get_child_value (_tmp9_, (gsize) 0);
+       _tmp11_ = _tmp10_;
+       _tmp12_ = _variant_get1 (_tmp11_);
+       _vala_assert (_tmp12_ == ((guint) 1), "(uint) request_result.get_child_value (0) == 1");
+       _g_variant_unref0 (_tmp11_);
+       _tmp13_ = g_strdup ("dbus_filedescriptor_client");
+       _tmp14_ = g_new0 (gchar*, 1 + 1);
+       _tmp14_[0] = _tmp13_;
+       _tmp15_ = _tmp14_;
+       _tmp15__length1 = 1;
+       g_spawn_async (NULL, _tmp15_, NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &_tmp16_, &_inner_error0_);
+       client_pid = _tmp16_;
+       _tmp15_ = (_vala_array_free (_tmp15_, _tmp15__length1, (GDestroyNotify) g_free), NULL);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_variant_unref0 (request_result);
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       g_child_watch_add_full (G_PRIORITY_DEFAULT_IDLE, client_pid, _client_exit_gchild_watch_func, NULL, 
NULL);
+       _tmp17_ = g_main_loop_new (NULL, FALSE);
+       _g_main_loop_unref0 (main_loop);
+       main_loop = _tmp17_;
+       _tmp18_ = main_loop;
+       g_main_loop_run (_tmp18_);
+       _g_variant_unref0 (request_result);
+       _g_object_unref0 (conn);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/dbus/generics_client.c-expected b/tests/dbus/generics_client.c-expected
new file mode 100644
index 000000000..eaada2f07
--- /dev/null
+++ b/tests/dbus/generics_client.c-expected
@@ -0,0 +1,397 @@
+/* dbus_generics_client.c generated by valac, the Vala compiler
+ * generated from dbus_generics_client.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <glib.h>
+#include <string.h>
+#include <stdlib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define TEST_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_TEST, TestIface))
+
+typedef struct _Test Test;
+typedef struct _TestIface TestIface;
+
+#define TYPE_TEST_PROXY (test_proxy_get_type ())
+typedef GDBusProxy TestProxy;
+typedef GDBusProxyClass TestProxyClass;
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _TestIface {
+       GTypeInterface parent_iface;
+       gint (*get_test) (Test* self, GError** error);
+};
+
+VALA_EXTERN GType test_proxy_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN guint test_register_object (void* object,
+                            GDBusConnection* connection,
+                            const gchar* path,
+                            GError** error);
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN gint test_get_test (Test* self,
+                    GError** error);
+static GType test_get_type_once (void);
+static void test_proxy_g_signal (GDBusProxy* proxy,
+                          const gchar* sender_name,
+                          const gchar* signal_name,
+                          GVariant* parameters);
+static gint test_proxy_get_test (Test* self,
+                          GError** error);
+static void test_proxy_test_interface_init (TestIface* iface);
+static void _dbus_test_get_test (Test* self,
+                          GVariant* _parameters_,
+                          GDBusMethodInvocation* invocation);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* method_name,
+                                      GVariant* parameters,
+                                      GDBusMethodInvocation* invocation,
+                                      gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+                                            const gchar* sender,
+                                            const gchar* object_path,
+                                            const gchar* interface_name,
+                                            const gchar* property_name,
+                                            GError** error,
+                                            gpointer user_data);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GVariant* value,
+                                           GError** error,
+                                           gpointer user_data);
+static void _test_unregister_object (gpointer user_data);
+VALA_EXTERN gpointer call (GType t_type,
+               GBoxedCopyFunc t_dup_func,
+               GDestroyNotify t_destroy_func,
+               GDBusConnection* conn,
+               const gchar* name,
+               const gchar* object_path);
+static void _vala_main (void);
+
+static const GDBusArgInfo _test_dbus_arg_info_get_test_result = {-1, "result", "i", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_get_test_in[] = {NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_get_test_out[] = 
{&_test_dbus_arg_info_get_test_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_get_test = {-1, "GetTest", (GDBusArgInfo **) 
(&_test_dbus_arg_info_get_test_in), (GDBusArgInfo **) (&_test_dbus_arg_info_get_test_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_get_test, NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = {NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) 
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, 
test_dbus_interface_get_property, test_dbus_interface_set_property};
+
+gint
+test_get_test (Test* self,
+               GError** error)
+{
+       TestIface* _iface_;
+       g_return_val_if_fail (IS_TEST (self), 0);
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->get_test) {
+               return _iface_->get_test (self, error);
+       }
+       return -1;
+}
+
+static void
+test_default_init (TestIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType test_type_id;
+       test_type_id = g_type_register_static (G_TYPE_INTERFACE, "Test", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (test_type_id, G_TYPE_OBJECT);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) 
test_proxy_get_type);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), 
"org.example.Test");
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*) 
(&_test_dbus_interface_info));
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_register_object);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_TEST, 
test_proxy_test_interface_init) )
+static void
+test_proxy_class_init (TestProxyClass* klass)
+{
+       G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal;
+}
+
+static void
+test_proxy_g_signal (GDBusProxy* proxy,
+                     const gchar* sender_name,
+                     const gchar* signal_name,
+                     GVariant* parameters)
+{
+}
+
+static void
+test_proxy_init (TestProxy* self)
+{
+       g_dbus_proxy_set_interface_info (G_DBUS_PROXY (self), (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info));
+}
+
+static gint
+test_proxy_get_test (Test* self,
+                     GError** error)
+{
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       GDBusMessage *_reply_message;
+       GVariant *_reply;
+       GVariantIter _reply_iter;
+       gint _result = 0;
+       GVariant* _tmp2_;
+       G_DBUS_ERROR;
+       G_IO_ERROR;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "GetTest");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       _reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout 
((GDBusProxy *) self), NULL, NULL, error);
+       g_object_unref (_message);
+       if (!_reply_message) {
+               gint _tmp0_ = 0;
+               return _tmp0_;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, error)) {
+               gint _tmp1_ = 0;
+               g_object_unref (_reply_message);
+               return _tmp1_;
+       }
+       _reply = g_dbus_message_get_body (_reply_message);
+       g_variant_iter_init (&_reply_iter, _reply);
+       _tmp2_ = g_variant_iter_next_value (&_reply_iter);
+       _result = g_variant_get_int32 (_tmp2_);
+       g_variant_unref (_tmp2_);
+       g_object_unref (_reply_message);
+       return _result;
+}
+
+static void
+test_proxy_test_interface_init (TestIface* iface)
+{
+       iface->get_test = test_proxy_get_test;
+}
+
+static void
+_dbus_test_get_test (Test* self,
+                     GVariant* _parameters_,
+                     GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       gint result;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       result = test_get_test (self, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               return;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_int32 (result));
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* method_name,
+                                 GVariant* parameters,
+                                 GDBusMethodInvocation* invocation,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "GetTest") == 0) {
+               _dbus_test_get_test (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return NULL;
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GVariant* value,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return FALSE;
+}
+
+guint
+test_register_object (gpointer object,
+                      GDBusConnection* connection,
+                      const gchar* path,
+                      GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+gpointer
+call (GType t_type,
+      GBoxedCopyFunc t_dup_func,
+      GDestroyNotify t_destroy_func,
+      GDBusConnection* conn,
+      const gchar* name,
+      const gchar* object_path)
+{
+       gpointer _tmp0_ = NULL;
+       gpointer _tmp1_;
+       gpointer _tmp2_;
+       GError* _inner_error0_ = NULL;
+       gpointer result = NULL;
+       g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (conn, g_dbus_connection_get_type ()), NULL);
+       g_return_val_if_fail (name != NULL, NULL);
+       g_return_val_if_fail (object_path != NULL, NULL);
+       _tmp1_ = (gpointer) g_initable_new (((GType (*) (void)) g_type_get_qdata (t_type, 
g_quark_from_static_string ("vala-dbus-proxy-type"))) (), NULL, &_inner_error0_, "g-flags", 0, "g-name", 
name, "g-connection", conn, "g-object-path", object_path, "g-interface-name", g_type_get_qdata (t_type, 
g_quark_from_static_string ("vala-dbus-interface-name")), NULL);
+       _tmp0_ = _tmp1_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return NULL;
+       }
+       _tmp2_ = _tmp0_;
+       _tmp0_ = NULL;
+       result = _tmp2_;
+       ((_tmp0_ == NULL) || (t_destroy_func == NULL)) ? NULL : (_tmp0_ = (t_destroy_func (_tmp0_), NULL));
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       GDBusConnection* conn = NULL;
+       GDBusConnection* _tmp0_;
+       Test* test = NULL;
+       GDBusConnection* _tmp1_;
+       gpointer _tmp2_;
+       gint i = 0;
+       Test* _tmp3_;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &_inner_error0_);
+       conn = _tmp0_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp1_ = conn;
+       _tmp2_ = call (TYPE_TEST, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp1_, 
"org.example.Test", "/org/example/test");
+       test = (Test*) _tmp2_;
+       _tmp3_ = test;
+       i = test_get_test (_tmp3_, &_inner_error0_);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (test);
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _vala_assert (i == 23, "i == 23");
+       _g_object_unref0 (test);
+       _g_object_unref0 (conn);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/dbus/generics_server.c-expected b/tests/dbus/generics_server.c-expected
new file mode 100644
index 000000000..92346b30d
--- /dev/null
+++ b/tests/dbus/generics_server.c-expected
@@ -0,0 +1,478 @@
+/* dbus_generics_server.c generated by valac, the Vala compiler
+ * generated from dbus_generics_server.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <glib.h>
+#include <string.h>
+#include <stdlib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TEST, TestClass))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define IS_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TEST))
+#define TEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TEST, TestClass))
+
+typedef struct _Test Test;
+typedef struct _TestClass TestClass;
+typedef struct _TestPrivate TestPrivate;
+enum  {
+       TEST_0_PROPERTY,
+       TEST_NUM_PROPERTIES
+};
+static GParamSpec* test_properties[TEST_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Test {
+       GObject parent_instance;
+       TestPrivate * priv;
+};
+
+struct _TestClass {
+       GObjectClass parent_class;
+};
+
+static gpointer test_parent_class = NULL;
+VALA_EXTERN GMainLoop* main_loop;
+GMainLoop* main_loop = NULL;
+
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
+VALA_EXTERN guint test_register_object (void* object,
+                            GDBusConnection* connection,
+                            const gchar* path,
+                            GError** error);
+VALA_EXTERN gint test_get_test (Test* self,
+                    GError** error);
+VALA_EXTERN Test* test_new (void);
+VALA_EXTERN Test* test_construct (GType object_type);
+static GType test_get_type_once (void);
+static void _dbus_test_get_test (Test* self,
+                          GVariant* _parameters_,
+                          GDBusMethodInvocation* invocation);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* method_name,
+                                      GVariant* parameters,
+                                      GDBusMethodInvocation* invocation,
+                                      gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+                                            const gchar* sender,
+                                            const gchar* object_path,
+                                            const gchar* interface_name,
+                                            const gchar* property_name,
+                                            GError** error,
+                                            gpointer user_data);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GVariant* value,
+                                           GError** error,
+                                           gpointer user_data);
+static void _test_unregister_object (gpointer user_data);
+VALA_EXTERN void client_exit (GPid pid,
+                  gint status);
+VALA_EXTERN void reg (GType t_type,
+          GBoxedCopyFunc t_dup_func,
+          GDestroyNotify t_destroy_func,
+          GDBusConnection* conn,
+          gconstpointer t,
+          GError** error);
+static guint _vala_g_dbus_connection_register_object (GType type,
+                                               void* object,
+                                               GDBusConnection* connection,
+                                               const gchar* path,
+                                               GError** error);
+static void _vala_main (void);
+static guint _variant_get1 (GVariant* value);
+static void _client_exit_gchild_watch_func (GPid pid,
+                                     gint wait_status,
+                                     gpointer self);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static const GDBusArgInfo _test_dbus_arg_info_get_test_result = {-1, "result", "i", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_get_test_in[] = {NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_get_test_out[] = 
{&_test_dbus_arg_info_get_test_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_get_test = {-1, "GetTest", (GDBusArgInfo **) 
(&_test_dbus_arg_info_get_test_in), (GDBusArgInfo **) (&_test_dbus_arg_info_get_test_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_get_test, NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = {NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) 
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, 
test_dbus_interface_get_property, test_dbus_interface_set_property};
+
+gint
+test_get_test (Test* self,
+               GError** error)
+{
+       gint result = 0;
+       g_return_val_if_fail (IS_TEST (self), 0);
+       result = 23;
+       return result;
+}
+
+Test*
+test_construct (GType object_type)
+{
+       Test * self = NULL;
+       self = (Test*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Test*
+test_new (void)
+{
+       return test_construct (TYPE_TEST);
+}
+
+static void
+test_class_init (TestClass * klass,
+                 gpointer klass_data)
+{
+       test_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+test_instance_init (Test * self,
+                    gpointer klass)
+{
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Test), 
0, (GInstanceInitFunc) test_instance_init, NULL };
+       GType test_type_id;
+       test_type_id = g_type_register_static (G_TYPE_OBJECT, "Test", &g_define_type_info, 0);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_register_object);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+static void
+_dbus_test_get_test (Test* self,
+                     GVariant* _parameters_,
+                     GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       gint result;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       result = test_get_test (self, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               return;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_int32 (result));
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* method_name,
+                                 GVariant* parameters,
+                                 GDBusMethodInvocation* invocation,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "GetTest") == 0) {
+               _dbus_test_get_test (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return NULL;
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GVariant* value,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return FALSE;
+}
+
+guint
+test_register_object (gpointer object,
+                      GDBusConnection* connection,
+                      const gchar* path,
+                      GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+void
+client_exit (GPid pid,
+             gint status)
+{
+       GMainLoop* _tmp0_;
+       _vala_assert (status == 0, "status == 0");
+       _tmp0_ = main_loop;
+       g_main_loop_quit (_tmp0_);
+}
+
+static guint
+_vala_g_dbus_connection_register_object (GType type,
+                                         void* object,
+                                         GDBusConnection* connection,
+                                         const gchar* path,
+                                         GError** error)
+{
+       void *func;
+       func = g_type_get_qdata (type, g_quark_from_static_string ("vala-dbus-register-object"));
+       if (!func) {
+               g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, "The specified type does not 
support D-Bus registration");
+               return 0;
+       }
+       return ((guint (*) (void *, GDBusConnection *, const gchar *, GError **)) func) (object, connection, 
path, error);
+}
+
+void
+reg (GType t_type,
+     GBoxedCopyFunc t_dup_func,
+     GDestroyNotify t_destroy_func,
+     GDBusConnection* conn,
+     gconstpointer t,
+     GError** error)
+{
+       GError* _inner_error0_ = NULL;
+       g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (conn, g_dbus_connection_get_type ()));
+       _vala_g_dbus_connection_register_object (t_type, t, conn, "/org/example/test", &_inner_error0_);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_propagate_error (error, _inner_error0_);
+               return;
+       }
+}
+
+static guint
+_variant_get1 (GVariant* value)
+{
+       return g_variant_get_uint32 (value);
+}
+
+static void
+_client_exit_gchild_watch_func (GPid pid,
+                                gint wait_status,
+                                gpointer self)
+{
+       client_exit (pid, wait_status);
+}
+
+static void
+_vala_main (void)
+{
+       GDBusConnection* conn = NULL;
+       GDBusConnection* _tmp0_;
+       GDBusConnection* _tmp1_;
+       Test* _tmp2_;
+       Test* _tmp3_;
+       GVariant* request_result = NULL;
+       GDBusConnection* _tmp4_;
+       GVariant* _tmp5_;
+       GVariant* _tmp6_;
+       GVariant* _tmp7_;
+       GVariant* _tmp8_;
+       GVariant* _tmp9_;
+       GVariant* _tmp10_;
+       GVariant* _tmp11_;
+       guint _tmp12_;
+       GPid client_pid = 0;
+       gchar* _tmp13_;
+       gchar** _tmp14_;
+       gchar** _tmp15_;
+       gint _tmp15__length1;
+       GPid _tmp16_ = 0;
+       GMainLoop* _tmp17_;
+       GMainLoop* _tmp18_;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &_inner_error0_);
+       conn = _tmp0_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp1_ = conn;
+       _tmp2_ = test_new ();
+       _tmp3_ = _tmp2_;
+       reg (TYPE_TEST, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp1_, _tmp3_, 
&_inner_error0_);
+       _g_object_unref0 (_tmp3_);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp4_ = conn;
+       _tmp5_ = g_variant_new ("(su)", "org.example.Test", 0x4, NULL);
+       g_variant_ref_sink (_tmp5_);
+       _tmp6_ = _tmp5_;
+       _tmp7_ = g_dbus_connection_call_sync (_tmp4_, "org.freedesktop.DBus", "/org/freedesktop/DBus", 
"org.freedesktop.DBus", "RequestName", _tmp6_, NULL, 0, -1, NULL, &_inner_error0_);
+       _tmp8_ = _tmp7_;
+       _g_variant_unref0 (_tmp6_);
+       request_result = _tmp8_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp9_ = request_result;
+       _tmp10_ = g_variant_get_child_value (_tmp9_, (gsize) 0);
+       _tmp11_ = _tmp10_;
+       _tmp12_ = _variant_get1 (_tmp11_);
+       _vala_assert (_tmp12_ == ((guint) 1), "(uint) request_result.get_child_value (0) == 1");
+       _g_variant_unref0 (_tmp11_);
+       _tmp13_ = g_strdup ("dbus_generics_client");
+       _tmp14_ = g_new0 (gchar*, 1 + 1);
+       _tmp14_[0] = _tmp13_;
+       _tmp15_ = _tmp14_;
+       _tmp15__length1 = 1;
+       g_spawn_async (NULL, _tmp15_, NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &_tmp16_, &_inner_error0_);
+       client_pid = _tmp16_;
+       _tmp15_ = (_vala_array_free (_tmp15_, _tmp15__length1, (GDestroyNotify) g_free), NULL);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_variant_unref0 (request_result);
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       g_child_watch_add_full (G_PRIORITY_DEFAULT_IDLE, client_pid, _client_exit_gchild_watch_func, NULL, 
NULL);
+       _tmp17_ = g_main_loop_new (NULL, FALSE);
+       _g_main_loop_unref0 (main_loop);
+       main_loop = _tmp17_;
+       _tmp18_ = main_loop;
+       g_main_loop_run (_tmp18_);
+       _g_variant_unref0 (request_result);
+       _g_object_unref0 (conn);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/dbus/interface-info_client.c-expected b/tests/dbus/interface-info_client.c-expected
new file mode 100644
index 000000000..9ae2ff2b7
--- /dev/null
+++ b/tests/dbus/interface-info_client.c-expected
@@ -0,0 +1,403 @@
+/* dbus_interface_info_client.c generated by valac, the Vala compiler
+ * generated from dbus_interface_info_client.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define TEST_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_TEST, TestIface))
+
+typedef struct _Test Test;
+typedef struct _TestIface TestIface;
+
+#define TYPE_TEST_PROXY (test_proxy_get_type ())
+enum  {
+       TEST_BAR_SIGNAL,
+       TEST_NUM_SIGNALS
+};
+static guint test_signals[TEST_NUM_SIGNALS] = {0};
+typedef GDBusProxy TestProxy;
+typedef GDBusProxyClass TestProxyClass;
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _TestIface {
+       GTypeInterface parent_iface;
+};
+
+VALA_EXTERN GMainLoop* main_loop;
+GMainLoop* main_loop = NULL;
+
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN GType test_proxy_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN guint test_register_object (void* object,
+                            GDBusConnection* connection,
+                            const gchar* path,
+                            GError** error);
+static GType test_get_type_once (void);
+static void test_proxy_g_signal (GDBusProxy* proxy,
+                          const gchar* sender_name,
+                          const gchar* signal_name,
+                          GVariant* parameters);
+static void _dbus_handle_test_bar (Test* self,
+                            GVariant* parameters);
+static void test_proxy_test_interface_init (TestIface* iface);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* method_name,
+                                      GVariant* parameters,
+                                      GDBusMethodInvocation* invocation,
+                                      gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+                                            const gchar* sender,
+                                            const gchar* object_path,
+                                            const gchar* interface_name,
+                                            const gchar* property_name,
+                                            GError** error,
+                                            gpointer user_data);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GVariant* value,
+                                           GError** error,
+                                           gpointer user_data);
+static void _dbus_test_bar (GObject* _sender,
+                     const gchar* j,
+                     gpointer* _data);
+static void _test_unregister_object (gpointer user_data);
+static void _vala_main (void);
+static gssize _vala_array_length (gpointer array);
+
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {NULL};
+static const GDBusArgInfo _test_dbus_arg_info_bar_j = {-1, "j", "s", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_bar[] = {&_test_dbus_arg_info_bar_j, NULL};
+static const GDBusSignalInfo _test_dbus_signal_info_bar = {-1, "Baz", (GDBusArgInfo **) 
(&_test_dbus_arg_info_bar), NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {&_test_dbus_signal_info_bar, NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = {NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) 
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, 
test_dbus_interface_get_property, test_dbus_interface_set_property};
+
+static void
+test_default_init (TestIface * iface,
+                   gpointer iface_data)
+{
+       test_signals[TEST_BAR_SIGNAL] = g_signal_new ("bar", TYPE_TEST, G_SIGNAL_RUN_LAST, 0, NULL, NULL, 
g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType test_type_id;
+       test_type_id = g_type_register_static (G_TYPE_INTERFACE, "Test", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (test_type_id, G_TYPE_OBJECT);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) 
test_proxy_get_type);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), 
"org.example.Test");
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*) 
(&_test_dbus_interface_info));
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_register_object);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_TEST, 
test_proxy_test_interface_init) )
+static void
+test_proxy_class_init (TestProxyClass* klass)
+{
+       G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal;
+}
+
+static void
+_dbus_handle_test_bar (Test* self,
+                       GVariant* parameters)
+{
+       GVariantIter _arguments_iter;
+       gchar* j = NULL;
+       GVariant* _tmp0_;
+       g_variant_iter_init (&_arguments_iter, parameters);
+       _tmp0_ = g_variant_iter_next_value (&_arguments_iter);
+       j = g_variant_dup_string (_tmp0_, NULL);
+       g_variant_unref (_tmp0_);
+       g_signal_emit_by_name (self, "bar", j);
+       _g_free0 (j);
+}
+
+static void
+test_proxy_g_signal (GDBusProxy* proxy,
+                     const gchar* sender_name,
+                     const gchar* signal_name,
+                     GVariant* parameters)
+{
+       if (strcmp (signal_name, "Baz") == 0) {
+               _dbus_handle_test_bar ((Test*) proxy, parameters);
+       }
+}
+
+static void
+test_proxy_init (TestProxy* self)
+{
+       g_dbus_proxy_set_interface_info (G_DBUS_PROXY (self), (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info));
+}
+
+static void
+test_proxy_test_interface_init (TestIface* iface)
+{
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* method_name,
+                                 GVariant* parameters,
+                                 GDBusMethodInvocation* invocation,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       g_object_unref (invocation);
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return NULL;
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GVariant* value,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return FALSE;
+}
+
+static void
+_dbus_test_bar (GObject* _sender,
+                const gchar* j,
+                gpointer* _data)
+{
+       GDBusConnection * _connection;
+       const gchar * _path;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       _connection = _data[1];
+       _path = _data[2];
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (j));
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_connection_emit_signal (_connection, NULL, _path, "org.example.Test", "Baz", _arguments, NULL);
+}
+
+guint
+test_register_object (gpointer object,
+                      GDBusConnection* connection,
+                      const gchar* path,
+                      GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       g_signal_connect (object, "bar", (GCallback) _dbus_test_bar, data);
+       return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_signal_handlers_disconnect_by_func (data[0], _dbus_test_bar, data);
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+static void
+_vala_main (void)
+{
+       Test* test = NULL;
+       Test* _tmp0_;
+       GDBusProxy* proxy = NULL;
+       GDBusInterfaceInfo* iface_info = NULL;
+       GDBusProxy* _tmp1_;
+       GDBusInterfaceInfo* _tmp2_;
+       GDBusInterfaceInfo* _tmp3_;
+       GDBusInterfaceInfo* _tmp4_;
+       GDBusSignalInfo** _tmp5_;
+       gint _tmp5__length1;
+       GDBusInterfaceInfo* _tmp6_;
+       GDBusSignalInfo** _tmp7_;
+       gint _tmp7__length1;
+       GDBusSignalInfo* _tmp8_;
+       GDBusInterfaceInfo* _tmp9_;
+       GDBusSignalInfo** _tmp10_;
+       gint _tmp10__length1;
+       GDBusSignalInfo* _tmp11_;
+       const gchar* _tmp12_;
+       GDBusInterfaceInfo* _tmp13_;
+       GDBusSignalInfo** _tmp14_;
+       gint _tmp14__length1;
+       GDBusSignalInfo* _tmp15_;
+       GDBusArgInfo** _tmp16_;
+       gint _tmp16__length1;
+       GDBusInterfaceInfo* _tmp17_;
+       GDBusSignalInfo** _tmp18_;
+       gint _tmp18__length1;
+       GDBusSignalInfo* _tmp19_;
+       GDBusArgInfo** _tmp20_;
+       gint _tmp20__length1;
+       GDBusArgInfo* _tmp21_;
+       GDBusInterfaceInfo* _tmp22_;
+       GDBusSignalInfo** _tmp23_;
+       gint _tmp23__length1;
+       GDBusSignalInfo* _tmp24_;
+       GDBusArgInfo** _tmp25_;
+       gint _tmp25__length1;
+       GDBusArgInfo* _tmp26_;
+       const gchar* _tmp27_;
+       GDBusInterfaceInfo* _tmp28_;
+       void* _tmp29_;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = (Test*) g_initable_new (TYPE_TEST_PROXY, NULL, &_inner_error0_, "g-flags", 0, "g-name", 
"org.example.Test", "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/example/test", 
"g-interface-name", "org.example.Test", NULL);
+       test = (Test*) _tmp0_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       proxy = G_TYPE_CHECK_INSTANCE_CAST (test, g_dbus_proxy_get_type (), GDBusProxy);
+       _tmp1_ = proxy;
+       _tmp2_ = g_dbus_proxy_get_interface_info (_tmp1_);
+       iface_info = _tmp2_;
+       _tmp3_ = iface_info;
+       _vala_assert (_tmp3_ != NULL, "iface_info != null");
+       _tmp4_ = iface_info;
+       _tmp5_ = _tmp4_->signals;
+       _tmp5__length1 = _vala_array_length (_tmp4_->signals);
+       _vala_assert (_tmp5_ != NULL, "iface_info.signals != null");
+       _tmp6_ = iface_info;
+       _tmp7_ = _tmp6_->signals;
+       _tmp7__length1 = _vala_array_length (_tmp6_->signals);
+       _tmp8_ = _tmp7_[0];
+       _vala_assert (_tmp8_ != NULL, "iface_info.signals[0] != null");
+       _tmp9_ = iface_info;
+       _tmp10_ = _tmp9_->signals;
+       _tmp10__length1 = _vala_array_length (_tmp9_->signals);
+       _tmp11_ = _tmp10_[0];
+       _tmp12_ = _tmp11_->name;
+       _vala_assert (g_strcmp0 (_tmp12_, "Baz") == 0, "iface_info.signals[0].name == \"Baz\"");
+       _tmp13_ = iface_info;
+       _tmp14_ = _tmp13_->signals;
+       _tmp14__length1 = _vala_array_length (_tmp13_->signals);
+       _tmp15_ = _tmp14_[0];
+       _tmp16_ = _tmp15_->args;
+       _tmp16__length1 = _vala_array_length (_tmp15_->args);
+       _vala_assert (_tmp16_ != NULL, "iface_info.signals[0].args != null");
+       _tmp17_ = iface_info;
+       _tmp18_ = _tmp17_->signals;
+       _tmp18__length1 = _vala_array_length (_tmp17_->signals);
+       _tmp19_ = _tmp18_[0];
+       _tmp20_ = _tmp19_->args;
+       _tmp20__length1 = _vala_array_length (_tmp19_->args);
+       _tmp21_ = _tmp20_[0];
+       _vala_assert (_tmp21_ != NULL, "iface_info.signals[0].args[0] != null");
+       _tmp22_ = iface_info;
+       _tmp23_ = _tmp22_->signals;
+       _tmp23__length1 = _vala_array_length (_tmp22_->signals);
+       _tmp24_ = _tmp23_[0];
+       _tmp25_ = _tmp24_->args;
+       _tmp25__length1 = _vala_array_length (_tmp24_->args);
+       _tmp26_ = _tmp25_[0];
+       _tmp27_ = _tmp26_->signature;
+       _vala_assert (g_strcmp0 (_tmp27_, "s") == 0, "iface_info.signals[0].args[0].signature == \"s\"");
+       _tmp28_ = iface_info;
+       _tmp29_ = g_type_get_qdata (TYPE_TEST, g_quark_from_string ("vala-dbus-interface-info"));
+       _vala_assert (_tmp28_ == ((GDBusInterfaceInfo*) _tmp29_), "iface_info == (DBusInterfaceInfo?) typeof 
(Test).get_qdata (Quark.from_string (\"vala-dbus-interface-info\"))");
+       _g_object_unref0 (test);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static gssize
+_vala_array_length (gpointer array)
+{
+       gssize length;
+       length = 0;
+       if (array) {
+               while (((gpointer*) array)[length]) {
+                       length++;
+               }
+       }
+       return length;
+}
+
diff --git a/tests/dbus/interface-info_server.c-expected b/tests/dbus/interface-info_server.c-expected
new file mode 100644
index 000000000..21a0c03c7
--- /dev/null
+++ b/tests/dbus/interface-info_server.c-expected
@@ -0,0 +1,414 @@
+/* dbus_interface_info_server.c generated by valac, the Vala compiler
+ * generated from dbus_interface_info_server.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TEST, TestClass))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define IS_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TEST))
+#define TEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TEST, TestClass))
+
+typedef struct _Test Test;
+typedef struct _TestClass TestClass;
+typedef struct _TestPrivate TestPrivate;
+enum  {
+       TEST_0_PROPERTY,
+       TEST_NUM_PROPERTIES
+};
+static GParamSpec* test_properties[TEST_NUM_PROPERTIES];
+enum  {
+       TEST_FOO_SIGNAL,
+       TEST_NUM_SIGNALS
+};
+static guint test_signals[TEST_NUM_SIGNALS] = {0};
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Test {
+       GObject parent_instance;
+       TestPrivate * priv;
+};
+
+struct _TestClass {
+       GObjectClass parent_class;
+};
+
+static gpointer test_parent_class = NULL;
+VALA_EXTERN GMainLoop* main_loop;
+GMainLoop* main_loop = NULL;
+
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
+VALA_EXTERN guint test_register_object (void* object,
+                            GDBusConnection* connection,
+                            const gchar* path,
+                            GError** error);
+VALA_EXTERN Test* test_new (void);
+VALA_EXTERN Test* test_construct (GType object_type);
+static GType test_get_type_once (void);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* method_name,
+                                      GVariant* parameters,
+                                      GDBusMethodInvocation* invocation,
+                                      gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+                                            const gchar* sender,
+                                            const gchar* object_path,
+                                            const gchar* interface_name,
+                                            const gchar* property_name,
+                                            GError** error,
+                                            gpointer user_data);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GVariant* value,
+                                           GError** error,
+                                           gpointer user_data);
+static void _dbus_test_foo (GObject* _sender,
+                     gint i,
+                     gpointer* _data);
+static void _test_unregister_object (gpointer user_data);
+VALA_EXTERN void client_exit (GPid pid,
+                  gint status);
+static void _vala_main (void);
+static guint _variant_get1 (GVariant* value);
+static void _client_exit_gchild_watch_func (GPid pid,
+                                     gint wait_status,
+                                     gpointer self);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {NULL};
+static const GDBusArgInfo _test_dbus_arg_info_foo_i = {-1, "i", "i", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_foo[] = {&_test_dbus_arg_info_foo_i, NULL};
+static const GDBusSignalInfo _test_dbus_signal_info_foo = {-1, "Foo", (GDBusArgInfo **) 
(&_test_dbus_arg_info_foo), NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {&_test_dbus_signal_info_foo, NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = {NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) 
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, 
test_dbus_interface_get_property, test_dbus_interface_set_property};
+
+Test*
+test_construct (GType object_type)
+{
+       Test * self = NULL;
+       self = (Test*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Test*
+test_new (void)
+{
+       return test_construct (TYPE_TEST);
+}
+
+static void
+test_class_init (TestClass * klass,
+                 gpointer klass_data)
+{
+       test_parent_class = g_type_class_peek_parent (klass);
+       test_signals[TEST_FOO_SIGNAL] = g_signal_new ("foo", TYPE_TEST, G_SIGNAL_RUN_LAST, 0, NULL, NULL, 
g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
+}
+
+static void
+test_instance_init (Test * self,
+                    gpointer klass)
+{
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Test), 
0, (GInstanceInitFunc) test_instance_init, NULL };
+       GType test_type_id;
+       test_type_id = g_type_register_static (G_TYPE_OBJECT, "Test", &g_define_type_info, 0);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_register_object);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* method_name,
+                                 GVariant* parameters,
+                                 GDBusMethodInvocation* invocation,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       g_object_unref (invocation);
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return NULL;
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GVariant* value,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return FALSE;
+}
+
+static void
+_dbus_test_foo (GObject* _sender,
+                gint i,
+                gpointer* _data)
+{
+       GDBusConnection * _connection;
+       const gchar * _path;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       _connection = _data[1];
+       _path = _data[2];
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_arguments_builder, g_variant_new_int32 (i));
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_connection_emit_signal (_connection, NULL, _path, "org.example.Test", "Foo", _arguments, NULL);
+}
+
+guint
+test_register_object (gpointer object,
+                      GDBusConnection* connection,
+                      const gchar* path,
+                      GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       g_signal_connect (object, "foo", (GCallback) _dbus_test_foo, data);
+       return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_signal_handlers_disconnect_by_func (data[0], _dbus_test_foo, data);
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+void
+client_exit (GPid pid,
+             gint status)
+{
+       GMainLoop* _tmp0_;
+       _vala_assert (status == 0, "status == 0");
+       _tmp0_ = main_loop;
+       g_main_loop_quit (_tmp0_);
+}
+
+static guint
+_variant_get1 (GVariant* value)
+{
+       return g_variant_get_uint32 (value);
+}
+
+static void
+_client_exit_gchild_watch_func (GPid pid,
+                                gint wait_status,
+                                gpointer self)
+{
+       client_exit (pid, wait_status);
+}
+
+static void
+_vala_main (void)
+{
+       GDBusConnection* conn = NULL;
+       GDBusConnection* _tmp0_;
+       GDBusConnection* _tmp1_;
+       Test* _tmp2_;
+       Test* _tmp3_;
+       GVariant* request_result = NULL;
+       GDBusConnection* _tmp4_;
+       GVariant* _tmp5_;
+       GVariant* _tmp6_;
+       GVariant* _tmp7_;
+       GVariant* _tmp8_;
+       GVariant* _tmp9_;
+       GVariant* _tmp10_;
+       GVariant* _tmp11_;
+       guint _tmp12_;
+       GPid client_pid = 0;
+       gchar* _tmp13_;
+       gchar** _tmp14_;
+       gchar** _tmp15_;
+       gint _tmp15__length1;
+       GPid _tmp16_ = 0;
+       GMainLoop* _tmp17_;
+       GMainLoop* _tmp18_;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &_inner_error0_);
+       conn = _tmp0_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp1_ = conn;
+       _tmp2_ = test_new ();
+       _tmp3_ = _tmp2_;
+       test_register_object (_tmp3_, _tmp1_, "/org/example/test", &_inner_error0_);
+       _g_object_unref0 (_tmp3_);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp4_ = conn;
+       _tmp5_ = g_variant_new ("(su)", "org.example.Test", 0x4, NULL);
+       g_variant_ref_sink (_tmp5_);
+       _tmp6_ = _tmp5_;
+       _tmp7_ = g_dbus_connection_call_sync (_tmp4_, "org.freedesktop.DBus", "/org/freedesktop/DBus", 
"org.freedesktop.DBus", "RequestName", _tmp6_, NULL, 0, -1, NULL, &_inner_error0_);
+       _tmp8_ = _tmp7_;
+       _g_variant_unref0 (_tmp6_);
+       request_result = _tmp8_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp9_ = request_result;
+       _tmp10_ = g_variant_get_child_value (_tmp9_, (gsize) 0);
+       _tmp11_ = _tmp10_;
+       _tmp12_ = _variant_get1 (_tmp11_);
+       _vala_assert (_tmp12_ == ((guint) 1), "(uint) request_result.get_child_value (0) == 1");
+       _g_variant_unref0 (_tmp11_);
+       _tmp13_ = g_strdup ("dbus_interface_info_client");
+       _tmp14_ = g_new0 (gchar*, 1 + 1);
+       _tmp14_[0] = _tmp13_;
+       _tmp15_ = _tmp14_;
+       _tmp15__length1 = 1;
+       g_spawn_async (NULL, _tmp15_, NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &_tmp16_, &_inner_error0_);
+       client_pid = _tmp16_;
+       _tmp15_ = (_vala_array_free (_tmp15_, _tmp15__length1, (GDestroyNotify) g_free), NULL);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_variant_unref0 (request_result);
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       g_child_watch_add_full (G_PRIORITY_DEFAULT_IDLE, client_pid, _client_exit_gchild_watch_func, NULL, 
NULL);
+       _tmp17_ = g_main_loop_new (NULL, FALSE);
+       _g_main_loop_unref0 (main_loop);
+       main_loop = _tmp17_;
+       _tmp18_ = main_loop;
+       g_main_loop_run (_tmp18_);
+       _g_variant_unref0 (request_result);
+       _g_object_unref0 (conn);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/dbus/no-reply_client.c-expected b/tests/dbus/no-reply_client.c-expected
new file mode 100644
index 000000000..106c9a2b2
--- /dev/null
+++ b/tests/dbus/no-reply_client.c-expected
@@ -0,0 +1,933 @@
+/* dbus_no_reply_client.c generated by valac, the Vala compiler
+ * generated from dbus_no_reply_client.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define TEST_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_TEST, TestIface))
+
+typedef struct _Test Test;
+typedef struct _TestIface TestIface;
+
+#define TYPE_TEST_PROXY (test_proxy_get_type ())
+typedef GDBusProxy TestProxy;
+typedef GDBusProxyClass TestProxyClass;
+#define _g_free0(var) (var = (g_free (var), NULL))
+typedef struct _Block1Data Block1Data;
+#define _g_async_queue_unref0(var) ((var == NULL) ? NULL : (var = (g_async_queue_unref (var), NULL)))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+typedef struct _RunData RunData;
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _TestIface {
+       GTypeInterface parent_iface;
+       gchar** (*list_messages) (Test* self, gint* result_length1, GError** error);
+       void (*post_message) (Test* self, const gchar* message, GError** error);
+       void (*post_message_no_reply) (Test* self, const gchar* message, GError** error);
+};
+
+struct _Block1Data {
+       int _ref_count_;
+       GAsyncQueue* events;
+       gpointer _async_data_;
+};
+
+struct _RunData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Block1Data* _data1_;
+       Test* test;
+       Test* _tmp0_;
+       GAsyncQueue* _tmp1_;
+       GDBusConnection* connection;
+       Test* _tmp2_;
+       GDBusConnection* _tmp3_;
+       GDBusConnection* _tmp4_;
+       GDBusConnection* _tmp5_;
+       gchar** messages;
+       Test* _tmp6_;
+       gint _tmp7_;
+       gchar** _tmp8_;
+       gint messages_length1;
+       gint _messages_size_;
+       gchar** _tmp9_;
+       gint _tmp9__length1;
+       Test* _tmp10_;
+       GAsyncQueue* _tmp11_;
+       gpointer _tmp12_;
+       gchar* _tmp13_;
+       GAsyncQueue* _tmp14_;
+       gpointer _tmp15_;
+       gchar* _tmp16_;
+       Test* _tmp17_;
+       GAsyncQueue* _tmp18_;
+       gpointer _tmp19_;
+       gchar* _tmp20_;
+       GAsyncQueue* _tmp21_;
+       gpointer _tmp22_;
+       gchar* _tmp23_;
+       gchar** _tmp24_;
+       Test* _tmp25_;
+       gint _tmp26_;
+       gchar** _tmp27_;
+       gint _tmp24__length1;
+       gint __tmp24__size_;
+       gchar** _tmp28_;
+       gint _tmp28__length1;
+       gchar** _tmp29_;
+       gint _tmp29__length1;
+       gchar** _tmp30_;
+       gint _tmp30__length1;
+       const gchar* _tmp31_;
+       gchar** _tmp32_;
+       gint _tmp32__length1;
+       const gchar* _tmp33_;
+       GMainLoop* _tmp34_;
+       GError* _inner_error0_;
+};
+
+VALA_EXTERN GMainLoop* main_loop;
+GMainLoop* main_loop = NULL;
+
+VALA_EXTERN GType test_proxy_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN guint test_register_object (void* object,
+                            GDBusConnection* connection,
+                            const gchar* path,
+                            GError** error);
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN gchar** test_list_messages (Test* self,
+                            gint* result_length1,
+                            GError** error);
+VALA_EXTERN void test_post_message (Test* self,
+                        const gchar* message,
+                        GError** error);
+VALA_EXTERN void test_post_message_no_reply (Test* self,
+                                 const gchar* message,
+                                 GError** error);
+static GType test_get_type_once (void);
+static void test_proxy_g_signal (GDBusProxy* proxy,
+                          const gchar* sender_name,
+                          const gchar* signal_name,
+                          GVariant* parameters);
+static gchar** test_proxy_list_messages (Test* self,
+                                  gint* result_length1,
+                                  GError** error);
+static void test_proxy_post_message (Test* self,
+                              const gchar* message,
+                              GError** error);
+static void test_proxy_post_message_no_reply (Test* self,
+                                       const gchar* message,
+                                       GError** error);
+static void test_proxy_test_interface_init (TestIface* iface);
+static void _dbus_test_list_messages (Test* self,
+                               GVariant* _parameters_,
+                               GDBusMethodInvocation* invocation);
+static void _dbus_test_post_message (Test* self,
+                              GVariant* _parameters_,
+                              GDBusMethodInvocation* invocation);
+static void _dbus_test_post_message_no_reply (Test* self,
+                                       GVariant* _parameters_,
+                                       GDBusMethodInvocation* invocation);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* method_name,
+                                      GVariant* parameters,
+                                      GDBusMethodInvocation* invocation,
+                                      gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+                                            const gchar* sender,
+                                            const gchar* object_path,
+                                            const gchar* interface_name,
+                                            const gchar* property_name,
+                                            GError** error,
+                                            gpointer user_data);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GVariant* value,
+                                           GError** error,
+                                           gpointer user_data);
+static void _test_unregister_object (gpointer user_data);
+static void run_data_free (gpointer _data);
+VALA_EXTERN void run (GAsyncReadyCallback _callback_,
+          gpointer _user_data_);
+VALA_EXTERN void run_finish (GAsyncResult* _res_);
+static gboolean run_co (RunData* _data_);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static void run_ready (GObject* source_object,
+                GAsyncResult* _res_,
+                gpointer _user_data_);
+static void _g_free0_ (gpointer var);
+static GDBusMessage* __lambda4_ (Block1Data* _data1_,
+                          GDBusConnection* conn,
+                          GDBusMessage* message,
+                          gboolean incoming);
+static GDBusMessage* ___lambda4__gd_bus_message_filter_function (GDBusConnection* connection,
+                                                          GDBusMessage* message,
+                                                          gboolean incoming,
+                                                          gpointer self);
+static void _vala_main (void);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static const GDBusArgInfo _test_dbus_arg_info_list_messages_result = {-1, "result", "as", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_list_messages_in[] = {NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_list_messages_out[] = 
{&_test_dbus_arg_info_list_messages_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_list_messages = {-1, "ListMessages", (GDBusArgInfo **) 
(&_test_dbus_arg_info_list_messages_in), (GDBusArgInfo **) (&_test_dbus_arg_info_list_messages_out), NULL};
+static const GDBusArgInfo _test_dbus_arg_info_post_message_message = {-1, "message", "s", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_post_message_in[] = 
{&_test_dbus_arg_info_post_message_message, NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_post_message_out[] = {NULL};
+static const GDBusMethodInfo _test_dbus_method_info_post_message = {-1, "PostMessage", (GDBusArgInfo **) 
(&_test_dbus_arg_info_post_message_in), (GDBusArgInfo **) (&_test_dbus_arg_info_post_message_out), NULL};
+static const GDBusArgInfo _test_dbus_arg_info_post_message_no_reply_message = {-1, "message", "s", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_post_message_no_reply_in[] = 
{&_test_dbus_arg_info_post_message_no_reply_message, NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_post_message_no_reply_out[] = {NULL};
+static const GDBusMethodInfo _test_dbus_method_info_post_message_no_reply = {-1, "PostMessageNoReply", 
(GDBusArgInfo **) (&_test_dbus_arg_info_post_message_no_reply_in), (GDBusArgInfo **) 
(&_test_dbus_arg_info_post_message_no_reply_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_list_messages, 
&_test_dbus_method_info_post_message, &_test_dbus_method_info_post_message_no_reply, NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = {NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) 
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, 
test_dbus_interface_get_property, test_dbus_interface_set_property};
+
+gchar**
+test_list_messages (Test* self,
+                    gint* result_length1,
+                    GError** error)
+{
+       TestIface* _iface_;
+       g_return_val_if_fail (IS_TEST (self), NULL);
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->list_messages) {
+               return _iface_->list_messages (self, result_length1, error);
+       }
+       return NULL;
+}
+
+void
+test_post_message (Test* self,
+                   const gchar* message,
+                   GError** error)
+{
+       TestIface* _iface_;
+       g_return_if_fail (IS_TEST (self));
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->post_message) {
+               _iface_->post_message (self, message, error);
+       }
+}
+
+void
+test_post_message_no_reply (Test* self,
+                            const gchar* message,
+                            GError** error)
+{
+       TestIface* _iface_;
+       g_return_if_fail (IS_TEST (self));
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->post_message_no_reply) {
+               _iface_->post_message_no_reply (self, message, error);
+       }
+}
+
+static void
+test_default_init (TestIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType test_type_id;
+       test_type_id = g_type_register_static (G_TYPE_INTERFACE, "Test", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (test_type_id, G_TYPE_OBJECT);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) 
test_proxy_get_type);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), 
"org.example.Test");
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*) 
(&_test_dbus_interface_info));
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_register_object);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_TEST, 
test_proxy_test_interface_init) )
+static void
+test_proxy_class_init (TestProxyClass* klass)
+{
+       G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal;
+}
+
+static void
+test_proxy_g_signal (GDBusProxy* proxy,
+                     const gchar* sender_name,
+                     const gchar* signal_name,
+                     GVariant* parameters)
+{
+}
+
+static void
+test_proxy_init (TestProxy* self)
+{
+       g_dbus_proxy_set_interface_info (G_DBUS_PROXY (self), (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info));
+}
+
+static gchar**
+test_proxy_list_messages (Test* self,
+                          gint* result_length1,
+                          GError** error)
+{
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       GDBusMessage *_reply_message;
+       GVariant *_reply;
+       GVariantIter _reply_iter;
+       gchar** _result = NULL;
+       gint _result_length1;
+       GVariant* _tmp0_;
+       gchar** _tmp1_;
+       gint _tmp1__length;
+       gint _tmp1__size;
+       gint _tmp1__length1;
+       GVariantIter _tmp2_;
+       GVariant* _tmp3_;
+       G_IO_ERROR;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "ListMessages");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       _reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout 
((GDBusProxy *) self), NULL, NULL, error);
+       g_object_unref (_message);
+       if (!_reply_message) {
+               return NULL;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, error)) {
+               g_object_unref (_reply_message);
+               return NULL;
+       }
+       _reply = g_dbus_message_get_body (_reply_message);
+       g_variant_iter_init (&_reply_iter, _reply);
+       _result_length1 = 0;
+       _tmp0_ = g_variant_iter_next_value (&_reply_iter);
+       _tmp1_ = g_new (gchar*, 5);
+       _tmp1__length = 0;
+       _tmp1__size = 4;
+       _tmp1__length1 = 0;
+       g_variant_iter_init (&_tmp2_, _tmp0_);
+       for (; (_tmp3_ = g_variant_iter_next_value (&_tmp2_)) != NULL; _tmp1__length1++) {
+               if (_tmp1__size == _tmp1__length) {
+                       _tmp1__size = 2 * _tmp1__size;
+                       _tmp1_ = g_renew (gchar*, _tmp1_, _tmp1__size + 1);
+               }
+               _tmp1_[_tmp1__length++] = g_variant_dup_string (_tmp3_, NULL);
+               g_variant_unref (_tmp3_);
+       }
+       _result_length1 = _tmp1__length1;
+       _tmp1_[_tmp1__length] = NULL;
+       _result = _tmp1_;
+       g_variant_unref (_tmp0_);
+       *result_length1 = _result_length1;
+       g_object_unref (_reply_message);
+       return _result;
+}
+
+static void
+test_proxy_post_message (Test* self,
+                         const gchar* message,
+                         GError** error)
+{
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       GDBusMessage *_reply_message;
+       G_IO_ERROR;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "PostMessage");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (message));
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       _reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout 
((GDBusProxy *) self), NULL, NULL, error);
+       g_object_unref (_message);
+       if (!_reply_message) {
+               return;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, error)) {
+               g_object_unref (_reply_message);
+               return;
+       }
+       g_object_unref (_reply_message);
+}
+
+static void
+test_proxy_post_message_no_reply (Test* self,
+                                  const gchar* message,
+                                  GError** error)
+{
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       G_IO_ERROR;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "PostMessageNoReply");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (message));
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       g_dbus_message_set_flags (_message, G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED);
+       g_dbus_connection_send_message (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, error);
+       g_object_unref (_message);
+}
+
+static void
+test_proxy_test_interface_init (TestIface* iface)
+{
+       iface->list_messages = test_proxy_list_messages;
+       iface->post_message = test_proxy_post_message;
+       iface->post_message_no_reply = test_proxy_post_message_no_reply;
+}
+
+static void
+_dbus_test_list_messages (Test* self,
+                          GVariant* _parameters_,
+                          GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       gchar** result;
+       gint result_length1 = 0;
+       gchar** _tmp4_;
+       GVariantBuilder _tmp5_;
+       gint _tmp6_;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       result = test_list_messages (self, &result_length1, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               return;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _tmp4_ = result;
+       g_variant_builder_init (&_tmp5_, G_VARIANT_TYPE ("as"));
+       for (_tmp6_ = 0; _tmp6_ < result_length1; _tmp6_++) {
+               g_variant_builder_add_value (&_tmp5_, g_variant_new_string (*_tmp4_));
+               _tmp4_++;
+       }
+       g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp5_));
+       result = (_vala_array_free (result, result_length1, (GDestroyNotify) g_free), NULL);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+}
+
+static void
+_dbus_test_post_message (Test* self,
+                         GVariant* _parameters_,
+                         GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       gchar* message = NULL;
+       GVariant* _tmp7_;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _tmp7_ = g_variant_iter_next_value (&_arguments_iter);
+       message = g_variant_dup_string (_tmp7_, NULL);
+       g_variant_unref (_tmp7_);
+       test_post_message (self, message, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               goto _error;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+       _error:
+       _g_free0 (message);
+       ;
+}
+
+static void
+_dbus_test_post_message_no_reply (Test* self,
+                                  GVariant* _parameters_,
+                                  GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       gchar* message = NULL;
+       GVariant* _tmp8_;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _tmp8_ = g_variant_iter_next_value (&_arguments_iter);
+       message = g_variant_dup_string (_tmp8_, NULL);
+       g_variant_unref (_tmp8_);
+       test_post_message_no_reply (self, message, &error);
+       _error:
+       _g_free0 (message);
+       ;
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* method_name,
+                                 GVariant* parameters,
+                                 GDBusMethodInvocation* invocation,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "ListMessages") == 0) {
+               _dbus_test_list_messages (object, parameters, invocation);
+       } else if (strcmp (method_name, "PostMessage") == 0) {
+               _dbus_test_post_message (object, parameters, invocation);
+       } else if (strcmp (method_name, "PostMessageNoReply") == 0) {
+               _dbus_test_post_message_no_reply (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return NULL;
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GVariant* value,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return FALSE;
+}
+
+guint
+test_register_object (gpointer object,
+                      GDBusConnection* connection,
+                      const gchar* path,
+                      GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+static void
+run_data_free (gpointer _data)
+{
+       RunData* _data_;
+       _data_ = _data;
+       g_slice_free (RunData, _data_);
+}
+
+void
+run (GAsyncReadyCallback _callback_,
+     gpointer _user_data_)
+{
+       RunData* _data_;
+       _data_ = g_slice_new0 (RunData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, run_data_free);
+       run_co (_data_);
+}
+
+void
+run_finish (GAsyncResult* _res_)
+{
+       RunData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               _g_async_queue_unref0 (_data1_->events);
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static void
+run_ready (GObject* source_object,
+           GAsyncResult* _res_,
+           gpointer _user_data_)
+{
+       RunData* _data_;
+       _data_ = _user_data_;
+       _data_->_source_object_ = source_object;
+       _data_->_res_ = _res_;
+       run_co (_data_);
+}
+
+static void
+_g_free0_ (gpointer var)
+{
+       var = (g_free (var), NULL);
+}
+
+static gpointer
+_g_object_ref0 (gpointer self)
+{
+       return self ? g_object_ref (self) : NULL;
+}
+
+static GDBusMessage*
+__lambda4_ (Block1Data* _data1_,
+            GDBusConnection* conn,
+            GDBusMessage* message,
+            gboolean incoming)
+{
+       gboolean _tmp0_ = FALSE;
+       const gchar* _tmp1_;
+       GDBusMessage* _tmp6_;
+       GDBusMessage* result = NULL;
+       g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (conn, g_dbus_connection_get_type ()), NULL);
+       g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (message, g_dbus_message_get_type ()), NULL);
+       _tmp1_ = g_dbus_message_get_interface (message);
+       if (g_strcmp0 (_tmp1_, "org.example.Test") == 0) {
+               const gchar* _tmp2_;
+               _tmp2_ = g_dbus_message_get_member (message);
+               _tmp0_ = g_strcmp0 (_tmp2_, "ListMessages") != 0;
+       } else {
+               _tmp0_ = FALSE;
+       }
+       if (_tmp0_) {
+               switch (g_dbus_message_get_message_type (message)) {
+                       case G_DBUS_MESSAGE_TYPE_METHOD_CALL:
+                       {
+                               GAsyncQueue* _tmp3_;
+                               GFlagsValue* _tmp4_;
+                               gchar* _tmp5_;
+                               _tmp3_ = _data1_->events;
+                               _tmp4_ = g_flags_get_first_value (g_type_class_ref 
(g_dbus_message_flags_get_type ()), g_dbus_message_get_flags (message));
+                               _tmp5_ = g_strdup ((_tmp4_ != NULL) ? _tmp4_->value_name : NULL);
+                               g_async_queue_push (_tmp3_, _tmp5_);
+                               break;
+                       }
+                       default:
+                       {
+                               g_assert_not_reached ();
+                       }
+               }
+       }
+       _tmp6_ = _g_object_ref0 (message);
+       result = _tmp6_;
+       _g_object_unref0 (message);
+       return result;
+}
+
+static GDBusMessage*
+___lambda4__gd_bus_message_filter_function (GDBusConnection* connection,
+                                            GDBusMessage* message,
+                                            gboolean incoming,
+                                            gpointer self)
+{
+       GDBusMessage* result;
+       result = __lambda4_ (self, connection, message, incoming);
+       return result;
+}
+
+static gboolean
+run_co (RunData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               case 1:
+               goto _state_1;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->_data1_ = g_slice_new0 (Block1Data);
+       _data_->_data1_->_ref_count_ = 1;
+       _data_->_data1_->_async_data_ = _data_;
+       _data_->_state_ = 1;
+       g_async_initable_new_async (TYPE_TEST_PROXY, 0, NULL, run_ready, _data_, "g-flags", 0, "g-name", 
"org.example.Test", "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/example/Test", 
"g-interface-name", "org.example.Test", NULL);
+       return FALSE;
+       _state_1:
+       _data_->_tmp0_ = (Test*) g_async_initable_new_finish ((GAsyncInitable *) _data_->_source_object_, 
_data_->_res_, &_data_->_inner_error0_);
+       _data_->test = (Test*) _data_->_tmp0_;
+       if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+               block1_data_unref (_data_->_data1_);
+               _data_->_data1_ = NULL;
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), 
_data_->_inner_error0_->code);
+               g_clear_error (&_data_->_inner_error0_);
+               g_object_unref (_data_->_async_result);
+               return FALSE;
+       }
+       _data_->_tmp1_ = g_async_queue_new_full (_g_free0_);
+       _data_->_data1_->events = _data_->_tmp1_;
+       _data_->_tmp2_ = _data_->test;
+       g_object_get (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp2_, g_dbus_proxy_get_type (), GDBusProxy), 
"g-connection", &_data_->_tmp3_, NULL);
+       _data_->_tmp4_ = _data_->_tmp3_;
+       _data_->connection = _data_->_tmp4_;
+       _data_->_tmp5_ = _data_->connection;
+       g_dbus_connection_add_filter (_data_->_tmp5_, ___lambda4__gd_bus_message_filter_function, 
block1_data_ref (_data_->_data1_), block1_data_unref);
+       _data_->_tmp6_ = _data_->test;
+       _data_->_tmp7_ = 0;
+       _data_->_tmp8_ = test_list_messages (_data_->_tmp6_, &_data_->_tmp7_, &_data_->_inner_error0_);
+       _data_->messages = _data_->_tmp8_;
+       _data_->messages_length1 = _data_->_tmp7_;
+       _data_->_messages_size_ = _data_->messages_length1;
+       if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+               _g_object_unref0 (_data_->connection);
+               _g_object_unref0 (_data_->test);
+               block1_data_unref (_data_->_data1_);
+               _data_->_data1_ = NULL;
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), 
_data_->_inner_error0_->code);
+               g_clear_error (&_data_->_inner_error0_);
+               g_object_unref (_data_->_async_result);
+               return FALSE;
+       }
+       _data_->_tmp9_ = _data_->messages;
+       _data_->_tmp9__length1 = _data_->messages_length1;
+       _vala_assert (_data_->_tmp9__length1 == 0, "messages.length == 0");
+       _data_->_tmp10_ = _data_->test;
+       test_post_message (_data_->_tmp10_, "round-trip", &_data_->_inner_error0_);
+       if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+               _data_->messages = (_vala_array_free (_data_->messages, _data_->messages_length1, 
(GDestroyNotify) g_free), NULL);
+               _g_object_unref0 (_data_->connection);
+               _g_object_unref0 (_data_->test);
+               block1_data_unref (_data_->_data1_);
+               _data_->_data1_ = NULL;
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), 
_data_->_inner_error0_->code);
+               g_clear_error (&_data_->_inner_error0_);
+               g_object_unref (_data_->_async_result);
+               return FALSE;
+       }
+       _data_->_tmp11_ = _data_->_data1_->events;
+       _data_->_tmp12_ = g_async_queue_pop (_data_->_tmp11_);
+       _data_->_tmp13_ = (gchar*) _data_->_tmp12_;
+       _vala_assert (g_strcmp0 (_data_->_tmp13_, "G_DBUS_MESSAGE_FLAGS_NONE") == 0, "events.pop () == 
\"G_DBUS_MESSAGE_FLAGS_NONE\"");
+       _g_free0 (_data_->_tmp13_);
+       _data_->_tmp14_ = _data_->_data1_->events;
+       _data_->_tmp15_ = g_async_queue_try_pop (_data_->_tmp14_);
+       _data_->_tmp16_ = (gchar*) _data_->_tmp15_;
+       _vala_assert (_data_->_tmp16_ == NULL, "events.try_pop () == null");
+       _g_free0 (_data_->_tmp16_);
+       _data_->_tmp17_ = _data_->test;
+       test_post_message_no_reply (_data_->_tmp17_, "fire-and-forget", &_data_->_inner_error0_);
+       if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+               _data_->messages = (_vala_array_free (_data_->messages, _data_->messages_length1, 
(GDestroyNotify) g_free), NULL);
+               _g_object_unref0 (_data_->connection);
+               _g_object_unref0 (_data_->test);
+               block1_data_unref (_data_->_data1_);
+               _data_->_data1_ = NULL;
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), 
_data_->_inner_error0_->code);
+               g_clear_error (&_data_->_inner_error0_);
+               g_object_unref (_data_->_async_result);
+               return FALSE;
+       }
+       _data_->_tmp18_ = _data_->_data1_->events;
+       _data_->_tmp19_ = g_async_queue_pop (_data_->_tmp18_);
+       _data_->_tmp20_ = (gchar*) _data_->_tmp19_;
+       _vala_assert (g_strcmp0 (_data_->_tmp20_, "G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED") == 0, "events.pop 
() == \"G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED\"");
+       _g_free0 (_data_->_tmp20_);
+       _data_->_tmp21_ = _data_->_data1_->events;
+       _data_->_tmp22_ = g_async_queue_try_pop (_data_->_tmp21_);
+       _data_->_tmp23_ = (gchar*) _data_->_tmp22_;
+       _vala_assert (_data_->_tmp23_ == NULL, "events.try_pop () == null");
+       _g_free0 (_data_->_tmp23_);
+       _data_->_tmp25_ = _data_->test;
+       _data_->_tmp26_ = 0;
+       _data_->_tmp27_ = test_list_messages (_data_->_tmp25_, &_data_->_tmp26_, &_data_->_inner_error0_);
+       _data_->_tmp24_ = _data_->_tmp27_;
+       _data_->_tmp24__length1 = _data_->_tmp26_;
+       _data_->__tmp24__size_ = _data_->_tmp24__length1;
+       if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
+               _data_->messages = (_vala_array_free (_data_->messages, _data_->messages_length1, 
(GDestroyNotify) g_free), NULL);
+               _g_object_unref0 (_data_->connection);
+               _g_object_unref0 (_data_->test);
+               block1_data_unref (_data_->_data1_);
+               _data_->_data1_ = NULL;
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), 
_data_->_inner_error0_->code);
+               g_clear_error (&_data_->_inner_error0_);
+               g_object_unref (_data_->_async_result);
+               return FALSE;
+       }
+       _data_->_tmp28_ = _data_->_tmp24_;
+       _data_->_tmp28__length1 = _data_->_tmp24__length1;
+       _data_->_tmp24_ = NULL;
+       _data_->_tmp24__length1 = 0;
+       _data_->messages = (_vala_array_free (_data_->messages, _data_->messages_length1, (GDestroyNotify) 
g_free), NULL);
+       _data_->messages = _data_->_tmp28_;
+       _data_->messages_length1 = _data_->_tmp28__length1;
+       _data_->_messages_size_ = _data_->messages_length1;
+       _data_->_tmp29_ = _data_->messages;
+       _data_->_tmp29__length1 = _data_->messages_length1;
+       _vala_assert (_data_->_tmp29__length1 == 2, "messages.length == 2");
+       _data_->_tmp30_ = _data_->messages;
+       _data_->_tmp30__length1 = _data_->messages_length1;
+       _data_->_tmp31_ = _data_->_tmp30_[0];
+       _vala_assert (g_strcmp0 (_data_->_tmp31_, "round-trip") == 0, "messages[0] == \"round-trip\"");
+       _data_->_tmp32_ = _data_->messages;
+       _data_->_tmp32__length1 = _data_->messages_length1;
+       _data_->_tmp33_ = _data_->_tmp32_[1];
+       _vala_assert (g_strcmp0 (_data_->_tmp33_, "fire-and-forget") == 0, "messages[1] == 
\"fire-and-forget\"");
+       _data_->_tmp34_ = main_loop;
+       g_main_loop_quit (_data_->_tmp34_);
+       _data_->_tmp24_ = (_vala_array_free (_data_->_tmp24_, _data_->_tmp24__length1, (GDestroyNotify) 
g_free), NULL);
+       _data_->messages = (_vala_array_free (_data_->messages, _data_->messages_length1, (GDestroyNotify) 
g_free), NULL);
+       _g_object_unref0 (_data_->connection);
+       _g_object_unref0 (_data_->test);
+       block1_data_unref (_data_->_data1_);
+       _data_->_data1_ = NULL;
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+_vala_main (void)
+{
+       GMainLoop* _tmp0_;
+       GMainLoop* _tmp1_;
+       run (NULL, NULL);
+       _tmp0_ = g_main_loop_new (NULL, FALSE);
+       _g_main_loop_unref0 (main_loop);
+       main_loop = _tmp0_;
+       _tmp1_ = main_loop;
+       g_main_loop_run (_tmp1_);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/dbus/no-reply_server.c-expected b/tests/dbus/no-reply_server.c-expected
new file mode 100644
index 000000000..1d719cde6
--- /dev/null
+++ b/tests/dbus/no-reply_server.c-expected
@@ -0,0 +1,632 @@
+/* dbus_no_reply_server.c generated by valac, the Vala compiler
+ * generated from dbus_no_reply_server.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TEST, TestClass))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define IS_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TEST))
+#define TEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TEST, TestClass))
+
+typedef struct _Test Test;
+typedef struct _TestClass TestClass;
+typedef struct _TestPrivate TestPrivate;
+enum  {
+       TEST_0_PROPERTY,
+       TEST_NUM_PROPERTIES
+};
+static GParamSpec* test_properties[TEST_NUM_PROPERTIES];
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Test {
+       GObject parent_instance;
+       TestPrivate * priv;
+};
+
+struct _TestClass {
+       GObjectClass parent_class;
+};
+
+struct _TestPrivate {
+       gchar** messages;
+       gint messages_length1;
+       gint _messages_size_;
+};
+
+static gint Test_private_offset;
+static gpointer test_parent_class = NULL;
+VALA_EXTERN GMainLoop* main_loop;
+GMainLoop* main_loop = NULL;
+
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
+VALA_EXTERN guint test_register_object (void* object,
+                            GDBusConnection* connection,
+                            const gchar* path,
+                            GError** error);
+VALA_EXTERN gchar** test_list_messages (Test* self,
+                            gint* result_length1);
+static gchar** _vala_array_dup1 (gchar** self,
+                          gssize length);
+VALA_EXTERN void test_post_message (Test* self,
+                        const gchar* message);
+static void _vala_array_add1 (gchar** * array,
+                       gint* length,
+                       gint* size,
+                       gchar* value);
+VALA_EXTERN void test_post_message_no_reply (Test* self,
+                                 const gchar* message);
+static void _vala_array_add2 (gchar** * array,
+                       gint* length,
+                       gint* size,
+                       gchar* value);
+VALA_EXTERN Test* test_new (void);
+VALA_EXTERN Test* test_construct (GType object_type);
+static void test_finalize (GObject * obj);
+static GType test_get_type_once (void);
+static void _dbus_test_list_messages (Test* self,
+                               GVariant* _parameters_,
+                               GDBusMethodInvocation* invocation);
+static void _dbus_test_post_message (Test* self,
+                              GVariant* _parameters_,
+                              GDBusMethodInvocation* invocation);
+static void _dbus_test_post_message_no_reply (Test* self,
+                                       GVariant* _parameters_,
+                                       GDBusMethodInvocation* invocation);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* method_name,
+                                      GVariant* parameters,
+                                      GDBusMethodInvocation* invocation,
+                                      gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+                                            const gchar* sender,
+                                            const gchar* object_path,
+                                            const gchar* interface_name,
+                                            const gchar* property_name,
+                                            GError** error,
+                                            gpointer user_data);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GVariant* value,
+                                           GError** error,
+                                           gpointer user_data);
+static void _test_unregister_object (gpointer user_data);
+VALA_EXTERN void client_exit (GPid pid,
+                  gint status);
+static void _vala_main (void);
+static guint _variant_get1 (GVariant* value);
+static void _client_exit_gchild_watch_func (GPid pid,
+                                     gint wait_status,
+                                     gpointer self);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static const GDBusArgInfo _test_dbus_arg_info_list_messages_result = {-1, "result", "as", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_list_messages_in[] = {NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_list_messages_out[] = 
{&_test_dbus_arg_info_list_messages_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_list_messages = {-1, "ListMessages", (GDBusArgInfo **) 
(&_test_dbus_arg_info_list_messages_in), (GDBusArgInfo **) (&_test_dbus_arg_info_list_messages_out), NULL};
+static const GDBusArgInfo _test_dbus_arg_info_post_message_message = {-1, "message", "s", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_post_message_in[] = 
{&_test_dbus_arg_info_post_message_message, NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_post_message_out[] = {NULL};
+static const GDBusMethodInfo _test_dbus_method_info_post_message = {-1, "PostMessage", (GDBusArgInfo **) 
(&_test_dbus_arg_info_post_message_in), (GDBusArgInfo **) (&_test_dbus_arg_info_post_message_out), NULL};
+static const GDBusArgInfo _test_dbus_arg_info_post_message_no_reply_message = {-1, "message", "s", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_post_message_no_reply_in[] = 
{&_test_dbus_arg_info_post_message_no_reply_message, NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_post_message_no_reply_out[] = {NULL};
+static const GDBusMethodInfo _test_dbus_method_info_post_message_no_reply = {-1, "PostMessageNoReply", 
(GDBusArgInfo **) (&_test_dbus_arg_info_post_message_no_reply_in), (GDBusArgInfo **) 
(&_test_dbus_arg_info_post_message_no_reply_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_list_messages, 
&_test_dbus_method_info_post_message, &_test_dbus_method_info_post_message_no_reply, NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = {NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) 
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, 
test_dbus_interface_get_property, test_dbus_interface_set_property};
+
+static inline gpointer
+test_get_instance_private (Test* self)
+{
+       return G_STRUCT_MEMBER_P (self, Test_private_offset);
+}
+
+static gchar**
+_vala_array_dup1 (gchar** self,
+                  gssize length)
+{
+       if (length >= 0) {
+               gchar** result;
+               gssize i;
+               result = g_new0 (gchar*, length + 1);
+               for (i = 0; i < length; i++) {
+                       gchar* _tmp0_;
+                       _tmp0_ = g_strdup (self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+gchar**
+test_list_messages (Test* self,
+                    gint* result_length1)
+{
+       gchar** _tmp0_;
+       gint _tmp0__length1;
+       gchar** _tmp1_;
+       gint _tmp1__length1;
+       gchar** _tmp2_;
+       gint _tmp2__length1;
+       gchar** result = NULL;
+       g_return_val_if_fail (IS_TEST (self), NULL);
+       _tmp0_ = self->priv->messages;
+       _tmp0__length1 = self->priv->messages_length1;
+       _tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup1 (_tmp0_, _tmp0__length1) : _tmp0_;
+       _tmp1__length1 = _tmp0__length1;
+       _tmp2_ = _tmp1_;
+       _tmp2__length1 = _tmp1__length1;
+       if (result_length1) {
+               *result_length1 = _tmp2__length1;
+       }
+       result = _tmp2_;
+       return result;
+}
+
+static void
+_vala_array_add1 (gchar** * array,
+                  gint* length,
+                  gint* size,
+                  gchar* value)
+{
+       if ((*length) == (*size)) {
+               *size = (*size) ? (2 * (*size)) : 4;
+               *array = g_renew (gchar*, *array, (*size) + 1);
+       }
+       (*array)[(*length)++] = value;
+       (*array)[*length] = NULL;
+}
+
+void
+test_post_message (Test* self,
+                   const gchar* message)
+{
+       gchar* _tmp0_;
+       g_return_if_fail (IS_TEST (self));
+       g_return_if_fail (message != NULL);
+       _tmp0_ = g_strdup (message);
+       _vala_array_add1 (&self->priv->messages, &self->priv->messages_length1, &self->priv->_messages_size_, 
_tmp0_);
+}
+
+static void
+_vala_array_add2 (gchar** * array,
+                  gint* length,
+                  gint* size,
+                  gchar* value)
+{
+       if ((*length) == (*size)) {
+               *size = (*size) ? (2 * (*size)) : 4;
+               *array = g_renew (gchar*, *array, (*size) + 1);
+       }
+       (*array)[(*length)++] = value;
+       (*array)[*length] = NULL;
+}
+
+void
+test_post_message_no_reply (Test* self,
+                            const gchar* message)
+{
+       gchar* _tmp0_;
+       g_return_if_fail (IS_TEST (self));
+       g_return_if_fail (message != NULL);
+       _tmp0_ = g_strdup (message);
+       _vala_array_add2 (&self->priv->messages, &self->priv->messages_length1, &self->priv->_messages_size_, 
_tmp0_);
+}
+
+Test*
+test_construct (GType object_type)
+{
+       Test * self = NULL;
+       self = (Test*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Test*
+test_new (void)
+{
+       return test_construct (TYPE_TEST);
+}
+
+static void
+test_class_init (TestClass * klass,
+                 gpointer klass_data)
+{
+       test_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Test_private_offset);
+       G_OBJECT_CLASS (klass)->finalize = test_finalize;
+}
+
+static void
+test_instance_init (Test * self,
+                    gpointer klass)
+{
+       gchar** _tmp0_;
+       self->priv = test_get_instance_private (self);
+       _tmp0_ = g_new0 (gchar*, 0 + 1);
+       self->priv->messages = _tmp0_;
+       self->priv->messages_length1 = 0;
+       self->priv->_messages_size_ = self->priv->messages_length1;
+}
+
+static void
+test_finalize (GObject * obj)
+{
+       Test * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_TEST, Test);
+       self->priv->messages = (_vala_array_free (self->priv->messages, self->priv->messages_length1, 
(GDestroyNotify) g_free), NULL);
+       G_OBJECT_CLASS (test_parent_class)->finalize (obj);
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Test), 
0, (GInstanceInitFunc) test_instance_init, NULL };
+       GType test_type_id;
+       test_type_id = g_type_register_static (G_TYPE_OBJECT, "Test", &g_define_type_info, 0);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_register_object);
+       Test_private_offset = g_type_add_instance_private (test_type_id, sizeof (TestPrivate));
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+static void
+_dbus_test_list_messages (Test* self,
+                          GVariant* _parameters_,
+                          GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       gchar** result;
+       gint result_length1 = 0;
+       gchar** _tmp0_;
+       GVariantBuilder _tmp1_;
+       gint _tmp2_;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       result = test_list_messages (self, &result_length1);
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _tmp0_ = result;
+       g_variant_builder_init (&_tmp1_, G_VARIANT_TYPE ("as"));
+       for (_tmp2_ = 0; _tmp2_ < result_length1; _tmp2_++) {
+               g_variant_builder_add_value (&_tmp1_, g_variant_new_string (*_tmp0_));
+               _tmp0_++;
+       }
+       g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp1_));
+       result = (_vala_array_free (result, result_length1, (GDestroyNotify) g_free), NULL);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+}
+
+static void
+_dbus_test_post_message (Test* self,
+                         GVariant* _parameters_,
+                         GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       gchar* message = NULL;
+       GVariant* _tmp3_;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _tmp3_ = g_variant_iter_next_value (&_arguments_iter);
+       message = g_variant_dup_string (_tmp3_, NULL);
+       g_variant_unref (_tmp3_);
+       test_post_message (self, message);
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+       _g_free0 (message);
+}
+
+static void
+_dbus_test_post_message_no_reply (Test* self,
+                                  GVariant* _parameters_,
+                                  GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       gchar* message = NULL;
+       GVariant* _tmp4_;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _tmp4_ = g_variant_iter_next_value (&_arguments_iter);
+       message = g_variant_dup_string (_tmp4_, NULL);
+       g_variant_unref (_tmp4_);
+       test_post_message_no_reply (self, message);
+       _g_free0 (message);
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* method_name,
+                                 GVariant* parameters,
+                                 GDBusMethodInvocation* invocation,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "ListMessages") == 0) {
+               _dbus_test_list_messages (object, parameters, invocation);
+       } else if (strcmp (method_name, "PostMessage") == 0) {
+               _dbus_test_post_message (object, parameters, invocation);
+       } else if (strcmp (method_name, "PostMessageNoReply") == 0) {
+               _dbus_test_post_message_no_reply (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return NULL;
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GVariant* value,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return FALSE;
+}
+
+guint
+test_register_object (gpointer object,
+                      GDBusConnection* connection,
+                      const gchar* path,
+                      GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+void
+client_exit (GPid pid,
+             gint status)
+{
+       GMainLoop* _tmp0_;
+       _vala_assert (status == 0, "status == 0");
+       _tmp0_ = main_loop;
+       g_main_loop_quit (_tmp0_);
+}
+
+static guint
+_variant_get1 (GVariant* value)
+{
+       return g_variant_get_uint32 (value);
+}
+
+static void
+_client_exit_gchild_watch_func (GPid pid,
+                                gint wait_status,
+                                gpointer self)
+{
+       client_exit (pid, wait_status);
+}
+
+static void
+_vala_main (void)
+{
+       GDBusConnection* conn = NULL;
+       GDBusConnection* _tmp0_;
+       GDBusConnection* _tmp1_;
+       Test* _tmp2_;
+       Test* _tmp3_;
+       GVariant* request_result = NULL;
+       GDBusConnection* _tmp4_;
+       GVariant* _tmp5_;
+       GVariant* _tmp6_;
+       GVariant* _tmp7_;
+       GVariant* _tmp8_;
+       GVariant* _tmp9_;
+       GVariant* _tmp10_;
+       GVariant* _tmp11_;
+       guint _tmp12_;
+       GPid client_pid = 0;
+       gchar* _tmp13_;
+       gchar** _tmp14_;
+       gchar** _tmp15_;
+       gint _tmp15__length1;
+       GPid _tmp16_ = 0;
+       GMainLoop* _tmp17_;
+       GMainLoop* _tmp18_;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &_inner_error0_);
+       conn = _tmp0_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp1_ = conn;
+       _tmp2_ = test_new ();
+       _tmp3_ = _tmp2_;
+       test_register_object (_tmp3_, _tmp1_, "/org/example/Test", &_inner_error0_);
+       _g_object_unref0 (_tmp3_);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp4_ = conn;
+       _tmp5_ = g_variant_new ("(su)", "org.example.Test", 0x4, NULL);
+       g_variant_ref_sink (_tmp5_);
+       _tmp6_ = _tmp5_;
+       _tmp7_ = g_dbus_connection_call_sync (_tmp4_, "org.freedesktop.DBus", "/org/freedesktop/DBus", 
"org.freedesktop.DBus", "RequestName", _tmp6_, NULL, 0, -1, NULL, &_inner_error0_);
+       _tmp8_ = _tmp7_;
+       _g_variant_unref0 (_tmp6_);
+       request_result = _tmp8_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp9_ = request_result;
+       _tmp10_ = g_variant_get_child_value (_tmp9_, (gsize) 0);
+       _tmp11_ = _tmp10_;
+       _tmp12_ = _variant_get1 (_tmp11_);
+       _vala_assert (_tmp12_ == ((guint) 1), "(uint) request_result.get_child_value (0) == 1");
+       _g_variant_unref0 (_tmp11_);
+       _tmp13_ = g_strdup ("dbus_no_reply_client");
+       _tmp14_ = g_new0 (gchar*, 1 + 1);
+       _tmp14_[0] = _tmp13_;
+       _tmp15_ = _tmp14_;
+       _tmp15__length1 = 1;
+       g_spawn_async (NULL, _tmp15_, NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &_tmp16_, &_inner_error0_);
+       client_pid = _tmp16_;
+       _tmp15_ = (_vala_array_free (_tmp15_, _tmp15__length1, (GDestroyNotify) g_free), NULL);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_variant_unref0 (request_result);
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       g_child_watch_add_full (G_PRIORITY_DEFAULT_IDLE, client_pid, _client_exit_gchild_watch_func, NULL, 
NULL);
+       _tmp17_ = g_main_loop_new (NULL, FALSE);
+       _g_main_loop_unref0 (main_loop);
+       main_loop = _tmp17_;
+       _tmp18_ = main_loop;
+       g_main_loop_run (_tmp18_);
+       _g_variant_unref0 (request_result);
+       _g_object_unref0 (conn);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/dbus/rawvariants_client.c-expected b/tests/dbus/rawvariants_client.c-expected
new file mode 100644
index 000000000..287614547
--- /dev/null
+++ b/tests/dbus/rawvariants_client.c-expected
@@ -0,0 +1,1277 @@
+/* dbus_rawvariants_client.c generated by valac, the Vala compiler
+ * generated from dbus_rawvariants_client.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define TEST_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_TEST, TestIface))
+
+typedef struct _Test Test;
+typedef struct _TestIface TestIface;
+
+#define TYPE_TEST_PROXY (test_proxy_get_type ())
+enum  {
+       TEST_TEST_SIGNAL_SIGNAL,
+       TEST_NUM_SIGNALS
+};
+static guint test_signals[TEST_NUM_SIGNALS] = {0};
+typedef GDBusProxy TestProxy;
+typedef GDBusProxyClass TestProxyClass;
+#define _g_free0(var) (var = (g_free (var), NULL))
+
+#define TYPE_TEST_RAW (test_raw_get_type ())
+#define TEST_RAW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST_RAW, TestRaw))
+#define IS_TEST_RAW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST_RAW))
+#define TEST_RAW_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_TEST_RAW, TestRawIface))
+
+typedef struct _TestRaw TestRaw;
+typedef struct _TestRawIface TestRawIface;
+
+#define TYPE_TEST_RAW_PROXY (test_raw_proxy_get_type ())
+enum  {
+       TEST_RAW_TEST_SIGNAL_SIGNAL,
+       TEST_RAW_NUM_SIGNALS
+};
+static guint test_raw_signals[TEST_RAW_NUM_SIGNALS] = {0};
+typedef GDBusProxy TestRawProxy;
+typedef GDBusProxyClass TestRawProxyClass;
+#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
+typedef struct _Block1Data Block1Data;
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+typedef struct _Block2Data Block2Data;
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _TestIface {
+       GTypeInterface parent_iface;
+       gint (*test_method) (Test* self, gint j, gint k, GError** error);
+       gchar* (*get_test_property) (Test* self);
+       void (*set_test_property) (Test* self, const gchar* value);
+};
+
+struct _TestRawIface {
+       GTypeInterface parent_iface;
+       GVariant* (*test_method) (TestRaw* self, GVariant* j, GVariant* k, GError** error);
+       GVariant* (*get_test_property) (TestRaw* self);
+       void (*set_test_property) (TestRaw* self, GVariant* value);
+};
+
+struct _Block1Data {
+       int _ref_count_;
+       GMainLoop* main_loop;
+};
+
+struct _Block2Data {
+       int _ref_count_;
+       GMainLoop* main_loop;
+};
+
+VALA_EXTERN GType test_proxy_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN guint test_register_object (void* object,
+                            GDBusConnection* connection,
+                            const gchar* path,
+                            GError** error);
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN gint test_test_method (Test* self,
+                       gint j,
+                       gint k,
+                       GError** error);
+VALA_EXTERN gchar* test_get_test_property (Test* self);
+VALA_EXTERN void test_set_test_property (Test* self,
+                             const gchar* value);
+static GType test_get_type_once (void);
+static void test_proxy_g_signal (GDBusProxy* proxy,
+                          const gchar* sender_name,
+                          const gchar* signal_name,
+                          GVariant* parameters);
+static void _dbus_handle_test_test_signal (Test* self,
+                                    GVariant* parameters);
+static gint test_proxy_test_method (Test* self,
+                             gint j,
+                             gint k,
+                             GError** error);
+static gchar* test_dbus_proxy_get_test_property (Test* self);
+static void test_dbus_proxy_set_test_property (Test* self,
+                                        const gchar* value);
+static void test_proxy_test_interface_init (TestIface* iface);
+static void _dbus_test_test_method (Test* self,
+                             GVariant* _parameters_,
+                             GDBusMethodInvocation* invocation);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* method_name,
+                                      GVariant* parameters,
+                                      GDBusMethodInvocation* invocation,
+                                      gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+                                            const gchar* sender,
+                                            const gchar* object_path,
+                                            const gchar* interface_name,
+                                            const gchar* property_name,
+                                            GError** error,
+                                            gpointer user_data);
+static GVariant* _dbus_test_get_test_property (Test* self);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GVariant* value,
+                                           GError** error,
+                                           gpointer user_data);
+static void _dbus_test_set_test_property (Test* self,
+                                   GVariant* _value);
+static void _dbus_test_test_signal (GObject* _sender,
+                             gint i,
+                             gpointer* _data);
+static void _test_unregister_object (gpointer user_data);
+VALA_EXTERN GType test_raw_proxy_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN guint test_raw_register_object (void* object,
+                                GDBusConnection* connection,
+                                const gchar* path,
+                                GError** error);
+VALA_EXTERN GType test_raw_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN GVariant* test_raw_test_method (TestRaw* self,
+                                GVariant* j,
+                                GVariant* k,
+                                GError** error);
+VALA_EXTERN GVariant* test_raw_get_test_property (TestRaw* self);
+VALA_EXTERN void test_raw_set_test_property (TestRaw* self,
+                                 GVariant* value);
+static GType test_raw_get_type_once (void);
+static void test_raw_proxy_g_signal (GDBusProxy* proxy,
+                              const gchar* sender_name,
+                              const gchar* signal_name,
+                              GVariant* parameters);
+static void _dbus_handle_test_raw_test_signal (TestRaw* self,
+                                        GVariant* parameters);
+static GVariant* test_raw_proxy_test_method (TestRaw* self,
+                                      GVariant* j,
+                                      GVariant* k,
+                                      GError** error);
+static GVariant* test_raw_dbus_proxy_get_test_property (TestRaw* self);
+static void test_raw_dbus_proxy_set_test_property (TestRaw* self,
+                                            GVariant* value);
+static void test_raw_proxy_test_raw_interface_init (TestRawIface* iface);
+static void _dbus_test_raw_test_method (TestRaw* self,
+                                 GVariant* _parameters_,
+                                 GDBusMethodInvocation* invocation);
+static void test_raw_dbus_interface_method_call (GDBusConnection* connection,
+                                          const gchar* sender,
+                                          const gchar* object_path,
+                                          const gchar* interface_name,
+                                          const gchar* method_name,
+                                          GVariant* parameters,
+                                          GDBusMethodInvocation* invocation,
+                                          gpointer user_data);
+static GVariant* test_raw_dbus_interface_get_property (GDBusConnection* connection,
+                                                const gchar* sender,
+                                                const gchar* object_path,
+                                                const gchar* interface_name,
+                                                const gchar* property_name,
+                                                GError** error,
+                                                gpointer user_data);
+static GVariant* _dbus_test_raw_get_test_property (TestRaw* self);
+static gboolean test_raw_dbus_interface_set_property (GDBusConnection* connection,
+                                               const gchar* sender,
+                                               const gchar* object_path,
+                                               const gchar* interface_name,
+                                               const gchar* property_name,
+                                               GVariant* value,
+                                               GError** error,
+                                               gpointer user_data);
+static void _dbus_test_raw_set_test_property (TestRaw* self,
+                                       GVariant* _value);
+static void _dbus_test_raw_test_signal (GObject* _sender,
+                                 GVariant* i,
+                                 gpointer* _data);
+static void _test_raw_unregister_object (gpointer user_data);
+VALA_EXTERN void test_raw (TestRaw* test);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static void __lambda4_ (Block1Data* _data1_,
+                 GVariant* var_i);
+static gint _variant_get1 (GVariant* value);
+static void ___lambda4__test_raw_test_signal (TestRaw* _sender,
+                                       GVariant* i,
+                                       gpointer self);
+static GVariant* _variant_new1 (gint value);
+static GVariant* _variant_new2 (gint value);
+static gint _variant_get2 (GVariant* value);
+static GVariant* _variant_new3 (const gchar* value);
+static gchar* _variant_get3 (GVariant* value);
+VALA_EXTERN void test (Test* test);
+static Block2Data* block2_data_ref (Block2Data* _data2_);
+static void block2_data_unref (void * _userdata_);
+static void __lambda5_ (Block2Data* _data2_,
+                 gint i);
+static void ___lambda5__test_test_signal (Test* _sender,
+                                   gint i,
+                                   gpointer self);
+static void _vala_main (void);
+
+static const GDBusArgInfo _test_dbus_arg_info_test_method_j = {-1, "j", "i", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_method_k = {-1, "k", "i", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_method_result = {-1, "result", "i", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_method_in[] = 
{&_test_dbus_arg_info_test_method_j, &_test_dbus_arg_info_test_method_k, NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_method_out[] = 
{&_test_dbus_arg_info_test_method_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_method = {-1, "TestMethod", (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_method_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_method_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_test_method, NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_signal_i = {-1, "i", "i", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_signal[] = {&_test_dbus_arg_info_test_signal_i, 
NULL};
+static const GDBusSignalInfo _test_dbus_signal_info_test_signal = {-1, "TestSignal", (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_signal), NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {&_test_dbus_signal_info_test_signal, NULL};
+static const GDBusPropertyInfo _test_dbus_property_info_test_property = {-1, "TestProperty", "s", 
G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = 
{&_test_dbus_property_info_test_property, NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) 
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, 
test_dbus_interface_get_property, test_dbus_interface_set_property};
+static const GDBusArgInfo _test_raw_dbus_arg_info_test_method_j = {-1, "j", "i", NULL};
+static const GDBusArgInfo _test_raw_dbus_arg_info_test_method_k = {-1, "k", "i", NULL};
+static const GDBusArgInfo _test_raw_dbus_arg_info_test_method_result = {-1, "result", "i", NULL};
+static const GDBusArgInfo * const _test_raw_dbus_arg_info_test_method_in[] = 
{&_test_raw_dbus_arg_info_test_method_j, &_test_raw_dbus_arg_info_test_method_k, NULL};
+static const GDBusArgInfo * const _test_raw_dbus_arg_info_test_method_out[] = 
{&_test_raw_dbus_arg_info_test_method_result, NULL};
+static const GDBusMethodInfo _test_raw_dbus_method_info_test_method = {-1, "TestMethod", (GDBusArgInfo **) 
(&_test_raw_dbus_arg_info_test_method_in), (GDBusArgInfo **) (&_test_raw_dbus_arg_info_test_method_out), 
NULL};
+static const GDBusMethodInfo * const _test_raw_dbus_method_info[] = 
{&_test_raw_dbus_method_info_test_method, NULL};
+static const GDBusArgInfo _test_raw_dbus_arg_info_test_signal_i = {-1, "i", "i", NULL};
+static const GDBusArgInfo * const _test_raw_dbus_arg_info_test_signal[] = 
{&_test_raw_dbus_arg_info_test_signal_i, NULL};
+static const GDBusSignalInfo _test_raw_dbus_signal_info_test_signal = {-1, "TestSignal", (GDBusArgInfo **) 
(&_test_raw_dbus_arg_info_test_signal), NULL};
+static const GDBusSignalInfo * const _test_raw_dbus_signal_info[] = 
{&_test_raw_dbus_signal_info_test_signal, NULL};
+static const GDBusPropertyInfo _test_raw_dbus_property_info_test_property = {-1, "TestProperty", "s", 
G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, NULL};
+static const GDBusPropertyInfo * const _test_raw_dbus_property_info[] = 
{&_test_raw_dbus_property_info_test_property, NULL};
+static const GDBusInterfaceInfo _test_raw_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo 
**) (&_test_raw_dbus_method_info), (GDBusSignalInfo **) (&_test_raw_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_raw_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_raw_dbus_interface_vtable = {test_raw_dbus_interface_method_call, 
test_raw_dbus_interface_get_property, test_raw_dbus_interface_set_property};
+
+gint
+test_test_method (Test* self,
+                  gint j,
+                  gint k,
+                  GError** error)
+{
+       TestIface* _iface_;
+       g_return_val_if_fail (IS_TEST (self), 0);
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->test_method) {
+               return _iface_->test_method (self, j, k, error);
+       }
+       return -1;
+}
+
+gchar*
+test_get_test_property (Test* self)
+{
+       TestIface* _iface_;
+       g_return_val_if_fail (IS_TEST (self), NULL);
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->get_test_property) {
+               return _iface_->get_test_property (self);
+       }
+       return NULL;
+}
+
+void
+test_set_test_property (Test* self,
+                        const gchar* value)
+{
+       TestIface* _iface_;
+       g_return_if_fail (IS_TEST (self));
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->set_test_property) {
+               _iface_->set_test_property (self, value);
+       }
+}
+
+static void
+test_default_init (TestIface * iface,
+                   gpointer iface_data)
+{
+       test_signals[TEST_TEST_SIGNAL_SIGNAL] = g_signal_new ("test-signal", TYPE_TEST, G_SIGNAL_RUN_LAST, 0, 
NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType test_type_id;
+       test_type_id = g_type_register_static (G_TYPE_INTERFACE, "Test", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (test_type_id, G_TYPE_OBJECT);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) 
test_proxy_get_type);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), 
"org.example.Test");
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*) 
(&_test_dbus_interface_info));
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_register_object);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_TEST, 
test_proxy_test_interface_init) )
+static void
+test_proxy_class_init (TestProxyClass* klass)
+{
+       G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal;
+}
+
+static void
+_dbus_handle_test_test_signal (Test* self,
+                               GVariant* parameters)
+{
+       GVariantIter _arguments_iter;
+       gint i = 0;
+       GVariant* _tmp0_;
+       g_variant_iter_init (&_arguments_iter, parameters);
+       _tmp0_ = g_variant_iter_next_value (&_arguments_iter);
+       i = g_variant_get_int32 (_tmp0_);
+       g_variant_unref (_tmp0_);
+       g_signal_emit_by_name (self, "test-signal", i);
+}
+
+static void
+test_proxy_g_signal (GDBusProxy* proxy,
+                     const gchar* sender_name,
+                     const gchar* signal_name,
+                     GVariant* parameters)
+{
+       if (strcmp (signal_name, "TestSignal") == 0) {
+               _dbus_handle_test_test_signal ((Test*) proxy, parameters);
+       }
+}
+
+static void
+test_proxy_init (TestProxy* self)
+{
+       g_dbus_proxy_set_interface_info (G_DBUS_PROXY (self), (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info));
+}
+
+static gint
+test_proxy_test_method (Test* self,
+                        gint j,
+                        gint k,
+                        GError** error)
+{
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       GDBusMessage *_reply_message;
+       GVariant *_reply;
+       GVariantIter _reply_iter;
+       gint _result = 0;
+       GVariant* _tmp3_;
+       G_IO_ERROR;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "TestMethod");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_arguments_builder, g_variant_new_int32 (j));
+       g_variant_builder_add_value (&_arguments_builder, g_variant_new_int32 (k));
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       _reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout 
((GDBusProxy *) self), NULL, NULL, error);
+       g_object_unref (_message);
+       if (!_reply_message) {
+               gint _tmp1_ = 0;
+               return _tmp1_;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, error)) {
+               gint _tmp2_ = 0;
+               g_object_unref (_reply_message);
+               return _tmp2_;
+       }
+       _reply = g_dbus_message_get_body (_reply_message);
+       g_variant_iter_init (&_reply_iter, _reply);
+       _tmp3_ = g_variant_iter_next_value (&_reply_iter);
+       _result = g_variant_get_int32 (_tmp3_);
+       g_variant_unref (_tmp3_);
+       g_object_unref (_reply_message);
+       return _result;
+}
+
+static gchar*
+test_dbus_proxy_get_test_property (Test* self)
+{
+       GVariant *_inner_reply;
+       gchar* _result;
+       _inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "TestProperty");
+       if (!_inner_reply) {
+               GVariant *_arguments;
+               GVariant *_reply;
+               GVariantBuilder _arguments_builder;
+               g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+               g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.example.Test"));
+               g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("TestProperty"));
+               _arguments = g_variant_builder_end (&_arguments_builder);
+               _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", 
_arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+               if (!_reply) {
+                       return NULL;
+               }
+               g_variant_get (_reply, "(v)", &_inner_reply);
+               g_variant_unref (_reply);
+       }
+       _result = g_variant_dup_string (_inner_reply, NULL);
+       g_variant_unref (_inner_reply);
+       return _result;
+}
+
+static void
+test_dbus_proxy_set_test_property (Test* self,
+                                   const gchar* value)
+{
+       GVariant *_arguments;
+       GVariant *_reply;
+       GVariantBuilder _arguments_builder;
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.example.Test"));
+       g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("TestProperty"));
+       g_variant_builder_open (&_arguments_builder, G_VARIANT_TYPE_VARIANT);
+       g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (value));
+       g_variant_builder_close (&_arguments_builder);
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Set", 
_arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+       if (!_reply) {
+               return;
+       }
+       g_variant_unref (_reply);
+}
+
+static void
+test_proxy_test_interface_init (TestIface* iface)
+{
+       iface->test_method = test_proxy_test_method;
+       iface->get_test_property = test_dbus_proxy_get_test_property;
+       iface->set_test_property = test_dbus_proxy_set_test_property;
+}
+
+static void
+_dbus_test_test_method (Test* self,
+                        GVariant* _parameters_,
+                        GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       gint j = 0;
+       GVariant* _tmp4_;
+       gint k = 0;
+       GVariant* _tmp5_;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       gint result;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _tmp4_ = g_variant_iter_next_value (&_arguments_iter);
+       j = g_variant_get_int32 (_tmp4_);
+       g_variant_unref (_tmp4_);
+       _tmp5_ = g_variant_iter_next_value (&_arguments_iter);
+       k = g_variant_get_int32 (_tmp5_);
+       g_variant_unref (_tmp5_);
+       result = test_test_method (self, j, k, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               return;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_int32 (result));
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* method_name,
+                                 GVariant* parameters,
+                                 GDBusMethodInvocation* invocation,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "TestMethod") == 0) {
+               _dbus_test_test_method (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+_dbus_test_get_test_property (Test* self)
+{
+       gchar* result;
+       GVariant* _reply;
+       result = test_get_test_property (self);
+       _reply = g_variant_new_string (result);
+       _g_free0 (result);
+       return _reply;
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (property_name, "TestProperty") == 0) {
+               return _dbus_test_get_test_property (object);
+       }
+       return NULL;
+}
+
+static void
+_dbus_test_set_test_property (Test* self,
+                              GVariant* _value)
+{
+       gchar* value = NULL;
+       value = g_variant_dup_string (_value, NULL);
+       test_set_test_property (self, value);
+       _g_free0 (value);
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GVariant* value,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (property_name, "TestProperty") == 0) {
+               _dbus_test_set_test_property (object, value);
+               return TRUE;
+       }
+       return FALSE;
+}
+
+static void
+_dbus_test_test_signal (GObject* _sender,
+                        gint i,
+                        gpointer* _data)
+{
+       GDBusConnection * _connection;
+       const gchar * _path;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       _connection = _data[1];
+       _path = _data[2];
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_arguments_builder, g_variant_new_int32 (i));
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_connection_emit_signal (_connection, NULL, _path, "org.example.Test", "TestSignal", 
_arguments, NULL);
+}
+
+guint
+test_register_object (gpointer object,
+                      GDBusConnection* connection,
+                      const gchar* path,
+                      GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       g_signal_connect (object, "test-signal", (GCallback) _dbus_test_test_signal, data);
+       return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_signal_handlers_disconnect_by_func (data[0], _dbus_test_test_signal, data);
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+GVariant*
+test_raw_test_method (TestRaw* self,
+                      GVariant* j,
+                      GVariant* k,
+                      GError** error)
+{
+       TestRawIface* _iface_;
+       g_return_val_if_fail (IS_TEST_RAW (self), NULL);
+       _iface_ = TEST_RAW_GET_INTERFACE (self);
+       if (_iface_->test_method) {
+               return _iface_->test_method (self, j, k, error);
+       }
+       return NULL;
+}
+
+GVariant*
+test_raw_get_test_property (TestRaw* self)
+{
+       TestRawIface* _iface_;
+       g_return_val_if_fail (IS_TEST_RAW (self), NULL);
+       _iface_ = TEST_RAW_GET_INTERFACE (self);
+       if (_iface_->get_test_property) {
+               return _iface_->get_test_property (self);
+       }
+       return NULL;
+}
+
+void
+test_raw_set_test_property (TestRaw* self,
+                            GVariant* value)
+{
+       TestRawIface* _iface_;
+       g_return_if_fail (IS_TEST_RAW (self));
+       _iface_ = TEST_RAW_GET_INTERFACE (self);
+       if (_iface_->set_test_property) {
+               _iface_->set_test_property (self, value);
+       }
+}
+
+static void
+test_raw_default_init (TestRawIface * iface,
+                       gpointer iface_data)
+{
+       test_raw_signals[TEST_RAW_TEST_SIGNAL_SIGNAL] = g_signal_new ("test-signal", TYPE_TEST_RAW, 
G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VARIANT, G_TYPE_NONE, 1, G_TYPE_VARIANT);
+}
+
+static GType
+test_raw_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestRawIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_raw_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType test_raw_type_id;
+       test_raw_type_id = g_type_register_static (G_TYPE_INTERFACE, "TestRaw", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (test_raw_type_id, G_TYPE_OBJECT);
+       g_type_set_qdata (test_raw_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) 
test_raw_proxy_get_type);
+       g_type_set_qdata (test_raw_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), 
"org.example.Test");
+       g_type_set_qdata (test_raw_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*) 
(&_test_raw_dbus_interface_info));
+       g_type_set_qdata (test_raw_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_raw_register_object);
+       return test_raw_type_id;
+}
+
+GType
+test_raw_get_type (void)
+{
+       static volatile gsize test_raw_type_id__volatile = 0;
+       if (g_once_init_enter (&test_raw_type_id__volatile)) {
+               GType test_raw_type_id;
+               test_raw_type_id = test_raw_get_type_once ();
+               g_once_init_leave (&test_raw_type_id__volatile, test_raw_type_id);
+       }
+       return test_raw_type_id__volatile;
+}
+
+G_DEFINE_TYPE_EXTENDED (TestRawProxy, test_raw_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE 
(TYPE_TEST_RAW, test_raw_proxy_test_raw_interface_init) )
+static void
+test_raw_proxy_class_init (TestRawProxyClass* klass)
+{
+       G_DBUS_PROXY_CLASS (klass)->g_signal = test_raw_proxy_g_signal;
+}
+
+static void
+_dbus_handle_test_raw_test_signal (TestRaw* self,
+                                   GVariant* parameters)
+{
+       GVariantIter _arguments_iter;
+       GVariant* i = NULL;
+       g_variant_iter_init (&_arguments_iter, parameters);
+       i = g_variant_iter_next_value (&_arguments_iter);
+       g_signal_emit_by_name (self, "test-signal", i);
+       _g_variant_unref0 (i);
+}
+
+static void
+test_raw_proxy_g_signal (GDBusProxy* proxy,
+                         const gchar* sender_name,
+                         const gchar* signal_name,
+                         GVariant* parameters)
+{
+       if (strcmp (signal_name, "TestSignal") == 0) {
+               _dbus_handle_test_raw_test_signal ((TestRaw*) proxy, parameters);
+       }
+}
+
+static void
+test_raw_proxy_init (TestRawProxy* self)
+{
+       g_dbus_proxy_set_interface_info (G_DBUS_PROXY (self), (GDBusInterfaceInfo *) 
(&_test_raw_dbus_interface_info));
+}
+
+static GVariant*
+test_raw_proxy_test_method (TestRaw* self,
+                            GVariant* j,
+                            GVariant* k,
+                            GError** error)
+{
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       GDBusMessage *_reply_message;
+       GVariant *_reply;
+       GVariantIter _reply_iter;
+       GVariant* _result = NULL;
+       G_IO_ERROR;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "TestMethod");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_arguments_builder, j);
+       g_variant_builder_add_value (&_arguments_builder, k);
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       _reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout 
((GDBusProxy *) self), NULL, NULL, error);
+       g_object_unref (_message);
+       if (!_reply_message) {
+               return NULL;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, error)) {
+               g_object_unref (_reply_message);
+               return NULL;
+       }
+       _reply = g_dbus_message_get_body (_reply_message);
+       g_variant_iter_init (&_reply_iter, _reply);
+       _result = g_variant_iter_next_value (&_reply_iter);
+       g_object_unref (_reply_message);
+       return _result;
+}
+
+static GVariant*
+test_raw_dbus_proxy_get_test_property (TestRaw* self)
+{
+       GVariant *_inner_reply;
+       GVariant* _result;
+       _inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "TestProperty");
+       if (!_inner_reply) {
+               GVariant *_arguments;
+               GVariant *_reply;
+               GVariantBuilder _arguments_builder;
+               g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+               g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.example.Test"));
+               g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("TestProperty"));
+               _arguments = g_variant_builder_end (&_arguments_builder);
+               _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", 
_arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+               if (!_reply) {
+                       return NULL;
+               }
+               g_variant_get (_reply, "(v)", &_inner_reply);
+               g_variant_unref (_reply);
+       }
+       _result = _inner_reply;
+       return _result;
+}
+
+static void
+test_raw_dbus_proxy_set_test_property (TestRaw* self,
+                                       GVariant* value)
+{
+       GVariant *_arguments;
+       GVariant *_reply;
+       GVariantBuilder _arguments_builder;
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.example.Test"));
+       g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("TestProperty"));
+       g_variant_builder_open (&_arguments_builder, G_VARIANT_TYPE_VARIANT);
+       g_variant_builder_add_value (&_arguments_builder, value);
+       g_variant_builder_close (&_arguments_builder);
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Set", 
_arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+       if (!_reply) {
+               return;
+       }
+       g_variant_unref (_reply);
+}
+
+static void
+test_raw_proxy_test_raw_interface_init (TestRawIface* iface)
+{
+       iface->test_method = test_raw_proxy_test_method;
+       iface->get_test_property = test_raw_dbus_proxy_get_test_property;
+       iface->set_test_property = test_raw_dbus_proxy_set_test_property;
+}
+
+static void
+_dbus_test_raw_test_method (TestRaw* self,
+                            GVariant* _parameters_,
+                            GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       GVariant* j = NULL;
+       GVariant* k = NULL;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       GVariant* result;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       j = g_variant_iter_next_value (&_arguments_iter);
+       k = g_variant_iter_next_value (&_arguments_iter);
+       result = test_raw_test_method (self, j, k, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               goto _error;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_reply_builder, result);
+       _g_variant_unref0 (result);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+       _error:
+       _g_variant_unref0 (j);
+       _g_variant_unref0 (k);
+       ;
+}
+
+static void
+test_raw_dbus_interface_method_call (GDBusConnection* connection,
+                                     const gchar* sender,
+                                     const gchar* object_path,
+                                     const gchar* interface_name,
+                                     const gchar* method_name,
+                                     GVariant* parameters,
+                                     GDBusMethodInvocation* invocation,
+                                     gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "TestMethod") == 0) {
+               _dbus_test_raw_test_method (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+_dbus_test_raw_get_test_property (TestRaw* self)
+{
+       GVariant* result;
+       GVariant* _reply;
+       result = test_raw_get_test_property (self);
+       _reply = result;
+       return _reply;
+}
+
+static GVariant*
+test_raw_dbus_interface_get_property (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* property_name,
+                                      GError** error,
+                                      gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (property_name, "TestProperty") == 0) {
+               return _dbus_test_raw_get_test_property (object);
+       }
+       return NULL;
+}
+
+static void
+_dbus_test_raw_set_test_property (TestRaw* self,
+                                  GVariant* _value)
+{
+       GVariant* value = NULL;
+       value = _value;
+       test_raw_set_test_property (self, value);
+}
+
+static gboolean
+test_raw_dbus_interface_set_property (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* property_name,
+                                      GVariant* value,
+                                      GError** error,
+                                      gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (property_name, "TestProperty") == 0) {
+               _dbus_test_raw_set_test_property (object, value);
+               return TRUE;
+       }
+       return FALSE;
+}
+
+static void
+_dbus_test_raw_test_signal (GObject* _sender,
+                            GVariant* i,
+                            gpointer* _data)
+{
+       GDBusConnection * _connection;
+       const gchar * _path;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       _connection = _data[1];
+       _path = _data[2];
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_arguments_builder, i);
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_connection_emit_signal (_connection, NULL, _path, "org.example.Test", "TestSignal", 
_arguments, NULL);
+}
+
+guint
+test_raw_register_object (gpointer object,
+                          GDBusConnection* connection,
+                          const gchar* path,
+                          GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_raw_dbus_interface_info), &_test_raw_dbus_interface_vtable, data, _test_raw_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       g_signal_connect (object, "test-signal", (GCallback) _dbus_test_raw_test_signal, data);
+       return result;
+}
+
+static void
+_test_raw_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_signal_handlers_disconnect_by_func (data[0], _dbus_test_raw_test_signal, data);
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               _g_main_loop_unref0 (_data1_->main_loop);
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static gint
+_variant_get1 (GVariant* value)
+{
+       return g_variant_get_int32 (value);
+}
+
+static void
+__lambda4_ (Block1Data* _data1_,
+            GVariant* var_i)
+{
+       gint i = 0;
+       gint _tmp0_;
+       g_return_if_fail (var_i != NULL);
+       _tmp0_ = _variant_get1 (var_i);
+       i = _tmp0_;
+       _vala_assert (i == 46, "i == 46");
+       g_main_loop_quit (_data1_->main_loop);
+}
+
+static void
+___lambda4__test_raw_test_signal (TestRaw* _sender,
+                                  GVariant* i,
+                                  gpointer self)
+{
+       __lambda4_ (self, i);
+}
+
+static GVariant*
+_variant_new1 (gint value)
+{
+       return g_variant_ref_sink (g_variant_new_int32 (value));
+}
+
+static GVariant*
+_variant_new2 (gint value)
+{
+       return g_variant_ref_sink (g_variant_new_int32 (value));
+}
+
+static gint
+_variant_get2 (GVariant* value)
+{
+       return g_variant_get_int32 (value);
+}
+
+static GVariant*
+_variant_new3 (const gchar* value)
+{
+       return g_variant_ref_sink (g_variant_new_string (value));
+}
+
+static gchar*
+_variant_get3 (GVariant* value)
+{
+       return g_variant_dup_string (value, NULL);
+}
+
+void
+test_raw (TestRaw* test)
+{
+       Block1Data* _data1_;
+       GMainLoop* _tmp0_;
+       gulong id = 0UL;
+       gulong _tmp1_;
+       GVariant* _tmp2_ = NULL;
+       GVariant* _tmp3_;
+       GVariant* _tmp4_;
+       GVariant* _tmp5_;
+       GVariant* _tmp6_;
+       gint j = 0;
+       gint _tmp7_;
+       GVariant* _tmp8_;
+       gchar* s = NULL;
+       GVariant* _tmp9_;
+       GVariant* _tmp10_;
+       GVariant* _tmp11_;
+       gchar* _tmp12_;
+       gchar* _tmp13_;
+       const gchar* _tmp14_;
+       GError* _inner_error0_ = NULL;
+       g_return_if_fail (IS_TEST_RAW (test));
+       _data1_ = g_slice_new0 (Block1Data);
+       _data1_->_ref_count_ = 1;
+       _tmp0_ = g_main_loop_new (NULL, FALSE);
+       _data1_->main_loop = _tmp0_;
+       _tmp1_ = g_signal_connect_data (test, "test-signal", (GCallback) ___lambda4__test_raw_test_signal, 
block1_data_ref (_data1_), (GClosureNotify) block1_data_unref, 0);
+       id = _tmp1_;
+       _tmp3_ = _variant_new1 (23);
+       _tmp4_ = _variant_new2 (11);
+       _tmp5_ = test_raw_test_method (test, _tmp3_, _tmp4_, &_inner_error0_);
+       _tmp6_ = _tmp5_;
+       _g_variant_unref0 (_tmp4_);
+       _g_variant_unref0 (_tmp3_);
+       _tmp2_ = _tmp6_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               block1_data_unref (_data1_);
+               _data1_ = NULL;
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp7_ = _variant_get2 (_tmp2_);
+       j = _tmp7_;
+       _vala_assert (j == 42, "j == 42");
+       g_main_loop_run (_data1_->main_loop);
+       g_signal_handler_disconnect (G_TYPE_CHECK_INSTANCE_CAST (test, G_TYPE_OBJECT, GObject), id);
+       _tmp8_ = _variant_new3 ("hello");
+       test_raw_set_test_property (test, _tmp8_);
+       _g_variant_unref0 (_tmp8_);
+       _tmp9_ = test_raw_get_test_property (test);
+       _tmp10_ = _tmp9_;
+       _tmp11_ = _tmp10_;
+       _tmp12_ = _variant_get3 (_tmp11_);
+       _tmp13_ = _tmp12_;
+       _g_variant_unref0 (_tmp11_);
+       s = _tmp13_;
+       _tmp14_ = s;
+       _vala_assert (g_strcmp0 (_tmp14_, "hello") == 0, "s == \"hello\"");
+       _g_free0 (s);
+       _g_variant_unref0 (_tmp2_);
+       block1_data_unref (_data1_);
+       _data1_ = NULL;
+}
+
+static Block2Data*
+block2_data_ref (Block2Data* _data2_)
+{
+       g_atomic_int_inc (&_data2_->_ref_count_);
+       return _data2_;
+}
+
+static void
+block2_data_unref (void * _userdata_)
+{
+       Block2Data* _data2_;
+       _data2_ = (Block2Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data2_->_ref_count_)) {
+               _g_main_loop_unref0 (_data2_->main_loop);
+               g_slice_free (Block2Data, _data2_);
+       }
+}
+
+static void
+__lambda5_ (Block2Data* _data2_,
+            gint i)
+{
+       _vala_assert (i == 46, "i == 46");
+       g_main_loop_quit (_data2_->main_loop);
+}
+
+static void
+___lambda5__test_test_signal (Test* _sender,
+                              gint i,
+                              gpointer self)
+{
+       __lambda5_ (self, i);
+}
+
+void
+test (Test* test)
+{
+       Block2Data* _data2_;
+       GMainLoop* _tmp0_;
+       gulong id = 0UL;
+       gulong _tmp1_;
+       gint j = 0;
+       gchar* s = NULL;
+       gchar* _tmp2_;
+       gchar* _tmp3_;
+       const gchar* _tmp4_;
+       GError* _inner_error0_ = NULL;
+       g_return_if_fail (IS_TEST (test));
+       _data2_ = g_slice_new0 (Block2Data);
+       _data2_->_ref_count_ = 1;
+       _tmp0_ = g_main_loop_new (NULL, FALSE);
+       _data2_->main_loop = _tmp0_;
+       _tmp1_ = g_signal_connect_data (test, "test-signal", (GCallback) ___lambda5__test_test_signal, 
block2_data_ref (_data2_), (GClosureNotify) block2_data_unref, 0);
+       id = _tmp1_;
+       j = test_test_method (test, 23, 11, &_inner_error0_);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               block2_data_unref (_data2_);
+               _data2_ = NULL;
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _vala_assert (j == 42, "j == 42");
+       g_main_loop_run (_data2_->main_loop);
+       g_signal_handler_disconnect (G_TYPE_CHECK_INSTANCE_CAST (test, G_TYPE_OBJECT, GObject), id);
+       test_set_test_property (test, "hello");
+       _tmp2_ = test_get_test_property (test);
+       _tmp3_ = _tmp2_;
+       s = _tmp3_;
+       _tmp4_ = s;
+       _vala_assert (g_strcmp0 (_tmp4_, "hello") == 0, "s == \"hello\"");
+       _g_free0 (s);
+       block2_data_unref (_data2_);
+       _data2_ = NULL;
+}
+
+static void
+_vala_main (void)
+{
+       Test* test1 = NULL;
+       Test* _tmp0_;
+       Test* _tmp1_;
+       TestRaw* test2 = NULL;
+       TestRaw* _tmp2_;
+       TestRaw* _tmp3_;
+       TestRaw* test3 = NULL;
+       TestRaw* _tmp4_;
+       TestRaw* _tmp5_;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = (Test*) g_initable_new (TYPE_TEST_PROXY, NULL, &_inner_error0_, "g-flags", 
G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, "g-name", "org.example.Test", "g-bus-type", G_BUS_TYPE_SESSION, 
"g-object-path", "/org/example/testraw", "g-interface-name", "org.example.Test", NULL);
+       test1 = (Test*) _tmp0_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp1_ = test1;
+       test (_tmp1_);
+       _tmp2_ = (TestRaw*) g_initable_new (TYPE_TEST_RAW_PROXY, NULL, &_inner_error0_, "g-flags", 
G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, "g-name", "org.example.Test", "g-bus-type", G_BUS_TYPE_SESSION, 
"g-object-path", "/org/example/test", "g-interface-name", "org.example.Test", NULL);
+       test2 = (TestRaw*) _tmp2_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (test1);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp3_ = test2;
+       test_raw (_tmp3_);
+       _tmp4_ = (TestRaw*) g_initable_new (TYPE_TEST_RAW_PROXY, NULL, &_inner_error0_, "g-flags", 
G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, "g-name", "org.example.Test", "g-bus-type", G_BUS_TYPE_SESSION, 
"g-object-path", "/org/example/testraw", "g-interface-name", "org.example.Test", NULL);
+       test3 = (TestRaw*) _tmp4_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (test2);
+               _g_object_unref0 (test1);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp5_ = test3;
+       test_raw (_tmp5_);
+       _g_object_unref0 (test3);
+       _g_object_unref0 (test2);
+       _g_object_unref0 (test1);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/dbus/rawvariants_server.c-expected b/tests/dbus/rawvariants_server.c-expected
new file mode 100644
index 000000000..f1e88b5cf
--- /dev/null
+++ b/tests/dbus/rawvariants_server.c-expected
@@ -0,0 +1,1095 @@
+/* dbus_rawvariants_server.c generated by valac, the Vala compiler
+ * generated from dbus_rawvariants_server.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TEST, TestClass))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define IS_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TEST))
+#define TEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TEST, TestClass))
+
+typedef struct _Test Test;
+typedef struct _TestClass TestClass;
+typedef struct _TestPrivate TestPrivate;
+enum  {
+       TEST_0_PROPERTY,
+       TEST_TEST_PROPERTY_PROPERTY,
+       TEST_NUM_PROPERTIES
+};
+static GParamSpec* test_properties[TEST_NUM_PROPERTIES];
+#define _g_free0(var) (var = (g_free (var), NULL))
+enum  {
+       TEST_TEST_SIGNAL_SIGNAL,
+       TEST_NUM_SIGNALS
+};
+static guint test_signals[TEST_NUM_SIGNALS] = {0};
+
+#define TYPE_TEST_RAW (test_raw_get_type ())
+#define TEST_RAW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST_RAW, TestRaw))
+#define TEST_RAW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TEST_RAW, TestRawClass))
+#define IS_TEST_RAW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST_RAW))
+#define IS_TEST_RAW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TEST_RAW))
+#define TEST_RAW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TEST_RAW, TestRawClass))
+
+typedef struct _TestRaw TestRaw;
+typedef struct _TestRawClass TestRawClass;
+typedef struct _TestRawPrivate TestRawPrivate;
+enum  {
+       TEST_RAW_0_PROPERTY,
+       TEST_RAW_TEST_PROPERTY_PROPERTY,
+       TEST_RAW_NUM_PROPERTIES
+};
+static GParamSpec* test_raw_properties[TEST_RAW_NUM_PROPERTIES];
+#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
+enum  {
+       TEST_RAW_TEST_SIGNAL_SIGNAL,
+       TEST_RAW_NUM_SIGNALS
+};
+static guint test_raw_signals[TEST_RAW_NUM_SIGNALS] = {0};
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Test {
+       GObject parent_instance;
+       TestPrivate * priv;
+};
+
+struct _TestClass {
+       GObjectClass parent_class;
+};
+
+struct _TestPrivate {
+       gchar* _test_property;
+};
+
+struct _TestRaw {
+       GObject parent_instance;
+       TestRawPrivate * priv;
+};
+
+struct _TestRawClass {
+       GObjectClass parent_class;
+};
+
+struct _TestRawPrivate {
+       GVariant* _test_property;
+};
+
+static gint Test_private_offset;
+static gpointer test_parent_class = NULL;
+static gint TestRaw_private_offset;
+static gpointer test_raw_parent_class = NULL;
+VALA_EXTERN GMainLoop* main_loop;
+GMainLoop* main_loop = NULL;
+
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
+VALA_EXTERN guint test_register_object (void* object,
+                            GDBusConnection* connection,
+                            const gchar* path,
+                            GError** error);
+VALA_EXTERN gint test_test_method (Test* self,
+                       gint j,
+                       gint k);
+VALA_EXTERN Test* test_new (void);
+VALA_EXTERN Test* test_construct (GType object_type);
+VALA_EXTERN gchar* test_get_test_property (Test* self);
+VALA_EXTERN void test_set_test_property (Test* self,
+                             const gchar* value);
+static void test_finalize (GObject * obj);
+static GType test_get_type_once (void);
+static void _vala_test_get_property (GObject * object,
+                              guint property_id,
+                              GValue * value,
+                              GParamSpec * pspec);
+static void _vala_test_set_property (GObject * object,
+                              guint property_id,
+                              const GValue * value,
+                              GParamSpec * pspec);
+static void _dbus_test_test_method (Test* self,
+                             GVariant* _parameters_,
+                             GDBusMethodInvocation* invocation);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* method_name,
+                                      GVariant* parameters,
+                                      GDBusMethodInvocation* invocation,
+                                      gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+                                            const gchar* sender,
+                                            const gchar* object_path,
+                                            const gchar* interface_name,
+                                            const gchar* property_name,
+                                            GError** error,
+                                            gpointer user_data);
+static GVariant* _dbus_test_get_test_property (Test* self);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GVariant* value,
+                                           GError** error,
+                                           gpointer user_data);
+static void _dbus_test_set_test_property (Test* self,
+                                   GVariant* _value);
+static void _dbus_test_test_signal (GObject* _sender,
+                             gint i,
+                             gpointer* _data);
+static void _test_unregister_object (gpointer user_data);
+VALA_EXTERN GType test_raw_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (TestRaw, g_object_unref)
+VALA_EXTERN guint test_raw_register_object (void* object,
+                                GDBusConnection* connection,
+                                const gchar* path,
+                                GError** error);
+VALA_EXTERN GVariant* test_raw_test_method (TestRaw* self,
+                                GVariant* j,
+                                GVariant* k);
+static gint _variant_get1 (GVariant* value);
+static gint _variant_get2 (GVariant* value);
+static GVariant* _variant_new1 (gint value);
+static GVariant* _variant_new2 (gint value);
+VALA_EXTERN TestRaw* test_raw_new (void);
+VALA_EXTERN TestRaw* test_raw_construct (GType object_type);
+VALA_EXTERN GVariant* test_raw_get_test_property (TestRaw* self);
+VALA_EXTERN void test_raw_set_test_property (TestRaw* self,
+                                 GVariant* value);
+static void test_raw_finalize (GObject * obj);
+static GType test_raw_get_type_once (void);
+static void _vala_test_raw_get_property (GObject * object,
+                                  guint property_id,
+                                  GValue * value,
+                                  GParamSpec * pspec);
+static void _vala_test_raw_set_property (GObject * object,
+                                  guint property_id,
+                                  const GValue * value,
+                                  GParamSpec * pspec);
+static void _dbus_test_raw_test_method (TestRaw* self,
+                                 GVariant* _parameters_,
+                                 GDBusMethodInvocation* invocation);
+static void test_raw_dbus_interface_method_call (GDBusConnection* connection,
+                                          const gchar* sender,
+                                          const gchar* object_path,
+                                          const gchar* interface_name,
+                                          const gchar* method_name,
+                                          GVariant* parameters,
+                                          GDBusMethodInvocation* invocation,
+                                          gpointer user_data);
+static GVariant* test_raw_dbus_interface_get_property (GDBusConnection* connection,
+                                                const gchar* sender,
+                                                const gchar* object_path,
+                                                const gchar* interface_name,
+                                                const gchar* property_name,
+                                                GError** error,
+                                                gpointer user_data);
+static GVariant* _dbus_test_raw_get_test_property (TestRaw* self);
+static gboolean test_raw_dbus_interface_set_property (GDBusConnection* connection,
+                                               const gchar* sender,
+                                               const gchar* object_path,
+                                               const gchar* interface_name,
+                                               const gchar* property_name,
+                                               GVariant* value,
+                                               GError** error,
+                                               gpointer user_data);
+static void _dbus_test_raw_set_test_property (TestRaw* self,
+                                       GVariant* _value);
+static void _dbus_test_raw_test_signal (GObject* _sender,
+                                 GVariant* i,
+                                 gpointer* _data);
+static void _test_raw_unregister_object (gpointer user_data);
+VALA_EXTERN void client_exit (GPid pid,
+                  gint status);
+static void _vala_main (void);
+static guint _variant_get3 (GVariant* value);
+static void _client_exit_gchild_watch_func (GPid pid,
+                                     gint wait_status,
+                                     gpointer self);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static const GDBusArgInfo _test_dbus_arg_info_test_method_j = {-1, "j", "i", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_method_k = {-1, "k", "i", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_method_result = {-1, "result", "i", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_method_in[] = 
{&_test_dbus_arg_info_test_method_j, &_test_dbus_arg_info_test_method_k, NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_method_out[] = 
{&_test_dbus_arg_info_test_method_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_method = {-1, "TestMethod", (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_method_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_method_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_test_method, NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_signal_i = {-1, "i", "i", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_signal[] = {&_test_dbus_arg_info_test_signal_i, 
NULL};
+static const GDBusSignalInfo _test_dbus_signal_info_test_signal = {-1, "TestSignal", (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_signal), NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {&_test_dbus_signal_info_test_signal, NULL};
+static const GDBusPropertyInfo _test_dbus_property_info_test_property = {-1, "TestProperty", "s", 
G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = 
{&_test_dbus_property_info_test_property, NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) 
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, 
test_dbus_interface_get_property, test_dbus_interface_set_property};
+static const GDBusArgInfo _test_raw_dbus_arg_info_test_method_j = {-1, "j", "i", NULL};
+static const GDBusArgInfo _test_raw_dbus_arg_info_test_method_k = {-1, "k", "i", NULL};
+static const GDBusArgInfo _test_raw_dbus_arg_info_test_method_result = {-1, "result", "i", NULL};
+static const GDBusArgInfo * const _test_raw_dbus_arg_info_test_method_in[] = 
{&_test_raw_dbus_arg_info_test_method_j, &_test_raw_dbus_arg_info_test_method_k, NULL};
+static const GDBusArgInfo * const _test_raw_dbus_arg_info_test_method_out[] = 
{&_test_raw_dbus_arg_info_test_method_result, NULL};
+static const GDBusMethodInfo _test_raw_dbus_method_info_test_method = {-1, "TestMethod", (GDBusArgInfo **) 
(&_test_raw_dbus_arg_info_test_method_in), (GDBusArgInfo **) (&_test_raw_dbus_arg_info_test_method_out), 
NULL};
+static const GDBusMethodInfo * const _test_raw_dbus_method_info[] = 
{&_test_raw_dbus_method_info_test_method, NULL};
+static const GDBusArgInfo _test_raw_dbus_arg_info_test_signal_i = {-1, "i", "i", NULL};
+static const GDBusArgInfo * const _test_raw_dbus_arg_info_test_signal[] = 
{&_test_raw_dbus_arg_info_test_signal_i, NULL};
+static const GDBusSignalInfo _test_raw_dbus_signal_info_test_signal = {-1, "TestSignal", (GDBusArgInfo **) 
(&_test_raw_dbus_arg_info_test_signal), NULL};
+static const GDBusSignalInfo * const _test_raw_dbus_signal_info[] = 
{&_test_raw_dbus_signal_info_test_signal, NULL};
+static const GDBusPropertyInfo _test_raw_dbus_property_info_test_property = {-1, "TestProperty", "s", 
G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, NULL};
+static const GDBusPropertyInfo * const _test_raw_dbus_property_info[] = 
{&_test_raw_dbus_property_info_test_property, NULL};
+static const GDBusInterfaceInfo _test_raw_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo 
**) (&_test_raw_dbus_method_info), (GDBusSignalInfo **) (&_test_raw_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_raw_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_raw_dbus_interface_vtable = {test_raw_dbus_interface_method_call, 
test_raw_dbus_interface_get_property, test_raw_dbus_interface_set_property};
+
+static inline gpointer
+test_get_instance_private (Test* self)
+{
+       return G_STRUCT_MEMBER_P (self, Test_private_offset);
+}
+
+gint
+test_test_method (Test* self,
+                  gint j,
+                  gint k)
+{
+       gint result = 0;
+       g_return_val_if_fail (IS_TEST (self), 0);
+       _vala_assert (j == 23, "j == 23");
+       _vala_assert (k == 11, "k == 11");
+       g_signal_emit (self, test_signals[TEST_TEST_SIGNAL_SIGNAL], 0, 46);
+       result = 42;
+       return result;
+}
+
+Test*
+test_construct (GType object_type)
+{
+       Test * self = NULL;
+       self = (Test*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Test*
+test_new (void)
+{
+       return test_construct (TYPE_TEST);
+}
+
+gchar*
+test_get_test_property (Test* self)
+{
+       gchar* result;
+       const gchar* _tmp0_;
+       gchar* _tmp1_;
+       g_return_val_if_fail (IS_TEST (self), NULL);
+       _tmp0_ = self->priv->_test_property;
+       _tmp1_ = g_strdup (_tmp0_);
+       result = _tmp1_;
+       return result;
+}
+
+void
+test_set_test_property (Test* self,
+                        const gchar* value)
+{
+       gchar* old_value;
+       g_return_if_fail (IS_TEST (self));
+       old_value = test_get_test_property (self);
+       if (g_strcmp0 (value, old_value) != 0) {
+               gchar* _tmp0_;
+               _tmp0_ = g_strdup (value);
+               _g_free0 (self->priv->_test_property);
+               self->priv->_test_property = _tmp0_;
+               g_object_notify_by_pspec ((GObject *) self, test_properties[TEST_TEST_PROPERTY_PROPERTY]);
+       }
+       _g_free0 (old_value);
+}
+
+static void
+test_class_init (TestClass * klass,
+                 gpointer klass_data)
+{
+       test_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Test_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_test_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_test_set_property;
+       G_OBJECT_CLASS (klass)->finalize = test_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), TEST_TEST_PROPERTY_PROPERTY, 
test_properties[TEST_TEST_PROPERTY_PROPERTY] = g_param_spec_string ("test-property", "test-property", 
"test-property", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       test_signals[TEST_TEST_SIGNAL_SIGNAL] = g_signal_new ("test-signal", TYPE_TEST, G_SIGNAL_RUN_LAST, 0, 
NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
+}
+
+static void
+test_instance_init (Test * self,
+                    gpointer klass)
+{
+       self->priv = test_get_instance_private (self);
+}
+
+static void
+test_finalize (GObject * obj)
+{
+       Test * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_TEST, Test);
+       _g_free0 (self->priv->_test_property);
+       G_OBJECT_CLASS (test_parent_class)->finalize (obj);
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Test), 
0, (GInstanceInitFunc) test_instance_init, NULL };
+       GType test_type_id;
+       test_type_id = g_type_register_static (G_TYPE_OBJECT, "Test", &g_define_type_info, 0);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_register_object);
+       Test_private_offset = g_type_add_instance_private (test_type_id, sizeof (TestPrivate));
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+static void
+_vala_test_get_property (GObject * object,
+                         guint property_id,
+                         GValue * value,
+                         GParamSpec * pspec)
+{
+       Test * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+       switch (property_id) {
+               case TEST_TEST_PROPERTY_PROPERTY:
+               g_value_take_string (value, test_get_test_property (self));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_test_set_property (GObject * object,
+                         guint property_id,
+                         const GValue * value,
+                         GParamSpec * pspec)
+{
+       Test * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+       switch (property_id) {
+               case TEST_TEST_PROPERTY_PROPERTY:
+               test_set_test_property (self, g_value_get_string (value));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_dbus_test_test_method (Test* self,
+                        GVariant* _parameters_,
+                        GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       gint j = 0;
+       GVariant* _tmp0_;
+       gint k = 0;
+       GVariant* _tmp1_;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       gint result;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _tmp0_ = g_variant_iter_next_value (&_arguments_iter);
+       j = g_variant_get_int32 (_tmp0_);
+       g_variant_unref (_tmp0_);
+       _tmp1_ = g_variant_iter_next_value (&_arguments_iter);
+       k = g_variant_get_int32 (_tmp1_);
+       g_variant_unref (_tmp1_);
+       result = test_test_method (self, j, k);
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_reply_builder, g_variant_new_int32 (result));
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* method_name,
+                                 GVariant* parameters,
+                                 GDBusMethodInvocation* invocation,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "TestMethod") == 0) {
+               _dbus_test_test_method (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+_dbus_test_get_test_property (Test* self)
+{
+       gchar* result;
+       GVariant* _reply;
+       result = test_get_test_property (self);
+       _reply = g_variant_new_string (result);
+       _g_free0 (result);
+       return _reply;
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (property_name, "TestProperty") == 0) {
+               return _dbus_test_get_test_property (object);
+       }
+       return NULL;
+}
+
+static void
+_dbus_test_set_test_property (Test* self,
+                              GVariant* _value)
+{
+       gchar* value = NULL;
+       value = g_variant_dup_string (_value, NULL);
+       test_set_test_property (self, value);
+       _g_free0 (value);
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GVariant* value,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (property_name, "TestProperty") == 0) {
+               _dbus_test_set_test_property (object, value);
+               return TRUE;
+       }
+       return FALSE;
+}
+
+static void
+_dbus_test_test_signal (GObject* _sender,
+                        gint i,
+                        gpointer* _data)
+{
+       GDBusConnection * _connection;
+       const gchar * _path;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       _connection = _data[1];
+       _path = _data[2];
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_arguments_builder, g_variant_new_int32 (i));
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_connection_emit_signal (_connection, NULL, _path, "org.example.Test", "TestSignal", 
_arguments, NULL);
+}
+
+guint
+test_register_object (gpointer object,
+                      GDBusConnection* connection,
+                      const gchar* path,
+                      GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       g_signal_connect (object, "test-signal", (GCallback) _dbus_test_test_signal, data);
+       return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_signal_handlers_disconnect_by_func (data[0], _dbus_test_test_signal, data);
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+static inline gpointer
+test_raw_get_instance_private (TestRaw* self)
+{
+       return G_STRUCT_MEMBER_P (self, TestRaw_private_offset);
+}
+
+static gint
+_variant_get1 (GVariant* value)
+{
+       return g_variant_get_int32 (value);
+}
+
+static gint
+_variant_get2 (GVariant* value)
+{
+       return g_variant_get_int32 (value);
+}
+
+static GVariant*
+_variant_new1 (gint value)
+{
+       return g_variant_ref_sink (g_variant_new_int32 (value));
+}
+
+static GVariant*
+_variant_new2 (gint value)
+{
+       return g_variant_ref_sink (g_variant_new_int32 (value));
+}
+
+GVariant*
+test_raw_test_method (TestRaw* self,
+                      GVariant* j,
+                      GVariant* k)
+{
+       gint _tmp0_;
+       gint _tmp1_;
+       GVariant* _tmp2_;
+       GVariant* _tmp3_;
+       GVariant* result = NULL;
+       g_return_val_if_fail (IS_TEST_RAW (self), NULL);
+       g_return_val_if_fail (j != NULL, NULL);
+       g_return_val_if_fail (k != NULL, NULL);
+       _tmp0_ = _variant_get1 (j);
+       _vala_assert (_tmp0_ == 23, "(int) j == 23");
+       _tmp1_ = _variant_get2 (k);
+       _vala_assert (_tmp1_ == 11, "(int) k == 11");
+       _tmp2_ = _variant_new1 (46);
+       g_signal_emit (self, test_raw_signals[TEST_RAW_TEST_SIGNAL_SIGNAL], 0, _tmp2_);
+       _g_variant_unref0 (_tmp2_);
+       _tmp3_ = _variant_new2 (42);
+       result = _tmp3_;
+       return result;
+}
+
+TestRaw*
+test_raw_construct (GType object_type)
+{
+       TestRaw * self = NULL;
+       self = (TestRaw*) g_object_new (object_type, NULL);
+       return self;
+}
+
+TestRaw*
+test_raw_new (void)
+{
+       return test_raw_construct (TYPE_TEST_RAW);
+}
+
+static gpointer
+_g_variant_ref0 (gpointer self)
+{
+       return self ? g_variant_ref (self) : NULL;
+}
+
+GVariant*
+test_raw_get_test_property (TestRaw* self)
+{
+       GVariant* result;
+       GVariant* _tmp0_;
+       GVariant* _tmp1_;
+       g_return_val_if_fail (IS_TEST_RAW (self), NULL);
+       _tmp0_ = self->priv->_test_property;
+       _tmp1_ = _g_variant_ref0 (_tmp0_);
+       result = _tmp1_;
+       return result;
+}
+
+void
+test_raw_set_test_property (TestRaw* self,
+                            GVariant* value)
+{
+       GVariant* old_value;
+       g_return_if_fail (IS_TEST_RAW (self));
+       old_value = test_raw_get_test_property (self);
+       if (old_value != value) {
+               GVariant* _tmp0_;
+               _tmp0_ = _g_variant_ref0 (value);
+               _g_variant_unref0 (self->priv->_test_property);
+               self->priv->_test_property = _tmp0_;
+               g_object_notify_by_pspec ((GObject *) self, 
test_raw_properties[TEST_RAW_TEST_PROPERTY_PROPERTY]);
+       }
+       _g_variant_unref0 (old_value);
+}
+
+static void
+test_raw_class_init (TestRawClass * klass,
+                     gpointer klass_data)
+{
+       test_raw_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &TestRaw_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_test_raw_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_test_raw_set_property;
+       G_OBJECT_CLASS (klass)->finalize = test_raw_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), TEST_RAW_TEST_PROPERTY_PROPERTY, 
test_raw_properties[TEST_RAW_TEST_PROPERTY_PROPERTY] = g_param_spec_variant ("test-property", 
"test-property", "test-property", G_VARIANT_TYPE_ANY, NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | 
G_PARAM_WRITABLE));
+       test_raw_signals[TEST_RAW_TEST_SIGNAL_SIGNAL] = g_signal_new ("test-signal", TYPE_TEST_RAW, 
G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VARIANT, G_TYPE_NONE, 1, G_TYPE_VARIANT);
+}
+
+static void
+test_raw_instance_init (TestRaw * self,
+                        gpointer klass)
+{
+       self->priv = test_raw_get_instance_private (self);
+}
+
+static void
+test_raw_finalize (GObject * obj)
+{
+       TestRaw * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_TEST_RAW, TestRaw);
+       _g_variant_unref0 (self->priv->_test_property);
+       G_OBJECT_CLASS (test_raw_parent_class)->finalize (obj);
+}
+
+static GType
+test_raw_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestRawClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_raw_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(TestRaw), 0, (GInstanceInitFunc) test_raw_instance_init, NULL };
+       GType test_raw_type_id;
+       test_raw_type_id = g_type_register_static (G_TYPE_OBJECT, "TestRaw", &g_define_type_info, 0);
+       g_type_set_qdata (test_raw_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_raw_register_object);
+       TestRaw_private_offset = g_type_add_instance_private (test_raw_type_id, sizeof (TestRawPrivate));
+       return test_raw_type_id;
+}
+
+GType
+test_raw_get_type (void)
+{
+       static volatile gsize test_raw_type_id__volatile = 0;
+       if (g_once_init_enter (&test_raw_type_id__volatile)) {
+               GType test_raw_type_id;
+               test_raw_type_id = test_raw_get_type_once ();
+               g_once_init_leave (&test_raw_type_id__volatile, test_raw_type_id);
+       }
+       return test_raw_type_id__volatile;
+}
+
+static void
+_vala_test_raw_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec)
+{
+       TestRaw * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST_RAW, TestRaw);
+       switch (property_id) {
+               case TEST_RAW_TEST_PROPERTY_PROPERTY:
+               g_value_take_variant (value, test_raw_get_test_property (self));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_test_raw_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec)
+{
+       TestRaw * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST_RAW, TestRaw);
+       switch (property_id) {
+               case TEST_RAW_TEST_PROPERTY_PROPERTY:
+               test_raw_set_test_property (self, g_value_get_variant (value));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_dbus_test_raw_test_method (TestRaw* self,
+                            GVariant* _parameters_,
+                            GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       GVariant* j = NULL;
+       GVariant* k = NULL;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       GVariant* result;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       j = g_variant_iter_next_value (&_arguments_iter);
+       k = g_variant_iter_next_value (&_arguments_iter);
+       result = test_raw_test_method (self, j, k);
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_reply_builder, result);
+       _g_variant_unref0 (result);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+       _g_variant_unref0 (j);
+       _g_variant_unref0 (k);
+}
+
+static void
+test_raw_dbus_interface_method_call (GDBusConnection* connection,
+                                     const gchar* sender,
+                                     const gchar* object_path,
+                                     const gchar* interface_name,
+                                     const gchar* method_name,
+                                     GVariant* parameters,
+                                     GDBusMethodInvocation* invocation,
+                                     gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "TestMethod") == 0) {
+               _dbus_test_raw_test_method (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+_dbus_test_raw_get_test_property (TestRaw* self)
+{
+       GVariant* result;
+       GVariant* _reply;
+       result = test_raw_get_test_property (self);
+       _reply = result;
+       return _reply;
+}
+
+static GVariant*
+test_raw_dbus_interface_get_property (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* property_name,
+                                      GError** error,
+                                      gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (property_name, "TestProperty") == 0) {
+               return _dbus_test_raw_get_test_property (object);
+       }
+       return NULL;
+}
+
+static void
+_dbus_test_raw_set_test_property (TestRaw* self,
+                                  GVariant* _value)
+{
+       GVariant* value = NULL;
+       value = _value;
+       test_raw_set_test_property (self, value);
+}
+
+static gboolean
+test_raw_dbus_interface_set_property (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* property_name,
+                                      GVariant* value,
+                                      GError** error,
+                                      gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (property_name, "TestProperty") == 0) {
+               _dbus_test_raw_set_test_property (object, value);
+               return TRUE;
+       }
+       return FALSE;
+}
+
+static void
+_dbus_test_raw_test_signal (GObject* _sender,
+                            GVariant* i,
+                            gpointer* _data)
+{
+       GDBusConnection * _connection;
+       const gchar * _path;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       _connection = _data[1];
+       _path = _data[2];
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_arguments_builder, i);
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_connection_emit_signal (_connection, NULL, _path, "org.example.Test", "TestSignal", 
_arguments, NULL);
+}
+
+guint
+test_raw_register_object (gpointer object,
+                          GDBusConnection* connection,
+                          const gchar* path,
+                          GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_raw_dbus_interface_info), &_test_raw_dbus_interface_vtable, data, _test_raw_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       g_signal_connect (object, "test-signal", (GCallback) _dbus_test_raw_test_signal, data);
+       return result;
+}
+
+static void
+_test_raw_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_signal_handlers_disconnect_by_func (data[0], _dbus_test_raw_test_signal, data);
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+void
+client_exit (GPid pid,
+             gint status)
+{
+       GMainLoop* _tmp0_;
+       _vala_assert (status == 0, "status == 0");
+       _tmp0_ = main_loop;
+       g_main_loop_quit (_tmp0_);
+}
+
+static guint
+_variant_get3 (GVariant* value)
+{
+       return g_variant_get_uint32 (value);
+}
+
+static void
+_client_exit_gchild_watch_func (GPid pid,
+                                gint wait_status,
+                                gpointer self)
+{
+       client_exit (pid, wait_status);
+}
+
+static void
+_vala_main (void)
+{
+       GDBusConnection* conn = NULL;
+       GDBusConnection* _tmp0_;
+       GDBusConnection* _tmp1_;
+       Test* _tmp2_;
+       Test* _tmp3_;
+       GDBusConnection* _tmp4_;
+       TestRaw* _tmp5_;
+       TestRaw* _tmp6_;
+       GVariant* request_result = NULL;
+       GDBusConnection* _tmp7_;
+       GVariant* _tmp8_;
+       GVariant* _tmp9_;
+       GVariant* _tmp10_;
+       GVariant* _tmp11_;
+       GVariant* _tmp12_;
+       GVariant* _tmp13_;
+       GVariant* _tmp14_;
+       guint _tmp15_;
+       GPid client_pid = 0;
+       gchar* _tmp16_;
+       gchar** _tmp17_;
+       gchar** _tmp18_;
+       gint _tmp18__length1;
+       GPid _tmp19_ = 0;
+       GMainLoop* _tmp20_;
+       GMainLoop* _tmp21_;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &_inner_error0_);
+       conn = _tmp0_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp1_ = conn;
+       _tmp2_ = test_new ();
+       _tmp3_ = _tmp2_;
+       test_register_object (_tmp3_, _tmp1_, "/org/example/test", &_inner_error0_);
+       _g_object_unref0 (_tmp3_);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp4_ = conn;
+       _tmp5_ = test_raw_new ();
+       _tmp6_ = _tmp5_;
+       test_raw_register_object (_tmp6_, _tmp4_, "/org/example/testraw", &_inner_error0_);
+       _g_object_unref0 (_tmp6_);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp7_ = conn;
+       _tmp8_ = g_variant_new ("(su)", "org.example.Test", 0x4, NULL);
+       g_variant_ref_sink (_tmp8_);
+       _tmp9_ = _tmp8_;
+       _tmp10_ = g_dbus_connection_call_sync (_tmp7_, "org.freedesktop.DBus", "/org/freedesktop/DBus", 
"org.freedesktop.DBus", "RequestName", _tmp9_, NULL, 0, -1, NULL, &_inner_error0_);
+       _tmp11_ = _tmp10_;
+       _g_variant_unref0 (_tmp9_);
+       request_result = _tmp11_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp12_ = request_result;
+       _tmp13_ = g_variant_get_child_value (_tmp12_, (gsize) 0);
+       _tmp14_ = _tmp13_;
+       _tmp15_ = _variant_get3 (_tmp14_);
+       _vala_assert (_tmp15_ == ((guint) 1), "(uint) request_result.get_child_value (0) == 1");
+       _g_variant_unref0 (_tmp14_);
+       _tmp16_ = g_strdup ("dbus_rawvariants_client");
+       _tmp17_ = g_new0 (gchar*, 1 + 1);
+       _tmp17_[0] = _tmp16_;
+       _tmp18_ = _tmp17_;
+       _tmp18__length1 = 1;
+       g_spawn_async (NULL, _tmp18_, NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &_tmp19_, &_inner_error0_);
+       client_pid = _tmp19_;
+       _tmp18_ = (_vala_array_free (_tmp18_, _tmp18__length1, (GDestroyNotify) g_free), NULL);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_variant_unref0 (request_result);
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       g_child_watch_add_full (G_PRIORITY_DEFAULT_IDLE, client_pid, _client_exit_gchild_watch_func, NULL, 
NULL);
+       _tmp20_ = g_main_loop_new (NULL, FALSE);
+       _g_main_loop_unref0 (main_loop);
+       main_loop = _tmp20_;
+       _tmp21_ = main_loop;
+       g_main_loop_run (_tmp21_);
+       _g_variant_unref0 (request_result);
+       _g_object_unref0 (conn);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/dbus/signals_client.c-expected b/tests/dbus/signals_client.c-expected
new file mode 100644
index 000000000..b172477d0
--- /dev/null
+++ b/tests/dbus/signals_client.c-expected
@@ -0,0 +1,780 @@
+/* dbus_signals_client.c generated by valac, the Vala compiler
+ * generated from dbus_signals_client.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define TEST_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_TEST, TestIface))
+
+typedef struct _Test Test;
+typedef struct _TestIface TestIface;
+
+#define TYPE_TEST_PROXY (test_proxy_get_type ())
+enum  {
+       TEST_FOO_SIGNAL,
+       TEST_BAR_SIGNAL,
+       TEST_FINISH_SIGNAL,
+       TEST_NUM_SIGNALS
+};
+static guint test_signals[TEST_NUM_SIGNALS] = {0};
+typedef GDBusProxy TestProxy;
+typedef GDBusProxyClass TestProxyClass;
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _TestIface {
+       GTypeInterface parent_iface;
+       void (*do_foo) (Test* self, gint i, GError** error);
+       void (*do_bar) (Test* self, gchar** baz, gint baz_length1, GError** error);
+};
+
+VALA_EXTERN GMainLoop* main_loop;
+GMainLoop* main_loop = NULL;
+
+VALA_EXTERN GType test_proxy_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN guint test_register_object (void* object,
+                            GDBusConnection* connection,
+                            const gchar* path,
+                            GError** error);
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN void test_do_foo (Test* self,
+                  gint i,
+                  GError** error);
+VALA_EXTERN void test_do_bar (Test* self,
+                  gchar** baz,
+                  gint baz_length1,
+                  GError** error);
+static void g_cclosure_user_marshal_VOID__BOXED_INT (GClosure * closure,
+                                              GValue * return_value,
+                                              guint n_param_values,
+                                              const GValue * param_values,
+                                              gpointer invocation_hint,
+                                              gpointer marshal_data);
+static GType test_get_type_once (void);
+static void test_proxy_g_signal (GDBusProxy* proxy,
+                          const gchar* sender_name,
+                          const gchar* signal_name,
+                          GVariant* parameters);
+static void _dbus_handle_test_foo (Test* self,
+                            GVariant* parameters);
+static void _dbus_handle_test_bar (Test* self,
+                            GVariant* parameters);
+static void test_proxy_do_foo (Test* self,
+                        gint i,
+                        GError** error);
+static void test_proxy_do_bar (Test* self,
+                        gchar** baz,
+                        gint baz_length1,
+                        GError** error);
+static void test_proxy_test_interface_init (TestIface* iface);
+static void _dbus_test_do_foo (Test* self,
+                        GVariant* _parameters_,
+                        GDBusMethodInvocation* invocation);
+static void _dbus_test_do_bar (Test* self,
+                        GVariant* _parameters_,
+                        GDBusMethodInvocation* invocation);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* method_name,
+                                      GVariant* parameters,
+                                      GDBusMethodInvocation* invocation,
+                                      gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+                                            const gchar* sender,
+                                            const gchar* object_path,
+                                            const gchar* interface_name,
+                                            const gchar* property_name,
+                                            GError** error,
+                                            gpointer user_data);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GVariant* value,
+                                           GError** error,
+                                           gpointer user_data);
+static void _dbus_test_foo (GObject* _sender,
+                     gint i,
+                     gpointer* _data);
+static void _dbus_test_bar (GObject* _sender,
+                     gchar** baz,
+                     gint baz_length1,
+                     gpointer* _data);
+static void _test_unregister_object (gpointer user_data);
+static void _vala_main (void);
+static void __lambda4_ (gint i);
+static void ___lambda4__test_foo (Test* _sender,
+                           gint i,
+                           gpointer self);
+static void __lambda5_ (gchar** baz,
+                 gint baz_length1);
+static void ___lambda5__test_bar (Test* _sender,
+                           gchar** baz,
+                           gint baz_length1,
+                           gpointer self);
+static void __lambda6_ (void);
+static void ___lambda6__test_finish (Test* _sender,
+                              gpointer self);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static const GDBusArgInfo _test_dbus_arg_info_do_foo_i = {-1, "i", "i", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_do_foo_in[] = {&_test_dbus_arg_info_do_foo_i, NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_do_foo_out[] = {NULL};
+static const GDBusMethodInfo _test_dbus_method_info_do_foo = {-1, "DoFoo", (GDBusArgInfo **) 
(&_test_dbus_arg_info_do_foo_in), (GDBusArgInfo **) (&_test_dbus_arg_info_do_foo_out), NULL};
+static const GDBusArgInfo _test_dbus_arg_info_do_bar_baz = {-1, "baz", "as", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_do_bar_in[] = {&_test_dbus_arg_info_do_bar_baz, NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_do_bar_out[] = {NULL};
+static const GDBusMethodInfo _test_dbus_method_info_do_bar = {-1, "DoBar", (GDBusArgInfo **) 
(&_test_dbus_arg_info_do_bar_in), (GDBusArgInfo **) (&_test_dbus_arg_info_do_bar_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_do_foo, 
&_test_dbus_method_info_do_bar, NULL};
+static const GDBusArgInfo _test_dbus_arg_info_foo_i = {-1, "i", "i", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_foo[] = {&_test_dbus_arg_info_foo_i, NULL};
+static const GDBusSignalInfo _test_dbus_signal_info_foo = {-1, "Foo", (GDBusArgInfo **) 
(&_test_dbus_arg_info_foo), NULL};
+static const GDBusArgInfo _test_dbus_arg_info_bar_baz = {-1, "baz", "as", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_bar[] = {&_test_dbus_arg_info_bar_baz, NULL};
+static const GDBusSignalInfo _test_dbus_signal_info_bar = {-1, "Bar", (GDBusArgInfo **) 
(&_test_dbus_arg_info_bar), NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {&_test_dbus_signal_info_foo, 
&_test_dbus_signal_info_bar, NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = {NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) 
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, 
test_dbus_interface_get_property, test_dbus_interface_set_property};
+
+void
+test_do_foo (Test* self,
+             gint i,
+             GError** error)
+{
+       TestIface* _iface_;
+       g_return_if_fail (IS_TEST (self));
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->do_foo) {
+               _iface_->do_foo (self, i, error);
+       }
+}
+
+void
+test_do_bar (Test* self,
+             gchar** baz,
+             gint baz_length1,
+             GError** error)
+{
+       TestIface* _iface_;
+       g_return_if_fail (IS_TEST (self));
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->do_bar) {
+               _iface_->do_bar (self, baz, baz_length1, error);
+       }
+}
+
+static void
+g_cclosure_user_marshal_VOID__BOXED_INT (GClosure * closure,
+                                         GValue * return_value,
+                                         guint n_param_values,
+                                         const GValue * param_values,
+                                         gpointer invocation_hint,
+                                         gpointer marshal_data)
+{
+       typedef void (*GMarshalFunc_VOID__BOXED_INT) (gpointer data1, gpointer arg_1, gint arg_2, gpointer 
data2);
+       register GMarshalFunc_VOID__BOXED_INT callback;
+       register GCClosure * cc;
+       register gpointer data1;
+       register gpointer data2;
+       cc = (GCClosure *) closure;
+       g_return_if_fail (n_param_values == 3);
+       if (G_CCLOSURE_SWAP_DATA (closure)) {
+               data1 = closure->data;
+               data2 = param_values->data[0].v_pointer;
+       } else {
+               data1 = param_values->data[0].v_pointer;
+               data2 = closure->data;
+       }
+       callback = (GMarshalFunc_VOID__BOXED_INT) (marshal_data ? marshal_data : cc->callback);
+       callback (data1, g_value_get_boxed (param_values + 1), g_value_get_int (param_values + 2), data2);
+}
+
+static void
+test_default_init (TestIface * iface,
+                   gpointer iface_data)
+{
+       test_signals[TEST_FOO_SIGNAL] = g_signal_new ("foo", TYPE_TEST, G_SIGNAL_RUN_LAST, 0, NULL, NULL, 
g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
+       test_signals[TEST_BAR_SIGNAL] = g_signal_new ("bar", TYPE_TEST, G_SIGNAL_RUN_LAST, 0, NULL, NULL, 
g_cclosure_user_marshal_VOID__BOXED_INT, G_TYPE_NONE, 2, G_TYPE_STRV, G_TYPE_INT);
+       test_signals[TEST_FINISH_SIGNAL] = g_signal_new ("finish", TYPE_TEST, G_SIGNAL_RUN_LAST, 0, NULL, 
NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType test_type_id;
+       test_type_id = g_type_register_static (G_TYPE_INTERFACE, "Test", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (test_type_id, G_TYPE_OBJECT);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) 
test_proxy_get_type);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), 
"org.example.Test");
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*) 
(&_test_dbus_interface_info));
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_register_object);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_TEST, 
test_proxy_test_interface_init) )
+static void
+test_proxy_class_init (TestProxyClass* klass)
+{
+       G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal;
+}
+
+static void
+_dbus_handle_test_foo (Test* self,
+                       GVariant* parameters)
+{
+       GVariantIter _arguments_iter;
+       gint i = 0;
+       GVariant* _tmp0_;
+       g_variant_iter_init (&_arguments_iter, parameters);
+       _tmp0_ = g_variant_iter_next_value (&_arguments_iter);
+       i = g_variant_get_int32 (_tmp0_);
+       g_variant_unref (_tmp0_);
+       g_signal_emit_by_name (self, "foo", i);
+}
+
+static void
+_dbus_handle_test_bar (Test* self,
+                       GVariant* parameters)
+{
+       GVariantIter _arguments_iter;
+       gchar** baz = NULL;
+       gint baz_length1;
+       GVariant* _tmp1_;
+       gchar** _tmp2_;
+       gint _tmp2__length;
+       gint _tmp2__size;
+       gint _tmp2__length1;
+       GVariantIter _tmp3_;
+       GVariant* _tmp4_;
+       g_variant_iter_init (&_arguments_iter, parameters);
+       baz_length1 = 0;
+       _tmp1_ = g_variant_iter_next_value (&_arguments_iter);
+       _tmp2_ = g_new (gchar*, 5);
+       _tmp2__length = 0;
+       _tmp2__size = 4;
+       _tmp2__length1 = 0;
+       g_variant_iter_init (&_tmp3_, _tmp1_);
+       for (; (_tmp4_ = g_variant_iter_next_value (&_tmp3_)) != NULL; _tmp2__length1++) {
+               if (_tmp2__size == _tmp2__length) {
+                       _tmp2__size = 2 * _tmp2__size;
+                       _tmp2_ = g_renew (gchar*, _tmp2_, _tmp2__size + 1);
+               }
+               _tmp2_[_tmp2__length++] = g_variant_dup_string (_tmp4_, NULL);
+               g_variant_unref (_tmp4_);
+       }
+       baz_length1 = _tmp2__length1;
+       _tmp2_[_tmp2__length] = NULL;
+       baz = _tmp2_;
+       g_variant_unref (_tmp1_);
+       g_signal_emit_by_name (self, "bar", baz, baz_length1);
+       baz = (_vala_array_free (baz, baz_length1, (GDestroyNotify) g_free), NULL);
+}
+
+static void
+test_proxy_g_signal (GDBusProxy* proxy,
+                     const gchar* sender_name,
+                     const gchar* signal_name,
+                     GVariant* parameters)
+{
+       if (strcmp (signal_name, "Foo") == 0) {
+               _dbus_handle_test_foo ((Test*) proxy, parameters);
+       } else if (strcmp (signal_name, "Bar") == 0) {
+               _dbus_handle_test_bar ((Test*) proxy, parameters);
+       }
+}
+
+static void
+test_proxy_init (TestProxy* self)
+{
+       g_dbus_proxy_set_interface_info (G_DBUS_PROXY (self), (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info));
+}
+
+static void
+test_proxy_do_foo (Test* self,
+                   gint i,
+                   GError** error)
+{
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       GDBusMessage *_reply_message;
+       G_DBUS_ERROR;
+       G_IO_ERROR;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "DoFoo");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_arguments_builder, g_variant_new_int32 (i));
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       _reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout 
((GDBusProxy *) self), NULL, NULL, error);
+       g_object_unref (_message);
+       if (!_reply_message) {
+               return;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, error)) {
+               g_object_unref (_reply_message);
+               return;
+       }
+       g_object_unref (_reply_message);
+}
+
+static void
+test_proxy_do_bar (Test* self,
+                   gchar** baz,
+                   gint baz_length1,
+                   GError** error)
+{
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       gchar** _tmp5_;
+       GVariantBuilder _tmp6_;
+       gint _tmp7_;
+       GDBusMessage *_reply_message;
+       G_DBUS_ERROR;
+       G_IO_ERROR;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "DoBar");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       _tmp5_ = baz;
+       g_variant_builder_init (&_tmp6_, G_VARIANT_TYPE ("as"));
+       for (_tmp7_ = 0; _tmp7_ < baz_length1; _tmp7_++) {
+               g_variant_builder_add_value (&_tmp6_, g_variant_new_string (*_tmp5_));
+               _tmp5_++;
+       }
+       g_variant_builder_add_value (&_arguments_builder, g_variant_builder_end (&_tmp6_));
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       _reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout 
((GDBusProxy *) self), NULL, NULL, error);
+       g_object_unref (_message);
+       if (!_reply_message) {
+               return;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, error)) {
+               g_object_unref (_reply_message);
+               return;
+       }
+       g_object_unref (_reply_message);
+}
+
+static void
+test_proxy_test_interface_init (TestIface* iface)
+{
+       iface->do_foo = test_proxy_do_foo;
+       iface->do_bar = test_proxy_do_bar;
+}
+
+static void
+_dbus_test_do_foo (Test* self,
+                   GVariant* _parameters_,
+                   GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       gint i = 0;
+       GVariant* _tmp8_;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _tmp8_ = g_variant_iter_next_value (&_arguments_iter);
+       i = g_variant_get_int32 (_tmp8_);
+       g_variant_unref (_tmp8_);
+       test_do_foo (self, i, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               return;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+}
+
+static void
+_dbus_test_do_bar (Test* self,
+                   GVariant* _parameters_,
+                   GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       gchar** baz = NULL;
+       gint baz_length1 = 0;
+       GVariant* _tmp9_;
+       gchar** _tmp10_;
+       gint _tmp10__length;
+       gint _tmp10__size;
+       gint _tmp10__length1;
+       GVariantIter _tmp11_;
+       GVariant* _tmp12_;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _tmp9_ = g_variant_iter_next_value (&_arguments_iter);
+       _tmp10_ = g_new (gchar*, 5);
+       _tmp10__length = 0;
+       _tmp10__size = 4;
+       _tmp10__length1 = 0;
+       g_variant_iter_init (&_tmp11_, _tmp9_);
+       for (; (_tmp12_ = g_variant_iter_next_value (&_tmp11_)) != NULL; _tmp10__length1++) {
+               if (_tmp10__size == _tmp10__length) {
+                       _tmp10__size = 2 * _tmp10__size;
+                       _tmp10_ = g_renew (gchar*, _tmp10_, _tmp10__size + 1);
+               }
+               _tmp10_[_tmp10__length++] = g_variant_dup_string (_tmp12_, NULL);
+               g_variant_unref (_tmp12_);
+       }
+       baz_length1 = _tmp10__length1;
+       _tmp10_[_tmp10__length] = NULL;
+       baz = _tmp10_;
+       g_variant_unref (_tmp9_);
+       test_do_bar (self, baz, baz_length1, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               goto _error;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+       _error:
+       baz = (_vala_array_free (baz, baz_length1, (GDestroyNotify) g_free), NULL);
+       ;
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* method_name,
+                                 GVariant* parameters,
+                                 GDBusMethodInvocation* invocation,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "DoFoo") == 0) {
+               _dbus_test_do_foo (object, parameters, invocation);
+       } else if (strcmp (method_name, "DoBar") == 0) {
+               _dbus_test_do_bar (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return NULL;
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GVariant* value,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return FALSE;
+}
+
+static void
+_dbus_test_foo (GObject* _sender,
+                gint i,
+                gpointer* _data)
+{
+       GDBusConnection * _connection;
+       const gchar * _path;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       _connection = _data[1];
+       _path = _data[2];
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_arguments_builder, g_variant_new_int32 (i));
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_connection_emit_signal (_connection, NULL, _path, "org.example.Test", "Foo", _arguments, NULL);
+}
+
+static void
+_dbus_test_bar (GObject* _sender,
+                gchar** baz,
+                gint baz_length1,
+                gpointer* _data)
+{
+       GDBusConnection * _connection;
+       const gchar * _path;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       gchar** _tmp13_;
+       GVariantBuilder _tmp14_;
+       gint _tmp15_;
+       _connection = _data[1];
+       _path = _data[2];
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       _tmp13_ = baz;
+       g_variant_builder_init (&_tmp14_, G_VARIANT_TYPE ("as"));
+       for (_tmp15_ = 0; _tmp15_ < baz_length1; _tmp15_++) {
+               g_variant_builder_add_value (&_tmp14_, g_variant_new_string (*_tmp13_));
+               _tmp13_++;
+       }
+       g_variant_builder_add_value (&_arguments_builder, g_variant_builder_end (&_tmp14_));
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_connection_emit_signal (_connection, NULL, _path, "org.example.Test", "Bar", _arguments, NULL);
+}
+
+guint
+test_register_object (gpointer object,
+                      GDBusConnection* connection,
+                      const gchar* path,
+                      GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       g_signal_connect (object, "foo", (GCallback) _dbus_test_foo, data);
+       g_signal_connect (object, "bar", (GCallback) _dbus_test_bar, data);
+       return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_signal_handlers_disconnect_by_func (data[0], _dbus_test_foo, data);
+       g_signal_handlers_disconnect_by_func (data[0], _dbus_test_bar, data);
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+static void
+__lambda4_ (gint i)
+{
+       _vala_assert (i == 42, "i == 42");
+}
+
+static void
+___lambda4__test_foo (Test* _sender,
+                      gint i,
+                      gpointer self)
+{
+       __lambda4_ (i);
+}
+
+static void
+__lambda5_ (gchar** baz,
+            gint baz_length1)
+{
+       const gchar* _tmp0_;
+       const gchar* _tmp1_;
+       const gchar* _tmp2_;
+       GMainLoop* _tmp3_;
+       _vala_assert (baz_length1 == 3, "baz.length == 3");
+       _tmp0_ = baz[0];
+       _vala_assert (g_strcmp0 (_tmp0_, "zero") == 0, "baz[0] == \"zero\"");
+       _tmp1_ = baz[1];
+       _vala_assert (g_strcmp0 (_tmp1_, "one") == 0, "baz[1] == \"one\"");
+       _tmp2_ = baz[2];
+       _vala_assert (g_strcmp0 (_tmp2_, "two") == 0, "baz[2] == \"two\"");
+       _tmp3_ = main_loop;
+       g_main_loop_quit (_tmp3_);
+}
+
+static void
+___lambda5__test_bar (Test* _sender,
+                      gchar** baz,
+                      gint baz_length1,
+                      gpointer self)
+{
+       __lambda5_ (baz, baz_length1);
+}
+
+static void
+__lambda6_ (void)
+{
+       g_assert_not_reached ();
+}
+
+static void
+___lambda6__test_finish (Test* _sender,
+                         gpointer self)
+{
+       __lambda6_ ();
+}
+
+static void
+_vala_main (void)
+{
+       Test* test = NULL;
+       Test* _tmp0_;
+       Test* _tmp1_;
+       Test* _tmp2_;
+       Test* _tmp3_;
+       Test* _tmp4_;
+       Test* _tmp5_;
+       gchar* _tmp6_;
+       gchar* _tmp7_;
+       gchar* _tmp8_;
+       gchar** _tmp9_;
+       gchar** _tmp10_;
+       gint _tmp10__length1;
+       GMainLoop* _tmp11_;
+       GMainLoop* _tmp12_;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = (Test*) g_initable_new (TYPE_TEST_PROXY, NULL, &_inner_error0_, "g-flags", 0, "g-name", 
"org.example.Test", "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/example/test", 
"g-interface-name", "org.example.Test", NULL);
+       test = (Test*) _tmp0_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp1_ = test;
+       g_signal_connect (_tmp1_, "foo", (GCallback) ___lambda4__test_foo, NULL);
+       _tmp2_ = test;
+       g_signal_connect (_tmp2_, "bar", (GCallback) ___lambda5__test_bar, NULL);
+       _tmp3_ = test;
+       g_signal_connect (_tmp3_, "finish", (GCallback) ___lambda6__test_finish, NULL);
+       _tmp4_ = test;
+       test_do_foo (_tmp4_, 42, &_inner_error0_);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (test);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp5_ = test;
+       _tmp6_ = g_strdup ("zero");
+       _tmp7_ = g_strdup ("one");
+       _tmp8_ = g_strdup ("two");
+       _tmp9_ = g_new0 (gchar*, 3 + 1);
+       _tmp9_[0] = _tmp6_;
+       _tmp9_[1] = _tmp7_;
+       _tmp9_[2] = _tmp8_;
+       _tmp10_ = _tmp9_;
+       _tmp10__length1 = 3;
+       test_do_bar (_tmp5_, _tmp10_, (gint) 3, &_inner_error0_);
+       _tmp10_ = (_vala_array_free (_tmp10_, _tmp10__length1, (GDestroyNotify) g_free), NULL);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (test);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp11_ = g_main_loop_new (NULL, FALSE);
+       _g_main_loop_unref0 (main_loop);
+       main_loop = _tmp11_;
+       _tmp12_ = main_loop;
+       g_main_loop_run (_tmp12_);
+       _g_object_unref0 (test);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/dbus/signals_server.c-expected b/tests/dbus/signals_server.c-expected
new file mode 100644
index 000000000..da9b02267
--- /dev/null
+++ b/tests/dbus/signals_server.c-expected
@@ -0,0 +1,620 @@
+/* dbus_signals_server.c generated by valac, the Vala compiler
+ * generated from dbus_signals_server.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TEST, TestClass))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define IS_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TEST))
+#define TEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TEST, TestClass))
+
+typedef struct _Test Test;
+typedef struct _TestClass TestClass;
+typedef struct _TestPrivate TestPrivate;
+enum  {
+       TEST_0_PROPERTY,
+       TEST_NUM_PROPERTIES
+};
+static GParamSpec* test_properties[TEST_NUM_PROPERTIES];
+enum  {
+       TEST_FOO_SIGNAL,
+       TEST_BAR_SIGNAL,
+       TEST_FINISH_SIGNAL,
+       TEST_NUM_SIGNALS
+};
+static guint test_signals[TEST_NUM_SIGNALS] = {0};
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Test {
+       GObject parent_instance;
+       TestPrivate * priv;
+};
+
+struct _TestClass {
+       GObjectClass parent_class;
+};
+
+static gpointer test_parent_class = NULL;
+VALA_EXTERN GMainLoop* main_loop;
+GMainLoop* main_loop = NULL;
+
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
+VALA_EXTERN guint test_register_object (void* object,
+                            GDBusConnection* connection,
+                            const gchar* path,
+                            GError** error);
+VALA_EXTERN void test_do_foo (Test* self,
+                  gint i,
+                  GError** error);
+VALA_EXTERN void test_do_bar (Test* self,
+                  gchar** baz,
+                  gint baz_length1,
+                  GError** error);
+VALA_EXTERN Test* test_new (void);
+VALA_EXTERN Test* test_construct (GType object_type);
+static void g_cclosure_user_marshal_VOID__BOXED_INT (GClosure * closure,
+                                              GValue * return_value,
+                                              guint n_param_values,
+                                              const GValue * param_values,
+                                              gpointer invocation_hint,
+                                              gpointer marshal_data);
+static GType test_get_type_once (void);
+static void _dbus_test_do_foo (Test* self,
+                        GVariant* _parameters_,
+                        GDBusMethodInvocation* invocation);
+static void _dbus_test_do_bar (Test* self,
+                        GVariant* _parameters_,
+                        GDBusMethodInvocation* invocation);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* method_name,
+                                      GVariant* parameters,
+                                      GDBusMethodInvocation* invocation,
+                                      gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+                                            const gchar* sender,
+                                            const gchar* object_path,
+                                            const gchar* interface_name,
+                                            const gchar* property_name,
+                                            GError** error,
+                                            gpointer user_data);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GVariant* value,
+                                           GError** error,
+                                           gpointer user_data);
+static void _dbus_test_foo (GObject* _sender,
+                     gint i,
+                     gpointer* _data);
+static void _dbus_test_bar (GObject* _sender,
+                     gchar** baz,
+                     gint baz_length1,
+                     gpointer* _data);
+static void _test_unregister_object (gpointer user_data);
+VALA_EXTERN void client_exit (GPid pid,
+                  gint status);
+static void _vala_main (void);
+static guint _variant_get1 (GVariant* value);
+static void _client_exit_gchild_watch_func (GPid pid,
+                                     gint wait_status,
+                                     gpointer self);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static const GDBusArgInfo _test_dbus_arg_info_do_foo_i = {-1, "i", "i", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_do_foo_in[] = {&_test_dbus_arg_info_do_foo_i, NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_do_foo_out[] = {NULL};
+static const GDBusMethodInfo _test_dbus_method_info_do_foo = {-1, "DoFoo", (GDBusArgInfo **) 
(&_test_dbus_arg_info_do_foo_in), (GDBusArgInfo **) (&_test_dbus_arg_info_do_foo_out), NULL};
+static const GDBusArgInfo _test_dbus_arg_info_do_bar_baz = {-1, "baz", "as", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_do_bar_in[] = {&_test_dbus_arg_info_do_bar_baz, NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_do_bar_out[] = {NULL};
+static const GDBusMethodInfo _test_dbus_method_info_do_bar = {-1, "DoBar", (GDBusArgInfo **) 
(&_test_dbus_arg_info_do_bar_in), (GDBusArgInfo **) (&_test_dbus_arg_info_do_bar_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_do_foo, 
&_test_dbus_method_info_do_bar, NULL};
+static const GDBusArgInfo _test_dbus_arg_info_foo_i = {-1, "i", "i", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_foo[] = {&_test_dbus_arg_info_foo_i, NULL};
+static const GDBusSignalInfo _test_dbus_signal_info_foo = {-1, "Foo", (GDBusArgInfo **) 
(&_test_dbus_arg_info_foo), NULL};
+static const GDBusArgInfo _test_dbus_arg_info_bar_baz = {-1, "baz", "as", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_bar[] = {&_test_dbus_arg_info_bar_baz, NULL};
+static const GDBusSignalInfo _test_dbus_signal_info_bar = {-1, "Bar", (GDBusArgInfo **) 
(&_test_dbus_arg_info_bar), NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {&_test_dbus_signal_info_foo, 
&_test_dbus_signal_info_bar, NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = {NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) 
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, 
test_dbus_interface_get_property, test_dbus_interface_set_property};
+
+void
+test_do_foo (Test* self,
+             gint i,
+             GError** error)
+{
+       g_return_if_fail (IS_TEST (self));
+       g_signal_emit (self, test_signals[TEST_FOO_SIGNAL], 0, i);
+       g_signal_emit (self, test_signals[TEST_FINISH_SIGNAL], 0);
+}
+
+void
+test_do_bar (Test* self,
+             gchar** baz,
+             gint baz_length1,
+             GError** error)
+{
+       g_return_if_fail (IS_TEST (self));
+       g_signal_emit (self, test_signals[TEST_BAR_SIGNAL], 0, baz, (gint) baz_length1);
+}
+
+Test*
+test_construct (GType object_type)
+{
+       Test * self = NULL;
+       self = (Test*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Test*
+test_new (void)
+{
+       return test_construct (TYPE_TEST);
+}
+
+static void
+g_cclosure_user_marshal_VOID__BOXED_INT (GClosure * closure,
+                                         GValue * return_value,
+                                         guint n_param_values,
+                                         const GValue * param_values,
+                                         gpointer invocation_hint,
+                                         gpointer marshal_data)
+{
+       typedef void (*GMarshalFunc_VOID__BOXED_INT) (gpointer data1, gpointer arg_1, gint arg_2, gpointer 
data2);
+       register GMarshalFunc_VOID__BOXED_INT callback;
+       register GCClosure * cc;
+       register gpointer data1;
+       register gpointer data2;
+       cc = (GCClosure *) closure;
+       g_return_if_fail (n_param_values == 3);
+       if (G_CCLOSURE_SWAP_DATA (closure)) {
+               data1 = closure->data;
+               data2 = param_values->data[0].v_pointer;
+       } else {
+               data1 = param_values->data[0].v_pointer;
+               data2 = closure->data;
+       }
+       callback = (GMarshalFunc_VOID__BOXED_INT) (marshal_data ? marshal_data : cc->callback);
+       callback (data1, g_value_get_boxed (param_values + 1), g_value_get_int (param_values + 2), data2);
+}
+
+static void
+test_class_init (TestClass * klass,
+                 gpointer klass_data)
+{
+       test_parent_class = g_type_class_peek_parent (klass);
+       test_signals[TEST_FOO_SIGNAL] = g_signal_new ("foo", TYPE_TEST, G_SIGNAL_RUN_LAST, 0, NULL, NULL, 
g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
+       test_signals[TEST_BAR_SIGNAL] = g_signal_new ("bar", TYPE_TEST, G_SIGNAL_RUN_LAST, 0, NULL, NULL, 
g_cclosure_user_marshal_VOID__BOXED_INT, G_TYPE_NONE, 2, G_TYPE_STRV, G_TYPE_INT);
+       test_signals[TEST_FINISH_SIGNAL] = g_signal_new ("finish", TYPE_TEST, G_SIGNAL_RUN_LAST, 0, NULL, 
NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+}
+
+static void
+test_instance_init (Test * self,
+                    gpointer klass)
+{
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Test), 
0, (GInstanceInitFunc) test_instance_init, NULL };
+       GType test_type_id;
+       test_type_id = g_type_register_static (G_TYPE_OBJECT, "Test", &g_define_type_info, 0);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_register_object);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+static void
+_dbus_test_do_foo (Test* self,
+                   GVariant* _parameters_,
+                   GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       gint i = 0;
+       GVariant* _tmp0_;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _tmp0_ = g_variant_iter_next_value (&_arguments_iter);
+       i = g_variant_get_int32 (_tmp0_);
+       g_variant_unref (_tmp0_);
+       test_do_foo (self, i, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               return;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+}
+
+static void
+_dbus_test_do_bar (Test* self,
+                   GVariant* _parameters_,
+                   GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       gchar** baz = NULL;
+       gint baz_length1 = 0;
+       GVariant* _tmp1_;
+       gchar** _tmp2_;
+       gint _tmp2__length;
+       gint _tmp2__size;
+       gint _tmp2__length1;
+       GVariantIter _tmp3_;
+       GVariant* _tmp4_;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _tmp1_ = g_variant_iter_next_value (&_arguments_iter);
+       _tmp2_ = g_new (gchar*, 5);
+       _tmp2__length = 0;
+       _tmp2__size = 4;
+       _tmp2__length1 = 0;
+       g_variant_iter_init (&_tmp3_, _tmp1_);
+       for (; (_tmp4_ = g_variant_iter_next_value (&_tmp3_)) != NULL; _tmp2__length1++) {
+               if (_tmp2__size == _tmp2__length) {
+                       _tmp2__size = 2 * _tmp2__size;
+                       _tmp2_ = g_renew (gchar*, _tmp2_, _tmp2__size + 1);
+               }
+               _tmp2_[_tmp2__length++] = g_variant_dup_string (_tmp4_, NULL);
+               g_variant_unref (_tmp4_);
+       }
+       baz_length1 = _tmp2__length1;
+       _tmp2_[_tmp2__length] = NULL;
+       baz = _tmp2_;
+       g_variant_unref (_tmp1_);
+       test_do_bar (self, baz, baz_length1, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               goto _error;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+       _error:
+       baz = (_vala_array_free (baz, baz_length1, (GDestroyNotify) g_free), NULL);
+       ;
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* method_name,
+                                 GVariant* parameters,
+                                 GDBusMethodInvocation* invocation,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "DoFoo") == 0) {
+               _dbus_test_do_foo (object, parameters, invocation);
+       } else if (strcmp (method_name, "DoBar") == 0) {
+               _dbus_test_do_bar (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return NULL;
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GVariant* value,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       return FALSE;
+}
+
+static void
+_dbus_test_foo (GObject* _sender,
+                gint i,
+                gpointer* _data)
+{
+       GDBusConnection * _connection;
+       const gchar * _path;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       _connection = _data[1];
+       _path = _data[2];
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_arguments_builder, g_variant_new_int32 (i));
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_connection_emit_signal (_connection, NULL, _path, "org.example.Test", "Foo", _arguments, NULL);
+}
+
+static void
+_dbus_test_bar (GObject* _sender,
+                gchar** baz,
+                gint baz_length1,
+                gpointer* _data)
+{
+       GDBusConnection * _connection;
+       const gchar * _path;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       gchar** _tmp5_;
+       GVariantBuilder _tmp6_;
+       gint _tmp7_;
+       _connection = _data[1];
+       _path = _data[2];
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       _tmp5_ = baz;
+       g_variant_builder_init (&_tmp6_, G_VARIANT_TYPE ("as"));
+       for (_tmp7_ = 0; _tmp7_ < baz_length1; _tmp7_++) {
+               g_variant_builder_add_value (&_tmp6_, g_variant_new_string (*_tmp5_));
+               _tmp5_++;
+       }
+       g_variant_builder_add_value (&_arguments_builder, g_variant_builder_end (&_tmp6_));
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_connection_emit_signal (_connection, NULL, _path, "org.example.Test", "Bar", _arguments, NULL);
+}
+
+guint
+test_register_object (gpointer object,
+                      GDBusConnection* connection,
+                      const gchar* path,
+                      GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       g_signal_connect (object, "foo", (GCallback) _dbus_test_foo, data);
+       g_signal_connect (object, "bar", (GCallback) _dbus_test_bar, data);
+       return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_signal_handlers_disconnect_by_func (data[0], _dbus_test_foo, data);
+       g_signal_handlers_disconnect_by_func (data[0], _dbus_test_bar, data);
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+void
+client_exit (GPid pid,
+             gint status)
+{
+       GMainLoop* _tmp0_;
+       _vala_assert (status == 0, "status == 0");
+       _tmp0_ = main_loop;
+       g_main_loop_quit (_tmp0_);
+}
+
+static guint
+_variant_get1 (GVariant* value)
+{
+       return g_variant_get_uint32 (value);
+}
+
+static void
+_client_exit_gchild_watch_func (GPid pid,
+                                gint wait_status,
+                                gpointer self)
+{
+       client_exit (pid, wait_status);
+}
+
+static void
+_vala_main (void)
+{
+       GDBusConnection* conn = NULL;
+       GDBusConnection* _tmp0_;
+       GDBusConnection* _tmp1_;
+       Test* _tmp2_;
+       Test* _tmp3_;
+       GVariant* request_result = NULL;
+       GDBusConnection* _tmp4_;
+       GVariant* _tmp5_;
+       GVariant* _tmp6_;
+       GVariant* _tmp7_;
+       GVariant* _tmp8_;
+       GVariant* _tmp9_;
+       GVariant* _tmp10_;
+       GVariant* _tmp11_;
+       guint _tmp12_;
+       GPid client_pid = 0;
+       gchar* _tmp13_;
+       gchar** _tmp14_;
+       gchar** _tmp15_;
+       gint _tmp15__length1;
+       GPid _tmp16_ = 0;
+       GMainLoop* _tmp17_;
+       GMainLoop* _tmp18_;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &_inner_error0_);
+       conn = _tmp0_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp1_ = conn;
+       _tmp2_ = test_new ();
+       _tmp3_ = _tmp2_;
+       test_register_object (_tmp3_, _tmp1_, "/org/example/test", &_inner_error0_);
+       _g_object_unref0 (_tmp3_);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp4_ = conn;
+       _tmp5_ = g_variant_new ("(su)", "org.example.Test", 0x4, NULL);
+       g_variant_ref_sink (_tmp5_);
+       _tmp6_ = _tmp5_;
+       _tmp7_ = g_dbus_connection_call_sync (_tmp4_, "org.freedesktop.DBus", "/org/freedesktop/DBus", 
"org.freedesktop.DBus", "RequestName", _tmp6_, NULL, 0, -1, NULL, &_inner_error0_);
+       _tmp8_ = _tmp7_;
+       _g_variant_unref0 (_tmp6_);
+       request_result = _tmp8_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp9_ = request_result;
+       _tmp10_ = g_variant_get_child_value (_tmp9_, (gsize) 0);
+       _tmp11_ = _tmp10_;
+       _tmp12_ = _variant_get1 (_tmp11_);
+       _vala_assert (_tmp12_ == ((guint) 1), "(uint) request_result.get_child_value (0) == 1");
+       _g_variant_unref0 (_tmp11_);
+       _tmp13_ = g_strdup ("dbus_signals_client");
+       _tmp14_ = g_new0 (gchar*, 1 + 1);
+       _tmp14_[0] = _tmp13_;
+       _tmp15_ = _tmp14_;
+       _tmp15__length1 = 1;
+       g_spawn_async (NULL, _tmp15_, NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &_tmp16_, &_inner_error0_);
+       client_pid = _tmp16_;
+       _tmp15_ = (_vala_array_free (_tmp15_, _tmp15__length1, (GDestroyNotify) g_free), NULL);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_variant_unref0 (request_result);
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       g_child_watch_add_full (G_PRIORITY_DEFAULT_IDLE, client_pid, _client_exit_gchild_watch_func, NULL, 
NULL);
+       _tmp17_ = g_main_loop_new (NULL, FALSE);
+       _g_main_loop_unref0 (main_loop);
+       main_loop = _tmp17_;
+       _tmp18_ = main_loop;
+       g_main_loop_run (_tmp18_);
+       _g_variant_unref0 (request_result);
+       _g_object_unref0 (conn);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/dbus/structs_client.c-expected b/tests/dbus/structs_client.c-expected
new file mode 100644
index 000000000..91c61053a
--- /dev/null
+++ b/tests/dbus/structs_client.c-expected
@@ -0,0 +1,718 @@
+/* dbus_structs_client.c generated by valac, the Vala compiler
+ * generated from dbus_structs_client.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+#include <gio/gio.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO_STRUCT (foo_struct_get_type ())
+typedef struct _FooStruct FooStruct;
+#define _g_free0(var) (var = (g_free (var), NULL))
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define TEST_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_TEST, TestIface))
+
+typedef struct _Test Test;
+typedef struct _TestIface TestIface;
+
+#define TYPE_TEST_PROXY (test_proxy_get_type ())
+typedef GDBusProxy TestProxy;
+typedef GDBusProxyClass TestProxyClass;
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _FooStruct {
+       gint i;
+       gchar* s;
+};
+
+struct _TestIface {
+       GTypeInterface parent_iface;
+       void (*test_struct) (Test* self, FooStruct* f, FooStruct* g, FooStruct* result, GError** error);
+       void (*get_test_property) (Test* self, FooStruct * result);
+       void (*set_test_property) (Test* self, FooStruct * value);
+};
+
+VALA_EXTERN GType foo_struct_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN FooStruct* foo_struct_dup (const FooStruct* self);
+VALA_EXTERN void foo_struct_free (FooStruct* self);
+VALA_EXTERN void foo_struct_copy (const FooStruct* self,
+                      FooStruct* dest);
+VALA_EXTERN void foo_struct_destroy (FooStruct* self);
+VALA_EXTERN void foo_struct_init (FooStruct *self,
+                      gint i,
+                      const gchar* s);
+VALA_EXTERN GType test_proxy_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN guint test_register_object (void* object,
+                            GDBusConnection* connection,
+                            const gchar* path,
+                            GError** error);
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN void test_test_struct (Test* self,
+                       FooStruct* f,
+                       FooStruct* g,
+                       FooStruct* result,
+                       GError** error);
+VALA_EXTERN void test_get_test_property (Test* self,
+                             FooStruct * result);
+VALA_EXTERN void test_set_test_property (Test* self,
+                             FooStruct * value);
+static GType test_get_type_once (void);
+static void test_proxy_g_signal (GDBusProxy* proxy,
+                          const gchar* sender_name,
+                          const gchar* signal_name,
+                          GVariant* parameters);
+static void test_proxy_test_struct (Test* self,
+                             FooStruct* f,
+                             FooStruct* g,
+                             FooStruct* result,
+                             GError** error);
+static void test_dbus_proxy_get_test_property (Test* self,
+                                        FooStruct* result);
+static void test_dbus_proxy_set_test_property (Test* self,
+                                        FooStruct* value);
+static void test_proxy_test_interface_init (TestIface* iface);
+static void _dbus_test_test_struct (Test* self,
+                             GVariant* _parameters_,
+                             GDBusMethodInvocation* invocation);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* method_name,
+                                      GVariant* parameters,
+                                      GDBusMethodInvocation* invocation,
+                                      gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+                                            const gchar* sender,
+                                            const gchar* object_path,
+                                            const gchar* interface_name,
+                                            const gchar* property_name,
+                                            GError** error,
+                                            gpointer user_data);
+static GVariant* _dbus_test_get_test_property (Test* self);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GVariant* value,
+                                           GError** error,
+                                           gpointer user_data);
+static void _dbus_test_set_test_property (Test* self,
+                                   GVariant* _value);
+static void _test_unregister_object (gpointer user_data);
+static void _vala_main (void);
+
+static const GDBusArgInfo _test_dbus_arg_info_test_struct_f = {-1, "f", "(is)", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_struct_g = {-1, "g", "(is)", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_struct_result = {-1, "result", "(is)", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_struct_in[] = 
{&_test_dbus_arg_info_test_struct_f, NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_struct_out[] = 
{&_test_dbus_arg_info_test_struct_g, &_test_dbus_arg_info_test_struct_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_struct = {-1, "TestStruct", (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_struct_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_struct_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_test_struct, NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo _test_dbus_property_info_test_property = {-1, "TestProperty", "(is)", 
G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = 
{&_test_dbus_property_info_test_property, NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) 
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, 
test_dbus_interface_get_property, test_dbus_interface_set_property};
+
+void
+foo_struct_init (FooStruct *self,
+                 gint i,
+                 const gchar* s)
+{
+       gchar* _tmp0_;
+       g_return_if_fail (s != NULL);
+       memset (self, 0, sizeof (FooStruct));
+       (*self).i = i;
+       _tmp0_ = g_strdup (s);
+       _g_free0 ((*self).s);
+       (*self).s = _tmp0_;
+}
+
+void
+foo_struct_copy (const FooStruct* self,
+                 FooStruct* dest)
+{
+       const gchar* _tmp0_;
+       gchar* _tmp1_;
+       (*dest).i = (*self).i;
+       _tmp0_ = (*self).s;
+       _tmp1_ = g_strdup (_tmp0_);
+       _g_free0 ((*dest).s);
+       (*dest).s = _tmp1_;
+}
+
+void
+foo_struct_destroy (FooStruct* self)
+{
+       _g_free0 ((*self).s);
+}
+
+FooStruct*
+foo_struct_dup (const FooStruct* self)
+{
+       FooStruct* dup;
+       dup = g_new0 (FooStruct, 1);
+       foo_struct_copy (self, dup);
+       return dup;
+}
+
+void
+foo_struct_free (FooStruct* self)
+{
+       foo_struct_destroy (self);
+       g_free (self);
+}
+
+static GType
+foo_struct_get_type_once (void)
+{
+       GType foo_struct_type_id;
+       foo_struct_type_id = g_boxed_type_register_static ("FooStruct", (GBoxedCopyFunc) foo_struct_dup, 
(GBoxedFreeFunc) foo_struct_free);
+       return foo_struct_type_id;
+}
+
+GType
+foo_struct_get_type (void)
+{
+       static volatile gsize foo_struct_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_struct_type_id__volatile)) {
+               GType foo_struct_type_id;
+               foo_struct_type_id = foo_struct_get_type_once ();
+               g_once_init_leave (&foo_struct_type_id__volatile, foo_struct_type_id);
+       }
+       return foo_struct_type_id__volatile;
+}
+
+void
+test_test_struct (Test* self,
+                  FooStruct* f,
+                  FooStruct* g,
+                  FooStruct* result,
+                  GError** error)
+{
+       TestIface* _iface_;
+       g_return_if_fail (IS_TEST (self));
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->test_struct) {
+               _iface_->test_struct (self, f, g, result, error);
+       }
+}
+
+void
+test_get_test_property (Test* self,
+                        FooStruct * result)
+{
+       TestIface* _iface_;
+       g_return_if_fail (IS_TEST (self));
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->get_test_property) {
+               _iface_->get_test_property (self, result);
+       }
+       return;
+}
+
+void
+test_set_test_property (Test* self,
+                        FooStruct * value)
+{
+       TestIface* _iface_;
+       g_return_if_fail (IS_TEST (self));
+       _iface_ = TEST_GET_INTERFACE (self);
+       if (_iface_->set_test_property) {
+               _iface_->set_test_property (self, value);
+       }
+}
+
+static void
+test_default_init (TestIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType test_type_id;
+       test_type_id = g_type_register_static (G_TYPE_INTERFACE, "Test", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (test_type_id, G_TYPE_OBJECT);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) 
test_proxy_get_type);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), 
"org.example.Test");
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*) 
(&_test_dbus_interface_info));
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_register_object);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_TEST, 
test_proxy_test_interface_init) )
+static void
+test_proxy_class_init (TestProxyClass* klass)
+{
+       G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal;
+}
+
+static void
+test_proxy_g_signal (GDBusProxy* proxy,
+                     const gchar* sender_name,
+                     const gchar* signal_name,
+                     GVariant* parameters)
+{
+}
+
+static void
+test_proxy_init (TestProxy* self)
+{
+       g_dbus_proxy_set_interface_info (G_DBUS_PROXY (self), (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info));
+}
+
+static void
+test_proxy_test_struct (Test* self,
+                        FooStruct* f,
+                        FooStruct* g,
+                        FooStruct* result,
+                        GError** error)
+{
+       GDBusMessage *_message;
+       GVariant *_arguments;
+       GVariantBuilder _arguments_builder;
+       GVariantBuilder _tmp0_;
+       GDBusMessage *_reply_message;
+       GVariant *_reply;
+       GVariantIter _reply_iter;
+       FooStruct _vala_g = {0};
+       GVariant* _tmp1_;
+       FooStruct _tmp2_;
+       GVariantIter _tmp3_;
+       GVariant* _tmp4_;
+       GVariant* _tmp5_;
+       GVariant* _tmp6_;
+       FooStruct _tmp7_;
+       GVariantIter _tmp8_;
+       GVariant* _tmp9_;
+       GVariant* _tmp10_;
+       G_IO_ERROR;
+       _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), 
g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "TestStruct");
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_init (&_tmp0_, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_tmp0_, g_variant_new_int32 ((*f).i));
+       g_variant_builder_add_value (&_tmp0_, g_variant_new_string ((*f).s));
+       g_variant_builder_add_value (&_arguments_builder, g_variant_builder_end (&_tmp0_));
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       g_dbus_message_set_body (_message, _arguments);
+       _reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection 
((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout 
((GDBusProxy *) self), NULL, NULL, error);
+       g_object_unref (_message);
+       if (!_reply_message) {
+               return;
+       }
+       if (g_dbus_message_to_gerror (_reply_message, error)) {
+               g_object_unref (_reply_message);
+               return;
+       }
+       _reply = g_dbus_message_get_body (_reply_message);
+       g_variant_iter_init (&_reply_iter, _reply);
+       _tmp1_ = g_variant_iter_next_value (&_reply_iter);
+       g_variant_iter_init (&_tmp3_, _tmp1_);
+       _tmp4_ = g_variant_iter_next_value (&_tmp3_);
+       _tmp2_.i = g_variant_get_int32 (_tmp4_);
+       g_variant_unref (_tmp4_);
+       _tmp5_ = g_variant_iter_next_value (&_tmp3_);
+       _tmp2_.s = g_variant_dup_string (_tmp5_, NULL);
+       g_variant_unref (_tmp5_);
+       _vala_g = _tmp2_;
+       g_variant_unref (_tmp1_);
+       *g = _vala_g;
+       _tmp6_ = g_variant_iter_next_value (&_reply_iter);
+       g_variant_iter_init (&_tmp8_, _tmp6_);
+       _tmp9_ = g_variant_iter_next_value (&_tmp8_);
+       _tmp7_.i = g_variant_get_int32 (_tmp9_);
+       g_variant_unref (_tmp9_);
+       _tmp10_ = g_variant_iter_next_value (&_tmp8_);
+       _tmp7_.s = g_variant_dup_string (_tmp10_, NULL);
+       g_variant_unref (_tmp10_);
+       *result = _tmp7_;
+       g_variant_unref (_tmp6_);
+       g_object_unref (_reply_message);
+}
+
+static void
+test_dbus_proxy_get_test_property (Test* self,
+                                   FooStruct* result)
+{
+       GVariant *_inner_reply;
+       FooStruct _tmp11_;
+       GVariantIter _tmp12_;
+       GVariant* _tmp13_;
+       GVariant* _tmp14_;
+       _inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "TestProperty");
+       if (!_inner_reply) {
+               GVariant *_arguments;
+               GVariant *_reply;
+               GVariantBuilder _arguments_builder;
+               g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+               g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.example.Test"));
+               g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("TestProperty"));
+               _arguments = g_variant_builder_end (&_arguments_builder);
+               _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", 
_arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+               if (!_reply) {
+                       return;
+               }
+               g_variant_get (_reply, "(v)", &_inner_reply);
+               g_variant_unref (_reply);
+       }
+       g_variant_iter_init (&_tmp12_, _inner_reply);
+       _tmp13_ = g_variant_iter_next_value (&_tmp12_);
+       _tmp11_.i = g_variant_get_int32 (_tmp13_);
+       g_variant_unref (_tmp13_);
+       _tmp14_ = g_variant_iter_next_value (&_tmp12_);
+       _tmp11_.s = g_variant_dup_string (_tmp14_, NULL);
+       g_variant_unref (_tmp14_);
+       *result = _tmp11_;
+       g_variant_unref (_inner_reply);
+       return;
+}
+
+static void
+test_dbus_proxy_set_test_property (Test* self,
+                                   FooStruct* value)
+{
+       GVariant *_arguments;
+       GVariant *_reply;
+       GVariantBuilder _arguments_builder;
+       GVariantBuilder _tmp15_;
+       g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.example.Test"));
+       g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("TestProperty"));
+       g_variant_builder_open (&_arguments_builder, G_VARIANT_TYPE_VARIANT);
+       g_variant_builder_init (&_tmp15_, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_tmp15_, g_variant_new_int32 ((*value).i));
+       g_variant_builder_add_value (&_tmp15_, g_variant_new_string ((*value).s));
+       g_variant_builder_add_value (&_arguments_builder, g_variant_builder_end (&_tmp15_));
+       g_variant_builder_close (&_arguments_builder);
+       _arguments = g_variant_builder_end (&_arguments_builder);
+       _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Set", 
_arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+       if (!_reply) {
+               return;
+       }
+       g_variant_unref (_reply);
+}
+
+static void
+test_proxy_test_interface_init (TestIface* iface)
+{
+       iface->test_struct = test_proxy_test_struct;
+       iface->get_test_property = test_dbus_proxy_get_test_property;
+       iface->set_test_property = test_dbus_proxy_set_test_property;
+}
+
+static void
+_dbus_test_test_struct (Test* self,
+                        GVariant* _parameters_,
+                        GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       FooStruct f = {0};
+       GVariant* _tmp16_;
+       FooStruct _tmp17_;
+       GVariantIter _tmp18_;
+       GVariant* _tmp19_;
+       GVariant* _tmp20_;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       FooStruct g = {0};
+       GVariantBuilder _tmp21_;
+       FooStruct result = {0};
+       GVariantBuilder _tmp22_;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _tmp16_ = g_variant_iter_next_value (&_arguments_iter);
+       g_variant_iter_init (&_tmp18_, _tmp16_);
+       _tmp19_ = g_variant_iter_next_value (&_tmp18_);
+       _tmp17_.i = g_variant_get_int32 (_tmp19_);
+       g_variant_unref (_tmp19_);
+       _tmp20_ = g_variant_iter_next_value (&_tmp18_);
+       _tmp17_.s = g_variant_dup_string (_tmp20_, NULL);
+       g_variant_unref (_tmp20_);
+       f = _tmp17_;
+       g_variant_unref (_tmp16_);
+       test_test_struct (self, &f, &g, &result, &error);
+       if (error) {
+               g_dbus_method_invocation_return_gerror (invocation, error);
+               g_error_free (error);
+               goto _error;
+       }
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_init (&_tmp21_, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_tmp21_, g_variant_new_int32 (g.i));
+       g_variant_builder_add_value (&_tmp21_, g_variant_new_string (g.s));
+       g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp21_));
+       g_variant_builder_init (&_tmp22_, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_tmp22_, g_variant_new_int32 (result.i));
+       g_variant_builder_add_value (&_tmp22_, g_variant_new_string (result.s));
+       g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp22_));
+       foo_struct_destroy (&result);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+       _error:
+       foo_struct_destroy (&f);
+       foo_struct_destroy (&g);
+       ;
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* method_name,
+                                 GVariant* parameters,
+                                 GDBusMethodInvocation* invocation,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "TestStruct") == 0) {
+               _dbus_test_test_struct (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+_dbus_test_get_test_property (Test* self)
+{
+       FooStruct result = {0};
+       GVariant* _reply;
+       GVariantBuilder _tmp23_;
+       test_get_test_property (self, &result);
+       g_variant_builder_init (&_tmp23_, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_tmp23_, g_variant_new_int32 (result.i));
+       g_variant_builder_add_value (&_tmp23_, g_variant_new_string (result.s));
+       _reply = g_variant_builder_end (&_tmp23_);
+       foo_struct_destroy (&result);
+       return _reply;
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (property_name, "TestProperty") == 0) {
+               return _dbus_test_get_test_property (object);
+       }
+       return NULL;
+}
+
+static void
+_dbus_test_set_test_property (Test* self,
+                              GVariant* _value)
+{
+       FooStruct value = {0};
+       FooStruct _tmp24_;
+       GVariantIter _tmp25_;
+       GVariant* _tmp26_;
+       GVariant* _tmp27_;
+       g_variant_iter_init (&_tmp25_, _value);
+       _tmp26_ = g_variant_iter_next_value (&_tmp25_);
+       _tmp24_.i = g_variant_get_int32 (_tmp26_);
+       g_variant_unref (_tmp26_);
+       _tmp27_ = g_variant_iter_next_value (&_tmp25_);
+       _tmp24_.s = g_variant_dup_string (_tmp27_, NULL);
+       g_variant_unref (_tmp27_);
+       value = _tmp24_;
+       test_set_test_property (self, &value);
+       foo_struct_destroy (&value);
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GVariant* value,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (property_name, "TestProperty") == 0) {
+               _dbus_test_set_test_property (object, value);
+               return TRUE;
+       }
+       return FALSE;
+}
+
+guint
+test_register_object (gpointer object,
+                      GDBusConnection* connection,
+                      const gchar* path,
+                      GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+static void
+_vala_main (void)
+{
+       Test* test = NULL;
+       Test* _tmp0_;
+       FooStruct f = {0};
+       FooStruct g = {0};
+       FooStruct h = {0};
+       FooStruct _tmp1_ = {0};
+       Test* _tmp2_;
+       FooStruct _tmp3_;
+       FooStruct _tmp4_ = {0};
+       FooStruct _tmp5_ = {0};
+       FooStruct _tmp6_;
+       FooStruct _tmp7_;
+       FooStruct _tmp8_;
+       const gchar* _tmp9_;
+       FooStruct _tmp10_;
+       FooStruct _tmp11_;
+       const gchar* _tmp12_;
+       Test* _tmp13_;
+       FooStruct _tmp14_;
+       Test* _tmp15_;
+       FooStruct _tmp16_ = {0};
+       FooStruct _tmp17_;
+       FooStruct _tmp18_;
+       FooStruct _tmp19_;
+       const gchar* _tmp20_;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = (Test*) g_initable_new (TYPE_TEST_PROXY, NULL, &_inner_error0_, "g-flags", 
G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, "g-name", "org.example.Test", "g-bus-type", G_BUS_TYPE_SESSION, 
"g-object-path", "/org/example/test", "g-interface-name", "org.example.Test", NULL);
+       test = (Test*) _tmp0_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       foo_struct_destroy (&f);
+       foo_struct_init (&f, 42, "hello");
+       _tmp2_ = test;
+       _tmp3_ = f;
+       test_test_struct (_tmp2_, &_tmp3_, &_tmp4_, &_tmp5_, &_inner_error0_);
+       foo_struct_destroy (&g);
+       g = _tmp4_;
+       _tmp1_ = _tmp5_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               foo_struct_destroy (&h);
+               foo_struct_destroy (&g);
+               foo_struct_destroy (&f);
+               _g_object_unref0 (test);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp6_ = _tmp1_;
+       memset (&_tmp1_, 0, sizeof (FooStruct));
+       foo_struct_destroy (&h);
+       h = _tmp6_;
+       _tmp7_ = g;
+       _vala_assert (_tmp7_.i == 23, "g.i == 23");
+       _tmp8_ = g;
+       _tmp9_ = _tmp8_.s;
+       _vala_assert (g_strcmp0 (_tmp9_, "world") == 0, "g.s == \"world\"");
+       _tmp10_ = h;
+       _vala_assert (_tmp10_.i == 11, "h.i == 11");
+       _tmp11_ = h;
+       _tmp12_ = _tmp11_.s;
+       _vala_assert (g_strcmp0 (_tmp12_, "vala") == 0, "h.s == \"vala\"");
+       _tmp13_ = test;
+       _tmp14_ = f;
+       test_set_test_property (_tmp13_, &_tmp14_);
+       _tmp15_ = test;
+       test_get_test_property (_tmp15_, &_tmp16_);
+       _tmp17_ = _tmp16_;
+       foo_struct_destroy (&g);
+       g = _tmp17_;
+       _tmp18_ = g;
+       _vala_assert (_tmp18_.i == 42, "g.i == 42");
+       _tmp19_ = g;
+       _tmp20_ = _tmp19_.s;
+       _vala_assert (g_strcmp0 (_tmp20_, "hello") == 0, "g.s == \"hello\"");
+       foo_struct_destroy (&_tmp1_);
+       foo_struct_destroy (&h);
+       foo_struct_destroy (&g);
+       foo_struct_destroy (&f);
+       _g_object_unref0 (test);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/dbus/structs_server.c-expected b/tests/dbus/structs_server.c-expected
new file mode 100644
index 000000000..0840275f1
--- /dev/null
+++ b/tests/dbus/structs_server.c-expected
@@ -0,0 +1,758 @@
+/* dbus_structs_server.c generated by valac, the Vala compiler
+ * generated from dbus_structs_server.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+#include <gio/gio.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO_STRUCT (foo_struct_get_type ())
+typedef struct _FooStruct FooStruct;
+#define _g_free0(var) (var = (g_free (var), NULL))
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TEST, TestClass))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define IS_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TEST))
+#define TEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TEST, TestClass))
+
+typedef struct _Test Test;
+typedef struct _TestClass TestClass;
+typedef struct _TestPrivate TestPrivate;
+enum  {
+       TEST_0_PROPERTY,
+       TEST_TEST_PROPERTY_PROPERTY,
+       TEST_NUM_PROPERTIES
+};
+static GParamSpec* test_properties[TEST_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _FooStruct {
+       gint i;
+       gchar* s;
+};
+
+struct _Test {
+       GObject parent_instance;
+       TestPrivate * priv;
+};
+
+struct _TestClass {
+       GObjectClass parent_class;
+};
+
+struct _TestPrivate {
+       FooStruct _test_property;
+};
+
+static gint Test_private_offset;
+static gpointer test_parent_class = NULL;
+VALA_EXTERN GMainLoop* main_loop;
+GMainLoop* main_loop = NULL;
+
+VALA_EXTERN GType foo_struct_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN FooStruct* foo_struct_dup (const FooStruct* self);
+VALA_EXTERN void foo_struct_free (FooStruct* self);
+VALA_EXTERN void foo_struct_copy (const FooStruct* self,
+                      FooStruct* dest);
+VALA_EXTERN void foo_struct_destroy (FooStruct* self);
+VALA_EXTERN void foo_struct_init (FooStruct *self,
+                      gint i,
+                      const gchar* s);
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
+VALA_EXTERN guint test_register_object (void* object,
+                            GDBusConnection* connection,
+                            const gchar* path,
+                            GError** error);
+VALA_EXTERN void test_test_struct (Test* self,
+                       FooStruct* f,
+                       FooStruct* g,
+                       FooStruct* result);
+VALA_EXTERN Test* test_new (void);
+VALA_EXTERN Test* test_construct (GType object_type);
+VALA_EXTERN void test_get_test_property (Test* self,
+                             FooStruct * result);
+VALA_EXTERN void test_set_test_property (Test* self,
+                             FooStruct * value);
+static gboolean _foo_struct_equal (const FooStruct * s1,
+                            const FooStruct * s2);
+static void test_finalize (GObject * obj);
+static GType test_get_type_once (void);
+static void _vala_test_get_property (GObject * object,
+                              guint property_id,
+                              GValue * value,
+                              GParamSpec * pspec);
+static void _vala_test_set_property (GObject * object,
+                              guint property_id,
+                              const GValue * value,
+                              GParamSpec * pspec);
+static void _dbus_test_test_struct (Test* self,
+                             GVariant* _parameters_,
+                             GDBusMethodInvocation* invocation);
+static void test_dbus_interface_method_call (GDBusConnection* connection,
+                                      const gchar* sender,
+                                      const gchar* object_path,
+                                      const gchar* interface_name,
+                                      const gchar* method_name,
+                                      GVariant* parameters,
+                                      GDBusMethodInvocation* invocation,
+                                      gpointer user_data);
+static GVariant* test_dbus_interface_get_property (GDBusConnection* connection,
+                                            const gchar* sender,
+                                            const gchar* object_path,
+                                            const gchar* interface_name,
+                                            const gchar* property_name,
+                                            GError** error,
+                                            gpointer user_data);
+static GVariant* _dbus_test_get_test_property (Test* self);
+static gboolean test_dbus_interface_set_property (GDBusConnection* connection,
+                                           const gchar* sender,
+                                           const gchar* object_path,
+                                           const gchar* interface_name,
+                                           const gchar* property_name,
+                                           GVariant* value,
+                                           GError** error,
+                                           gpointer user_data);
+static void _dbus_test_set_test_property (Test* self,
+                                   GVariant* _value);
+static void _test_unregister_object (gpointer user_data);
+VALA_EXTERN void client_exit (GPid pid,
+                  gint status);
+static void _vala_main (void);
+static guint _variant_get1 (GVariant* value);
+static void _client_exit_gchild_watch_func (GPid pid,
+                                     gint wait_status,
+                                     gpointer self);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static const GDBusArgInfo _test_dbus_arg_info_test_struct_f = {-1, "f", "(is)", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_struct_g = {-1, "g", "(is)", NULL};
+static const GDBusArgInfo _test_dbus_arg_info_test_struct_result = {-1, "result", "(is)", NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_struct_in[] = 
{&_test_dbus_arg_info_test_struct_f, NULL};
+static const GDBusArgInfo * const _test_dbus_arg_info_test_struct_out[] = 
{&_test_dbus_arg_info_test_struct_g, &_test_dbus_arg_info_test_struct_result, NULL};
+static const GDBusMethodInfo _test_dbus_method_info_test_struct = {-1, "TestStruct", (GDBusArgInfo **) 
(&_test_dbus_arg_info_test_struct_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_struct_out), NULL};
+static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_test_struct, NULL};
+static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL};
+static const GDBusPropertyInfo _test_dbus_property_info_test_property = {-1, "TestProperty", "(is)", 
G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, NULL};
+static const GDBusPropertyInfo * const _test_dbus_property_info[] = 
{&_test_dbus_property_info_test_property, NULL};
+static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) 
(&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) 
(&_test_dbus_property_info), NULL};
+static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, 
test_dbus_interface_get_property, test_dbus_interface_set_property};
+
+void
+foo_struct_init (FooStruct *self,
+                 gint i,
+                 const gchar* s)
+{
+       gchar* _tmp0_;
+       g_return_if_fail (s != NULL);
+       memset (self, 0, sizeof (FooStruct));
+       (*self).i = i;
+       _tmp0_ = g_strdup (s);
+       _g_free0 ((*self).s);
+       (*self).s = _tmp0_;
+}
+
+void
+foo_struct_copy (const FooStruct* self,
+                 FooStruct* dest)
+{
+       const gchar* _tmp0_;
+       gchar* _tmp1_;
+       (*dest).i = (*self).i;
+       _tmp0_ = (*self).s;
+       _tmp1_ = g_strdup (_tmp0_);
+       _g_free0 ((*dest).s);
+       (*dest).s = _tmp1_;
+}
+
+void
+foo_struct_destroy (FooStruct* self)
+{
+       _g_free0 ((*self).s);
+}
+
+FooStruct*
+foo_struct_dup (const FooStruct* self)
+{
+       FooStruct* dup;
+       dup = g_new0 (FooStruct, 1);
+       foo_struct_copy (self, dup);
+       return dup;
+}
+
+void
+foo_struct_free (FooStruct* self)
+{
+       foo_struct_destroy (self);
+       g_free (self);
+}
+
+static GType
+foo_struct_get_type_once (void)
+{
+       GType foo_struct_type_id;
+       foo_struct_type_id = g_boxed_type_register_static ("FooStruct", (GBoxedCopyFunc) foo_struct_dup, 
(GBoxedFreeFunc) foo_struct_free);
+       return foo_struct_type_id;
+}
+
+GType
+foo_struct_get_type (void)
+{
+       static volatile gsize foo_struct_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_struct_type_id__volatile)) {
+               GType foo_struct_type_id;
+               foo_struct_type_id = foo_struct_get_type_once ();
+               g_once_init_leave (&foo_struct_type_id__volatile, foo_struct_type_id);
+       }
+       return foo_struct_type_id__volatile;
+}
+
+static inline gpointer
+test_get_instance_private (Test* self)
+{
+       return G_STRUCT_MEMBER_P (self, Test_private_offset);
+}
+
+void
+test_test_struct (Test* self,
+                  FooStruct* f,
+                  FooStruct* g,
+                  FooStruct* result)
+{
+       FooStruct _vala_g = {0};
+       FooStruct _tmp0_;
+       FooStruct _tmp1_;
+       const gchar* _tmp2_;
+       FooStruct _tmp3_ = {0};
+       g_return_if_fail (IS_TEST (self));
+       g_return_if_fail (f != NULL);
+       _tmp0_ = *f;
+       _vala_assert (_tmp0_.i == 42, "f.i == 42");
+       _tmp1_ = *f;
+       _tmp2_ = _tmp1_.s;
+       _vala_assert (g_strcmp0 (_tmp2_, "hello") == 0, "f.s == \"hello\"");
+       foo_struct_destroy (&_vala_g);
+       foo_struct_init (&_vala_g, 23, "world");
+       foo_struct_init (&_tmp3_, 11, "vala");
+       *result = _tmp3_;
+       if (g) {
+               *g = _vala_g;
+       } else {
+               foo_struct_destroy (&_vala_g);
+       }
+       return;
+}
+
+Test*
+test_construct (GType object_type)
+{
+       Test * self = NULL;
+       self = (Test*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Test*
+test_new (void)
+{
+       return test_construct (TYPE_TEST);
+}
+
+void
+test_get_test_property (Test* self,
+                        FooStruct * result)
+{
+       FooStruct _tmp0_;
+       FooStruct _tmp1_;
+       FooStruct _tmp2_ = {0};
+       g_return_if_fail (IS_TEST (self));
+       _tmp0_ = self->priv->_test_property;
+       _tmp1_ = _tmp0_;
+       foo_struct_copy (&_tmp1_, &_tmp2_);
+       *result = _tmp2_;
+       return;
+}
+
+static gboolean
+_foo_struct_equal (const FooStruct * s1,
+                   const FooStruct * s2)
+{
+       if (s1 == s2) {
+               return TRUE;
+       }
+       if (s1 == NULL) {
+               return FALSE;
+       }
+       if (s2 == NULL) {
+               return FALSE;
+       }
+       if (s1->i != s2->i) {
+               return FALSE;
+       }
+       if (g_strcmp0 (s1->s, s2->s)) {
+               return FALSE;
+       }
+       return TRUE;
+}
+
+void
+test_set_test_property (Test* self,
+                        FooStruct * value)
+{
+       FooStruct old_value;
+       g_return_if_fail (IS_TEST (self));
+       test_get_test_property (self, &old_value);
+       if (_foo_struct_equal (value, &old_value) != TRUE) {
+               FooStruct _tmp0_;
+               FooStruct _tmp1_;
+               FooStruct _tmp2_ = {0};
+               _tmp0_ = *value;
+               _tmp1_ = _tmp0_;
+               foo_struct_copy (&_tmp1_, &_tmp2_);
+               foo_struct_destroy (&self->priv->_test_property);
+               self->priv->_test_property = _tmp2_;
+               g_object_notify_by_pspec ((GObject *) self, test_properties[TEST_TEST_PROPERTY_PROPERTY]);
+       }
+       foo_struct_destroy (&old_value);
+}
+
+static void
+test_class_init (TestClass * klass,
+                 gpointer klass_data)
+{
+       test_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Test_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_test_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_test_set_property;
+       G_OBJECT_CLASS (klass)->finalize = test_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), TEST_TEST_PROPERTY_PROPERTY, 
test_properties[TEST_TEST_PROPERTY_PROPERTY] = g_param_spec_boxed ("test-property", "test-property", 
"test-property", TYPE_FOO_STRUCT, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+}
+
+static void
+test_instance_init (Test * self,
+                    gpointer klass)
+{
+       self->priv = test_get_instance_private (self);
+}
+
+static void
+test_finalize (GObject * obj)
+{
+       Test * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_TEST, Test);
+       foo_struct_destroy (&self->priv->_test_property);
+       G_OBJECT_CLASS (test_parent_class)->finalize (obj);
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Test), 
0, (GInstanceInitFunc) test_instance_init, NULL };
+       GType test_type_id;
+       test_type_id = g_type_register_static (G_TYPE_OBJECT, "Test", &g_define_type_info, 0);
+       g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) 
test_register_object);
+       Test_private_offset = g_type_add_instance_private (test_type_id, sizeof (TestPrivate));
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+static void
+_vala_test_get_property (GObject * object,
+                         guint property_id,
+                         GValue * value,
+                         GParamSpec * pspec)
+{
+       Test * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+       switch (property_id) {
+               case TEST_TEST_PROPERTY_PROPERTY:
+               {
+                       FooStruct boxed;
+                       test_get_test_property (self, &boxed);
+                       g_value_set_boxed (value, &boxed);
+                       foo_struct_destroy (&boxed);
+               }
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_test_set_property (GObject * object,
+                         guint property_id,
+                         const GValue * value,
+                         GParamSpec * pspec)
+{
+       Test * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST, Test);
+       switch (property_id) {
+               case TEST_TEST_PROPERTY_PROPERTY:
+               test_set_test_property (self, g_value_get_boxed (value));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_dbus_test_test_struct (Test* self,
+                        GVariant* _parameters_,
+                        GDBusMethodInvocation* invocation)
+{
+       GError* error = NULL;
+       GVariantIter _arguments_iter;
+       FooStruct f = {0};
+       GVariant* _tmp0_;
+       FooStruct _tmp1_;
+       GVariantIter _tmp2_;
+       GVariant* _tmp3_;
+       GVariant* _tmp4_;
+       GDBusMessage* _reply_message = NULL;
+       GVariant* _reply;
+       GVariantBuilder _reply_builder;
+       FooStruct g = {0};
+       GVariantBuilder _tmp5_;
+       FooStruct result = {0};
+       GVariantBuilder _tmp6_;
+       g_variant_iter_init (&_arguments_iter, _parameters_);
+       _tmp0_ = g_variant_iter_next_value (&_arguments_iter);
+       g_variant_iter_init (&_tmp2_, _tmp0_);
+       _tmp3_ = g_variant_iter_next_value (&_tmp2_);
+       _tmp1_.i = g_variant_get_int32 (_tmp3_);
+       g_variant_unref (_tmp3_);
+       _tmp4_ = g_variant_iter_next_value (&_tmp2_);
+       _tmp1_.s = g_variant_dup_string (_tmp4_, NULL);
+       g_variant_unref (_tmp4_);
+       f = _tmp1_;
+       g_variant_unref (_tmp0_);
+       test_test_struct (self, &f, &g, &result);
+       _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+       g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_init (&_tmp5_, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_tmp5_, g_variant_new_int32 (g.i));
+       g_variant_builder_add_value (&_tmp5_, g_variant_new_string (g.s));
+       g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp5_));
+       g_variant_builder_init (&_tmp6_, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_tmp6_, g_variant_new_int32 (result.i));
+       g_variant_builder_add_value (&_tmp6_, g_variant_new_string (result.s));
+       g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp6_));
+       foo_struct_destroy (&result);
+       _reply = g_variant_builder_end (&_reply_builder);
+       g_dbus_message_set_body (_reply_message, _reply);
+       g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, 
G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+       g_object_unref (invocation);
+       g_object_unref (_reply_message);
+       foo_struct_destroy (&f);
+       foo_struct_destroy (&g);
+}
+
+static void
+test_dbus_interface_method_call (GDBusConnection* connection,
+                                 const gchar* sender,
+                                 const gchar* object_path,
+                                 const gchar* interface_name,
+                                 const gchar* method_name,
+                                 GVariant* parameters,
+                                 GDBusMethodInvocation* invocation,
+                                 gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (method_name, "TestStruct") == 0) {
+               _dbus_test_test_struct (object, parameters, invocation);
+       } else {
+               g_object_unref (invocation);
+       }
+}
+
+static GVariant*
+_dbus_test_get_test_property (Test* self)
+{
+       FooStruct result = {0};
+       GVariant* _reply;
+       GVariantBuilder _tmp7_;
+       test_get_test_property (self, &result);
+       g_variant_builder_init (&_tmp7_, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_tmp7_, g_variant_new_int32 (result.i));
+       g_variant_builder_add_value (&_tmp7_, g_variant_new_string (result.s));
+       _reply = g_variant_builder_end (&_tmp7_);
+       foo_struct_destroy (&result);
+       return _reply;
+}
+
+static GVariant*
+test_dbus_interface_get_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (property_name, "TestProperty") == 0) {
+               return _dbus_test_get_test_property (object);
+       }
+       return NULL;
+}
+
+static void
+_dbus_test_set_test_property (Test* self,
+                              GVariant* _value)
+{
+       FooStruct value = {0};
+       FooStruct _tmp8_;
+       GVariantIter _tmp9_;
+       GVariant* _tmp10_;
+       GVariant* _tmp11_;
+       g_variant_iter_init (&_tmp9_, _value);
+       _tmp10_ = g_variant_iter_next_value (&_tmp9_);
+       _tmp8_.i = g_variant_get_int32 (_tmp10_);
+       g_variant_unref (_tmp10_);
+       _tmp11_ = g_variant_iter_next_value (&_tmp9_);
+       _tmp8_.s = g_variant_dup_string (_tmp11_, NULL);
+       g_variant_unref (_tmp11_);
+       value = _tmp8_;
+       test_set_test_property (self, &value);
+       foo_struct_destroy (&value);
+}
+
+static gboolean
+test_dbus_interface_set_property (GDBusConnection* connection,
+                                  const gchar* sender,
+                                  const gchar* object_path,
+                                  const gchar* interface_name,
+                                  const gchar* property_name,
+                                  GVariant* value,
+                                  GError** error,
+                                  gpointer user_data)
+{
+       gpointer* data;
+       gpointer object;
+       data = user_data;
+       object = data[0];
+       if (strcmp (property_name, "TestProperty") == 0) {
+               _dbus_test_set_test_property (object, value);
+               return TRUE;
+       }
+       return FALSE;
+}
+
+guint
+test_register_object (gpointer object,
+                      GDBusConnection* connection,
+                      const gchar* path,
+                      GError** error)
+{
+       guint result;
+       gpointer *data;
+       data = g_new (gpointer, 3);
+       data[0] = g_object_ref (object);
+       data[1] = g_object_ref (connection);
+       data[2] = g_strdup (path);
+       result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) 
(&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error);
+       if (!result) {
+               return 0;
+       }
+       return result;
+}
+
+static void
+_test_unregister_object (gpointer user_data)
+{
+       gpointer* data;
+       data = user_data;
+       g_object_unref (data[0]);
+       g_object_unref (data[1]);
+       g_free (data[2]);
+       g_free (data);
+}
+
+void
+client_exit (GPid pid,
+             gint status)
+{
+       GMainLoop* _tmp0_;
+       _vala_assert (status == 0, "status == 0");
+       _tmp0_ = main_loop;
+       g_main_loop_quit (_tmp0_);
+}
+
+static guint
+_variant_get1 (GVariant* value)
+{
+       return g_variant_get_uint32 (value);
+}
+
+static void
+_client_exit_gchild_watch_func (GPid pid,
+                                gint wait_status,
+                                gpointer self)
+{
+       client_exit (pid, wait_status);
+}
+
+static void
+_vala_main (void)
+{
+       GDBusConnection* conn = NULL;
+       GDBusConnection* _tmp0_;
+       GDBusConnection* _tmp1_;
+       Test* _tmp2_;
+       Test* _tmp3_;
+       GVariant* request_result = NULL;
+       GDBusConnection* _tmp4_;
+       GVariant* _tmp5_;
+       GVariant* _tmp6_;
+       GVariant* _tmp7_;
+       GVariant* _tmp8_;
+       GVariant* _tmp9_;
+       GVariant* _tmp10_;
+       GVariant* _tmp11_;
+       guint _tmp12_;
+       GPid client_pid = 0;
+       gchar* _tmp13_;
+       gchar** _tmp14_;
+       gchar** _tmp15_;
+       gint _tmp15__length1;
+       GPid _tmp16_ = 0;
+       GMainLoop* _tmp17_;
+       GMainLoop* _tmp18_;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &_inner_error0_);
+       conn = _tmp0_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp1_ = conn;
+       _tmp2_ = test_new ();
+       _tmp3_ = _tmp2_;
+       test_register_object (_tmp3_, _tmp1_, "/org/example/test", &_inner_error0_);
+       _g_object_unref0 (_tmp3_);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp4_ = conn;
+       _tmp5_ = g_variant_new ("(su)", "org.example.Test", 0x4, NULL);
+       g_variant_ref_sink (_tmp5_);
+       _tmp6_ = _tmp5_;
+       _tmp7_ = g_dbus_connection_call_sync (_tmp4_, "org.freedesktop.DBus", "/org/freedesktop/DBus", 
"org.freedesktop.DBus", "RequestName", _tmp6_, NULL, 0, -1, NULL, &_inner_error0_);
+       _tmp8_ = _tmp7_;
+       _g_variant_unref0 (_tmp6_);
+       request_result = _tmp8_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp9_ = request_result;
+       _tmp10_ = g_variant_get_child_value (_tmp9_, (gsize) 0);
+       _tmp11_ = _tmp10_;
+       _tmp12_ = _variant_get1 (_tmp11_);
+       _vala_assert (_tmp12_ == ((guint) 1), "(uint) request_result.get_child_value (0) == 1");
+       _g_variant_unref0 (_tmp11_);
+       _tmp13_ = g_strdup ("dbus_structs_client");
+       _tmp14_ = g_new0 (gchar*, 1 + 1);
+       _tmp14_[0] = _tmp13_;
+       _tmp15_ = _tmp14_;
+       _tmp15__length1 = 1;
+       g_spawn_async (NULL, _tmp15_, NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &_tmp16_, &_inner_error0_);
+       client_pid = _tmp16_;
+       _tmp15_ = (_vala_array_free (_tmp15_, _tmp15__length1, (GDestroyNotify) g_free), NULL);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_variant_unref0 (request_result);
+               _g_object_unref0 (conn);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       g_child_watch_add_full (G_PRIORITY_DEFAULT_IDLE, client_pid, _client_exit_gchild_watch_func, NULL, 
NULL);
+       _tmp17_ = g_main_loop_new (NULL, FALSE);
+       _g_main_loop_unref0 (main_loop);
+       main_loop = _tmp17_;
+       _tmp18_ = main_loop;
+       g_main_loop_run (_tmp18_);
+       _g_variant_unref0 (request_result);
+       _g_object_unref0 (conn);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/delegates/bug539166.c-expected b/tests/delegates/bug539166.c-expected
new file mode 100644
index 000000000..515da0949
--- /dev/null
+++ b/tests/delegates/bug539166.c-expected
@@ -0,0 +1,163 @@
+/* delegates_bug539166.c generated by valac, the Vala compiler
+ * generated from delegates_bug539166.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef void (*Deleg) (gpointer user_data);
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+       GObject* baz;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN void foo_bar (Foo* self);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (GObject * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+void
+foo_bar (Foo* self)
+{
+       GObject* _tmp0_;
+       g_return_if_fail (IS_FOO (self));
+       _tmp0_ = self->baz;
+       _vala_assert (_tmp0_ != NULL, "baz != null");
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       G_OBJECT_CLASS (klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       GObject* _tmp0_;
+       _tmp0_ = g_object_new (G_TYPE_OBJECT, NULL);
+       self->baz = _tmp0_;
+}
+
+static void
+foo_finalize (GObject * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       _g_object_unref0 (self->baz);
+       G_OBJECT_CLASS (foo_parent_class)->finalize (obj);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       Deleg deleg = NULL;
+       Foo* _tmp1_;
+       gpointer deleg_target;
+       GDestroyNotify deleg_target_destroy_notify;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       _tmp1_ = foo;
+       deleg = (Deleg) foo_bar;
+       deleg_target = g_object_ref (_tmp1_);
+       deleg_target_destroy_notify = g_object_unref;
+       _g_object_unref0 (foo);
+       foo = NULL;
+       deleg (deleg_target);
+       (deleg_target_destroy_notify == NULL) ? NULL : (deleg_target_destroy_notify (deleg_target), NULL);
+       deleg = NULL;
+       deleg_target = NULL;
+       deleg_target_destroy_notify = NULL;
+       _g_object_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/delegates/bug595610.c-expected b/tests/delegates/bug595610.c-expected
new file mode 100644
index 000000000..cbc5934c0
--- /dev/null
+++ b/tests/delegates/bug595610.c-expected
@@ -0,0 +1,109 @@
+/* delegates_bug595610.c generated by valac, the Vala compiler
+ * generated from delegates_bug595610.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+typedef void (*Func) (Foo* result, gpointer user_data);
+
+struct _Foo {
+       gint bar;
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN void do_foo (Foo* result);
+static void _vala_main (void);
+static void _do_foo_func (Foo* result,
+                   gpointer self);
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       memcpy (dup, self, sizeof (Foo));
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+void
+do_foo (Foo* result)
+{
+       Foo _tmp0_ = {0};
+       memset (&_tmp0_, 0, sizeof (Foo));
+       *result = _tmp0_;
+       return;
+}
+
+static void
+_do_foo_func (Foo* result,
+              gpointer self)
+{
+       do_foo (result);
+}
+
+static void
+_vala_main (void)
+{
+       Func func = NULL;
+       gpointer func_target;
+       GDestroyNotify func_target_destroy_notify;
+       Foo _tmp0_ = {0};
+       func = _do_foo_func;
+       func_target = NULL;
+       func_target_destroy_notify = NULL;
+       func (&_tmp0_, func_target);
+       (func_target_destroy_notify == NULL) ? NULL : (func_target_destroy_notify (func_target), NULL);
+       func = NULL;
+       func_target = NULL;
+       func_target_destroy_notify = NULL;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/delegates/bug595639.c-expected b/tests/delegates/bug595639.c-expected
new file mode 100644
index 000000000..c39528bf7
--- /dev/null
+++ b/tests/delegates/bug595639.c-expected
@@ -0,0 +1,65 @@
+/* delegates_bug595639.c generated by valac, the Vala compiler
+ * generated from delegates_bug595639.vala, do not modify */
+
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef void (*Foo) (gpointer user_data);
+
+VALA_EXTERN void do_foo (Foo foo,
+             gpointer foo_target,
+             GDestroyNotify foo_target_destroy_notify);
+static void _vala_main (void);
+
+void
+do_foo (Foo foo,
+        gpointer foo_target,
+        GDestroyNotify foo_target_destroy_notify)
+{
+       Foo bar = NULL;
+       Foo _tmp0_;
+       gpointer _tmp0__target;
+       GDestroyNotify _tmp0__target_destroy_notify;
+       gpointer bar_target;
+       GDestroyNotify bar_target_destroy_notify;
+       _tmp0_ = foo;
+       _tmp0__target = foo_target;
+       _tmp0__target_destroy_notify = foo_target_destroy_notify;
+       foo = NULL;
+       foo_target = NULL;
+       foo_target_destroy_notify = NULL;
+       bar = _tmp0_;
+       bar_target = _tmp0__target;
+       bar_target_destroy_notify = _tmp0__target_destroy_notify;
+       (bar_target_destroy_notify == NULL) ? NULL : (bar_target_destroy_notify (bar_target), NULL);
+       bar = NULL;
+       bar_target = NULL;
+       bar_target_destroy_notify = NULL;
+       (foo_target_destroy_notify == NULL) ? NULL : (foo_target_destroy_notify (foo_target), NULL);
+       foo = NULL;
+       foo_target = NULL;
+       foo_target_destroy_notify = NULL;
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/delegates/bug638415.c-expected b/tests/delegates/bug638415.c-expected
new file mode 100644
index 000000000..772da589f
--- /dev/null
+++ b/tests/delegates/bug638415.c-expected
@@ -0,0 +1,108 @@
+/* delegates_bug638415.c generated by valac, the Vala compiler
+ * generated from delegates_bug638415.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef gchar** (*Deleg) (gpointer user_data);
+
+VALA_EXTERN gchar** foo (gint* result_length1);
+static void _vala_main (void);
+static gchar** _foo_deleg (gpointer self);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+gchar**
+foo (gint* result_length1)
+{
+       gchar** _tmp0_;
+       gchar** _tmp1_;
+       gint _tmp1__length1;
+       gchar** result = NULL;
+       _tmp0_ = g_new0 (gchar*, 0 + 1);
+       _tmp1_ = _tmp0_;
+       _tmp1__length1 = 0;
+       if (result_length1) {
+               *result_length1 = _tmp1__length1;
+       }
+       result = _tmp1_;
+       return result;
+}
+
+static gchar**
+_foo_deleg (gpointer self)
+{
+       gchar** result;
+       result = foo (NULL);
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       Deleg bar = NULL;
+       gpointer bar_target;
+       GDestroyNotify bar_target_destroy_notify;
+       gchar** _tmp0_;
+       gchar** _tmp1_;
+       gint _tmp1__length1;
+       bar = _foo_deleg;
+       bar_target = NULL;
+       bar_target_destroy_notify = NULL;
+       _tmp0_ = bar (bar_target);
+       _tmp1_ = _tmp0_;
+       _tmp1__length1 = -1;
+       _tmp1_ = (_vala_array_free (_tmp1_, _tmp1__length1, (GDestroyNotify) g_free), NULL);
+       (bar_target_destroy_notify == NULL) ? NULL : (bar_target_destroy_notify (bar_target), NULL);
+       bar = NULL;
+       bar_target = NULL;
+       bar_target_destroy_notify = NULL;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/delegates/bug639751.c-expected b/tests/delegates/bug639751.c-expected
new file mode 100644
index 000000000..35f39994b
--- /dev/null
+++ b/tests/delegates/bug639751.c-expected
@@ -0,0 +1,142 @@
+/* delegates_bug639751.c generated by valac, the Vala compiler
+ * generated from delegates_bug639751.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+typedef struct _Block1Data Block1Data;
+
+struct _Foo {
+       GSourceFunc bar;
+       gpointer bar_target;
+};
+
+struct _Block1Data {
+       int _ref_count_;
+       Foo foo;
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+static void _vala_main (void);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static gboolean __lambda4_ (Block1Data* _data1_);
+static gboolean ___lambda4__gsource_func (gpointer self);
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       memcpy (dup, self, sizeof (Foo));
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static gboolean
+__lambda4_ (Block1Data* _data1_)
+{
+       gboolean result = FALSE;
+       _data1_->foo.bar = NULL;
+       _data1_->foo.bar_target = NULL;
+       result = FALSE;
+       return result;
+}
+
+static gboolean
+___lambda4__gsource_func (gpointer self)
+{
+       gboolean result;
+       result = __lambda4_ (self);
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       Block1Data* _data1_;
+       Foo baz = {0};
+       Foo _tmp0_;
+       Foo _tmp1_;
+       GSourceFunc _tmp2_;
+       gpointer _tmp2__target;
+       _data1_ = g_slice_new0 (Block1Data);
+       _data1_->_ref_count_ = 1;
+       memset (&_data1_->foo, 0, sizeof (Foo));
+       _data1_->foo.bar = ___lambda4__gsource_func;
+       _data1_->foo.bar_target = _data1_;
+       _tmp0_ = _data1_->foo;
+       baz = _tmp0_;
+       _tmp1_ = baz;
+       _tmp2_ = _tmp1_.bar;
+       _tmp2__target = _tmp1_.bar_target;
+       _tmp2_ (_tmp2__target);
+       block1_data_unref (_data1_);
+       _data1_ = NULL;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/delegates/bug659778.c-expected b/tests/delegates/bug659778.c-expected
new file mode 100644
index 000000000..f42c329c4
--- /dev/null
+++ b/tests/delegates/bug659778.c-expected
@@ -0,0 +1,521 @@
+/* delegates_bug659778.c generated by valac, the Vala compiler
+ * generated from delegates_bug659778.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef gpointer (*DoSomething) (gconstpointer g, gpointer user_data);
+typedef enum  {
+       TEST_ENUM_T
+} TestEnum;
+
+#define TYPE_TEST_ENUM (test_enum_get_type ())
+typedef struct _Block1Data Block1Data;
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TEST, TestClass))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define IS_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TEST))
+#define TEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TEST, TestClass))
+
+typedef struct _Test Test;
+typedef struct _TestClass TestClass;
+typedef struct _TestPrivate TestPrivate;
+typedef struct _ParamSpecTest ParamSpecTest;
+#define _test_unref0(var) ((var == NULL) ? NULL : (var = (test_unref (var), NULL)))
+
+struct _Block1Data {
+       int _ref_count_;
+       TestEnum self;
+       gint i;
+};
+
+struct _Test {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       TestPrivate * priv;
+};
+
+struct _TestClass {
+       GTypeClass parent_class;
+       void (*finalize) (Test *self);
+};
+
+struct _ParamSpecTest {
+       GParamSpec parent_instance;
+};
+
+static gpointer test_parent_class = NULL;
+
+VALA_EXTERN void do_something (GType g_type,
+                   GBoxedCopyFunc g_dup_func,
+                   GDestroyNotify g_destroy_func,
+                   DoSomething f,
+                   gpointer f_target);
+VALA_EXTERN GType test_enum_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN void test_enum_f (TestEnum self);
+static TestEnum __lambda4_ (TestEnum self,
+                     TestEnum x);
+static gpointer ___lambda4__do_something (gconstpointer g,
+                                   gpointer self);
+VALA_EXTERN void test_enum_g (TestEnum self,
+                  gint i);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static TestEnum __lambda5_ (Block1Data* _data1_,
+                     TestEnum x);
+static gpointer ___lambda5__do_something (gconstpointer g,
+                                   gpointer self);
+VALA_EXTERN gpointer test_ref (gpointer instance);
+VALA_EXTERN void test_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_test (const gchar* name,
+                             const gchar* nick,
+                             const gchar* blurb,
+                             GType object_type,
+                             GParamFlags flags);
+VALA_EXTERN void value_set_test (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN void value_take_test (GValue* value,
+                      gpointer v_object);
+VALA_EXTERN gpointer value_get_test (const GValue* value);
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, test_unref)
+VALA_EXTERN void test_f (Test* self);
+static TestEnum test_g (TestEnum i,
+                 Test* self);
+static gpointer _test_g_do_something (gconstpointer g,
+                               gpointer self);
+static gint test_h (gint i,
+             Test* self);
+static gpointer _test_h_do_something (gconstpointer g,
+                               gpointer self);
+VALA_EXTERN Test* test_new (void);
+VALA_EXTERN Test* test_construct (GType object_type);
+static void test_finalize (Test * obj);
+static GType test_get_type_once (void);
+static gint _vala_main (void);
+
+void
+do_something (GType g_type,
+              GBoxedCopyFunc g_dup_func,
+              GDestroyNotify g_destroy_func,
+              DoSomething f,
+              gpointer f_target)
+{
+}
+
+static TestEnum
+__lambda4_ (TestEnum self,
+            TestEnum x)
+{
+       TestEnum result = 0;
+       switch (self) {
+               case TEST_ENUM_T:
+               {
+                       result = TEST_ENUM_T;
+                       return result;
+               }
+               default:
+               {
+                       g_assert_not_reached ();
+               }
+       }
+}
+
+static gpointer
+___lambda4__do_something (gconstpointer g,
+                          gpointer self)
+{
+       gpointer result;
+       result = (gpointer) ((gintptr) __lambda4_ ((TestEnum) ((gintptr) self), (TestEnum) ((gintptr) g)));
+       return result;
+}
+
+void
+test_enum_f (TestEnum self)
+{
+       do_something (TYPE_TEST_ENUM, NULL, NULL, ___lambda4__do_something, (gpointer) ((gintptr) self));
+}
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               TestEnum self;
+               self = _data1_->self;
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static TestEnum
+__lambda5_ (Block1Data* _data1_,
+            TestEnum x)
+{
+       TestEnum self;
+       TestEnum result = 0;
+       self = _data1_->self;
+       switch (self) {
+               case TEST_ENUM_T:
+               {
+                       gint _tmp0_;
+                       _tmp0_ = _data1_->i;
+                       _data1_->i = _tmp0_ + 1;
+                       result = TEST_ENUM_T;
+                       return result;
+               }
+               default:
+               {
+                       g_assert_not_reached ();
+               }
+       }
+}
+
+static gpointer
+___lambda5__do_something (gconstpointer g,
+                          gpointer self)
+{
+       gpointer result;
+       result = (gpointer) ((gintptr) __lambda5_ (self, (TestEnum) ((gintptr) g)));
+       return result;
+}
+
+void
+test_enum_g (TestEnum self,
+             gint i)
+{
+       Block1Data* _data1_;
+       _data1_ = g_slice_new0 (Block1Data);
+       _data1_->_ref_count_ = 1;
+       _data1_->self =  (self);
+       _data1_->i = i;
+       do_something (TYPE_TEST_ENUM, NULL, NULL, ___lambda5__do_something, _data1_);
+       block1_data_unref (_data1_);
+       _data1_ = NULL;
+}
+
+static GType
+test_enum_get_type_once (void)
+{
+       static const GEnumValue values[] = {{TEST_ENUM_T, "TEST_ENUM_T", "t"}, {0, NULL, NULL}};
+       GType test_enum_type_id;
+       test_enum_type_id = g_enum_register_static ("TestEnum", values);
+       return test_enum_type_id;
+}
+
+GType
+test_enum_get_type (void)
+{
+       static volatile gsize test_enum_type_id__volatile = 0;
+       if (g_once_init_enter (&test_enum_type_id__volatile)) {
+               GType test_enum_type_id;
+               test_enum_type_id = test_enum_get_type_once ();
+               g_once_init_leave (&test_enum_type_id__volatile, test_enum_type_id);
+       }
+       return test_enum_type_id__volatile;
+}
+
+static gpointer
+_test_g_do_something (gconstpointer g,
+                      gpointer self)
+{
+       gpointer result;
+       result = (gpointer) ((gintptr) test_g ((TestEnum) ((gintptr) g), (Test*) self));
+       return result;
+}
+
+static gpointer
+_test_h_do_something (gconstpointer g,
+                      gpointer self)
+{
+       gpointer result;
+       result = (gpointer) ((gintptr) test_h ((gint) ((gintptr) g), (Test*) self));
+       return result;
+}
+
+void
+test_f (Test* self)
+{
+       g_return_if_fail (IS_TEST (self));
+       do_something (TYPE_TEST_ENUM, NULL, NULL, _test_g_do_something, self);
+       do_something (G_TYPE_INT, NULL, NULL, _test_h_do_something, self);
+}
+
+static TestEnum
+test_g (TestEnum i,
+        Test* self)
+{
+       TestEnum result = 0;
+       g_return_val_if_fail (IS_TEST (self), 0);
+       result = i;
+       return result;
+}
+
+static gint
+test_h (gint i,
+        Test* self)
+{
+       gint result = 0;
+       g_return_val_if_fail (IS_TEST (self), 0);
+       result = i;
+       return result;
+}
+
+Test*
+test_construct (GType object_type)
+{
+       Test* self = NULL;
+       self = (Test*) g_type_create_instance (object_type);
+       return self;
+}
+
+Test*
+test_new (void)
+{
+       return test_construct (TYPE_TEST);
+}
+
+static void
+value_test_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_test_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               test_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_test_copy_value (const GValue* src_value,
+                       GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = test_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_test_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_test_collect_value (GValue* value,
+                          guint n_collect_values,
+                          GTypeCValue* collect_values,
+                          guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Test * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = test_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_test_lcopy_value (const GValue* value,
+                        guint n_collect_values,
+                        GTypeCValue* collect_values,
+                        guint collect_flags)
+{
+       Test ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = test_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_test (const gchar* name,
+                 const gchar* nick,
+                 const gchar* blurb,
+                 GType object_type,
+                 GParamFlags flags)
+{
+       ParamSpecTest* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_TEST), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_test (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_TEST), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_test (GValue* value,
+                gpointer v_object)
+{
+       Test * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_TEST));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_TEST));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               test_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               test_unref (old);
+       }
+}
+
+void
+value_take_test (GValue* value,
+                 gpointer v_object)
+{
+       Test * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_TEST));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_TEST));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               test_unref (old);
+       }
+}
+
+static void
+test_class_init (TestClass * klass,
+                 gpointer klass_data)
+{
+       test_parent_class = g_type_class_peek_parent (klass);
+       ((TestClass *) klass)->finalize = test_finalize;
+}
+
+static void
+test_instance_init (Test * self,
+                    gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+test_finalize (Test * obj)
+{
+       Test * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_TEST, Test);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_test_init, value_test_free_value, 
value_test_copy_value, value_test_peek_pointer, "p", value_test_collect_value, "p", value_test_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (TestClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Test), 
0, (GInstanceInitFunc) test_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType test_type_id;
+       test_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Test", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+gpointer
+test_ref (gpointer instance)
+{
+       Test * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+test_unref (gpointer instance)
+{
+       Test * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               TEST_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static gint
+_vala_main (void)
+{
+       TestEnum t = 0;
+       Test* t2 = NULL;
+       Test* _tmp0_;
+       gint result = 0;
+       t = TEST_ENUM_T;
+       test_enum_f (t);
+       test_enum_g (t, 0);
+       _tmp0_ = test_new ();
+       t2 = _tmp0_;
+       test_f (t2);
+       result = 0;
+       _test_unref0 (t2);
+       return result;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       return _vala_main ();
+}
+
diff --git a/tests/delegates/bug683925.c-expected b/tests/delegates/bug683925.c-expected
new file mode 100644
index 000000000..e2767abd1
--- /dev/null
+++ b/tests/delegates/bug683925.c-expected
@@ -0,0 +1,187 @@
+/* delegates_bug683925.c generated by valac, the Vala compiler
+ * generated from delegates_bug683925.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef void (*FooFunc) (gpointer user_data);
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _FooPrivate {
+       gboolean check;
+       FooFunc func;
+       gpointer func_target;
+       GDestroyNotify func_target_destroy_notify;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+static void foo_default_func (Foo* self);
+static void _foo_default_func_foo_func (gpointer self);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+VALA_EXTERN void foo_run (Foo* self);
+static void foo_finalize (GObject * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+static void
+_foo_default_func_foo_func (gpointer self)
+{
+       foo_default_func ((Foo*) self);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+foo_default_func (Foo* self)
+{
+       g_return_if_fail (IS_FOO (self));
+       self->priv->check = TRUE;
+}
+
+void
+foo_run (Foo* self)
+{
+       FooFunc _tmp0_;
+       gpointer _tmp0__target;
+       g_return_if_fail (IS_FOO (self));
+       _tmp0_ = self->priv->func;
+       _tmp0__target = self->priv->func_target;
+       _tmp0_ (_tmp0__target);
+       _vala_assert (self->priv->check, "check");
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+       G_OBJECT_CLASS (klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+       self->priv->check = FALSE;
+       self->priv->func = _foo_default_func_foo_func;
+       self->priv->func_target = self;
+       self->priv->func_target_destroy_notify = NULL;
+}
+
+static void
+foo_finalize (GObject * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       (self->priv->func_target_destroy_notify == NULL) ? NULL : (self->priv->func_target_destroy_notify 
(self->priv->func_target), NULL);
+       self->priv->func = NULL;
+       self->priv->func_target = NULL;
+       self->priv->func_target_destroy_notify = NULL;
+       G_OBJECT_CLASS (foo_parent_class)->finalize (obj);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       foo_run (foo);
+       _g_object_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/delegates/bug703804.c-expected b/tests/delegates/bug703804.c-expected
new file mode 100644
index 000000000..b26578a3b
--- /dev/null
+++ b/tests/delegates/bug703804.c-expected
@@ -0,0 +1,105 @@
+/* delegates_bug703804.c generated by valac, the Vala compiler
+ * generated from delegates_bug703804.vala, do not modify */
+
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef void (*Run) (gpointer user_data);
+typedef struct _Block1Data Block1Data;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Block1Data {
+       int _ref_count_;
+       gint i;
+};
+
+VALA_EXTERN void eval (Run run,
+           gpointer run_target);
+static void _vala_main (void);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static void __lambda4_ (Block1Data* _data1_);
+static void ___lambda4__run (gpointer self);
+
+void
+eval (Run run,
+      gpointer run_target)
+{
+       Run own = NULL;
+       Run _tmp0_;
+       gpointer _tmp0__target;
+       gpointer own_target;
+       _tmp0_ = run;
+       _tmp0__target = run_target;
+       run = NULL;
+       run_target = NULL;
+       own = _tmp0_;
+       own_target = _tmp0__target;
+       own (own_target);
+}
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static void
+__lambda4_ (Block1Data* _data1_)
+{
+       gint _tmp0_;
+       _tmp0_ = _data1_->i;
+       _data1_->i = _tmp0_ + 1;
+}
+
+static void
+___lambda4__run (gpointer self)
+{
+       __lambda4_ (self);
+       block1_data_unref (self);
+}
+
+static void
+_vala_main (void)
+{
+       Block1Data* _data1_;
+       _data1_ = g_slice_new0 (Block1Data);
+       _data1_->_ref_count_ = 1;
+       _data1_->i = 0;
+       eval (___lambda4__run, block1_data_ref (_data1_));
+       _vala_assert (_data1_->i == 1, "i == 1");
+       block1_data_unref (_data1_);
+       _data1_ = NULL;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/delegates/bug761360.c-expected b/tests/delegates/bug761360.c-expected
new file mode 100644
index 000000000..9e9379d13
--- /dev/null
+++ b/tests/delegates/bug761360.c-expected
@@ -0,0 +1,79 @@
+/* delegates_bug761360.c generated by valac, the Vala compiler
+ * generated from delegates_bug761360.vala, do not modify */
+
+#include <glib.h>
+
+typedef gint* (*ArrayReturnFunc) (gint* result_length1, gpointer user_data);
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (void);
+static gint* __lambda4_ (gint* result_length1);
+static gint* ___lambda4__array_return_func (gint* result_length1,
+                                     gpointer self);
+
+static gint*
+__lambda4_ (gint* result_length1)
+{
+       gint* _tmp0_;
+       gint* _tmp1_;
+       gint _tmp1__length1;
+       gint* result = NULL;
+       _tmp0_ = g_new0 (gint, 3);
+       _tmp0_[0] = 1;
+       _tmp0_[1] = 2;
+       _tmp0_[2] = 3;
+       _tmp1_ = _tmp0_;
+       _tmp1__length1 = 3;
+       if (result_length1) {
+               *result_length1 = _tmp1__length1;
+       }
+       result = _tmp1_;
+       return result;
+}
+
+static gint*
+___lambda4__array_return_func (gint* result_length1,
+                               gpointer self)
+{
+       gint* result;
+       result = __lambda4_ (result_length1);
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       ArrayReturnFunc f = NULL;
+       gpointer f_target;
+       GDestroyNotify f_target_destroy_notify;
+       gint* a = NULL;
+       gint _tmp0_ = 0;
+       gint* _tmp1_;
+       gint a_length1;
+       gint _a_size_;
+       f = ___lambda4__array_return_func;
+       f_target = NULL;
+       f_target_destroy_notify = NULL;
+       _tmp1_ = f (&_tmp0_, f_target);
+       a = _tmp1_;
+       a_length1 = _tmp0_;
+       _a_size_ = a_length1;
+       _vala_assert (a_length1 == 3, "a.length == 3");
+       a = (g_free (a), NULL);
+       (f_target_destroy_notify == NULL) ? NULL : (f_target_destroy_notify (f_target), NULL);
+       f = NULL;
+       f_target = NULL;
+       f_target_destroy_notify = NULL;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/delegates/bug792077.c-expected b/tests/delegates/bug792077.c-expected
new file mode 100644
index 000000000..159d75351
--- /dev/null
+++ b/tests/delegates/bug792077.c-expected
@@ -0,0 +1,114 @@
+/* delegates_bug792077.c generated by valac, the Vala compiler
+ * generated from delegates_bug792077.vala, do not modify */
+
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef void (*FooFunc) (gint i, gpointer user_data);
+typedef FooFunc (*BarFunc) (gpointer* result_target, GDestroyNotify* result_target_destroy_notify, gpointer 
user_data);
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN gint result;
+gint result = 0;
+
+static void _vala_main (void);
+static FooFunc __lambda4_ (gpointer* result_target,
+                    GDestroyNotify* result_target_destroy_notify);
+static void __lambda5_ (gint data);
+static void ___lambda5__foo_func (gint i,
+                           gpointer self);
+static FooFunc ___lambda4__bar_func (gpointer* result_target,
+                              GDestroyNotify* result_target_destroy_notify,
+                              gpointer self);
+
+static void
+__lambda5_ (gint data)
+{
+       result = data;
+}
+
+static void
+___lambda5__foo_func (gint i,
+                      gpointer self)
+{
+       __lambda5_ (i);
+}
+
+static FooFunc
+__lambda4_ (gpointer* result_target,
+            GDestroyNotify* result_target_destroy_notify)
+{
+       FooFunc _tmp0_;
+       gpointer _tmp0__target;
+       GDestroyNotify _tmp0__target_destroy_notify;
+       FooFunc result = NULL;
+       _tmp0_ = ___lambda5__foo_func;
+       _tmp0__target = NULL;
+       _tmp0__target_destroy_notify = NULL;
+       *result_target = _tmp0__target;
+       *result_target_destroy_notify = _tmp0__target_destroy_notify;
+       result = _tmp0_;
+       return result;
+}
+
+static FooFunc
+___lambda4__bar_func (gpointer* result_target,
+                      GDestroyNotify* result_target_destroy_notify,
+                      gpointer self)
+{
+       FooFunc result;
+       result = __lambda4_ (result_target, result_target_destroy_notify);
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       BarFunc func_gen = NULL;
+       gpointer func_gen_target;
+       GDestroyNotify func_gen_target_destroy_notify;
+       FooFunc func = NULL;
+       gpointer _tmp0_ = NULL;
+       GDestroyNotify _tmp1_ = NULL;
+       FooFunc _tmp2_;
+       gpointer func_target;
+       GDestroyNotify func_target_destroy_notify;
+       func_gen = ___lambda4__bar_func;
+       func_gen_target = NULL;
+       func_gen_target_destroy_notify = NULL;
+       _tmp2_ = func_gen (&_tmp0_, &_tmp1_, func_gen_target);
+       func = _tmp2_;
+       func_target = _tmp0_;
+       func_target_destroy_notify = _tmp1_;
+       func (42, func_target);
+       _vala_assert (result == 42, "result == 42");
+       (func_target_destroy_notify == NULL) ? NULL : (func_target_destroy_notify (func_target), NULL);
+       func = NULL;
+       func_target = NULL;
+       func_target_destroy_notify = NULL;
+       (func_gen_target_destroy_notify == NULL) ? NULL : (func_gen_target_destroy_notify (func_gen_target), 
NULL);
+       func_gen = NULL;
+       func_gen_target = NULL;
+       func_gen_target_destroy_notify = NULL;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/delegates/casting.c-expected b/tests/delegates/casting.c-expected
new file mode 100644
index 000000000..2642e8e86
--- /dev/null
+++ b/tests/delegates/casting.c-expected
@@ -0,0 +1,285 @@
+/* delegates_casting.c generated by valac, the Vala compiler
+ * generated from delegates_casting.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef void (*FooFunc) (gpointer user_data);
+typedef void (*FooFuncTargetless) (void);
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_baz (Foo* self,
+              FooFunc f,
+              gpointer f_target);
+VALA_EXTERN void foo_func (Foo* self);
+static void _foo_func_foo_func (gpointer self);
+static void foo_bar (Foo* self,
+              FooFunc f,
+              gpointer f_target,
+              GDestroyNotify f_target_destroy_notify);
+static void foo_man (Foo* self,
+              FooFuncTargetless f);
+static void foo_maz (Foo* self,
+              FooFuncTargetless f);
+static GType foo_get_type_once (void);
+VALA_EXTERN void func (void);
+static void _vala_main (void);
+static void _func_foo_func_targetless (void);
+
+static void
+_foo_func_foo_func (gpointer self)
+{
+       foo_func ((Foo*) self);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       foo_baz (self, _foo_func_foo_func, self);
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (self, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"ref_count == 1");
+       foo_bar (self, _foo_func_foo_func, g_object_ref (self), g_object_unref);
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (self, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"ref_count == 1");
+       foo_baz (self, (FooFunc) foo_func, self);
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (self, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"ref_count == 1");
+       foo_bar (self, (FooFunc) foo_func, g_object_ref (self), g_object_unref);
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (self, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"ref_count == 1");
+       foo_man (self, (FooFuncTargetless) foo_func);
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (self, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"ref_count == 1");
+       foo_maz (self, (FooFuncTargetless) foo_func);
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (self, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"ref_count == 1");
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+void
+foo_func (Foo* self)
+{
+       g_return_if_fail (IS_FOO (self));
+}
+
+static void
+foo_baz (Foo* self,
+         FooFunc f,
+         gpointer f_target)
+{
+       g_return_if_fail (IS_FOO (self));
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (self, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"ref_count == 1");
+}
+
+static void
+foo_bar (Foo* self,
+         FooFunc f,
+         gpointer f_target,
+         GDestroyNotify f_target_destroy_notify)
+{
+       g_return_if_fail (IS_FOO (self));
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (self, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 2), 
"ref_count == 2");
+       (f_target_destroy_notify == NULL) ? NULL : (f_target_destroy_notify (f_target), NULL);
+       f = NULL;
+       f_target = NULL;
+       f_target_destroy_notify = NULL;
+}
+
+static void
+foo_man (Foo* self,
+         FooFuncTargetless f)
+{
+       g_return_if_fail (IS_FOO (self));
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (self, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"ref_count == 1");
+}
+
+static void
+foo_maz (Foo* self,
+         FooFuncTargetless f)
+{
+       g_return_if_fail (IS_FOO (self));
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (self, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"ref_count == 1");
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+void
+func (void)
+{
+}
+
+static void
+_func_foo_func_targetless (void)
+{
+       func ();
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       FooFunc f0 = NULL;
+       gpointer f0_target;
+       GDestroyNotify f0_target_destroy_notify;
+       FooFunc f1 = NULL;
+       gpointer f1_target;
+       GDestroyNotify f1_target_destroy_notify;
+       FooFunc f2 = NULL;
+       gpointer f2_target;
+       FooFunc f3 = NULL;
+       gpointer f3_target;
+       FooFuncTargetless f4 = NULL;
+       FooFuncTargetless f5 = NULL;
+       FooFuncTargetless f6 = NULL;
+       FooFuncTargetless f7 = NULL;
+       FooFuncTargetless f8 = NULL;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"foo.ref_count == 1");
+       f0 = _foo_func_foo_func;
+       f0_target = g_object_ref (foo);
+       f0_target_destroy_notify = g_object_unref;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 2), 
"foo.ref_count == 2");
+       (f0_target_destroy_notify == NULL) ? NULL : (f0_target_destroy_notify (f0_target), NULL);
+       f0 = NULL;
+       f0_target = NULL;
+       f0_target_destroy_notify = NULL;
+       f0 = NULL;
+       f0_target = NULL;
+       f0_target_destroy_notify = NULL;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"foo.ref_count == 1");
+       f1 = (FooFunc) foo_func;
+       f1_target = g_object_ref (foo);
+       f1_target_destroy_notify = g_object_unref;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 2), 
"foo.ref_count == 2");
+       (f1_target_destroy_notify == NULL) ? NULL : (f1_target_destroy_notify (f1_target), NULL);
+       f1 = NULL;
+       f1_target = NULL;
+       f1_target_destroy_notify = NULL;
+       f1 = NULL;
+       f1_target = NULL;
+       f1_target_destroy_notify = NULL;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"foo.ref_count == 1");
+       f2 = _foo_func_foo_func;
+       f2_target = foo;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"foo.ref_count == 1");
+       f2 = NULL;
+       f2_target = NULL;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"foo.ref_count == 1");
+       f3 = (FooFunc) foo_func;
+       f3_target = foo;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"foo.ref_count == 1");
+       f3 = NULL;
+       f3_target = NULL;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"foo.ref_count == 1");
+       f4 = (FooFuncTargetless) foo_func;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"foo.ref_count == 1");
+       f4 = NULL;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"foo.ref_count == 1");
+       f5 = _func_foo_func_targetless;
+       f5 = NULL;
+       f6 = (FooFuncTargetless) func;
+       f6 = NULL;
+       f7 = _func_foo_func_targetless;
+       f7 = NULL;
+       f8 = (FooFuncTargetless) func;
+       f8 = NULL;
+       (f1_target_destroy_notify == NULL) ? NULL : (f1_target_destroy_notify (f1_target), NULL);
+       f1 = NULL;
+       f1_target = NULL;
+       f1_target_destroy_notify = NULL;
+       (f0_target_destroy_notify == NULL) ? NULL : (f0_target_destroy_notify (f0_target), NULL);
+       f0 = NULL;
+       f0_target = NULL;
+       f0_target_destroy_notify = NULL;
+       _g_object_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/delegates/compatible.c-expected b/tests/delegates/compatible.c-expected
new file mode 100644
index 000000000..249a05609
--- /dev/null
+++ b/tests/delegates/compatible.c-expected
@@ -0,0 +1,196 @@
+/* delegates_compatible.c generated by valac, the Vala compiler
+ * generated from delegates_compatible.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef void (*Func) (gpointer user_data);
+typedef void (*CompatibleFunc) (gpointer user_data);
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define FOO_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_FOO, FooIface))
+
+typedef struct _Foo Foo;
+typedef struct _FooIface FooIface;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+enum  {
+       BAR_0_PROPERTY,
+       BAR_NUM_PROPERTIES
+};
+static GParamSpec* bar_properties[BAR_NUM_PROPERTIES];
+
+struct _FooIface {
+       GTypeInterface parent_iface;
+       void (*foo) (Foo* self, Func func, gpointer func_target);
+};
+
+struct _Bar {
+       GObject parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       GObjectClass parent_class;
+};
+
+static gpointer bar_parent_class = NULL;
+static FooIface * bar_foo_parent_iface = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN void foo_foo (Foo* self,
+              Func func,
+              gpointer func_target);
+static GType foo_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
+static void bar_real_foo (Foo* base,
+                   CompatibleFunc func,
+                   gpointer func_target);
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static GType bar_get_type_once (void);
+static void _vala_main (void);
+
+void
+foo_foo (Foo* self,
+         Func func,
+         gpointer func_target)
+{
+       FooIface* _iface_;
+       g_return_if_fail (IS_FOO (self));
+       _iface_ = FOO_GET_INTERFACE (self);
+       if (_iface_->foo) {
+               _iface_->foo (self, func, func_target);
+       }
+}
+
+static void
+foo_default_init (FooIface * iface,
+                  gpointer iface_data)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_INTERFACE, "Foo", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (foo_type_id, G_TYPE_OBJECT);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+bar_real_foo (Foo* base,
+              CompatibleFunc func,
+              gpointer func_target)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAR, Bar);
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar * self = NULL;
+       self = (Bar*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+bar_foo_interface_init (FooIface * iface,
+                        gpointer iface_data)
+{
+       bar_foo_parent_iface = g_type_interface_peek_parent (iface);
+       iface->foo = (void (*) (Foo*, Func, gpointer)) bar_real_foo;
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       static const GInterfaceInfo foo_info = { (GInterfaceInitFunc) bar_foo_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (G_TYPE_OBJECT, "Bar", &g_define_type_info, 0);
+       g_type_add_interface_static (bar_type_id, TYPE_FOO, &foo_info);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/delegates/delegate-recusive.c-expected b/tests/delegates/delegate-recusive.c-expected
new file mode 100644
index 000000000..fcafb34a5
--- /dev/null
+++ b/tests/delegates/delegate-recusive.c-expected
@@ -0,0 +1,23 @@
+/* delegates_delegate_recusive.c generated by valac, the Vala compiler
+ * generated from delegates_delegate_recusive.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+
+typedef GCallback (*MamanSelfCallback) (GCallback scb, gpointer* result_target, GDestroyNotify* 
result_target_destroy_notify, gpointer user_data);
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/delegates/delegate_only.c-expected b/tests/delegates/delegate_only.c-expected
new file mode 100644
index 000000000..dfcf7a5d2
--- /dev/null
+++ b/tests/delegates/delegate_only.c-expected
@@ -0,0 +1,22 @@
+/* delegates_delegate_only.c generated by valac, the Vala compiler
+ * generated from delegates_delegate_only.vala, do not modify */
+
+#include <glib.h>
+
+typedef void (*FooFunc) (gpointer user_data);
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/delegates/delegates.c-expected b/tests/delegates/delegates.c-expected
new file mode 100644
index 000000000..ae52846d0
--- /dev/null
+++ b/tests/delegates/delegates.c-expected
@@ -0,0 +1,593 @@
+/* delegates_delegates.c generated by valac, the Vala compiler
+ * generated from delegates_delegates.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef enum  {
+       PARAMETER_ENUM_FOO,
+       PARAMETER_ENUM_BAR
+} ParameterEnum;
+
+#define TYPE_PARAMETER_ENUM (parameter_enum_get_type ())
+typedef void (*MamanVoidCallback) (void);
+typedef gint (*MamanActionCallback) (void);
+typedef void (*MamanInstanceCallback) (gint i, gpointer user_data);
+typedef ParameterEnum (*MamanEnumDelegate) (ParameterEnum pe, gpointer user_data);
+
+#define MAMAN_TYPE_DELEGATE_STRUCT (maman_delegate_struct_get_type ())
+typedef struct _MamanDelegateStruct MamanDelegateStruct;
+
+#define MAMAN_TYPE_FOO (maman_foo_get_type ())
+#define MAMAN_FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_FOO, MamanFoo))
+#define MAMAN_IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_FOO))
+#define MAMAN_FOO_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), MAMAN_TYPE_FOO, MamanFooIface))
+
+typedef struct _MamanFoo MamanFoo;
+typedef struct _MamanFooIface MamanFooIface;
+
+#define MAMAN_TYPE_BAR (maman_bar_get_type ())
+#define MAMAN_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_BAR, MamanBar))
+#define MAMAN_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAMAN_TYPE_BAR, MamanBarClass))
+#define MAMAN_IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_BAR))
+#define MAMAN_IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAMAN_TYPE_BAR))
+#define MAMAN_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAMAN_TYPE_BAR, MamanBarClass))
+
+typedef struct _MamanBar MamanBar;
+typedef struct _MamanBarClass MamanBarClass;
+typedef struct _MamanBarPrivate MamanBarPrivate;
+enum  {
+       MAMAN_BAR_0_PROPERTY,
+       MAMAN_BAR_NUM_PROPERTIES
+};
+static GParamSpec* maman_bar_properties[MAMAN_BAR_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _MamanDelegateStruct {
+       MamanVoidCallback callback;
+};
+
+struct _MamanFooIface {
+       GTypeInterface parent_iface;
+       void (*foo_method) (MamanFoo* self, gint i);
+};
+
+struct _MamanBar {
+       GObject parent_instance;
+       MamanBarPrivate * priv;
+};
+
+struct _MamanBarClass {
+       GObjectClass parent_class;
+};
+
+struct _MamanBarPrivate {
+       MamanInstanceCallback callback_field;
+       gpointer callback_field_target;
+       GDestroyNotify callback_field_target_destroy_notify;
+};
+
+static gint MamanBar_private_offset;
+static gpointer maman_bar_parent_class = NULL;
+static MamanFooIface * maman_bar_maman_foo_parent_iface = NULL;
+
+VALA_EXTERN GType parameter_enum_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN GType maman_delegate_struct_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN MamanDelegateStruct* maman_delegate_struct_dup (const MamanDelegateStruct* self);
+VALA_EXTERN void maman_delegate_struct_free (MamanDelegateStruct* self);
+VALA_EXTERN GType maman_foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN void maman_foo_foo_method (MamanFoo* self,
+                           gint i);
+static GType maman_foo_get_type_once (void);
+VALA_EXTERN GType maman_bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MamanBar, g_object_unref)
+static void maman_bar_do_void_action (void);
+static void _maman_bar_do_void_action_maman_void_callback (void);
+VALA_EXTERN MamanBar* maman_bar_new (void);
+VALA_EXTERN MamanBar* maman_bar_construct (GType object_type);
+static gint maman_bar_do_action (void);
+static void maman_bar_do_instance_action (MamanBar* self,
+                                   gint i);
+static void maman_bar_call_instance_delegate (MamanInstanceCallback instance_cb,
+                                       gpointer instance_cb_target);
+static void maman_bar_assign_instance_delegate (MamanBar* self,
+                                         MamanInstanceCallback* instance_cb,
+                                         gpointer* instance_cb_target,
+                                         GDestroyNotify* instance_cb_target_destroy_notify);
+static void _maman_foo_foo_method_maman_instance_callback (gint i,
+                                                    gpointer self);
+static void maman_bar_test_function_pointers (void);
+static void _g_object_unref_gdestroy_notify (void* data);
+static void maman_bar_real_foo_method (MamanFoo* base,
+                                gint i);
+static void maman_bar_test_delegates_interface_method (void);
+static void maman_bar_test_field_reference_transfer (MamanBar* self);
+static MamanVoidCallback maman_bar_test_unowned_delegate_return (void);
+static void __lambda4_ (void);
+static void ___lambda4__maman_void_callback (void);
+static gint maman_bar_main (void);
+static gint _maman_bar_do_action_maman_action_callback (void);
+static void _maman_bar_do_instance_action_maman_instance_callback (gint i,
+                                                            gpointer self);
+static void maman_bar_finalize (GObject * obj);
+static GType maman_bar_get_type_once (void);
+
+static const MamanDelegateStruct MAMAN_BAR_const_delegate_struct = 
{_maman_bar_do_void_action_maman_void_callback};
+
+static GType
+parameter_enum_get_type_once (void)
+{
+       static const GEnumValue values[] = {{PARAMETER_ENUM_FOO, "PARAMETER_ENUM_FOO", "foo"}, 
{PARAMETER_ENUM_BAR, "PARAMETER_ENUM_BAR", "bar"}, {0, NULL, NULL}};
+       GType parameter_enum_type_id;
+       parameter_enum_type_id = g_enum_register_static ("ParameterEnum", values);
+       return parameter_enum_type_id;
+}
+
+GType
+parameter_enum_get_type (void)
+{
+       static volatile gsize parameter_enum_type_id__volatile = 0;
+       if (g_once_init_enter (&parameter_enum_type_id__volatile)) {
+               GType parameter_enum_type_id;
+               parameter_enum_type_id = parameter_enum_get_type_once ();
+               g_once_init_leave (&parameter_enum_type_id__volatile, parameter_enum_type_id);
+       }
+       return parameter_enum_type_id__volatile;
+}
+
+MamanDelegateStruct*
+maman_delegate_struct_dup (const MamanDelegateStruct* self)
+{
+       MamanDelegateStruct* dup;
+       dup = g_new0 (MamanDelegateStruct, 1);
+       memcpy (dup, self, sizeof (MamanDelegateStruct));
+       return dup;
+}
+
+void
+maman_delegate_struct_free (MamanDelegateStruct* self)
+{
+       g_free (self);
+}
+
+static GType
+maman_delegate_struct_get_type_once (void)
+{
+       GType maman_delegate_struct_type_id;
+       maman_delegate_struct_type_id = g_boxed_type_register_static ("MamanDelegateStruct", (GBoxedCopyFunc) 
maman_delegate_struct_dup, (GBoxedFreeFunc) maman_delegate_struct_free);
+       return maman_delegate_struct_type_id;
+}
+
+GType
+maman_delegate_struct_get_type (void)
+{
+       static volatile gsize maman_delegate_struct_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_delegate_struct_type_id__volatile)) {
+               GType maman_delegate_struct_type_id;
+               maman_delegate_struct_type_id = maman_delegate_struct_get_type_once ();
+               g_once_init_leave (&maman_delegate_struct_type_id__volatile, maman_delegate_struct_type_id);
+       }
+       return maman_delegate_struct_type_id__volatile;
+}
+
+void
+maman_foo_foo_method (MamanFoo* self,
+                      gint i)
+{
+       MamanFooIface* _iface_;
+       g_return_if_fail (MAMAN_IS_FOO (self));
+       _iface_ = MAMAN_FOO_GET_INTERFACE (self);
+       if (_iface_->foo_method) {
+               _iface_->foo_method (self, i);
+       }
+}
+
+static void
+maman_foo_default_init (MamanFooIface * iface,
+                        gpointer iface_data)
+{
+}
+
+static GType
+maman_foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (MamanFooIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_foo_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType maman_foo_type_id;
+       maman_foo_type_id = g_type_register_static (G_TYPE_INTERFACE, "MamanFoo", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (maman_foo_type_id, G_TYPE_OBJECT);
+       return maman_foo_type_id;
+}
+
+GType
+maman_foo_get_type (void)
+{
+       static volatile gsize maman_foo_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_foo_type_id__volatile)) {
+               GType maman_foo_type_id;
+               maman_foo_type_id = maman_foo_get_type_once ();
+               g_once_init_leave (&maman_foo_type_id__volatile, maman_foo_type_id);
+       }
+       return maman_foo_type_id__volatile;
+}
+
+static inline gpointer
+maman_bar_get_instance_private (MamanBar* self)
+{
+       return G_STRUCT_MEMBER_P (self, MamanBar_private_offset);
+}
+
+static void
+_maman_bar_do_void_action_maman_void_callback (void)
+{
+       maman_bar_do_void_action ();
+}
+
+MamanBar*
+maman_bar_construct (GType object_type)
+{
+       MamanBar * self = NULL;
+       self = (MamanBar*) g_object_new (object_type, NULL);
+       return self;
+}
+
+MamanBar*
+maman_bar_new (void)
+{
+       return maman_bar_construct (MAMAN_TYPE_BAR);
+}
+
+static void
+maman_bar_do_void_action (void)
+{
+       FILE* _tmp0_;
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, " 2");
+}
+
+static gint
+maman_bar_do_action (void)
+{
+       gint result = 0;
+       result = 4;
+       return result;
+}
+
+static void
+maman_bar_do_instance_action (MamanBar* self,
+                              gint i)
+{
+       FILE* _tmp0_;
+       g_return_if_fail (MAMAN_IS_BAR (self));
+       _vala_assert (i == 42, "i == 42");
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, " 6");
+}
+
+static void
+maman_bar_call_instance_delegate (MamanInstanceCallback instance_cb,
+                                  gpointer instance_cb_target)
+{
+       instance_cb (42, instance_cb_target);
+}
+
+static void
+_maman_foo_foo_method_maman_instance_callback (gint i,
+                                               gpointer self)
+{
+       maman_foo_foo_method ((MamanFoo*) self, i);
+}
+
+static void
+maman_bar_assign_instance_delegate (MamanBar* self,
+                                    MamanInstanceCallback* instance_cb,
+                                    gpointer* instance_cb_target,
+                                    GDestroyNotify* instance_cb_target_destroy_notify)
+{
+       MamanInstanceCallback _vala_instance_cb = NULL;
+       gpointer _vala_instance_cb_target = NULL;
+       GDestroyNotify _vala_instance_cb_target_destroy_notify = NULL;
+       g_return_if_fail (MAMAN_IS_BAR (self));
+       (_vala_instance_cb_target_destroy_notify == NULL) ? NULL : (_vala_instance_cb_target_destroy_notify 
(_vala_instance_cb_target), NULL);
+       _vala_instance_cb = NULL;
+       _vala_instance_cb_target = NULL;
+       _vala_instance_cb_target_destroy_notify = NULL;
+       _vala_instance_cb = _maman_foo_foo_method_maman_instance_callback;
+       _vala_instance_cb_target = g_object_ref (G_TYPE_CHECK_INSTANCE_CAST (self, MAMAN_TYPE_FOO, MamanFoo));
+       _vala_instance_cb_target_destroy_notify = g_object_unref;
+       if (instance_cb) {
+               *instance_cb = _vala_instance_cb;
+               *instance_cb_target = _vala_instance_cb_target;
+               *instance_cb_target_destroy_notify = _vala_instance_cb_target_destroy_notify;
+       } else {
+               (_vala_instance_cb_target_destroy_notify == NULL) ? NULL : 
(_vala_instance_cb_target_destroy_notify (_vala_instance_cb_target), NULL);
+               _vala_instance_cb = NULL;
+               _vala_instance_cb_target = NULL;
+               _vala_instance_cb_target_destroy_notify = NULL;
+       }
+}
+
+static void
+_g_object_unref_gdestroy_notify (void* data)
+{
+       g_object_unref (data);
+}
+
+static gpointer
+_g_object_ref0 (gpointer self)
+{
+       return self ? g_object_ref (self) : NULL;
+}
+
+static void
+maman_bar_test_function_pointers (void)
+{
+       FILE* _tmp0_;
+       GHashTable* table = NULL;
+       GHashFunc _tmp1_;
+       GEqualFunc _tmp2_;
+       GDestroyNotify _tmp3_;
+       GHashTable* _tmp4_;
+       FILE* _tmp5_;
+       gchar* _tmp6_;
+       MamanBar* _tmp7_;
+       FILE* _tmp8_;
+       MamanBar* bar = NULL;
+       gconstpointer _tmp9_;
+       MamanBar* _tmp10_;
+       FILE* _tmp11_;
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, "testing function pointers:");
+       _tmp1_ = g_str_hash;
+       _tmp2_ = g_str_equal;
+       _tmp3_ = g_free;
+       _tmp4_ = g_hash_table_new_full (_tmp1_, _tmp2_, _tmp3_, _g_object_unref_gdestroy_notify);
+       table = _tmp4_;
+       _tmp5_ = stdout;
+       fprintf (_tmp5_, " 1");
+       _tmp6_ = g_strdup ("foo");
+       _tmp7_ = maman_bar_new ();
+       g_hash_table_insert (table, _tmp6_, _tmp7_);
+       _tmp8_ = stdout;
+       fprintf (_tmp8_, " 2");
+       _tmp9_ = g_hash_table_lookup (table, "foo");
+       _tmp10_ = _g_object_ref0 ((MamanBar*) _tmp9_);
+       bar = _tmp10_;
+       _tmp11_ = stdout;
+       fprintf (_tmp11_, " 3\n");
+       _g_object_unref0 (bar);
+       _g_hash_table_unref0 (table);
+}
+
+static void
+maman_bar_real_foo_method (MamanFoo* base,
+                           gint i)
+{
+       MamanBar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, MAMAN_TYPE_BAR, MamanBar);
+}
+
+static void
+maman_bar_test_delegates_interface_method (void)
+{
+       MamanBar* bar = NULL;
+       MamanBar* _tmp0_;
+       _tmp0_ = maman_bar_new ();
+       bar = _tmp0_;
+       maman_bar_call_instance_delegate (_maman_foo_foo_method_maman_instance_callback, 
G_TYPE_CHECK_INSTANCE_CAST (bar, MAMAN_TYPE_FOO, MamanFoo));
+       _g_object_unref0 (bar);
+}
+
+static void
+maman_bar_test_field_reference_transfer (MamanBar* self)
+{
+       MamanInstanceCallback foo = NULL;
+       MamanInstanceCallback _tmp0_;
+       gpointer _tmp0__target;
+       GDestroyNotify _tmp0__target_destroy_notify;
+       gpointer foo_target;
+       GDestroyNotify foo_target_destroy_notify;
+       g_return_if_fail (MAMAN_IS_BAR (self));
+       _tmp0_ = self->priv->callback_field;
+       _tmp0__target = self->priv->callback_field_target;
+       _tmp0__target_destroy_notify = self->priv->callback_field_target_destroy_notify;
+       self->priv->callback_field = NULL;
+       self->priv->callback_field_target = NULL;
+       self->priv->callback_field_target_destroy_notify = NULL;
+       foo = _tmp0_;
+       foo_target = _tmp0__target;
+       foo_target_destroy_notify = _tmp0__target_destroy_notify;
+       (foo_target_destroy_notify == NULL) ? NULL : (foo_target_destroy_notify (foo_target), NULL);
+       foo = NULL;
+       foo_target = NULL;
+       foo_target_destroy_notify = NULL;
+}
+
+static void
+__lambda4_ (void)
+{
+}
+
+static void
+___lambda4__maman_void_callback (void)
+{
+       __lambda4_ ();
+}
+
+static MamanVoidCallback
+maman_bar_test_unowned_delegate_return (void)
+{
+       MamanVoidCallback result = NULL;
+       result = ___lambda4__maman_void_callback;
+       return result;
+}
+
+static gint
+_maman_bar_do_action_maman_action_callback (void)
+{
+       gint result;
+       result = maman_bar_do_action ();
+       return result;
+}
+
+static void
+_maman_bar_do_instance_action_maman_instance_callback (gint i,
+                                                       gpointer self)
+{
+       maman_bar_do_instance_action ((MamanBar*) self, i);
+}
+
+static gint
+maman_bar_main (void)
+{
+       FILE* _tmp0_;
+       MamanVoidCallback void_cb = NULL;
+       FILE* _tmp1_;
+       MamanActionCallback cb = NULL;
+       FILE* _tmp2_;
+       FILE* _tmp3_;
+       MamanBar* bar = NULL;
+       MamanBar* _tmp4_;
+       MamanInstanceCallback instance_cb = NULL;
+       gpointer instance_cb_target;
+       GDestroyNotify instance_cb_target_destroy_notify;
+       MamanInstanceCallback _tmp5_;
+       gpointer _tmp5__target;
+       MamanInstanceCallback _tmp6_ = NULL;
+       gpointer _tmp7_ = NULL;
+       GDestroyNotify _tmp8_ = NULL;
+       MamanInstanceCallback _tmp9_;
+       gpointer _tmp9__target;
+       FILE* _tmp10_;
+       MamanVoidCallback baz = NULL;
+       MamanVoidCallback _tmp11_;
+       gint result = 0;
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, "Delegate Test: 1");
+       void_cb = _maman_bar_do_void_action_maman_void_callback;
+       void_cb ();
+       _tmp1_ = stdout;
+       fprintf (_tmp1_, " 3");
+       cb = _maman_bar_do_action_maman_action_callback;
+       _tmp2_ = stdout;
+       fprintf (_tmp2_, " %d", cb ());
+       _tmp3_ = stdout;
+       fprintf (_tmp3_, " 5");
+       _tmp4_ = maman_bar_new ();
+       bar = _tmp4_;
+       instance_cb = _maman_bar_do_instance_action_maman_instance_callback;
+       instance_cb_target = g_object_ref (bar);
+       instance_cb_target_destroy_notify = g_object_unref;
+       _tmp5_ = instance_cb;
+       _tmp5__target = instance_cb_target;
+       maman_bar_call_instance_delegate (_tmp5_, _tmp5__target);
+       maman_bar_assign_instance_delegate (bar, &_tmp6_, &_tmp7_, &_tmp8_);
+       (instance_cb_target_destroy_notify == NULL) ? NULL : (instance_cb_target_destroy_notify 
(instance_cb_target), NULL);
+       instance_cb = NULL;
+       instance_cb_target = NULL;
+       instance_cb_target_destroy_notify = NULL;
+       instance_cb = _tmp6_;
+       instance_cb_target = _tmp7_;
+       instance_cb_target_destroy_notify = _tmp8_;
+       _tmp9_ = instance_cb;
+       _tmp9__target = instance_cb_target;
+       maman_bar_call_instance_delegate (_tmp9_, _tmp9__target);
+       _tmp10_ = stdout;
+       fprintf (_tmp10_, " 7\n");
+       maman_bar_test_function_pointers ();
+       maman_bar_test_delegates_interface_method ();
+       _tmp11_ = maman_bar_test_unowned_delegate_return ();
+       baz = _tmp11_;
+       result = 0;
+       (instance_cb_target_destroy_notify == NULL) ? NULL : (instance_cb_target_destroy_notify 
(instance_cb_target), NULL);
+       instance_cb = NULL;
+       instance_cb_target = NULL;
+       instance_cb_target_destroy_notify = NULL;
+       _g_object_unref0 (bar);
+       return result;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       return maman_bar_main ();
+}
+
+static void
+maman_bar_class_init (MamanBarClass * klass,
+                      gpointer klass_data)
+{
+       maman_bar_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &MamanBar_private_offset);
+       G_OBJECT_CLASS (klass)->finalize = maman_bar_finalize;
+}
+
+static void
+maman_bar_maman_foo_interface_init (MamanFooIface * iface,
+                                    gpointer iface_data)
+{
+       maman_bar_maman_foo_parent_iface = g_type_interface_peek_parent (iface);
+       iface->foo_method = (void (*) (MamanFoo*, gint)) maman_bar_real_foo_method;
+}
+
+static void
+maman_bar_instance_init (MamanBar * self,
+                         gpointer klass)
+{
+       self->priv = maman_bar_get_instance_private (self);
+}
+
+static void
+maman_bar_finalize (GObject * obj)
+{
+       MamanBar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, MAMAN_TYPE_BAR, MamanBar);
+       (self->priv->callback_field_target_destroy_notify == NULL) ? NULL : 
(self->priv->callback_field_target_destroy_notify (self->priv->callback_field_target), NULL);
+       self->priv->callback_field = NULL;
+       self->priv->callback_field_target = NULL;
+       self->priv->callback_field_target_destroy_notify = NULL;
+       G_OBJECT_CLASS (maman_bar_parent_class)->finalize (obj);
+}
+
+static GType
+maman_bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (MamanBarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(MamanBar), 0, (GInstanceInitFunc) maman_bar_instance_init, NULL };
+       static const GInterfaceInfo maman_foo_info = { (GInterfaceInitFunc) 
maman_bar_maman_foo_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
+       GType maman_bar_type_id;
+       maman_bar_type_id = g_type_register_static (G_TYPE_OBJECT, "MamanBar", &g_define_type_info, 0);
+       g_type_add_interface_static (maman_bar_type_id, MAMAN_TYPE_FOO, &maman_foo_info);
+       MamanBar_private_offset = g_type_add_instance_private (maman_bar_type_id, sizeof (MamanBarPrivate));
+       return maman_bar_type_id;
+}
+
+GType
+maman_bar_get_type (void)
+{
+       static volatile gsize maman_bar_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_bar_type_id__volatile)) {
+               GType maman_bar_type_id;
+               maman_bar_type_id = maman_bar_get_type_once ();
+               g_once_init_leave (&maman_bar_type_id__volatile, maman_bar_type_id);
+       }
+       return maman_bar_type_id__volatile;
+}
+
diff --git a/tests/delegates/error-pos.c-expected b/tests/delegates/error-pos.c-expected
new file mode 100644
index 000000000..cc87fa625
--- /dev/null
+++ b/tests/delegates/error-pos.c-expected
@@ -0,0 +1,482 @@
+/* delegates_error_pos.c generated by valac, the Vala compiler
+ * generated from delegates_error_pos.vala, do not modify */
+
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib-object.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef gchar* (*FooFunc) (gint i, GError** error, gpointer user_data);
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+#define _g_free0(var) (var = (g_free (var), NULL))
+typedef struct _ParamSpecBar ParamSpecBar;
+#define _bar_unref0(var) ((var == NULL) ? NULL : (var = (bar_unref (var), NULL)))
+#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+typedef enum  {
+       FOO_ERROR_BAR
+} FooError;
+#define FOO_ERROR foo_error_quark ()
+struct _Bar {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       GTypeClass parent_class;
+       void (*finalize) (Bar *self);
+};
+
+struct _ParamSpecBar {
+       GParamSpec parent_instance;
+};
+
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN GQuark foo_error_quark (void);
+VALA_EXTERN gpointer bar_ref (gpointer instance);
+VALA_EXTERN void bar_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_bar (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_bar (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_bar (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_bar (const GValue* value);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, bar_unref)
+VALA_EXTERN gchar* bar_foo (Bar* self,
+                GError** error,
+                gint i);
+VALA_EXTERN gchar* bar_faz (Bar* self,
+                GError** error,
+                gint i);
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static void bar_finalize (Bar * obj);
+static GType bar_get_type_once (void);
+VALA_EXTERN void foo (FooFunc f,
+          gpointer f_target);
+static void _vala_main (void);
+static gchar* _bar_foo_foo_func (gint i,
+                          GError** error,
+                          gpointer self);
+
+GQuark
+foo_error_quark (void)
+{
+       return g_quark_from_static_string ("foo-error-quark");
+}
+
+gchar*
+bar_foo (Bar* self,
+         GError** error,
+         gint i)
+{
+       gchar* _tmp0_;
+       gchar* result = NULL;
+       g_return_val_if_fail (IS_BAR (self), NULL);
+       _vala_assert (IS_BAR (self), "this is Bar");
+       _tmp0_ = g_strdup_printf ("%i", i);
+       result = _tmp0_;
+       return result;
+}
+
+gchar*
+bar_faz (Bar* self,
+         GError** error,
+         gint i)
+{
+       gchar* _tmp0_;
+       gchar* _tmp1_;
+       GError* _tmp2_;
+       GError* _tmp3_;
+       GError* _inner_error0_ = NULL;
+       g_return_val_if_fail (IS_BAR (self), NULL);
+       _vala_assert (IS_BAR (self), "this is Bar");
+       _tmp0_ = g_strdup_printf ("%i", i);
+       _tmp1_ = _tmp0_;
+       _tmp2_ = g_error_new_literal (FOO_ERROR, FOO_ERROR_BAR, _tmp1_);
+       _tmp3_ = _tmp2_;
+       _g_free0 (_tmp1_);
+       _inner_error0_ = _tmp3_;
+       if (_inner_error0_->domain == FOO_ERROR) {
+               g_propagate_error (error, _inner_error0_);
+               return NULL;
+       } else {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return NULL;
+       }
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar* self = NULL;
+       self = (Bar*) g_type_create_instance (object_type);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+value_bar_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_bar_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               bar_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_bar_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = bar_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_bar_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_bar_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Bar * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = bar_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_bar_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Bar ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = bar_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_bar (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecBar* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_BAR), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_bar (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_bar (GValue* value,
+               gpointer v_object)
+{
+       Bar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               bar_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_unref (old);
+       }
+}
+
+void
+value_take_bar (GValue* value,
+                gpointer v_object)
+{
+       Bar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_unref (old);
+       }
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       ((BarClass *) klass)->finalize = bar_finalize;
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+bar_finalize (Bar * obj)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_bar_init, value_bar_free_value, 
value_bar_copy_value, value_bar_peek_pointer, "p", value_bar_collect_value, "p", value_bar_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType bar_type_id;
+       bar_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Bar", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+gpointer
+bar_ref (gpointer instance)
+{
+       Bar * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+bar_unref (gpointer instance)
+{
+       Bar * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               BAR_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+void
+foo (FooFunc f,
+     gpointer f_target)
+{
+       GError* _inner_error0_ = NULL;
+       {
+               gchar* _tmp0_ = NULL;
+               gchar* _tmp1_;
+               _tmp1_ = f (23, &_inner_error0_, f_target);
+               _tmp0_ = _tmp1_;
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       goto __catch0_g_error;
+               }
+               _vala_assert (g_strcmp0 (_tmp0_, "23") == 0, "f (23) == \"23\"");
+               _g_free0 (_tmp0_);
+       }
+       goto __finally0;
+       __catch0_g_error:
+       {
+               g_clear_error (&_inner_error0_);
+               g_assert_not_reached ();
+       }
+       __finally0:
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+}
+
+static gchar*
+_bar_foo_foo_func (gint i,
+                   GError** error,
+                   gpointer self)
+{
+       gchar* result;
+       result = bar_foo ((Bar*) self, error, i);
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       GError* _inner_error0_ = NULL;
+       {
+               Bar* bar = NULL;
+               Bar* _tmp0_;
+               gchar* _tmp1_ = NULL;
+               gchar* _tmp2_;
+               _tmp0_ = bar_new ();
+               bar = _tmp0_;
+               _tmp2_ = bar_foo (bar, &_inner_error0_, 42);
+               _tmp1_ = _tmp2_;
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       _bar_unref0 (bar);
+                       goto __catch0_g_error;
+               }
+               _vala_assert (g_strcmp0 (_tmp1_, "42") == 0, "bar.foo (42) == \"42\"");
+               foo (_bar_foo_foo_func, bar);
+               _g_free0 (_tmp1_);
+               _bar_unref0 (bar);
+       }
+       goto __finally0;
+       __catch0_g_error:
+       {
+               g_clear_error (&_inner_error0_);
+               g_assert_not_reached ();
+       }
+       __finally0:
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       {
+               Bar* bar = NULL;
+               Bar* _tmp3_;
+               gchar* _tmp4_;
+               gchar* _tmp5_;
+               _tmp3_ = bar_new ();
+               bar = _tmp3_;
+               _tmp4_ = bar_faz (bar, &_inner_error0_, 42);
+               _tmp5_ = _tmp4_;
+               _g_free0 (_tmp5_);
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       _bar_unref0 (bar);
+                       if (g_error_matches (_inner_error0_, FOO_ERROR, FOO_ERROR_BAR)) {
+                               goto __catch1_foo_error_bar;
+                       }
+                       goto __catch1_g_error;
+               }
+               _bar_unref0 (bar);
+       }
+       goto __finally1;
+       __catch1_foo_error_bar:
+       {
+               GError* e = NULL;
+               GError* _tmp6_;
+               const gchar* _tmp7_;
+               e = _inner_error0_;
+               _inner_error0_ = NULL;
+               _tmp6_ = e;
+               _tmp7_ = _tmp6_->message;
+               _vala_assert (g_strcmp0 (_tmp7_, "42") == 0, "e.message == \"42\"");
+               _g_error_free0 (e);
+       }
+       goto __finally1;
+       __catch1_g_error:
+       {
+               g_clear_error (&_inner_error0_);
+               g_assert_not_reached ();
+       }
+       __finally1:
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/delegates/fields-no-target.c-expected b/tests/delegates/fields-no-target.c-expected
new file mode 100644
index 000000000..fbc4d09bc
--- /dev/null
+++ b/tests/delegates/fields-no-target.c-expected
@@ -0,0 +1,400 @@
+/* delegates_fields_no_target.c generated by valac, the Vala compiler
+ * generated from delegates_fields_no_target.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+#include <string.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef void (*FooFunc) (gpointer user_data);
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+typedef struct _ParamSpecBar ParamSpecBar;
+#define _bar_unref0(var) ((var == NULL) ? NULL : (var = (bar_unref (var), NULL)))
+#define _foo_free0(var) ((var == NULL) ? NULL : (var = (foo_free (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       FooFunc func;
+       gint i;
+};
+
+struct _Bar {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       BarPrivate * priv;
+       FooFunc func;
+       gint i;
+};
+
+struct _BarClass {
+       GTypeClass parent_class;
+       void (*finalize) (Bar *self);
+};
+
+struct _ParamSpecBar {
+       GParamSpec parent_instance;
+};
+
+VALA_EXTERN FooFunc func;
+FooFunc func = NULL;
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN gpointer bar_ref (gpointer instance);
+VALA_EXTERN void bar_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_bar (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_bar (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_bar (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_bar (const GValue* value);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, bar_unref)
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static void bar_finalize (Bar * obj);
+static GType bar_get_type_once (void);
+VALA_EXTERN void foo_cb (void);
+static void _foo_cb_foo_func (gpointer self);
+static void _vala_main (void);
+
+const Foo foos[1] = {{_foo_cb_foo_func, 42}};
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       memcpy (dup, self, sizeof (Foo));
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar* self = NULL;
+       self = (Bar*) g_type_create_instance (object_type);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+value_bar_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_bar_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               bar_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_bar_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = bar_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_bar_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_bar_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Bar * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = bar_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_bar_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Bar ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = bar_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_bar (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecBar* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_BAR), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_bar (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_bar (GValue* value,
+               gpointer v_object)
+{
+       Bar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               bar_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_unref (old);
+       }
+}
+
+void
+value_take_bar (GValue* value,
+                gpointer v_object)
+{
+       Bar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_unref (old);
+       }
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       ((BarClass *) klass)->finalize = bar_finalize;
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+bar_finalize (Bar * obj)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_bar_init, value_bar_free_value, 
value_bar_copy_value, value_bar_peek_pointer, "p", value_bar_collect_value, "p", value_bar_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType bar_type_id;
+       bar_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Bar", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+gpointer
+bar_ref (gpointer instance)
+{
+       Bar * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+bar_unref (gpointer instance)
+{
+       Bar * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               BAR_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+void
+foo_cb (void)
+{
+}
+
+static void
+_foo_cb_foo_func (gpointer self)
+{
+       foo_cb ();
+}
+
+static gpointer
+_foo_dup0 (gpointer self)
+{
+       return self ? foo_dup (self) : NULL;
+}
+
+static void
+_vala_main (void)
+{
+       Foo f_stack = {0};
+       Foo _tmp0_ = {0};
+       Foo* f_heap = NULL;
+       Foo _tmp1_ = {0};
+       Foo* _tmp2_;
+       Foo _tmp3_;
+       Foo _tmp4_;
+       Bar* b = NULL;
+       Bar* _tmp5_;
+       func = _foo_cb_foo_func;
+       _tmp0_.func = _foo_cb_foo_func;
+       _tmp0_.i = 23;
+       f_stack = _tmp0_;
+       _tmp1_.func = _foo_cb_foo_func;
+       _tmp1_.i = 4711;
+       _tmp2_ = _foo_dup0 (&_tmp1_);
+       f_heap = _tmp2_;
+       _tmp3_ = f_stack;
+       _vala_assert (_tmp3_.i == 23, "f_stack.i == 23");
+       _vala_assert ((*f_heap).i == 4711, "f_heap.i == 4711");
+       _tmp4_ = foos[0];
+       _vala_assert (_tmp4_.i == 42, "foos[0].i == 42");
+       _tmp5_ = bar_new ();
+       b = _tmp5_;
+       b->func = _foo_cb_foo_func;
+       b->i = 42;
+       _bar_unref0 (b);
+       _foo_free0 (f_heap);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/delegates/fields.c-expected b/tests/delegates/fields.c-expected
new file mode 100644
index 000000000..3b4ae26fc
--- /dev/null
+++ b/tests/delegates/fields.c-expected
@@ -0,0 +1,76 @@
+/* delegates_fields.c generated by valac, the Vala compiler
+ * generated from delegates_fields.vala, do not modify */
+
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef void (*FooFunc) (gpointer user_data);
+typedef void (*FooFuncTargetless) (void);
+
+VALA_EXTERN FooFunc foo;
+VALA_EXTERN gpointer foo_target;
+VALA_EXTERN GDestroyNotify foo_target_destroy_notify;
+FooFunc foo = NULL;
+gpointer foo_target = NULL;
+GDestroyNotify foo_target_destroy_notify = NULL;
+VALA_EXTERN FooFunc foo_unowned;
+VALA_EXTERN gpointer foo_unowned_target;
+FooFunc foo_unowned = NULL;
+gpointer foo_unowned_target = NULL;
+VALA_EXTERN FooFuncTargetless foo_targetless;
+FooFuncTargetless foo_targetless = NULL;
+
+VALA_EXTERN void func (void);
+static void _vala_main (void);
+static void _func_foo_func (gpointer self);
+static void _func_foo_func_targetless (void);
+
+void
+func (void)
+{
+}
+
+static void
+_func_foo_func (gpointer self)
+{
+       func ();
+}
+
+static void
+_func_foo_func_targetless (void)
+{
+       func ();
+}
+
+static void
+_vala_main (void)
+{
+       (foo_target_destroy_notify == NULL) ? NULL : (foo_target_destroy_notify (foo_target), NULL);
+       foo = NULL;
+       foo_target = NULL;
+       foo_target_destroy_notify = NULL;
+       foo = _func_foo_func;
+       foo_target = NULL;
+       foo_target_destroy_notify = NULL;
+       foo_unowned = _func_foo_func;
+       foo_unowned_target = NULL;
+       foo_targetless = _func_foo_func_targetless;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/delegates/gclosure-conversion.c-expected b/tests/delegates/gclosure-conversion.c-expected
new file mode 100644
index 000000000..f7b889293
--- /dev/null
+++ b/tests/delegates/gclosure-conversion.c-expected
@@ -0,0 +1,462 @@
+/* delegates_gclosure_conversion.c generated by valac, the Vala compiler
+ * generated from delegates_gclosure_conversion.vala, do not modify */
+
+#include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_FOO_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_free0(var) (var = (g_free (var), NULL))
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+enum  {
+       BAR_0_PROPERTY,
+       BAR_BAR_PROPERTY,
+       BAR_NUM_PROPERTIES
+};
+static GParamSpec* bar_properties[BAR_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _FooPrivate {
+       gchar* _foo;
+};
+
+struct _Bar {
+       GObject parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       GObjectClass parent_class;
+};
+
+struct _BarPrivate {
+       gint _bar;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+static gint Bar_private_offset;
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+VALA_EXTERN const gchar* foo_get_foo (Foo* self);
+VALA_EXTERN void foo_set_foo (Foo* self,
+                  const gchar* value);
+static void foo_finalize (GObject * obj);
+static GType foo_get_type_once (void);
+static void _vala_foo_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_foo_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+VALA_EXTERN gint bar_get_bar (Bar* self);
+VALA_EXTERN void bar_set_bar (Bar* self,
+                  gint value);
+static void bar_finalize (GObject * obj);
+static GType bar_get_type_once (void);
+static void _vala_bar_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_bar_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec);
+VALA_EXTERN gboolean to_int (GBinding* b,
+                 GValue* from,
+                 GValue* to);
+VALA_EXTERN gboolean to_string (GBinding* b,
+                    GValue* from,
+                    GValue* to);
+static void _vala_main (void);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+const gchar*
+foo_get_foo (Foo* self)
+{
+       const gchar* result;
+       const gchar* _tmp0_;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = self->priv->_foo;
+       result = _tmp0_;
+       return result;
+}
+
+void
+foo_set_foo (Foo* self,
+             const gchar* value)
+{
+       gchar* old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_foo (self);
+       if (g_strcmp0 (value, old_value) != 0) {
+               gchar* _tmp0_;
+               _tmp0_ = g_strdup (value);
+               _g_free0 (self->priv->_foo);
+               self->priv->_foo = _tmp0_;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_FOO_PROPERTY]);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_foo_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_foo_set_property;
+       G_OBJECT_CLASS (klass)->finalize = foo_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_FOO_PROPERTY, 
foo_properties[FOO_FOO_PROPERTY] = g_param_spec_string ("foo", "foo", "foo", NULL, G_PARAM_STATIC_STRINGS | 
G_PARAM_READABLE | G_PARAM_WRITABLE));
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+}
+
+static void
+foo_finalize (GObject * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       _g_free0 (self->priv->_foo);
+       G_OBJECT_CLASS (foo_parent_class)->finalize (obj);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_foo_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_FOO_PROPERTY:
+               g_value_set_string (value, foo_get_foo (self));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_foo_set_property (GObject * object,
+                        guint property_id,
+                        const GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_FOO_PROPERTY:
+               foo_set_foo (self, g_value_get_string (value));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static inline gpointer
+bar_get_instance_private (Bar* self)
+{
+       return G_STRUCT_MEMBER_P (self, Bar_private_offset);
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar * self = NULL;
+       self = (Bar*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+gint
+bar_get_bar (Bar* self)
+{
+       gint result;
+       g_return_val_if_fail (IS_BAR (self), 0);
+       result = self->priv->_bar;
+       return result;
+}
+
+void
+bar_set_bar (Bar* self,
+             gint value)
+{
+       gint old_value;
+       g_return_if_fail (IS_BAR (self));
+       old_value = bar_get_bar (self);
+       if (old_value != value) {
+               self->priv->_bar = value;
+               g_object_notify_by_pspec ((GObject *) self, bar_properties[BAR_BAR_PROPERTY]);
+       }
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Bar_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_bar_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_bar_set_property;
+       G_OBJECT_CLASS (klass)->finalize = bar_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), BAR_BAR_PROPERTY, 
bar_properties[BAR_BAR_PROPERTY] = g_param_spec_int ("bar", "bar", "bar", G_MININT, G_MAXINT, 0, 
G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+       self->priv = bar_get_instance_private (self);
+}
+
+static void
+bar_finalize (GObject * obj)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       G_OBJECT_CLASS (bar_parent_class)->finalize (obj);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (G_TYPE_OBJECT, "Bar", &g_define_type_info, 0);
+       Bar_private_offset = g_type_add_instance_private (bar_type_id, sizeof (BarPrivate));
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_bar_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_BAR, Bar);
+       switch (property_id) {
+               case BAR_BAR_PROPERTY:
+               g_value_set_int (value, bar_get_bar (self));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_bar_set_property (GObject * object,
+                        guint property_id,
+                        const GValue * value,
+                        GParamSpec * pspec)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_BAR, Bar);
+       switch (property_id) {
+               case BAR_BAR_PROPERTY:
+               bar_set_bar (self, g_value_get_int (value));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+gboolean
+to_int (GBinding* b,
+        GValue* from,
+        GValue* to)
+{
+       const gchar* _tmp0_;
+       gboolean result = FALSE;
+       g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (b, G_TYPE_BINDING), FALSE);
+       g_return_val_if_fail (from != NULL, FALSE);
+       g_return_val_if_fail (to != NULL, FALSE);
+       _tmp0_ = g_value_get_string (from);
+       g_value_set_int (to, atoi (_tmp0_));
+       result = TRUE;
+       return result;
+}
+
+gboolean
+to_string (GBinding* b,
+           GValue* from,
+           GValue* to)
+{
+       gchar* _tmp0_;
+       gchar* _tmp1_;
+       gboolean result = FALSE;
+       g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (b, G_TYPE_BINDING), FALSE);
+       g_return_val_if_fail (from != NULL, FALSE);
+       g_return_val_if_fail (to != NULL, FALSE);
+       _tmp0_ = g_strdup_printf ("%i", g_value_get_int (from));
+       _tmp1_ = _tmp0_;
+       g_value_set_string (to, _tmp1_);
+       _g_free0 (_tmp1_);
+       result = TRUE;
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       Bar* bar = NULL;
+       Bar* _tmp1_;
+       gint _tmp2_;
+       gint _tmp3_;
+       const gchar* _tmp4_;
+       const gchar* _tmp5_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       _tmp1_ = bar_new ();
+       bar = _tmp1_;
+       g_object_bind_property_with_closures (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject), 
"foo", G_TYPE_CHECK_INSTANCE_CAST (bar, G_TYPE_OBJECT, GObject), "bar", G_BINDING_BIDIRECTIONAL, (GClosure*) 
((((GBindingTransformFunc) to_int) == NULL) ? NULL : g_cclosure_new ((GCallback) ((GBindingTransformFunc) 
to_int), NULL, (GClosureNotify) NULL)), (GClosure*) ((((GBindingTransformFunc) to_string) == NULL) ? NULL : 
g_cclosure_new ((GCallback) ((GBindingTransformFunc) to_string), NULL, (GClosureNotify) NULL)));
+       foo_set_foo (foo, "42");
+       _tmp2_ = bar_get_bar (bar);
+       _tmp3_ = _tmp2_;
+       _vala_assert (_tmp3_ == 42, "bar.bar == 42");
+       bar_set_bar (bar, 23);
+       _tmp4_ = foo_get_foo (foo);
+       _tmp5_ = _tmp4_;
+       _vala_assert (g_strcmp0 (_tmp5_, "23") == 0, "foo.foo == \"23\"");
+       _g_object_unref0 (bar);
+       _g_object_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/delegates/lambda-mixed-instance-static.c-expected 
b/tests/delegates/lambda-mixed-instance-static.c-expected
new file mode 100644
index 000000000..5f79ce8a4
--- /dev/null
+++ b/tests/delegates/lambda-mixed-instance-static.c-expected
@@ -0,0 +1,123 @@
+/* delegates_lambda_mixed_instance_static.c generated by valac, the Vala compiler
+ * generated from delegates_lambda_mixed_instance_static.vala, do not modify */
+
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef gint (*FooFunc) (gint i);
+typedef gint (*BarFunc) (gint i, gpointer user_data);
+typedef struct _Block1Data Block1Data;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Block1Data {
+       int _ref_count_;
+       gint global;
+};
+
+VALA_EXTERN void func (FooFunc f,
+           BarFunc b,
+           gpointer b_target);
+static void _vala_main (void);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static gint __lambda4_ (gint i);
+static gint ___lambda4__foo_func (gint i);
+static gint __lambda5_ (Block1Data* _data1_,
+                 gint i);
+static gint ___lambda5__bar_func (gint i,
+                           gpointer self);
+
+void
+func (FooFunc f,
+      BarFunc b,
+      gpointer b_target)
+{
+       _vala_assert (f (42) == 42, "f (42) == 42");
+       _vala_assert (b (23, b_target) == 4711, "b (23) == 4711");
+}
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static gint
+__lambda4_ (gint i)
+{
+       gint result = 0;
+       _vala_assert (i == 42, "i == 42");
+       result = i;
+       return result;
+}
+
+static gint
+___lambda4__foo_func (gint i)
+{
+       gint result;
+       result = __lambda4_ (i);
+       return result;
+}
+
+static gint
+__lambda5_ (Block1Data* _data1_,
+            gint i)
+{
+       gint result = 0;
+       _vala_assert (i == 23, "i == 23");
+       result = _data1_->global;
+       return result;
+}
+
+static gint
+___lambda5__bar_func (gint i,
+                      gpointer self)
+{
+       gint result;
+       result = __lambda5_ (self, i);
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       Block1Data* _data1_;
+       _data1_ = g_slice_new0 (Block1Data);
+       _data1_->_ref_count_ = 1;
+       _data1_->global = 4711;
+       func (___lambda4__foo_func, ___lambda5__bar_func, _data1_);
+       block1_data_unref (_data1_);
+       _data1_ = NULL;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/delegates/lambda-shared-closure.c-expected 
b/tests/delegates/lambda-shared-closure.c-expected
new file mode 100644
index 000000000..8d78411ef
--- /dev/null
+++ b/tests/delegates/lambda-shared-closure.c-expected
@@ -0,0 +1,875 @@
+/* delegates_lambda_shared_closure.c generated by valac, the Vala compiler
+ * generated from delegates_lambda_shared_closure.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef void (*FooFunc) (gpointer user_data);
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+typedef struct _Block1Data Block1Data;
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+typedef struct _Block2Data Block2Data;
+typedef struct _Block3Data Block3Data;
+typedef struct _Block4Data Block4Data;
+typedef struct _Block5Data Block5Data;
+typedef struct _Block6Data Block6Data;
+typedef struct _Block7Data Block7Data;
+typedef struct _Block8Data Block8Data;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _FooPrivate {
+       gint global;
+};
+
+struct _Block1Data {
+       int _ref_count_;
+       Foo* self;
+       gint local;
+};
+
+struct _Block2Data {
+       int _ref_count_;
+       Foo* self;
+       gint local;
+};
+
+struct _Block3Data {
+       int _ref_count_;
+       Foo* self;
+       gint local;
+};
+
+struct _Block4Data {
+       int _ref_count_;
+       Foo* self;
+       gint local;
+};
+
+struct _Block5Data {
+       int _ref_count_;
+       Foo* foo;
+};
+
+struct _Block6Data {
+       int _ref_count_;
+       Foo* foo;
+};
+
+struct _Block7Data {
+       int _ref_count_;
+       Foo* foo;
+};
+
+struct _Block8Data {
+       int _ref_count_;
+       Foo* foo;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+static void foo_call (Foo* self,
+               FooFunc a,
+               gpointer a_target,
+               FooFunc b,
+               gpointer b_target);
+static void foo_call_owned (Foo* self,
+                     FooFunc a,
+                     gpointer a_target,
+                     GDestroyNotify a_target_destroy_notify,
+                     FooFunc b,
+                     gpointer b_target,
+                     GDestroyNotify b_target_destroy_notify);
+static void foo_call_shared (Foo* self,
+                      FooFunc a,
+                      FooFunc b,
+                      gpointer user_data);
+static void foo_call_shared_owned (Foo* self,
+                            FooFunc a,
+                            FooFunc b,
+                            gpointer user_data,
+                            GDestroyNotify user_data_destroy_notify);
+VALA_EXTERN void foo_run_1 (Foo* self);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static void __lambda4_ (Block1Data* _data1_);
+static void ___lambda4__foo_func (gpointer self);
+static void __lambda5_ (Block1Data* _data1_);
+static void ___lambda5__foo_func (gpointer self);
+VALA_EXTERN void foo_run_2 (Foo* self);
+static Block2Data* block2_data_ref (Block2Data* _data2_);
+static void block2_data_unref (void * _userdata_);
+static void __lambda6_ (Block2Data* _data2_);
+static void ___lambda6__foo_func (gpointer self);
+static void __lambda7_ (Block2Data* _data2_);
+static void ___lambda7__foo_func (gpointer self);
+VALA_EXTERN void foo_run_3 (Foo* self);
+static Block3Data* block3_data_ref (Block3Data* _data3_);
+static void block3_data_unref (void * _userdata_);
+static void __lambda8_ (Block3Data* _data3_);
+static void ___lambda8__foo_func (gpointer self);
+static void __lambda9_ (Block3Data* _data3_);
+static void ___lambda9__foo_func (gpointer self);
+VALA_EXTERN void foo_run_4 (Foo* self);
+static Block4Data* block4_data_ref (Block4Data* _data4_);
+static void block4_data_unref (void * _userdata_);
+static void __lambda10_ (Block4Data* _data4_);
+static void ___lambda10__foo_func (gpointer self);
+static void __lambda11_ (Block4Data* _data4_);
+static void ___lambda11__foo_func (gpointer self);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (GObject * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN void call_shared (FooFunc a,
+                  FooFunc b,
+                  gpointer user_data);
+VALA_EXTERN void call_shared_owned (FooFunc a,
+                        FooFunc b,
+                        gpointer user_data,
+                        GDestroyNotify user_data_destroy_notify);
+VALA_EXTERN void run_static_1 (void);
+static Block5Data* block5_data_ref (Block5Data* _data5_);
+static void block5_data_unref (void * _userdata_);
+static void __lambda12_ (Block5Data* _data5_);
+static void ___lambda12__foo_func (gpointer self);
+static void __lambda13_ (void);
+static void ___lambda13__foo_func (gpointer self);
+VALA_EXTERN void run_static_2 (void);
+static Block6Data* block6_data_ref (Block6Data* _data6_);
+static void block6_data_unref (void * _userdata_);
+static void __lambda14_ (void);
+static void ___lambda14__foo_func (gpointer self);
+static void __lambda15_ (Block6Data* _data6_);
+static void ___lambda15__foo_func (gpointer self);
+VALA_EXTERN void run_static_3 (void);
+static Block7Data* block7_data_ref (Block7Data* _data7_);
+static void block7_data_unref (void * _userdata_);
+static void __lambda16_ (Block7Data* _data7_);
+static void ___lambda16__foo_func (gpointer self);
+static void __lambda17_ (void);
+static void ___lambda17__foo_func (gpointer self);
+VALA_EXTERN void run_static_4 (void);
+static Block8Data* block8_data_ref (Block8Data* _data8_);
+static void block8_data_unref (void * _userdata_);
+static void __lambda18_ (void);
+static void ___lambda18__foo_func (gpointer self);
+static void __lambda19_ (Block8Data* _data8_);
+static void ___lambda19__foo_func (gpointer self);
+static void _vala_main (void);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+static void
+foo_call (Foo* self,
+          FooFunc a,
+          gpointer a_target,
+          FooFunc b,
+          gpointer b_target)
+{
+       g_return_if_fail (IS_FOO (self));
+       a (a_target);
+       b (b_target);
+}
+
+static void
+foo_call_owned (Foo* self,
+                FooFunc a,
+                gpointer a_target,
+                GDestroyNotify a_target_destroy_notify,
+                FooFunc b,
+                gpointer b_target,
+                GDestroyNotify b_target_destroy_notify)
+{
+       g_return_if_fail (IS_FOO (self));
+       a (a_target);
+       b (b_target);
+       (a_target_destroy_notify == NULL) ? NULL : (a_target_destroy_notify (a_target), NULL);
+       a = NULL;
+       a_target = NULL;
+       a_target_destroy_notify = NULL;
+       (b_target_destroy_notify == NULL) ? NULL : (b_target_destroy_notify (b_target), NULL);
+       b = NULL;
+       b_target = NULL;
+       b_target_destroy_notify = NULL;
+}
+
+static void
+foo_call_shared (Foo* self,
+                 FooFunc a,
+                 FooFunc b,
+                 gpointer user_data)
+{
+       g_return_if_fail (IS_FOO (self));
+       a (user_data);
+       b (user_data);
+}
+
+static void
+foo_call_shared_owned (Foo* self,
+                       FooFunc a,
+                       FooFunc b,
+                       gpointer user_data,
+                       GDestroyNotify user_data_destroy_notify)
+{
+       g_return_if_fail (IS_FOO (self));
+       a (user_data);
+       b (user_data);
+       (user_data_destroy_notify == NULL) ? NULL : (user_data_destroy_notify (user_data), NULL);
+       a = NULL;
+       user_data = NULL;
+       user_data_destroy_notify = NULL;
+       (user_data_destroy_notify == NULL) ? NULL : (user_data_destroy_notify (user_data), NULL);
+       b = NULL;
+       user_data = NULL;
+       user_data_destroy_notify = NULL;
+}
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               Foo* self;
+               self = _data1_->self;
+               _g_object_unref0 (self);
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static void
+__lambda4_ (Block1Data* _data1_)
+{
+       Foo* self;
+       self = _data1_->self;
+       _vala_assert (self->priv->global == 42, "global == 42");
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (self, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 2), 
"this.ref_count == 2");
+}
+
+static void
+___lambda4__foo_func (gpointer self)
+{
+       __lambda4_ (self);
+}
+
+static void
+__lambda5_ (Block1Data* _data1_)
+{
+       Foo* self;
+       self = _data1_->self;
+       _vala_assert (_data1_->local == 23, "local == 23");
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (self, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 2), 
"this.ref_count == 2");
+}
+
+static void
+___lambda5__foo_func (gpointer self)
+{
+       __lambda5_ (self);
+}
+
+void
+foo_run_1 (Foo* self)
+{
+       Block1Data* _data1_;
+       g_return_if_fail (IS_FOO (self));
+       _data1_ = g_slice_new0 (Block1Data);
+       _data1_->_ref_count_ = 1;
+       _data1_->self = g_object_ref (self);
+       _data1_->local = 23;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (self, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 2), 
"this.ref_count == 2");
+       foo_call (self, ___lambda4__foo_func, _data1_, ___lambda5__foo_func, _data1_);
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (self, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 2), 
"this.ref_count == 2");
+       block1_data_unref (_data1_);
+       _data1_ = NULL;
+}
+
+static Block2Data*
+block2_data_ref (Block2Data* _data2_)
+{
+       g_atomic_int_inc (&_data2_->_ref_count_);
+       return _data2_;
+}
+
+static void
+block2_data_unref (void * _userdata_)
+{
+       Block2Data* _data2_;
+       _data2_ = (Block2Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data2_->_ref_count_)) {
+               Foo* self;
+               self = _data2_->self;
+               _g_object_unref0 (self);
+               g_slice_free (Block2Data, _data2_);
+       }
+}
+
+static void
+__lambda6_ (Block2Data* _data2_)
+{
+       Foo* self;
+       self = _data2_->self;
+       _vala_assert (self->priv->global == 42, "global == 42");
+}
+
+static void
+___lambda6__foo_func (gpointer self)
+{
+       __lambda6_ (self);
+}
+
+static void
+__lambda7_ (Block2Data* _data2_)
+{
+       Foo* self;
+       self = _data2_->self;
+       _vala_assert (_data2_->local == 23, "local == 23");
+}
+
+static void
+___lambda7__foo_func (gpointer self)
+{
+       __lambda7_ (self);
+}
+
+void
+foo_run_2 (Foo* self)
+{
+       Block2Data* _data2_;
+       g_return_if_fail (IS_FOO (self));
+       _data2_ = g_slice_new0 (Block2Data);
+       _data2_->_ref_count_ = 1;
+       _data2_->self = g_object_ref (self);
+       _data2_->local = 23;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (self, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 2), 
"this.ref_count == 2");
+       foo_call_owned (self, ___lambda6__foo_func, block2_data_ref (_data2_), block2_data_unref, 
___lambda7__foo_func, block2_data_ref (_data2_), block2_data_unref);
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (self, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 2), 
"this.ref_count == 2");
+       block2_data_unref (_data2_);
+       _data2_ = NULL;
+}
+
+static Block3Data*
+block3_data_ref (Block3Data* _data3_)
+{
+       g_atomic_int_inc (&_data3_->_ref_count_);
+       return _data3_;
+}
+
+static void
+block3_data_unref (void * _userdata_)
+{
+       Block3Data* _data3_;
+       _data3_ = (Block3Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data3_->_ref_count_)) {
+               Foo* self;
+               self = _data3_->self;
+               _g_object_unref0 (self);
+               g_slice_free (Block3Data, _data3_);
+       }
+}
+
+static void
+__lambda8_ (Block3Data* _data3_)
+{
+       Foo* self;
+       self = _data3_->self;
+       _vala_assert (self->priv->global == 42, "global == 42");
+}
+
+static void
+___lambda8__foo_func (gpointer self)
+{
+       __lambda8_ (self);
+}
+
+static void
+__lambda9_ (Block3Data* _data3_)
+{
+       Foo* self;
+       self = _data3_->self;
+       _vala_assert (_data3_->local == 23, "local == 23");
+}
+
+static void
+___lambda9__foo_func (gpointer self)
+{
+       __lambda9_ (self);
+}
+
+void
+foo_run_3 (Foo* self)
+{
+       Block3Data* _data3_;
+       g_return_if_fail (IS_FOO (self));
+       _data3_ = g_slice_new0 (Block3Data);
+       _data3_->_ref_count_ = 1;
+       _data3_->self = g_object_ref (self);
+       _data3_->local = 23;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (self, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 2), 
"this.ref_count == 2");
+       foo_call_shared (self, ___lambda8__foo_func, ___lambda9__foo_func, _data3_);
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (self, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 2), 
"this.ref_count == 2");
+       block3_data_unref (_data3_);
+       _data3_ = NULL;
+}
+
+static Block4Data*
+block4_data_ref (Block4Data* _data4_)
+{
+       g_atomic_int_inc (&_data4_->_ref_count_);
+       return _data4_;
+}
+
+static void
+block4_data_unref (void * _userdata_)
+{
+       Block4Data* _data4_;
+       _data4_ = (Block4Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data4_->_ref_count_)) {
+               Foo* self;
+               self = _data4_->self;
+               _g_object_unref0 (self);
+               g_slice_free (Block4Data, _data4_);
+       }
+}
+
+static void
+__lambda10_ (Block4Data* _data4_)
+{
+       Foo* self;
+       self = _data4_->self;
+       _vala_assert (self->priv->global == 42, "global == 42");
+}
+
+static void
+___lambda10__foo_func (gpointer self)
+{
+       __lambda10_ (self);
+}
+
+static void
+__lambda11_ (Block4Data* _data4_)
+{
+       Foo* self;
+       self = _data4_->self;
+       _vala_assert (_data4_->local == 23, "local == 23");
+}
+
+static void
+___lambda11__foo_func (gpointer self)
+{
+       __lambda11_ (self);
+}
+
+void
+foo_run_4 (Foo* self)
+{
+       Block4Data* _data4_;
+       g_return_if_fail (IS_FOO (self));
+       _data4_ = g_slice_new0 (Block4Data);
+       _data4_->_ref_count_ = 1;
+       _data4_->self = g_object_ref (self);
+       _data4_->local = 23;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (self, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 2), 
"this.ref_count == 2");
+       foo_call_shared_owned (self, ___lambda10__foo_func, ___lambda11__foo_func, block4_data_ref (_data4_), 
block4_data_unref);
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (self, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 2), 
"this.ref_count == 2");
+       block4_data_unref (_data4_);
+       _data4_ = NULL;
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+       G_OBJECT_CLASS (klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+       self->priv->global = 42;
+}
+
+static void
+foo_finalize (GObject * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       G_OBJECT_CLASS (foo_parent_class)->finalize (obj);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+void
+call_shared (FooFunc a,
+             FooFunc b,
+             gpointer user_data)
+{
+       a (user_data);
+       b (user_data);
+}
+
+void
+call_shared_owned (FooFunc a,
+                   FooFunc b,
+                   gpointer user_data,
+                   GDestroyNotify user_data_destroy_notify)
+{
+       a (user_data);
+       b (user_data);
+       (user_data_destroy_notify == NULL) ? NULL : (user_data_destroy_notify (user_data), NULL);
+       a = NULL;
+       user_data = NULL;
+       user_data_destroy_notify = NULL;
+       (user_data_destroy_notify == NULL) ? NULL : (user_data_destroy_notify (user_data), NULL);
+       b = NULL;
+       user_data = NULL;
+       user_data_destroy_notify = NULL;
+}
+
+static Block5Data*
+block5_data_ref (Block5Data* _data5_)
+{
+       g_atomic_int_inc (&_data5_->_ref_count_);
+       return _data5_;
+}
+
+static void
+block5_data_unref (void * _userdata_)
+{
+       Block5Data* _data5_;
+       _data5_ = (Block5Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data5_->_ref_count_)) {
+               _g_object_unref0 (_data5_->foo);
+               g_slice_free (Block5Data, _data5_);
+       }
+}
+
+static void
+__lambda12_ (Block5Data* _data5_)
+{
+       _vala_assert (_data5_->foo != NULL, "foo != null");
+}
+
+static void
+___lambda12__foo_func (gpointer self)
+{
+       __lambda12_ (self);
+}
+
+static void
+__lambda13_ (void)
+{
+}
+
+static void
+___lambda13__foo_func (gpointer self)
+{
+       __lambda13_ ();
+}
+
+void
+run_static_1 (void)
+{
+       Block5Data* _data5_;
+       Foo* _tmp0_;
+       _data5_ = g_slice_new0 (Block5Data);
+       _data5_->_ref_count_ = 1;
+       _tmp0_ = foo_new ();
+       _data5_->foo = _tmp0_;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_data5_->foo, G_TYPE_OBJECT, GObject)->ref_count == 
((guint) 1), "foo.ref_count == 1");
+       call_shared (___lambda12__foo_func, ___lambda13__foo_func, _data5_);
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_data5_->foo, G_TYPE_OBJECT, GObject)->ref_count == 
((guint) 1), "foo.ref_count == 1");
+       block5_data_unref (_data5_);
+       _data5_ = NULL;
+}
+
+static Block6Data*
+block6_data_ref (Block6Data* _data6_)
+{
+       g_atomic_int_inc (&_data6_->_ref_count_);
+       return _data6_;
+}
+
+static void
+block6_data_unref (void * _userdata_)
+{
+       Block6Data* _data6_;
+       _data6_ = (Block6Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data6_->_ref_count_)) {
+               _g_object_unref0 (_data6_->foo);
+               g_slice_free (Block6Data, _data6_);
+       }
+}
+
+static void
+__lambda14_ (void)
+{
+}
+
+static void
+___lambda14__foo_func (gpointer self)
+{
+       __lambda14_ ();
+}
+
+static void
+__lambda15_ (Block6Data* _data6_)
+{
+       _vala_assert (_data6_->foo != NULL, "foo != null");
+}
+
+static void
+___lambda15__foo_func (gpointer self)
+{
+       __lambda15_ (self);
+}
+
+void
+run_static_2 (void)
+{
+       Block6Data* _data6_;
+       Foo* _tmp0_;
+       _data6_ = g_slice_new0 (Block6Data);
+       _data6_->_ref_count_ = 1;
+       _tmp0_ = foo_new ();
+       _data6_->foo = _tmp0_;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_data6_->foo, G_TYPE_OBJECT, GObject)->ref_count == 
((guint) 1), "foo.ref_count == 1");
+       call_shared (___lambda14__foo_func, ___lambda15__foo_func, _data6_);
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_data6_->foo, G_TYPE_OBJECT, GObject)->ref_count == 
((guint) 1), "foo.ref_count == 1");
+       block6_data_unref (_data6_);
+       _data6_ = NULL;
+}
+
+static Block7Data*
+block7_data_ref (Block7Data* _data7_)
+{
+       g_atomic_int_inc (&_data7_->_ref_count_);
+       return _data7_;
+}
+
+static void
+block7_data_unref (void * _userdata_)
+{
+       Block7Data* _data7_;
+       _data7_ = (Block7Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data7_->_ref_count_)) {
+               _g_object_unref0 (_data7_->foo);
+               g_slice_free (Block7Data, _data7_);
+       }
+}
+
+static void
+__lambda16_ (Block7Data* _data7_)
+{
+       _vala_assert (_data7_->foo != NULL, "foo != null");
+}
+
+static void
+___lambda16__foo_func (gpointer self)
+{
+       __lambda16_ (self);
+}
+
+static void
+__lambda17_ (void)
+{
+}
+
+static void
+___lambda17__foo_func (gpointer self)
+{
+       __lambda17_ ();
+}
+
+void
+run_static_3 (void)
+{
+       Block7Data* _data7_;
+       Foo* _tmp0_;
+       _data7_ = g_slice_new0 (Block7Data);
+       _data7_->_ref_count_ = 1;
+       _tmp0_ = foo_new ();
+       _data7_->foo = _tmp0_;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_data7_->foo, G_TYPE_OBJECT, GObject)->ref_count == 
((guint) 1), "foo.ref_count == 1");
+       call_shared_owned (___lambda16__foo_func, ___lambda17__foo_func, block7_data_ref (_data7_), 
block7_data_unref);
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_data7_->foo, G_TYPE_OBJECT, GObject)->ref_count == 
((guint) 1), "foo.ref_count == 1");
+       block7_data_unref (_data7_);
+       _data7_ = NULL;
+}
+
+static Block8Data*
+block8_data_ref (Block8Data* _data8_)
+{
+       g_atomic_int_inc (&_data8_->_ref_count_);
+       return _data8_;
+}
+
+static void
+block8_data_unref (void * _userdata_)
+{
+       Block8Data* _data8_;
+       _data8_ = (Block8Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data8_->_ref_count_)) {
+               _g_object_unref0 (_data8_->foo);
+               g_slice_free (Block8Data, _data8_);
+       }
+}
+
+static void
+__lambda18_ (void)
+{
+}
+
+static void
+___lambda18__foo_func (gpointer self)
+{
+       __lambda18_ ();
+}
+
+static void
+__lambda19_ (Block8Data* _data8_)
+{
+       _vala_assert (_data8_->foo != NULL, "foo != null");
+}
+
+static void
+___lambda19__foo_func (gpointer self)
+{
+       __lambda19_ (self);
+}
+
+void
+run_static_4 (void)
+{
+       Block8Data* _data8_;
+       Foo* _tmp0_;
+       _data8_ = g_slice_new0 (Block8Data);
+       _data8_->_ref_count_ = 1;
+       _tmp0_ = foo_new ();
+       _data8_->foo = _tmp0_;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_data8_->foo, G_TYPE_OBJECT, GObject)->ref_count == 
((guint) 1), "foo.ref_count == 1");
+       call_shared_owned (___lambda18__foo_func, ___lambda19__foo_func, block8_data_ref (_data8_), 
block8_data_unref);
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_data8_->foo, G_TYPE_OBJECT, GObject)->ref_count == 
((guint) 1), "foo.ref_count == 1");
+       block8_data_unref (_data8_);
+       _data8_ = NULL;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"foo.ref_count == 1");
+       foo_run_1 (foo);
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"foo.ref_count == 1");
+       foo_run_2 (foo);
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"foo.ref_count == 1");
+       foo_run_3 (foo);
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"foo.ref_count == 1");
+       foo_run_4 (foo);
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"foo.ref_count == 1");
+       run_static_1 ();
+       run_static_2 ();
+       run_static_3 ();
+       run_static_4 ();
+       _g_object_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/delegates/member-target-destroy.c-expected 
b/tests/delegates/member-target-destroy.c-expected
new file mode 100644
index 000000000..85d2ab3f4
--- /dev/null
+++ b/tests/delegates/member-target-destroy.c-expected
@@ -0,0 +1,84 @@
+/* delegates_member_target_destroy.c generated by valac, the Vala compiler
+ * generated from delegates_member_target_destroy.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef gchar* (*Foo) (gpointer user_data);
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN gchar* bar (const gchar* s);
+VALA_EXTERN void foo_free (void* data);
+static void _vala_main (void);
+
+gchar*
+bar (const gchar* s)
+{
+       gchar* _tmp0_;
+       gchar* result = NULL;
+       g_return_val_if_fail (s != NULL, NULL);
+       _tmp0_ = g_strdup (s);
+       result = _tmp0_;
+       return result;
+}
+
+void
+foo_free (void* data)
+{
+       g_free (data);
+}
+
+static void
+_vala_main (void)
+{
+       Foo foo = NULL;
+       gpointer foo_target;
+       GDestroyNotify foo_target_destroy_notify;
+       const gchar* foo_data = NULL;
+       gchar* _tmp0_;
+       gchar* _tmp1_;
+       gchar* _tmp2_;
+       foo = (Foo) bar;
+       foo_target = NULL;
+       foo_target_destroy_notify = NULL;
+       _vala_assert (foo_target == NULL, "foo.target == null");
+       _vala_assert (foo_target_destroy_notify == NULL, "foo.destroy == null");
+       _tmp0_ = g_strdup ("foo");
+       foo_data = _tmp0_;
+       foo_target = foo_data;
+       foo_target_destroy_notify = (GDestroyNotify) foo_free;
+       _tmp1_ = foo (foo_target);
+       _tmp2_ = _tmp1_;
+       _vala_assert (g_strcmp0 (_tmp2_, "foo") == 0, "foo () == \"foo\"");
+       _g_free0 (_tmp2_);
+       _vala_assert (foo_target == foo_data, "foo.target == foo_data");
+       _vala_assert (foo_target_destroy_notify == ((GDestroyNotify) foo_free), "foo.destroy == 
(GLib.DestroyNotify) foo_free");
+       (foo_target_destroy_notify == NULL) ? NULL : (foo_target_destroy_notify (foo_target), NULL);
+       foo = NULL;
+       foo_target = NULL;
+       foo_target_destroy_notify = NULL;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/delegates/params-array-with-throws.c-expected 
b/tests/delegates/params-array-with-throws.c-expected
new file mode 100644
index 000000000..a00603906
--- /dev/null
+++ b/tests/delegates/params-array-with-throws.c-expected
@@ -0,0 +1,202 @@
+/* delegates_params_array_with_throws.c generated by valac, the Vala compiler
+ * generated from delegates_params_array_with_throws.vala, do not modify */
+
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef void (*FooFunc) (GError** error, const gchar* _first_array, ...);
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+typedef enum  {
+       FOO_ERROR_BAD,
+       FOO_ERROR_WORSE
+} FooError;
+#define FOO_ERROR foo_error_quark ()
+
+VALA_EXTERN GQuark foo_error_quark (void);
+VALA_EXTERN void foo (GError** error,
+          gchar* _first_array,
+          ...);
+static void _vala_array_add1 (const gchar** * array,
+                       gint* length,
+                       gint* size,
+                       const gchar* value);
+VALA_EXTERN void bar (GError** error,
+          gchar* _first_array,
+          ...);
+static void _vala_array_add2 (const gchar** * array,
+                       gint* length,
+                       gint* size,
+                       const gchar* value);
+static void _vala_main (void);
+
+GQuark
+foo_error_quark (void)
+{
+       return g_quark_from_static_string ("foo-error-quark");
+}
+
+static void
+_vala_array_add1 (const gchar** * array,
+                  gint* length,
+                  gint* size,
+                  const gchar* value)
+{
+       if ((*length) == (*size)) {
+               *size = (*size) ? (2 * (*size)) : 4;
+               *array = g_renew (const gchar*, *array, (*size) + 1);
+       }
+       (*array)[(*length)++] = value;
+       (*array)[*length] = NULL;
+}
+
+void
+foo (GError** error,
+     gchar* _first_array,
+     ...)
+{
+       const gchar* _array_element;
+       va_list _va_list_array;
+       const gchar** array = NULL;
+       gint array_length1 = 0;
+       gint _array_size_ = 0;
+       const gchar* _tmp0_;
+       const gchar* _tmp1_;
+       const gchar* _tmp2_;
+       array = g_new0 (const gchar*, array_length1 + 1);
+       va_start (_va_list_array, _first_array);
+       _array_element = _first_array;
+       while (_array_element != NULL) {
+               _vala_array_add1 (&array, &array_length1, &_array_size_, _array_element);
+               _array_element = va_arg (_va_list_array, const gchar*);
+       }
+       va_end (_va_list_array);
+       _vala_assert (array_length1 == 3, "array.length == 3");
+       _tmp0_ = array[0];
+       _vala_assert (g_strcmp0 (_tmp0_, "foo") == 0, "array[0] == \"foo\"");
+       _tmp1_ = array[1];
+       _vala_assert (g_strcmp0 (_tmp1_, "bar") == 0, "array[1] == \"bar\"");
+       _tmp2_ = array[2];
+       _vala_assert (g_strcmp0 (_tmp2_, "manam") == 0, "array[2] == \"manam\"");
+       array = (g_free (array), NULL);
+}
+
+static void
+_vala_array_add2 (const gchar** * array,
+                  gint* length,
+                  gint* size,
+                  const gchar* value)
+{
+       if ((*length) == (*size)) {
+               *size = (*size) ? (2 * (*size)) : 4;
+               *array = g_renew (const gchar*, *array, (*size) + 1);
+       }
+       (*array)[(*length)++] = value;
+       (*array)[*length] = NULL;
+}
+
+void
+bar (GError** error,
+     gchar* _first_array,
+     ...)
+{
+       const gchar* _array_element;
+       va_list _va_list_array;
+       const gchar** array = NULL;
+       gint array_length1 = 0;
+       gint _array_size_ = 0;
+       GError* _tmp0_;
+       GError* _inner_error0_ = NULL;
+       array = g_new0 (const gchar*, array_length1 + 1);
+       va_start (_va_list_array, _first_array);
+       _array_element = _first_array;
+       while (_array_element != NULL) {
+               _vala_array_add2 (&array, &array_length1, &_array_size_, _array_element);
+               _array_element = va_arg (_va_list_array, const gchar*);
+       }
+       va_end (_va_list_array);
+       _tmp0_ = g_error_new_literal (FOO_ERROR, FOO_ERROR_BAD, "bad");
+       _inner_error0_ = _tmp0_;
+       if (_inner_error0_->domain == FOO_ERROR) {
+               g_propagate_error (error, _inner_error0_);
+               array = (g_free (array), NULL);
+               return;
+       } else {
+               array = (g_free (array), NULL);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+}
+
+static void
+_vala_main (void)
+{
+       GError* _inner_error0_ = NULL;
+       {
+               FooFunc func = NULL;
+               func = foo;
+               func (&_inner_error0_, "foo", "bar", "manam", NULL);
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+       }
+       {
+               FooFunc func = NULL;
+               func = bar;
+               {
+                       FooFunc _tmp0_;
+                       _tmp0_ = func;
+                       _tmp0_ (&_inner_error0_, "foo", "bar", "manam", NULL);
+                       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                               if (g_error_matches (_inner_error0_, FOO_ERROR, FOO_ERROR_BAD)) {
+                                       goto __catch0_foo_error_bad;
+                               }
+                               goto __catch0_g_error;
+                       }
+                       g_assert_not_reached ();
+               }
+               goto __finally0;
+               __catch0_foo_error_bad:
+               {
+                       g_clear_error (&_inner_error0_);
+               }
+               goto __finally0;
+               __catch0_g_error:
+               {
+                       g_clear_error (&_inner_error0_);
+                       g_assert_not_reached ();
+               }
+               __finally0:
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/delegates/params-array.c-expected b/tests/delegates/params-array.c-expected
new file mode 100644
index 000000000..74a7d084c
--- /dev/null
+++ b/tests/delegates/params-array.c-expected
@@ -0,0 +1,444 @@
+/* delegates_params_array.c generated by valac, the Vala compiler
+ * generated from delegates_params_array.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+#include <glib-object.h>
+#include <float.h>
+#include <math.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef void (*FooFunc) (const gchar* _first_strv, ...);
+typedef void (*BarFunc) (gint _first_intv, ...);
+typedef void (*ManamFunc) (GValue* _first_valuev, ...);
+typedef void (*ManamOwnedFunc) (GValue* _first_valuev, ...);
+typedef void (*MinimFunc) (GVariant* _first_variantv, ...);
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define __vala_GValue_free0(var) ((var == NULL) ? NULL : (var = (_vala_GValue_free (var), NULL)))
+#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN void foo (gchar* _first_strv,
+          ...);
+static void _vala_array_add1 (const gchar** * array,
+                       gint* length,
+                       gint* size,
+                       const gchar* value);
+VALA_EXTERN void bar (gint _first_intv,
+          ...);
+static void _vala_array_add2 (gint* * array,
+                       gint* length,
+                       gint* size,
+                       gint value);
+VALA_EXTERN void manam (GValue* _first_valuev,
+            ...);
+static void _vala_array_add3 (GValue** * array,
+                       gint* length,
+                       gint* size,
+                       const GValue* value);
+VALA_EXTERN void manam_owned (GValue* _first_valuev,
+                  ...);
+static void _vala_array_add4 (GValue** * array,
+                       gint* length,
+                       gint* size,
+                       GValue* value);
+static void _vala_GValue_free (GValue* self);
+VALA_EXTERN void minim (GVariant* _first_variantv,
+            ...);
+static void _vala_array_add5 (GVariant** * array,
+                       gint* length,
+                       gint* size,
+                       GVariant* value);
+static gchar* _variant_get1 (GVariant* value);
+static gint _variant_get2 (GVariant* value);
+static gdouble _variant_get3 (GVariant* value);
+static void _vala_main (void);
+static GVariant* _variant_new1 (const gchar* value);
+static GVariant* _variant_new2 (gint value);
+static GVariant* _variant_new3 (gdouble value);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static void
+_vala_array_add1 (const gchar** * array,
+                  gint* length,
+                  gint* size,
+                  const gchar* value)
+{
+       if ((*length) == (*size)) {
+               *size = (*size) ? (2 * (*size)) : 4;
+               *array = g_renew (const gchar*, *array, (*size) + 1);
+       }
+       (*array)[(*length)++] = value;
+       (*array)[*length] = NULL;
+}
+
+void
+foo (gchar* _first_strv,
+     ...)
+{
+       const gchar* _strv_element;
+       va_list _va_list_strv;
+       const gchar** strv = NULL;
+       gint strv_length1 = 0;
+       gint _strv_size_ = 0;
+       const gchar* _tmp0_;
+       const gchar* _tmp1_;
+       const gchar* _tmp2_;
+       strv = g_new0 (const gchar*, strv_length1 + 1);
+       va_start (_va_list_strv, _first_strv);
+       _strv_element = _first_strv;
+       while (_strv_element != NULL) {
+               _vala_array_add1 (&strv, &strv_length1, &_strv_size_, _strv_element);
+               _strv_element = va_arg (_va_list_strv, const gchar*);
+       }
+       va_end (_va_list_strv);
+       _vala_assert (strv_length1 == 3, "strv.length == 3");
+       _tmp0_ = strv[0];
+       _vala_assert (g_strcmp0 (_tmp0_, "foo") == 0, "strv[0] == \"foo\"");
+       _tmp1_ = strv[1];
+       _vala_assert (g_strcmp0 (_tmp1_, "bar") == 0, "strv[1] == \"bar\"");
+       _tmp2_ = strv[2];
+       _vala_assert (g_strcmp0 (_tmp2_, "manam") == 0, "strv[2] == \"manam\"");
+       strv = (g_free (strv), NULL);
+}
+
+static void
+_vala_array_add2 (gint* * array,
+                  gint* length,
+                  gint* size,
+                  gint value)
+{
+       if ((*length) == (*size)) {
+               *size = (*size) ? (2 * (*size)) : 4;
+               *array = g_renew (gint, *array, *size);
+       }
+       (*array)[(*length)++] = value;
+}
+
+void
+bar (gint _first_intv,
+     ...)
+{
+       gint _intv_element;
+       va_list _va_list_intv;
+       gint* intv = NULL;
+       gint intv_length1 = 0;
+       gint _intv_size_ = 0;
+       gint _tmp0_;
+       gint _tmp1_;
+       gint _tmp2_;
+       intv = g_new0 (gint, intv_length1);
+       va_start (_va_list_intv, _first_intv);
+       _intv_element = _first_intv;
+       while (_intv_element != NULL) {
+               _vala_array_add2 (&intv, &intv_length1, &_intv_size_, _intv_element);
+               _intv_element = va_arg (_va_list_intv, gint);
+       }
+       va_end (_va_list_intv);
+       _vala_assert (intv_length1 == 3, "intv.length == 3");
+       _tmp0_ = intv[0];
+       _vala_assert (_tmp0_ == 23, "intv[0] == 23");
+       _tmp1_ = intv[1];
+       _vala_assert (_tmp1_ == 42, "intv[1] == 42");
+       _tmp2_ = intv[2];
+       _vala_assert (_tmp2_ == 4711, "intv[2] == 4711");
+       intv = (g_free (intv), NULL);
+}
+
+static void
+_vala_array_add3 (GValue** * array,
+                  gint* length,
+                  gint* size,
+                  const GValue* value)
+{
+       if ((*length) == (*size)) {
+               *size = (*size) ? (2 * (*size)) : 4;
+               *array = g_renew (GValue*, *array, *size);
+       }
+       (*array)[(*length)++] = value;
+}
+
+void
+manam (GValue* _first_valuev,
+       ...)
+{
+       GValue* _valuev_element;
+       va_list _va_list_valuev;
+       GValue** valuev = NULL;
+       gint valuev_length1 = 0;
+       gint _valuev_size_ = 0;
+       GValue* _tmp0_;
+       GValue* _tmp1_;
+       GValue* _tmp2_;
+       valuev = g_new0 (GValue*, valuev_length1);
+       va_start (_va_list_valuev, _first_valuev);
+       _valuev_element = _first_valuev;
+       while (_valuev_element != NULL) {
+               _vala_array_add3 (&valuev, &valuev_length1, &_valuev_size_, _valuev_element);
+               _valuev_element = va_arg (_va_list_valuev, GValue*);
+       }
+       va_end (_va_list_valuev);
+       _vala_assert (valuev_length1 == 3, "valuev.length == 3");
+       _tmp0_ = valuev[0];
+       _vala_assert (g_strcmp0 (g_value_get_string (_tmp0_), "foo") == 0, "valuev[0] == \"foo\"");
+       _tmp1_ = valuev[1];
+       _vala_assert (g_value_get_int (_tmp1_) == 4711, "valuev[1] == 4711");
+       _tmp2_ = valuev[2];
+       _vala_assert (g_value_get_double (_tmp2_) == 3.1415, "valuev[2] == 3.1415");
+       valuev = (g_free (valuev), NULL);
+}
+
+static void
+_vala_array_add4 (GValue** * array,
+                  gint* length,
+                  gint* size,
+                  GValue* value)
+{
+       if ((*length) == (*size)) {
+               *size = (*size) ? (2 * (*size)) : 4;
+               *array = g_renew (GValue*, *array, *size);
+       }
+       (*array)[(*length)++] = value;
+}
+
+static void
+_vala_GValue_free (GValue* self)
+{
+       g_boxed_free (G_TYPE_VALUE, self);
+}
+
+void
+manam_owned (GValue* _first_valuev,
+             ...)
+{
+       GValue* _valuev_element;
+       va_list _va_list_valuev;
+       GValue** valuev = NULL;
+       gint valuev_length1 = 0;
+       gint _valuev_size_ = 0;
+       GValue* _tmp0_;
+       GValue* _tmp1_;
+       GValue* _tmp2_;
+       valuev = g_new0 (GValue*, valuev_length1);
+       va_start (_va_list_valuev, _first_valuev);
+       _valuev_element = _first_valuev;
+       while (_valuev_element != NULL) {
+               _vala_array_add4 (&valuev, &valuev_length1, &_valuev_size_, _valuev_element);
+               _valuev_element = va_arg (_va_list_valuev, GValue*);
+       }
+       va_end (_va_list_valuev);
+       _vala_assert (valuev_length1 == 3, "valuev.length == 3");
+       _tmp0_ = valuev[0];
+       _vala_assert (g_strcmp0 (g_value_get_string (_tmp0_), "foo") == 0, "valuev[0] == \"foo\"");
+       _tmp1_ = valuev[1];
+       _vala_assert (g_value_get_int (_tmp1_) == 4711, "valuev[1] == 4711");
+       _tmp2_ = valuev[2];
+       _vala_assert (g_value_get_double (_tmp2_) == 3.1415, "valuev[2] == 3.1415");
+       valuev = (_vala_array_free (valuev, valuev_length1, (GDestroyNotify) _vala_GValue_free), NULL);
+}
+
+static void
+_vala_array_add5 (GVariant** * array,
+                  gint* length,
+                  gint* size,
+                  GVariant* value)
+{
+       if ((*length) == (*size)) {
+               *size = (*size) ? (2 * (*size)) : 4;
+               *array = g_renew (GVariant*, *array, (*size) + 1);
+       }
+       (*array)[(*length)++] = value;
+       (*array)[*length] = NULL;
+}
+
+static gchar*
+_variant_get1 (GVariant* value)
+{
+       return g_variant_dup_string (value, NULL);
+}
+
+static gint
+_variant_get2 (GVariant* value)
+{
+       return g_variant_get_int32 (value);
+}
+
+static gdouble
+_variant_get3 (GVariant* value)
+{
+       return g_variant_get_double (value);
+}
+
+void
+minim (GVariant* _first_variantv,
+       ...)
+{
+       GVariant* _variantv_element;
+       va_list _va_list_variantv;
+       GVariant** variantv = NULL;
+       gint variantv_length1 = 0;
+       gint _variantv_size_ = 0;
+       GVariant* _tmp0_;
+       gchar* _tmp1_;
+       gchar* _tmp2_;
+       GVariant* _tmp3_;
+       gint _tmp4_;
+       GVariant* _tmp5_;
+       gdouble _tmp6_;
+       variantv = g_new0 (GVariant*, variantv_length1 + 1);
+       va_start (_va_list_variantv, _first_variantv);
+       _variantv_element = _first_variantv;
+       while (_variantv_element != NULL) {
+               _vala_array_add5 (&variantv, &variantv_length1, &_variantv_size_, _variantv_element);
+               _variantv_element = va_arg (_va_list_variantv, GVariant*);
+       }
+       va_end (_va_list_variantv);
+       _vala_assert (variantv_length1 == 3, "variantv.length == 3");
+       _tmp0_ = variantv[0];
+       _tmp1_ = _variant_get1 (_tmp0_);
+       _tmp2_ = _tmp1_;
+       _vala_assert (g_strcmp0 (_tmp2_, "foo") == 0, "(string) variantv[0] == \"foo\"");
+       _g_free0 (_tmp2_);
+       _tmp3_ = variantv[1];
+       _tmp4_ = _variant_get2 (_tmp3_);
+       _vala_assert (_tmp4_ == 4711, "(int) variantv[1] == 4711");
+       _tmp5_ = variantv[2];
+       _tmp6_ = _variant_get3 (_tmp5_);
+       _vala_assert (_tmp6_ == 3.1415, "(double) variantv[2] == 3.1415");
+       variantv = (g_free (variantv), NULL);
+}
+
+static GVariant*
+_variant_new1 (const gchar* value)
+{
+       return g_variant_ref_sink (g_variant_new_string (value));
+}
+
+static GVariant*
+_variant_new2 (gint value)
+{
+       return g_variant_ref_sink (g_variant_new_int32 (value));
+}
+
+static GVariant*
+_variant_new3 (gdouble value)
+{
+       return g_variant_ref_sink (g_variant_new_double (value));
+}
+
+static void
+_vala_main (void)
+{
+       {
+               FooFunc func = NULL;
+               func = foo;
+               func ("foo", "bar", "manam", NULL);
+       }
+       {
+               BarFunc func = NULL;
+               func = bar;
+               func (23, 42, 4711, NULL);
+       }
+       {
+               ManamFunc func = NULL;
+               GValue* _tmp0_ = NULL;
+               GValue* _tmp1_ = NULL;
+               GValue* _tmp2_ = NULL;
+               func = manam;
+               _tmp0_ = g_new0 (GValue, 1);
+               g_value_init (_tmp0_, G_TYPE_STRING);
+               g_value_set_string (_tmp0_, "foo");
+               _tmp1_ = g_new0 (GValue, 1);
+               g_value_init (_tmp1_, G_TYPE_INT);
+               g_value_set_int (_tmp1_, 4711);
+               _tmp2_ = g_new0 (GValue, 1);
+               g_value_init (_tmp2_, G_TYPE_DOUBLE);
+               g_value_set_double (_tmp2_, 3.1415);
+               func (_tmp0_, _tmp1_, _tmp2_, NULL);
+               __vala_GValue_free0 (_tmp2_);
+               __vala_GValue_free0 (_tmp1_);
+               __vala_GValue_free0 (_tmp0_);
+       }
+       {
+               ManamOwnedFunc func = NULL;
+               GValue* _tmp3_ = NULL;
+               GValue* _tmp4_ = NULL;
+               GValue* _tmp5_ = NULL;
+               func = manam_owned;
+               _tmp3_ = g_new0 (GValue, 1);
+               g_value_init (_tmp3_, G_TYPE_STRING);
+               g_value_set_string (_tmp3_, "foo");
+               _tmp4_ = g_new0 (GValue, 1);
+               g_value_init (_tmp4_, G_TYPE_INT);
+               g_value_set_int (_tmp4_, 4711);
+               _tmp5_ = g_new0 (GValue, 1);
+               g_value_init (_tmp5_, G_TYPE_DOUBLE);
+               g_value_set_double (_tmp5_, 3.1415);
+               func (_tmp3_, _tmp4_, _tmp5_, NULL);
+       }
+       {
+               MinimFunc func = NULL;
+               GVariant* _tmp6_;
+               GVariant* _tmp7_;
+               GVariant* _tmp8_;
+               func = minim;
+               _tmp6_ = _variant_new1 ("foo");
+               _tmp7_ = _variant_new2 (4711);
+               _tmp8_ = _variant_new3 (3.1415);
+               func (_tmp6_, _tmp7_, _tmp8_, NULL);
+               _g_variant_unref0 (_tmp8_);
+               _g_variant_unref0 (_tmp7_);
+               _g_variant_unref0 (_tmp6_);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/delegates/reference_transfer.c-expected b/tests/delegates/reference_transfer.c-expected
new file mode 100644
index 000000000..91f561c06
--- /dev/null
+++ b/tests/delegates/reference_transfer.c-expected
@@ -0,0 +1,368 @@
+/* delegates_reference_transfer.c generated by valac, the Vala compiler
+ * generated from delegates_reference_transfer.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef void (*FooFunc) (gpointer user_data);
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _FooPrivate {
+       FooFunc f;
+       gpointer f_target;
+       GDestroyNotify f_target_destroy_notify;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new (FooFunc d,
+              gpointer d_target,
+              GDestroyNotify d_target_destroy_notify);
+VALA_EXTERN Foo* foo_construct (GType object_type,
+                    FooFunc d,
+                    gpointer d_target,
+                    GDestroyNotify d_target_destroy_notify);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+static void __lambda4_ (void);
+static void ___lambda4__foo_func (gpointer self);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct (GType object_type,
+               FooFunc d,
+               gpointer d_target,
+               GDestroyNotify d_target_destroy_notify)
+{
+       Foo* self = NULL;
+       FooFunc _tmp0_;
+       gpointer _tmp0__target;
+       GDestroyNotify _tmp0__target_destroy_notify;
+       self = (Foo*) g_type_create_instance (object_type);
+       _tmp0_ = d;
+       _tmp0__target = d_target;
+       _tmp0__target_destroy_notify = d_target_destroy_notify;
+       d = NULL;
+       d_target = NULL;
+       d_target_destroy_notify = NULL;
+       (self->priv->f_target_destroy_notify == NULL) ? NULL : (self->priv->f_target_destroy_notify 
(self->priv->f_target), NULL);
+       self->priv->f = NULL;
+       self->priv->f_target = NULL;
+       self->priv->f_target_destroy_notify = NULL;
+       self->priv->f = _tmp0_;
+       self->priv->f_target = _tmp0__target;
+       self->priv->f_target_destroy_notify = _tmp0__target_destroy_notify;
+       _vala_assert (d == NULL, "d == null");
+       (d_target_destroy_notify == NULL) ? NULL : (d_target_destroy_notify (d_target), NULL);
+       d = NULL;
+       d_target = NULL;
+       d_target_destroy_notify = NULL;
+       return self;
+}
+
+Foo*
+foo_new (FooFunc d,
+         gpointer d_target,
+         GDestroyNotify d_target_destroy_notify)
+{
+       return foo_construct (TYPE_FOO, d, d_target, d_target_destroy_notify);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+       (self->priv->f_target_destroy_notify == NULL) ? NULL : (self->priv->f_target_destroy_notify 
(self->priv->f_target), NULL);
+       self->priv->f = NULL;
+       self->priv->f_target = NULL;
+       self->priv->f_target_destroy_notify = NULL;
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+__lambda4_ (void)
+{
+}
+
+static void
+___lambda4__foo_func (gpointer self)
+{
+       __lambda4_ ();
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       _tmp0_ = foo_new (___lambda4__foo_func, NULL, NULL);
+       foo = _tmp0_;
+       _foo_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/delegates/return-array-null-terminated.c-expected 
b/tests/delegates/return-array-null-terminated.c-expected
new file mode 100644
index 000000000..e519e2f10
--- /dev/null
+++ b/tests/delegates/return-array-null-terminated.c-expected
@@ -0,0 +1,126 @@
+/* delegates_return_array_null_terminated.c generated by valac, the Vala compiler
+ * generated from delegates_return_array_null_terminated.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef gchar** (*FooFunc) (void);
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN gchar** foo (void);
+static void _vala_main (void);
+static gchar** _foo_foo_func (void);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+static gssize _vala_array_length (gpointer array);
+
+gchar**
+foo (void)
+{
+       gchar* _tmp0_;
+       gchar* _tmp1_;
+       gchar** _tmp2_;
+       gchar** result = NULL;
+       _tmp0_ = g_strdup ("foo");
+       _tmp1_ = g_strdup ("bar");
+       _tmp2_ = g_new0 (gchar*, 2 + 1);
+       _tmp2_[0] = _tmp0_;
+       _tmp2_[1] = _tmp1_;
+       result = _tmp2_;
+       return result;
+}
+
+static gchar**
+_foo_foo_func (void)
+{
+       gchar** result;
+       result = foo ();
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       FooFunc f = NULL;
+       f = _foo_foo_func;
+       {
+               gchar** s = NULL;
+               gchar** _tmp0_;
+               gchar** _tmp1_;
+               gint s_length1;
+               gint _s_size_;
+               const gchar* _tmp2_;
+               _tmp1_ = _tmp0_ = f ();
+               s = _tmp1_;
+               s_length1 = _vala_array_length (_tmp0_);
+               _s_size_ = s_length1;
+               _vala_assert (s_length1 == 2, "s.length == 2");
+               _tmp2_ = s[1];
+               _vala_assert (g_strcmp0 (_tmp2_, "bar") == 0, "s[1] == \"bar\"");
+               s = (_vala_array_free (s, s_length1, (GDestroyNotify) g_free), NULL);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
+static gssize
+_vala_array_length (gpointer array)
+{
+       gssize length;
+       length = 0;
+       if (array) {
+               while (((gpointer*) array)[length]) {
+                       length++;
+               }
+       }
+       return length;
+}
+
diff --git a/tests/delegates/variadic.c-expected b/tests/delegates/variadic.c-expected
new file mode 100644
index 000000000..ae5d477d6
--- /dev/null
+++ b/tests/delegates/variadic.c-expected
@@ -0,0 +1,202 @@
+/* delegates_variadic.c generated by valac, the Vala compiler
+ * generated from delegates_variadic.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+#include <stdarg.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef void (*FooFunc) (const gchar* first, ...);
+typedef void (*BarFunc) (const gchar* first, ...);
+typedef void (*BazFunc) (const gchar* first, GError** error, ...);
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+typedef enum  {
+       BAZ_ERROR_BAD,
+       BAZ_ERROR_WORSE
+} BazError;
+#define BAZ_ERROR baz_error_quark ()
+
+VALA_EXTERN GQuark baz_error_quark (void);
+VALA_EXTERN void foo (const gchar* first,
+          ...);
+VALA_EXTERN void baz (const gchar* first,
+          GError** error,
+          ...);
+VALA_EXTERN void baz_fail (const gchar* first,
+               GError** error,
+               ...);
+VALA_EXTERN void mamam (FooFunc func);
+static void _vala_main (void);
+
+GQuark
+baz_error_quark (void)
+{
+       return g_quark_from_static_string ("baz-error-quark");
+}
+
+void
+foo (const gchar* first,
+     ...)
+{
+       va_list args = {0};
+       gint i = 0;
+       gchar* s = NULL;
+       const gchar* _tmp0_;
+       gchar* _tmp1_;
+       g_return_if_fail (first != NULL);
+       _vala_assert (g_strcmp0 (first, "foo") == 0, "first == \"foo\"");
+       va_start (args, first);
+       i = va_arg (args, gint);
+       _vala_assert (i == 42, "i == 42");
+       _tmp0_ = va_arg (args, gchar*);
+       _tmp1_ = g_strdup (_tmp0_);
+       s = _tmp1_;
+       _vala_assert (g_strcmp0 (s, "bar") == 0, "s == \"bar\"");
+       _g_free0 (s);
+       va_end (args);
+}
+
+void
+baz (const gchar* first,
+     GError** error,
+     ...)
+{
+       va_list args = {0};
+       gint i = 0;
+       gchar* s = NULL;
+       const gchar* _tmp0_;
+       gchar* _tmp1_;
+       g_return_if_fail (first != NULL);
+       _vala_assert (g_strcmp0 (first, "baz") == 0, "first == \"baz\"");
+       va_start (args, error);
+       i = va_arg (args, gint);
+       _vala_assert (i == 23, "i == 23");
+       _tmp0_ = va_arg (args, gchar*);
+       _tmp1_ = g_strdup (_tmp0_);
+       s = _tmp1_;
+       _vala_assert (g_strcmp0 (s, "bar") == 0, "s == \"bar\"");
+       _g_free0 (s);
+       va_end (args);
+}
+
+void
+baz_fail (const gchar* first,
+          GError** error,
+          ...)
+{
+       GError* _tmp0_;
+       GError* _inner_error0_ = NULL;
+       g_return_if_fail (first != NULL);
+       _tmp0_ = g_error_new_literal (BAZ_ERROR, BAZ_ERROR_BAD, "bad");
+       _inner_error0_ = _tmp0_;
+       if (_inner_error0_->domain == BAZ_ERROR) {
+               g_propagate_error (error, _inner_error0_);
+               return;
+       } else {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+}
+
+void
+mamam (FooFunc func)
+{
+       func ("foo", 42, "bar", NULL);
+}
+
+static void
+_vala_main (void)
+{
+       GError* _inner_error0_ = NULL;
+       {
+               FooFunc func = NULL;
+               func = foo;
+               func ("foo", 42, "bar", NULL);
+       }
+       {
+               FooFunc func = NULL;
+               BarFunc f = NULL;
+               func = foo;
+               f = func;
+       }
+       {
+               FooFunc func = NULL;
+               BarFunc f = NULL;
+               func = (FooFunc) foo;
+               f = (BarFunc) func;
+       }
+       {
+               BazFunc func = NULL;
+               func = baz;
+               func ("baz", &_inner_error0_, 23, "bar", NULL);
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+       }
+       {
+               BazFunc func = NULL;
+               func = baz_fail;
+               {
+                       BazFunc _tmp0_;
+                       _tmp0_ = func;
+                       _tmp0_ ("baz", &_inner_error0_, 23, "bar", NULL);
+                       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                               if (g_error_matches (_inner_error0_, BAZ_ERROR, BAZ_ERROR_BAD)) {
+                                       goto __catch0_baz_error_bad;
+                               }
+                               goto __catch0_g_error;
+                       }
+                       g_assert_not_reached ();
+               }
+               goto __finally0;
+               __catch0_baz_error_bad:
+               {
+                       g_clear_error (&_inner_error0_);
+               }
+               goto __finally0;
+               __catch0_g_error:
+               {
+                       g_clear_error (&_inner_error0_);
+                       g_assert_not_reached ();
+               }
+               __finally0:
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+       }
+       {
+               mamam (foo);
+       }
+       {
+               mamam ((FooFunc) foo);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/delegates/wrapper.c-expected b/tests/delegates/wrapper.c-expected
new file mode 100644
index 000000000..361445ecc
--- /dev/null
+++ b/tests/delegates/wrapper.c-expected
@@ -0,0 +1,177 @@
+/* delegates_wrapper.c generated by valac, the Vala compiler
+ * generated from delegates_wrapper.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef void (*FooFunc) (gchar** a, gpointer user_data);
+typedef void (*BarFunc) (FooFunc func, gpointer func_target, GDestroyNotify func_target_destroy_notify, 
gpointer user_data);
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN void foo (gchar** a,
+          gint a_length1);
+VALA_EXTERN void bar (FooFunc func,
+          gpointer func_target,
+          GDestroyNotify func_target_destroy_notify);
+static void _vala_main (void);
+static void _foo_foo_func (gchar** a,
+                    gpointer self);
+static void _bar_bar_func (FooFunc func,
+                    gpointer func_target,
+                    GDestroyNotify func_target_destroy_notify,
+                    gpointer self);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+static gssize _vala_array_length (gpointer array);
+
+void
+foo (gchar** a,
+     gint a_length1)
+{
+       const gchar* _tmp0_;
+       _vala_assert (a_length1 == 2, "a.length == 2");
+       _tmp0_ = a[1];
+       _vala_assert (g_strcmp0 (_tmp0_, "bar") == 0, "a[1] == \"bar\"");
+}
+
+void
+bar (FooFunc func,
+     gpointer func_target,
+     GDestroyNotify func_target_destroy_notify)
+{
+       gchar** ia = NULL;
+       gchar* _tmp0_;
+       gchar* _tmp1_;
+       gchar** _tmp2_;
+       gint ia_length1;
+       gint _ia_size_;
+       _tmp0_ = g_strdup ("foo");
+       _tmp1_ = g_strdup ("bar");
+       _tmp2_ = g_new0 (gchar*, 2 + 1);
+       _tmp2_[0] = _tmp0_;
+       _tmp2_[1] = _tmp1_;
+       ia = _tmp2_;
+       ia_length1 = 2;
+       _ia_size_ = ia_length1;
+       func (ia, func_target);
+       ia = (_vala_array_free (ia, ia_length1, (GDestroyNotify) g_free), NULL);
+       (func_target_destroy_notify == NULL) ? NULL : (func_target_destroy_notify (func_target), NULL);
+       func = NULL;
+       func_target = NULL;
+       func_target_destroy_notify = NULL;
+}
+
+static void
+_foo_foo_func (gchar** a,
+               gpointer self)
+{
+       foo (a, _vala_array_length (a));
+}
+
+static void
+_bar_bar_func (FooFunc func,
+               gpointer func_target,
+               GDestroyNotify func_target_destroy_notify,
+               gpointer self)
+{
+       bar (func, func_target, func_target_destroy_notify);
+}
+
+static void
+_vala_main (void)
+{
+       FooFunc f = NULL;
+       gpointer f_target;
+       GDestroyNotify f_target_destroy_notify;
+       BarFunc b = NULL;
+       gpointer b_target;
+       GDestroyNotify b_target_destroy_notify;
+       FooFunc _tmp0_;
+       gpointer _tmp0__target;
+       GDestroyNotify _tmp0__target_destroy_notify;
+       f = _foo_foo_func;
+       f_target = NULL;
+       f_target_destroy_notify = NULL;
+       b = _bar_bar_func;
+       b_target = NULL;
+       b_target_destroy_notify = NULL;
+       _tmp0_ = f;
+       _tmp0__target = f_target;
+       _tmp0__target_destroy_notify = f_target_destroy_notify;
+       f = NULL;
+       f_target = NULL;
+       f_target_destroy_notify = NULL;
+       b (_tmp0_, _tmp0__target, _tmp0__target_destroy_notify, b_target);
+       (b_target_destroy_notify == NULL) ? NULL : (b_target_destroy_notify (b_target), NULL);
+       b = NULL;
+       b_target = NULL;
+       b_target_destroy_notify = NULL;
+       (f_target_destroy_notify == NULL) ? NULL : (f_target_destroy_notify (f_target), NULL);
+       f = NULL;
+       f_target = NULL;
+       f_target_destroy_notify = NULL;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
+static gssize
+_vala_array_length (gpointer array)
+{
+       gssize length;
+       length = 0;
+       if (array) {
+               while (((gpointer*) array)[length]) {
+                       length++;
+               }
+       }
+       return length;
+}
+
diff --git a/tests/enums/bug666035.c-expected b/tests/enums/bug666035.c-expected
new file mode 100644
index 000000000..558677334
--- /dev/null
+++ b/tests/enums/bug666035.c-expected
@@ -0,0 +1,231 @@
+/* enums_bug666035.c generated by valac, the Vala compiler
+ * generated from enums_bug666035.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef enum  {
+       FOO_ENUM_FOO,
+       FOO_ENUM_BAR,
+       FOO_ENUM_MAM
+} FooEnum;
+
+#define TYPE_FOO_ENUM (foo_enum_get_type ())
+typedef enum  {
+       FOO_FLAG_FOO = 1 << 0,
+       FOO_FLAG_BAR = 1 << 1,
+       FOO_FLAG_MAM = 1 << 2
+} FooFlag;
+
+#define TYPE_FOO_FLAG (foo_flag_get_type ())
+
+#define TYPE_FOO_STRUCT (foo_struct_get_type ())
+typedef struct _FooStruct FooStruct;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _FooStruct {
+       FooEnum f;
+};
+
+VALA_EXTERN GType foo_enum_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN GType foo_flag_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN GType foo_struct_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN FooStruct* foo_struct_dup (const FooStruct* self);
+VALA_EXTERN void foo_struct_free (FooStruct* self);
+VALA_EXTERN FooEnum takes_enum (FooEnum foo);
+VALA_EXTERN FooEnum gives_enum (void);
+VALA_EXTERN FooFlag takes_flag (FooFlag foo);
+VALA_EXTERN FooFlag gives_flag (void);
+static void _vala_main (void);
+
+static GType
+foo_enum_get_type_once (void)
+{
+       static const GEnumValue values[] = {{FOO_ENUM_FOO, "FOO_ENUM_FOO", "foo"}, {FOO_ENUM_BAR, 
"FOO_ENUM_BAR", "bar"}, {FOO_ENUM_MAM, "FOO_ENUM_MAM", "mam"}, {0, NULL, NULL}};
+       GType foo_enum_type_id;
+       foo_enum_type_id = g_enum_register_static ("FooEnum", values);
+       return foo_enum_type_id;
+}
+
+GType
+foo_enum_get_type (void)
+{
+       static volatile gsize foo_enum_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_enum_type_id__volatile)) {
+               GType foo_enum_type_id;
+               foo_enum_type_id = foo_enum_get_type_once ();
+               g_once_init_leave (&foo_enum_type_id__volatile, foo_enum_type_id);
+       }
+       return foo_enum_type_id__volatile;
+}
+
+static GType
+foo_flag_get_type_once (void)
+{
+       static const GFlagsValue values[] = {{FOO_FLAG_FOO, "FOO_FLAG_FOO", "foo"}, {FOO_FLAG_BAR, 
"FOO_FLAG_BAR", "bar"}, {FOO_FLAG_MAM, "FOO_FLAG_MAM", "mam"}, {0, NULL, NULL}};
+       GType foo_flag_type_id;
+       foo_flag_type_id = g_flags_register_static ("FooFlag", values);
+       return foo_flag_type_id;
+}
+
+GType
+foo_flag_get_type (void)
+{
+       static volatile gsize foo_flag_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_flag_type_id__volatile)) {
+               GType foo_flag_type_id;
+               foo_flag_type_id = foo_flag_get_type_once ();
+               g_once_init_leave (&foo_flag_type_id__volatile, foo_flag_type_id);
+       }
+       return foo_flag_type_id__volatile;
+}
+
+FooStruct*
+foo_struct_dup (const FooStruct* self)
+{
+       FooStruct* dup;
+       dup = g_new0 (FooStruct, 1);
+       memcpy (dup, self, sizeof (FooStruct));
+       return dup;
+}
+
+void
+foo_struct_free (FooStruct* self)
+{
+       g_free (self);
+}
+
+static GType
+foo_struct_get_type_once (void)
+{
+       GType foo_struct_type_id;
+       foo_struct_type_id = g_boxed_type_register_static ("FooStruct", (GBoxedCopyFunc) foo_struct_dup, 
(GBoxedFreeFunc) foo_struct_free);
+       return foo_struct_type_id;
+}
+
+GType
+foo_struct_get_type (void)
+{
+       static volatile gsize foo_struct_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_struct_type_id__volatile)) {
+               GType foo_struct_type_id;
+               foo_struct_type_id = foo_struct_get_type_once ();
+               g_once_init_leave (&foo_struct_type_id__volatile, foo_struct_type_id);
+       }
+       return foo_struct_type_id__volatile;
+}
+
+FooEnum
+takes_enum (FooEnum foo)
+{
+       FooEnum result = 0;
+       result = foo;
+       return result;
+}
+
+FooEnum
+gives_enum (void)
+{
+       FooEnum result = 0;
+       result = FOO_ENUM_MAM;
+       return result;
+}
+
+FooFlag
+takes_flag (FooFlag foo)
+{
+       FooFlag result = 0U;
+       result = foo;
+       return result;
+}
+
+FooFlag
+gives_flag (void)
+{
+       FooFlag result = 0U;
+       result = FOO_FLAG_MAM | FOO_FLAG_BAR;
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       FooEnum* foo_array = NULL;
+       FooEnum* _tmp0_;
+       gint foo_array_length1;
+       gint _foo_array_size_;
+       FooEnum* _tmp1_;
+       gint _tmp1__length1;
+       FooEnum* _tmp2_;
+       gint _tmp2__length1;
+       FooEnum _tmp3_;
+       FooStruct foo_struct = {0};
+       FooStruct _tmp4_ = {0};
+       FooStruct _tmp5_;
+       FooEnum _tmp6_;
+       FooEnum foo_enum = 0;
+       FooEnum _tmp7_;
+       if (takes_enum (FOO_ENUM_BAR) == FOO_ENUM_BAR) {
+               return;
+       }
+       _vala_assert (takes_enum (FOO_ENUM_BAR) == FOO_ENUM_BAR, "takes_enum (BAR) == BAR");
+       _vala_assert (takes_flag (FOO_FLAG_BAR | FOO_FLAG_MAM) == (FOO_FLAG_BAR | FOO_FLAG_MAM), "takes_flag 
(BAR | MAM) == (BAR | MAM)");
+       _vala_assert (gives_flag () == (FOO_FLAG_BAR | FOO_FLAG_MAM), "gives_flag () == (BAR | MAM)");
+       _tmp0_ = g_new0 (FooEnum, 3);
+       _tmp0_[0] = FOO_ENUM_FOO;
+       _tmp0_[1] = FOO_ENUM_BAR;
+       _tmp0_[2] = FOO_ENUM_FOO;
+       foo_array = _tmp0_;
+       foo_array_length1 = 3;
+       _foo_array_size_ = foo_array_length1;
+       _tmp1_ = foo_array;
+       _tmp1__length1 = foo_array_length1;
+       _tmp1_[1] = FOO_ENUM_MAM;
+       _tmp2_ = foo_array;
+       _tmp2__length1 = foo_array_length1;
+       _tmp3_ = _tmp2_[1];
+       _vala_assert (_tmp3_ == FOO_ENUM_MAM, "foo_array[1] == MAM");
+       _tmp4_.f = FOO_ENUM_BAR;
+       foo_struct = _tmp4_;
+       _tmp5_ = foo_struct;
+       _tmp6_ = _tmp5_.f;
+       _vala_assert (_tmp6_ == FOO_ENUM_BAR, "foo_struct.f == BAR");
+       foo_enum = FOO_ENUM_BAR;
+       _tmp7_ = foo_enum;
+       switch (_tmp7_) {
+               default:
+               case FOO_ENUM_FOO:
+               {
+                       _vala_assert (FALSE, "false");
+                       break;
+               }
+               case FOO_ENUM_BAR:
+               {
+                       break;
+               }
+       }
+       foo_array = (g_free (foo_array), NULL);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/enums/bug673879.c-expected b/tests/enums/bug673879.c-expected
new file mode 100644
index 000000000..8547699b9
--- /dev/null
+++ b/tests/enums/bug673879.c-expected
@@ -0,0 +1,93 @@
+/* enums_bug673879.c generated by valac, the Vala compiler
+ * generated from enums_bug673879.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef enum  {
+       TEST_TEST = 10
+} Test;
+
+#define TYPE_TEST (test_get_type ())
+#define _g_free0(var) ((var == NULL) ? NULL : (var = (g_free (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+static void _vala_main (void);
+static Test* _test_dup (Test* self);
+
+static GType
+test_get_type_once (void)
+{
+       static const GEnumValue values[] = {{TEST_TEST, "TEST_TEST", "test"}, {0, NULL, NULL}};
+       GType test_type_id;
+       test_type_id = g_enum_register_static ("Test", values);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+static Test*
+_test_dup (Test* self)
+{
+       Test* dup;
+       dup = g_new0 (Test, 1);
+       memcpy (dup, self, sizeof (Test));
+       return dup;
+}
+
+static gpointer
+__test_dup0 (gpointer self)
+{
+       return self ? _test_dup (self) : NULL;
+}
+
+static void
+_vala_main (void)
+{
+       Test* test = NULL;
+       Test _tmp0_;
+       Test* _tmp1_;
+       Test* _tmp2_;
+       test = NULL;
+       _tmp0_ = TEST_TEST;
+       _tmp1_ = __test_dup0 (&_tmp0_);
+       _g_free0 (test);
+       test = _tmp1_;
+       _tmp2_ = test;
+       _vala_assert (((Test) (*_tmp2_)) == 10, "(!)test == 10");
+       _g_free0 (test);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/enums/bug763831.c-expected b/tests/enums/bug763831.c-expected
new file mode 100644
index 000000000..56d3b52dc
--- /dev/null
+++ b/tests/enums/bug763831.c-expected
@@ -0,0 +1,89 @@
+/* enums_bug763831.c generated by valac, the Vala compiler
+ * generated from enums_bug763831.vala, do not modify */
+
+#include <glib-object.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef enum  {
+       FOO_TEST = 1 << 0
+} Foo;
+
+#define TYPE_FOO (foo_get_type ())
+typedef enum  {
+       BAR_TEST = 1 << 0
+} Bar;
+
+#define TYPE_BAR (bar_get_type ())
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+static void _vala_main (void);
+
+static GType
+foo_get_type_once (void)
+{
+       static const GFlagsValue values[] = {{FOO_TEST, "FOO_TEST", "test"}, {0, NULL, NULL}};
+       GType foo_type_id;
+       foo_type_id = g_flags_register_static ("Foo", values);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GEnumValue values[] = {{BAR_TEST, "BAR_TEST", "test"}, {0, NULL, NULL}};
+       GType bar_type_id;
+       bar_type_id = g_enum_register_static ("Bar", values);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       GFlagsValue* _tmp0_;
+       GEnumValue* _tmp1_;
+       _tmp0_ = g_flags_get_first_value (g_type_class_ref (TYPE_FOO), FOO_TEST);
+       _tmp1_ = g_enum_get_value (g_type_class_ref (TYPE_BAR), BAR_TEST);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/enums/bug780050.c-expected b/tests/enums/bug780050.c-expected
new file mode 100644
index 000000000..b5548cda5
--- /dev/null
+++ b/tests/enums/bug780050.c-expected
@@ -0,0 +1,61 @@
+/* enums_bug780050.c generated by valac, the Vala compiler
+ * generated from enums_bug780050.vala, do not modify */
+
+#include <glib-object.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef enum  {
+       BAR_FOO
+} Bar;
+
+#define TYPE_BAR (bar_get_type ())
+
+VALA_EXTERN Bar foo_bar;
+Bar foo_bar = BAR_FOO;
+
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+static void _vala_main (void);
+
+static GType
+bar_get_type_once (void)
+{
+       static const GEnumValue values[] = {{BAR_FOO, "BAR_FOO", "foo"}, {0, NULL, NULL}};
+       GType bar_type_id;
+       bar_type_id = g_enum_register_static ("Bar", values);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/enums/default-gtype.c-expected b/tests/enums/default-gtype.c-expected
new file mode 100644
index 000000000..41b4b2970
--- /dev/null
+++ b/tests/enums/default-gtype.c-expected
@@ -0,0 +1,36 @@
+/* enums_default_gtype.c generated by valac, the Vala compiler
+ * generated from enums_default_gtype.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+
+typedef enum  {
+       FOO_MANAM
+} Foo;
+
+typedef enum  {
+       BAR_MANAM = 1 << 0
+} Bar;
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+       _vala_assert (G_TYPE_INT == G_TYPE_INT, "typeof (Foo) == typeof (int)");
+       _vala_assert (G_TYPE_UINT == G_TYPE_UINT, "typeof (Bar) == typeof (uint)");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/enums/enum-no-gtype.c-expected b/tests/enums/enum-no-gtype.c-expected
new file mode 100644
index 000000000..c2a05e86d
--- /dev/null
+++ b/tests/enums/enum-no-gtype.c-expected
@@ -0,0 +1,23 @@
+/* enums_enum_no_gtype.c generated by valac, the Vala compiler
+ * generated from enums_enum_no_gtype.vala, do not modify */
+
+typedef enum  {
+       FOO_BAR,
+       FOO_BAZ
+} Foo;
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/enums/enum_only.c-expected b/tests/enums/enum_only.c-expected
new file mode 100644
index 000000000..ba4551b70
--- /dev/null
+++ b/tests/enums/enum_only.c-expected
@@ -0,0 +1,59 @@
+/* enums_enum_only.c generated by valac, the Vala compiler
+ * generated from enums_enum_only.vala, do not modify */
+
+#include <glib-object.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef enum  {
+       FOO_BAR,
+       FOO_BAZ
+} Foo;
+
+#define TYPE_FOO (foo_get_type ())
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+static void _vala_main (void);
+
+static GType
+foo_get_type_once (void)
+{
+       static const GEnumValue values[] = {{FOO_BAR, "FOO_BAR", "bar"}, {FOO_BAZ, "FOO_BAZ", "baz"}, {0, 
NULL, NULL}};
+       GType foo_type_id;
+       foo_type_id = g_enum_register_static ("Foo", values);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/enums/enums.c-expected b/tests/enums/enums.c-expected
new file mode 100644
index 000000000..fc6dd0197
--- /dev/null
+++ b/tests/enums/enums.c-expected
@@ -0,0 +1,238 @@
+/* enums_enums.c generated by valac, the Vala compiler
+ * generated from enums_enums.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <stdio.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef enum  {
+       MAMAN_FOO_VAL2 = 2,
+       MAMAN_FOO_VAL3,
+       MAMAN_FOO_VAL5 = 5
+} MamanFoo;
+
+#define MAMAN_TYPE_FOO (maman_foo_get_type ())
+typedef enum  {
+       MAMAN_FOOISH_VAL1,
+       MAMAN_FOOISH_VAL2
+} MamanFooish;
+
+#define MAMAN_TYPE_FOOISH (maman_fooish_get_type ())
+
+#define MAMAN_TYPE_BAR (maman_bar_get_type ())
+#define MAMAN_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_BAR, MamanBar))
+#define MAMAN_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAMAN_TYPE_BAR, MamanBarClass))
+#define MAMAN_IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_BAR))
+#define MAMAN_IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAMAN_TYPE_BAR))
+#define MAMAN_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAMAN_TYPE_BAR, MamanBarClass))
+
+typedef struct _MamanBar MamanBar;
+typedef struct _MamanBarClass MamanBarClass;
+typedef struct _MamanBarPrivate MamanBarPrivate;
+enum  {
+       MAMAN_BAR_0_PROPERTY,
+       MAMAN_BAR_NUM_PROPERTIES
+};
+static GParamSpec* maman_bar_properties[MAMAN_BAR_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+
+struct _MamanBar {
+       GObject parent_instance;
+       MamanBarPrivate * priv;
+};
+
+struct _MamanBarClass {
+       GObjectClass parent_class;
+};
+
+static gpointer maman_bar_parent_class = NULL;
+
+VALA_EXTERN GType maman_foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN GType maman_fooish_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN gint maman_fooish_something (MamanFooish self);
+#define MAMAN_FOOISH_FOO 2
+VALA_EXTERN GType maman_bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MamanBar, g_object_unref)
+VALA_EXTERN void maman_bar_run (MamanBar* self);
+static void maman_bar_test_enums_0_conversion (void);
+static void maman_bar_test_enum_methods_constants (void);
+static gint maman_bar_main (void);
+VALA_EXTERN MamanBar* maman_bar_new (void);
+VALA_EXTERN MamanBar* maman_bar_construct (GType object_type);
+static GType maman_bar_get_type_once (void);
+
+static GType
+maman_foo_get_type_once (void)
+{
+       static const GEnumValue values[] = {{MAMAN_FOO_VAL2, "MAMAN_FOO_VAL2", "val2"}, {MAMAN_FOO_VAL3, 
"MAMAN_FOO_VAL3", "val3"}, {MAMAN_FOO_VAL5, "MAMAN_FOO_VAL5", "val5"}, {0, NULL, NULL}};
+       GType maman_foo_type_id;
+       maman_foo_type_id = g_enum_register_static ("MamanFoo", values);
+       return maman_foo_type_id;
+}
+
+GType
+maman_foo_get_type (void)
+{
+       static volatile gsize maman_foo_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_foo_type_id__volatile)) {
+               GType maman_foo_type_id;
+               maman_foo_type_id = maman_foo_get_type_once ();
+               g_once_init_leave (&maman_foo_type_id__volatile, maman_foo_type_id);
+       }
+       return maman_foo_type_id__volatile;
+}
+
+gint
+maman_fooish_something (MamanFooish self)
+{
+       gint result = 0;
+       result = (gint) self;
+       return result;
+}
+
+static GType
+maman_fooish_get_type_once (void)
+{
+       static const GEnumValue values[] = {{MAMAN_FOOISH_VAL1, "MAMAN_FOOISH_VAL1", "val1"}, 
{MAMAN_FOOISH_VAL2, "MAMAN_FOOISH_VAL2", "val2"}, {0, NULL, NULL}};
+       GType maman_fooish_type_id;
+       maman_fooish_type_id = g_enum_register_static ("MamanFooish", values);
+       return maman_fooish_type_id;
+}
+
+GType
+maman_fooish_get_type (void)
+{
+       static volatile gsize maman_fooish_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_fooish_type_id__volatile)) {
+               GType maman_fooish_type_id;
+               maman_fooish_type_id = maman_fooish_get_type_once ();
+               g_once_init_leave (&maman_fooish_type_id__volatile, maman_fooish_type_id);
+       }
+       return maman_fooish_type_id__volatile;
+}
+
+void
+maman_bar_run (MamanBar* self)
+{
+       FILE* _tmp0_;
+       FILE* _tmp1_;
+       FILE* _tmp2_;
+       FILE* _tmp3_;
+       g_return_if_fail (MAMAN_IS_BAR (self));
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, " %d", (gint) MAMAN_FOO_VAL2);
+       _tmp1_ = stdout;
+       fprintf (_tmp1_, " %d", (gint) MAMAN_FOO_VAL3);
+       _tmp2_ = stdout;
+       fprintf (_tmp2_, " 4");
+       _tmp3_ = stdout;
+       fprintf (_tmp3_, " %d", (gint) MAMAN_FOO_VAL5);
+}
+
+static void
+maman_bar_test_enums_0_conversion (void)
+{
+       MamanFoo foo = 0;
+       foo = 0;
+}
+
+static void
+maman_bar_test_enum_methods_constants (void)
+{
+       MamanFooish x = 0;
+       FILE* _tmp0_;
+       FILE* _tmp1_;
+       x = MAMAN_FOOISH_VAL1;
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, "%d", maman_fooish_something (x));
+       _tmp1_ = stdout;
+       fprintf (_tmp1_, "%d", MAMAN_FOOISH_FOO);
+}
+
+static gint
+maman_bar_main (void)
+{
+       FILE* _tmp0_;
+       MamanBar* bar = NULL;
+       MamanBar* _tmp1_;
+       FILE* _tmp2_;
+       gint result = 0;
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, "Enum Test: 1");
+       _tmp1_ = maman_bar_new ();
+       bar = _tmp1_;
+       maman_bar_run (bar);
+       _tmp2_ = stdout;
+       fprintf (_tmp2_, " 6\n");
+       maman_bar_test_enums_0_conversion ();
+       maman_bar_test_enum_methods_constants ();
+       result = 0;
+       _g_object_unref0 (bar);
+       return result;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       return maman_bar_main ();
+}
+
+MamanBar*
+maman_bar_construct (GType object_type)
+{
+       MamanBar * self = NULL;
+       self = (MamanBar*) g_object_new (object_type, NULL);
+       return self;
+}
+
+MamanBar*
+maman_bar_new (void)
+{
+       return maman_bar_construct (MAMAN_TYPE_BAR);
+}
+
+static void
+maman_bar_class_init (MamanBarClass * klass,
+                      gpointer klass_data)
+{
+       maman_bar_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+maman_bar_instance_init (MamanBar * self,
+                         gpointer klass)
+{
+}
+
+static GType
+maman_bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (MamanBarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(MamanBar), 0, (GInstanceInitFunc) maman_bar_instance_init, NULL };
+       GType maman_bar_type_id;
+       maman_bar_type_id = g_type_register_static (G_TYPE_OBJECT, "MamanBar", &g_define_type_info, 0);
+       return maman_bar_type_id;
+}
+
+GType
+maman_bar_get_type (void)
+{
+       static volatile gsize maman_bar_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_bar_type_id__volatile)) {
+               GType maman_bar_type_id;
+               maman_bar_type_id = maman_bar_get_type_once ();
+               g_once_init_leave (&maman_bar_type_id__volatile, maman_bar_type_id);
+       }
+       return maman_bar_type_id__volatile;
+}
+
diff --git a/tests/enums/flags.c-expected b/tests/enums/flags.c-expected
new file mode 100644
index 000000000..0c0966257
--- /dev/null
+++ b/tests/enums/flags.c-expected
@@ -0,0 +1,81 @@
+/* enums_flags.c generated by valac, the Vala compiler
+ * generated from enums_flags.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef enum  {
+       FOO_VAL1 = 1 << 0,
+       FOO_VAL2 = 1 << 1,
+       FOO_VAL3 = 1 << 2
+} Foo;
+
+#define TYPE_FOO (foo_get_type ())
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+static void _vala_main (void);
+
+static GType
+foo_get_type_once (void)
+{
+       static const GFlagsValue values[] = {{FOO_VAL1, "FOO_VAL1", "val1"}, {FOO_VAL2, "FOO_VAL2", "val2"}, 
{FOO_VAL3, "FOO_VAL3", "val3"}, {0, NULL, NULL}};
+       GType foo_type_id;
+       foo_type_id = g_flags_register_static ("Foo", values);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Foo foo = 0U;
+       Foo bar = 0U;
+       Foo baz = 0U;
+       foo = (FOO_VAL1 | FOO_VAL2) | FOO_VAL3;
+       bar = FOO_VAL1 | FOO_VAL2;
+       baz = bar | FOO_VAL3;
+       _vala_assert (FOO_VAL1 == (1 << 0), "Foo.VAL1 == 1 << 0");
+       _vala_assert (FOO_VAL2 == (1 << 1), "Foo.VAL2 == 1 << 1");
+       _vala_assert (FOO_VAL3 == (1 << 2), "Foo.VAL3 == 1 << 2");
+       _vala_assert ((bar & FOO_VAL1) == FOO_VAL1, "Foo.VAL1 in bar");
+       _vala_assert ((bar & (FOO_VAL1 | FOO_VAL2)) == (FOO_VAL1 | FOO_VAL2), "(Foo.VAL1 | Foo.VAL2) in bar");
+       _vala_assert (!((bar & FOO_VAL3) == FOO_VAL3), "!(Foo.VAL3 in bar)");
+       _vala_assert ((baz & FOO_VAL1) == FOO_VAL1, "Foo.VAL1 in baz");
+       _vala_assert ((baz & FOO_VAL2) == FOO_VAL2, "Foo.VAL2 in baz");
+       _vala_assert ((baz & FOO_VAL3) == FOO_VAL3, "Foo.VAL3 in baz");
+       _vala_assert ((foo & bar) == bar, "bar in foo");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/enums/from-0-literal.c-expected b/tests/enums/from-0-literal.c-expected
new file mode 100644
index 000000000..22ba1c191
--- /dev/null
+++ b/tests/enums/from-0-literal.c-expected
@@ -0,0 +1,95 @@
+/* enums_from_0_literal.c generated by valac, the Vala compiler
+ * generated from enums_from_0_literal.vala, do not modify */
+
+#include <glib-object.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef enum  {
+       FOO_BAR
+} Foo;
+
+#define TYPE_FOO (foo_get_type ())
+typedef enum  {
+       BAR_FOO = 1 << 0
+} Bar;
+
+#define TYPE_BAR (bar_get_type ())
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+static void _vala_main (void);
+
+static GType
+foo_get_type_once (void)
+{
+       static const GEnumValue values[] = {{FOO_BAR, "FOO_BAR", "bar"}, {0, NULL, NULL}};
+       GType foo_type_id;
+       foo_type_id = g_enum_register_static ("Foo", values);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GFlagsValue values[] = {{BAR_FOO, "BAR_FOO", "foo"}, {0, NULL, NULL}};
+       GType bar_type_id;
+       bar_type_id = g_flags_register_static ("Bar", values);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       {
+               Foo foo = 0;
+               foo = 0;
+               foo = 0U;
+       }
+       {
+               Bar bar = 0U;
+               bar = 0;
+               bar = 0U;
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/enums/in-inference.c-expected b/tests/enums/in-inference.c-expected
new file mode 100644
index 000000000..726babc90
--- /dev/null
+++ b/tests/enums/in-inference.c-expected
@@ -0,0 +1,71 @@
+/* enums_in_inference.c generated by valac, the Vala compiler
+ * generated from enums_in_inference.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef enum  {
+       FOO_FOO = 1 << 0,
+       FOO_BAR = 1 << 1,
+       FOO_MANAM = 1 << 2
+} Foo;
+
+#define TYPE_FOO (foo_get_type ())
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+static void _vala_main (void);
+
+static GType
+foo_get_type_once (void)
+{
+       static const GFlagsValue values[] = {{FOO_FOO, "FOO_FOO", "foo"}, {FOO_BAR, "FOO_BAR", "bar"}, 
{FOO_MANAM, "FOO_MANAM", "manam"}, {0, NULL, NULL}};
+       GType foo_type_id;
+       foo_type_id = g_flags_register_static ("Foo", values);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Foo foo = 0U;
+       foo = FOO_FOO | FOO_BAR;
+       if ((foo & FOO_MANAM) == FOO_MANAM) {
+               g_assert_not_reached ();
+       }
+       _vala_assert ((foo & FOO_BAR) == FOO_BAR, "BAR in foo");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/enums/no_gtype_to_string.c-expected b/tests/enums/no_gtype_to_string.c-expected
new file mode 100644
index 000000000..872f19b85
--- /dev/null
+++ b/tests/enums/no_gtype_to_string.c-expected
@@ -0,0 +1,80 @@
+/* enums_no_gtype_to_string.c generated by valac, the Vala compiler
+ * generated from enums_no_gtype_to_string.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+
+typedef enum  {
+       FOO_BAR,
+       FOO_MANAM,
+       FOO_BAZ_FAZ
+} Foo;
+
+typedef enum  {
+       BAR_FOO = 1 << 0,
+       BAR_MANAM = 1 << 1,
+       BAR_FAZ_BAZ = 1 << 2
+} Bar;
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (void);
+static const char* _foo_to_string (Foo value);
+static const char* _bar_to_string (Bar value);
+
+static const char*
+_foo_to_string (Foo value)
+{
+       switch (value) {
+               case FOO_BAR:
+               return "FOO_BAR";
+               case FOO_MANAM:
+               return "FOO_MANAM";
+               case FOO_BAZ_FAZ:
+               return "FOO_BAZ_FAZ";
+       }
+       return NULL;
+}
+
+static const char*
+_bar_to_string (Bar value)
+{
+       switch (value) {
+               case BAR_FOO:
+               return "BAR_FOO";
+               case BAR_MANAM:
+               return "BAR_MANAM";
+               case BAR_FAZ_BAZ:
+               return "BAR_FAZ_BAZ";
+       }
+       return NULL;
+}
+
+static void
+_vala_main (void)
+{
+       const gchar* _tmp0_;
+       const gchar* _tmp1_;
+       const gchar* _tmp2_;
+       const gchar* _tmp3_;
+       _tmp0_ = _foo_to_string (FOO_BAR);
+       _vala_assert (g_strcmp0 ("FOO_BAR", _tmp0_) == 0, "\"FOO_BAR\" == Foo.BAR.to_string ()");
+       _tmp1_ = _foo_to_string (FOO_BAZ_FAZ);
+       _vala_assert (g_strcmp0 ("FOO_BAZ_FAZ", _tmp1_) == 0, "\"FOO_BAZ_FAZ\" == Foo.BAZ_FAZ.to_string ()");
+       _tmp2_ = _bar_to_string (BAR_FOO);
+       _vala_assert (g_strcmp0 ("BAR_FOO", _tmp2_) == 0, "\"BAR_FOO\" == Bar.FOO.to_string ()");
+       _tmp3_ = _bar_to_string (BAR_FAZ_BAZ);
+       _vala_assert (g_strcmp0 ("BAR_FAZ_BAZ", _tmp3_) == 0, "\"BAR_FAZ_BAZ\" == Bar.FAZ_BAZ.to_string ()");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/enums/switch.c-expected b/tests/enums/switch.c-expected
new file mode 100644
index 000000000..515c62604
--- /dev/null
+++ b/tests/enums/switch.c-expected
@@ -0,0 +1,77 @@
+/* enums_switch.c generated by valac, the Vala compiler
+ * generated from enums_switch.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef enum  {
+       FOO_BAR,
+       FOO_MANAM
+} Foo;
+
+#define TYPE_FOO (foo_get_type ())
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+static void _vala_main (void);
+
+static GType
+foo_get_type_once (void)
+{
+       static const GEnumValue values[] = {{FOO_BAR, "FOO_BAR", "bar"}, {FOO_MANAM, "FOO_MANAM", "manam"}, 
{0, NULL, NULL}};
+       GType foo_type_id;
+       foo_type_id = g_enum_register_static ("Foo", values);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Foo foo = 0;
+       foo = FOO_MANAM;
+       switch (foo) {
+               case FOO_BAR:
+               {
+                       g_assert_not_reached ();
+                       break;
+               }
+               case FOO_MANAM:
+               {
+                       break;
+               }
+               default:
+               {
+                       g_assert_not_reached ();
+               }
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/errors/bug567181.c-expected b/tests/errors/bug567181.c-expected
new file mode 100644
index 000000000..16ce1c21a
--- /dev/null
+++ b/tests/errors/bug567181.c-expected
@@ -0,0 +1,214 @@
+/* errors_bug567181.c generated by valac, the Vala compiler
+ * generated from errors_bug567181.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+typedef enum  {
+       ERROR_FOOBAR
+} Error;
+#define ERROR error_quark ()
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+VALA_EXTERN GList* list;
+GList* list = NULL;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN GQuark error_quark (void);
+VALA_EXTERN Foo* foo_new (GError** error);
+VALA_EXTERN Foo* foo_construct (GType object_type,
+                    GError** error);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+static void _g_object_unref0_ (gpointer var);
+static inline void _g_list_free__g_object_unref0_ (GList* self);
+
+GQuark
+error_quark (void)
+{
+       return g_quark_from_static_string ("error-quark");
+}
+
+static gpointer
+_g_object_ref0 (gpointer self)
+{
+       return self ? g_object_ref (self) : NULL;
+}
+
+Foo*
+foo_construct (GType object_type,
+               GError** error)
+{
+       Foo * self = NULL;
+       Foo* _tmp0_;
+       GError* _tmp1_;
+       GError* _inner_error0_ = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       _tmp0_ = _g_object_ref0 (self);
+       list = g_list_append (list, _tmp0_);
+       _tmp1_ = g_error_new_literal (ERROR, ERROR_FOOBAR, "foo");
+       _inner_error0_ = _tmp1_;
+       if (_inner_error0_->domain == ERROR) {
+               g_propagate_error (error, _inner_error0_);
+               _g_object_unref0 (self);
+               return NULL;
+       } else {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return NULL;
+       }
+       return self;
+}
+
+Foo*
+foo_new (GError** error)
+{
+       return foo_construct (TYPE_FOO, error);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_g_object_unref0_ (gpointer var)
+{
+       (var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
+}
+
+static inline void
+_g_list_free__g_object_unref0_ (GList* self)
+{
+       g_list_free_full (self, (GDestroyNotify) _g_object_unref0_);
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp3_;
+       GList* _tmp4_;
+       gconstpointer _tmp5_;
+       GError* _inner_error0_ = NULL;
+       foo = NULL;
+       (list == NULL) ? NULL : (list = (_g_list_free__g_object_unref0_ (list), NULL));
+       list = NULL;
+       {
+               Foo* _tmp0_ = NULL;
+               Foo* _tmp1_;
+               Foo* _tmp2_;
+               _tmp1_ = foo_new (&_inner_error0_);
+               _tmp0_ = _tmp1_;
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       if (_inner_error0_->domain == ERROR) {
+                               goto __catch0_error;
+                       }
+                       _g_object_unref0 (foo);
+                       g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+               _tmp2_ = _tmp0_;
+               _tmp0_ = NULL;
+               _g_object_unref0 (foo);
+               foo = _tmp2_;
+               _g_object_unref0 (_tmp0_);
+       }
+       goto __finally0;
+       __catch0_error:
+       {
+               g_clear_error (&_inner_error0_);
+       }
+       __finally0:
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_object_unref0 (foo);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp3_ = foo;
+       _vala_assert (_tmp3_ == NULL, "foo == null");
+       _tmp4_ = list;
+       _tmp5_ = g_list_nth_data (_tmp4_, (guint) 0);
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST ((Foo*) _tmp5_, G_TYPE_OBJECT, GObject)->ref_count == 
((guint) 1), "list.nth_data (0).ref_count == 1");
+       _g_object_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/errors/bug579101.c-expected b/tests/errors/bug579101.c-expected
new file mode 100644
index 000000000..8c6cfb42e
--- /dev/null
+++ b/tests/errors/bug579101.c-expected
@@ -0,0 +1,199 @@
+/* errors_bug579101.c generated by valac, the Vala compiler
+ * generated from errors_bug579101.vala, do not modify */
+
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+typedef enum  {
+       FOO_ERROR_FAIL
+} FooError;
+#define FOO_ERROR foo_error_quark ()
+
+VALA_EXTERN GQuark foo_error_quark (void);
+VALA_EXTERN void do_foo (gint* i);
+VALA_EXTERN gchar* do_bar (gint* i);
+VALA_EXTERN gchar* do_manam (gint* i);
+static void _vala_main (void);
+
+GQuark
+foo_error_quark (void)
+{
+       return g_quark_from_static_string ("foo-error-quark");
+}
+
+void
+do_foo (gint* i)
+{
+       gint _vala_i = 0;
+       GError* _inner_error0_ = NULL;
+       _vala_i = 0;
+       {
+               {
+                       _vala_i = 42;
+               }
+               if (i) {
+                       *i = _vala_i;
+               }
+               return;
+       }
+       __finally0:
+       {
+               _vala_i = 42;
+       }
+       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+       g_clear_error (&_inner_error0_);
+       return;
+}
+
+gchar*
+do_bar (gint* i)
+{
+       gint _vala_i = 0;
+       gchar* s = NULL;
+       gchar* _tmp0_;
+       GError* _inner_error0_ = NULL;
+       gchar* result = NULL;
+       _tmp0_ = g_strdup ("bar");
+       s = _tmp0_;
+       {
+               const gchar* _tmp1_;
+               _tmp1_ = s;
+               if (g_strcmp0 (_tmp1_, "bar") == 0) {
+                       const gchar* _tmp2_;
+                       gchar* _tmp3_;
+                       _tmp2_ = s;
+                       _tmp3_ = g_strdup (_tmp2_);
+                       result = _tmp3_;
+                       {
+                               _vala_i = 23;
+                       }
+                       _g_free0 (s);
+                       if (i) {
+                               *i = _vala_i;
+                       }
+                       return result;
+               }
+       }
+       __finally0:
+       {
+               _vala_i = 23;
+       }
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_free0 (s);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return NULL;
+       }
+       g_assert_not_reached ();
+}
+
+gchar*
+do_manam (gint* i)
+{
+       gint _vala_i = 0;
+       gchar* s = NULL;
+       gchar* _tmp0_;
+       GError* _inner_error0_ = NULL;
+       gchar* result = NULL;
+       _tmp0_ = g_strdup ("manam");
+       s = _tmp0_;
+       {
+               GError* _tmp1_;
+               _tmp1_ = g_error_new_literal (FOO_ERROR, FOO_ERROR_FAIL, "manam");
+               _inner_error0_ = _tmp1_;
+               goto __catch0_g_error;
+       }
+       goto __finally0;
+       __catch0_g_error:
+       {
+               g_clear_error (&_inner_error0_);
+               if (g_strcmp0 (s, "manam") == 0) {
+                       gchar* _tmp2_;
+                       _tmp2_ = g_strdup (s);
+                       result = _tmp2_;
+                       {
+                               GError* _inner_error0_ = NULL;
+                               _vala_i = 4711;
+                       }
+                       _g_free0 (s);
+                       if (i) {
+                               *i = _vala_i;
+                       }
+                       return result;
+               }
+       }
+       __finally0:
+       {
+               GError* _inner_error1_ = NULL;
+               _vala_i = 4711;
+       }
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_free0 (s);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return NULL;
+       }
+       g_assert_not_reached ();
+}
+
+static void
+_vala_main (void)
+{
+       {
+               gint i = 0;
+               gint _tmp0_ = 0;
+               do_foo (&_tmp0_);
+               i = _tmp0_;
+               _vala_assert (i == 42, "i == 42");
+       }
+       {
+               gint i = 0;
+               gchar* s = NULL;
+               gint _tmp1_ = 0;
+               gchar* _tmp2_;
+               _tmp2_ = do_bar (&_tmp1_);
+               i = _tmp1_;
+               s = _tmp2_;
+               _vala_assert (i == 23, "i == 23");
+               _vala_assert (g_strcmp0 (s, "bar") == 0, "s == \"bar\"");
+               _g_free0 (s);
+       }
+       {
+               gint i = 0;
+               gchar* s = NULL;
+               gint _tmp3_ = 0;
+               gchar* _tmp4_;
+               _tmp4_ = do_manam (&_tmp3_);
+               i = _tmp3_;
+               s = _tmp4_;
+               _vala_assert (i == 4711, "i == 4711");
+               _vala_assert (g_strcmp0 (s, "manam") == 0, "s == \"manam\"");
+               _g_free0 (s);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/errors/bug596228.c-expected b/tests/errors/bug596228.c-expected
new file mode 100644
index 000000000..9a1a17425
--- /dev/null
+++ b/tests/errors/bug596228.c-expected
@@ -0,0 +1,116 @@
+/* errors_bug596228.c generated by valac, the Vala compiler
+ * generated from errors_bug596228.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       gint foo;
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+static void foo_init (Foo *self,
+               gint foo);
+VALA_EXTERN void get_foo (Foo* result,
+              GError** error);
+static void _vala_main (void);
+
+static void
+foo_init (Foo *self,
+          gint foo)
+{
+       memset (self, 0, sizeof (Foo));
+       (*self).foo = foo;
+}
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       memcpy (dup, self, sizeof (Foo));
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+void
+get_foo (Foo* result,
+         GError** error)
+{
+       Foo _tmp0_ = {0};
+       foo_init (&_tmp0_, 42);
+       *result = _tmp0_;
+       return;
+}
+
+static void
+_vala_main (void)
+{
+       Foo foo = {0};
+       Foo _tmp0_ = {0};
+       Foo _tmp1_;
+       GError* _inner_error0_ = NULL;
+       get_foo (&_tmp0_, &_inner_error0_);
+       foo = _tmp0_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp1_ = foo;
+       _vala_assert (_tmp1_.foo == 42, "foo.foo == 42");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/errors/bug623049.c-expected b/tests/errors/bug623049.c-expected
new file mode 100644
index 000000000..cb1446c05
--- /dev/null
+++ b/tests/errors/bug623049.c-expected
@@ -0,0 +1,243 @@
+/* errors_bug623049.c generated by valac, the Vala compiler
+ * generated from errors_bug623049.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_CLS_A (cls_a_get_type ())
+#define CLS_A(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_CLS_A, ClsA))
+#define CLS_A_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_CLS_A, ClsAClass))
+#define IS_CLS_A(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_CLS_A))
+#define IS_CLS_A_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_CLS_A))
+#define CLS_A_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_CLS_A, ClsAClass))
+
+typedef struct _ClsA ClsA;
+typedef struct _ClsAClass ClsAClass;
+typedef struct _ClsAPrivate ClsAPrivate;
+enum  {
+       CLS_A_0_PROPERTY,
+       CLS_A_NUM_PROPERTIES
+};
+static GParamSpec* cls_a_properties[CLS_A_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+
+#define TYPE_CLS_B (cls_b_get_type ())
+#define CLS_B(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_CLS_B, ClsB))
+#define CLS_B_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_CLS_B, ClsBClass))
+#define IS_CLS_B(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_CLS_B))
+#define IS_CLS_B_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_CLS_B))
+#define CLS_B_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_CLS_B, ClsBClass))
+
+typedef struct _ClsB ClsB;
+typedef struct _ClsBClass ClsBClass;
+typedef struct _ClsBPrivate ClsBPrivate;
+enum  {
+       CLS_B_0_PROPERTY,
+       CLS_B_NUM_PROPERTIES
+};
+static GParamSpec* cls_b_properties[CLS_B_NUM_PROPERTIES];
+
+typedef enum  {
+       FOO_BAR
+} Foo;
+#define FOO foo_quark ()
+struct _ClsA {
+       GObject parent_instance;
+       ClsAPrivate * priv;
+};
+
+struct _ClsAClass {
+       GObjectClass parent_class;
+};
+
+struct _ClsB {
+       ClsA parent_instance;
+       ClsBPrivate * priv;
+};
+
+struct _ClsBClass {
+       ClsAClass parent_class;
+};
+
+static gpointer cls_a_parent_class = NULL;
+static gpointer cls_b_parent_class = NULL;
+
+VALA_EXTERN GQuark foo_quark (void);
+VALA_EXTERN GType cls_a_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClsA, g_object_unref)
+VALA_EXTERN ClsA* cls_a_new (GError** error);
+VALA_EXTERN ClsA* cls_a_construct (GType object_type,
+                       GError** error);
+static GType cls_a_get_type_once (void);
+VALA_EXTERN GType cls_b_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClsB, g_object_unref)
+VALA_EXTERN ClsB* cls_b_new (GError** error);
+VALA_EXTERN ClsB* cls_b_construct (GType object_type,
+                       GError** error);
+static GType cls_b_get_type_once (void);
+static void _vala_main (void);
+
+GQuark
+foo_quark (void)
+{
+       return g_quark_from_static_string ("foo-quark");
+}
+
+ClsA*
+cls_a_construct (GType object_type,
+                 GError** error)
+{
+       ClsA * self = NULL;
+       GError* _tmp0_;
+       GError* _inner_error0_ = NULL;
+       self = (ClsA*) g_object_new (object_type, NULL);
+       _tmp0_ = g_error_new_literal (FOO, FOO_BAR, "Test");
+       _inner_error0_ = _tmp0_;
+       g_propagate_error (error, _inner_error0_);
+       _g_object_unref0 (self);
+       return NULL;
+       return self;
+}
+
+ClsA*
+cls_a_new (GError** error)
+{
+       return cls_a_construct (TYPE_CLS_A, error);
+}
+
+static void
+cls_a_class_init (ClsAClass * klass,
+                  gpointer klass_data)
+{
+       cls_a_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+cls_a_instance_init (ClsA * self,
+                     gpointer klass)
+{
+}
+
+static GType
+cls_a_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (ClsAClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) cls_a_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ClsA), 
0, (GInstanceInitFunc) cls_a_instance_init, NULL };
+       GType cls_a_type_id;
+       cls_a_type_id = g_type_register_static (G_TYPE_OBJECT, "ClsA", &g_define_type_info, 0);
+       return cls_a_type_id;
+}
+
+GType
+cls_a_get_type (void)
+{
+       static volatile gsize cls_a_type_id__volatile = 0;
+       if (g_once_init_enter (&cls_a_type_id__volatile)) {
+               GType cls_a_type_id;
+               cls_a_type_id = cls_a_get_type_once ();
+               g_once_init_leave (&cls_a_type_id__volatile, cls_a_type_id);
+       }
+       return cls_a_type_id__volatile;
+}
+
+ClsB*
+cls_b_construct (GType object_type,
+                 GError** error)
+{
+       ClsB * self = NULL;
+       GError* _inner_error0_ = NULL;
+       self = (ClsB*) cls_a_construct (object_type, &_inner_error0_);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_propagate_error (error, _inner_error0_);
+               _g_object_unref0 (self);
+               return NULL;
+       }
+       g_assert_not_reached ();
+       return self;
+}
+
+ClsB*
+cls_b_new (GError** error)
+{
+       return cls_b_construct (TYPE_CLS_B, error);
+}
+
+static void
+cls_b_class_init (ClsBClass * klass,
+                  gpointer klass_data)
+{
+       cls_b_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+cls_b_instance_init (ClsB * self,
+                     gpointer klass)
+{
+}
+
+static GType
+cls_b_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (ClsBClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) cls_b_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ClsB), 
0, (GInstanceInitFunc) cls_b_instance_init, NULL };
+       GType cls_b_type_id;
+       cls_b_type_id = g_type_register_static (TYPE_CLS_A, "ClsB", &g_define_type_info, 0);
+       return cls_b_type_id;
+}
+
+GType
+cls_b_get_type (void)
+{
+       static volatile gsize cls_b_type_id__volatile = 0;
+       if (g_once_init_enter (&cls_b_type_id__volatile)) {
+               GType cls_b_type_id;
+               cls_b_type_id = cls_b_get_type_once ();
+               g_once_init_leave (&cls_b_type_id__volatile, cls_b_type_id);
+       }
+       return cls_b_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       GError* _inner_error0_ = NULL;
+       {
+               ClsB* _tmp0_;
+               ClsB* _tmp1_;
+               _tmp0_ = cls_b_new (&_inner_error0_);
+               _tmp1_ = _tmp0_;
+               _g_object_unref0 (_tmp1_);
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       goto __catch0_g_error;
+               }
+       }
+       goto __finally0;
+       __catch0_g_error:
+       {
+               g_clear_error (&_inner_error0_);
+               g_debug ("errors_bug623049.vala:23: Propagated error");
+       }
+       __finally0:
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/errors/bug627090.c-expected b/tests/errors/bug627090.c-expected
new file mode 100644
index 000000000..5343de9e1
--- /dev/null
+++ b/tests/errors/bug627090.c-expected
@@ -0,0 +1,202 @@
+/* errors_bug627090.c generated by valac, the Vala compiler
+ * generated from errors_bug627090.vala, do not modify */
+
+#include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_BAR_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+VALA_EXTERN gchar* foo_get_bar (Foo* self);
+VALA_EXTERN gchar* manam (GError** error);
+static GType foo_get_type_once (void);
+static void _vala_foo_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_main (void);
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+gchar*
+foo_get_bar (Foo* self)
+{
+       gchar* result;
+       GError* _inner_error0_ = NULL;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       {
+               gchar* _tmp0_ = NULL;
+               gchar* _tmp1_;
+               gchar* _tmp2_;
+               _tmp1_ = manam (&_inner_error0_);
+               _tmp0_ = _tmp1_;
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       goto __catch0_g_error;
+               }
+               _tmp2_ = _tmp0_;
+               _tmp0_ = NULL;
+               result = _tmp2_;
+               _g_free0 (_tmp0_);
+               return result;
+       }
+       goto __finally0;
+       __catch0_g_error:
+       {
+               g_clear_error (&_inner_error0_);
+               g_assert_not_reached ();
+       }
+       __finally0:
+       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+       g_clear_error (&_inner_error0_);
+       return NULL;
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       G_OBJECT_CLASS (klass)->get_property = _vala_foo_get_property;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_BAR_PROPERTY, 
foo_properties[FOO_BAR_PROPERTY] = g_param_spec_string ("bar", "bar", "bar", NULL, G_PARAM_STATIC_STRINGS | 
G_PARAM_READABLE));
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_foo_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_BAR_PROPERTY:
+               g_value_take_string (value, foo_get_bar (self));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+gchar*
+manam (GError** error)
+{
+       gchar* _tmp0_;
+       gchar* result = NULL;
+       _tmp0_ = g_strdup ("manam");
+       result = _tmp0_;
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       gchar* _tmp1_;
+       gchar* _tmp2_;
+       gchar* _tmp3_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       _tmp1_ = foo_get_bar (foo);
+       _tmp2_ = _tmp1_;
+       _tmp3_ = _tmp2_;
+       _vala_assert (g_strcmp0 (_tmp3_, "manam") == 0, "foo.bar == \"manam\"");
+       _g_free0 (_tmp3_);
+       _g_object_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/errors/bug639589.c-expected b/tests/errors/bug639589.c-expected
new file mode 100644
index 000000000..59ebaf508
--- /dev/null
+++ b/tests/errors/bug639589.c-expected
@@ -0,0 +1,97 @@
+/* errors_bug639589.c generated by valac, the Vala compiler
+ * generated from errors_bug639589.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+
+VALA_EXTERN void foo (GError** error);
+static void _vala_main (void);
+
+static gpointer
+_g_error_copy0 (gpointer self)
+{
+       return self ? g_error_copy (self) : NULL;
+}
+
+void
+foo (GError** error)
+{
+       GObject* bar = NULL;
+       GObject* _tmp0_;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = g_object_new (G_TYPE_OBJECT, NULL);
+       bar = _tmp0_;
+       {
+               GError* _tmp1_;
+               _tmp1_ = g_error_new_literal (G_FILE_ERROR, G_FILE_ERROR_EXIST, "");
+               _inner_error0_ = _tmp1_;
+               goto __catch0_g_error;
+       }
+       goto __finally0;
+       __catch0_g_error:
+       {
+               GError* e = NULL;
+               GError* _tmp2_;
+               e = _inner_error0_;
+               _inner_error0_ = NULL;
+               _tmp2_ = _g_error_copy0 (e);
+               _inner_error0_ = _tmp2_;
+               _g_error_free0 (e);
+               goto __finally0;
+       }
+       __finally0:
+       {
+               GError* _inner_error1_ = NULL;
+               gchar* _tmp3_;
+               _tmp3_ = g_strdup ("bar");
+               g_object_set_data_full (bar, "foo", _tmp3_, g_free);
+       }
+       g_propagate_error (error, _inner_error0_);
+       _g_object_unref0 (bar);
+       return;
+}
+
+static void
+_vala_main (void)
+{
+       GError* _inner_error0_ = NULL;
+       {
+               foo (&_inner_error0_);
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       goto __catch0_g_error;
+               }
+       }
+       goto __finally0;
+       __catch0_g_error:
+       {
+               g_clear_error (&_inner_error0_);
+       }
+       __finally0:
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/errors/bug651145.c-expected b/tests/errors/bug651145.c-expected
new file mode 100644
index 000000000..484bf6432
--- /dev/null
+++ b/tests/errors/bug651145.c-expected
@@ -0,0 +1,49 @@
+/* errors_bug651145.c generated by valac, the Vala compiler
+ * generated from errors_bug651145.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+       GError* _inner_error0_ = NULL;
+       {
+               gchar* foo = NULL;
+               _g_free0 (foo);
+       }
+       __finally0:
+       {
+       }
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       {
+               gchar* foo = NULL;
+               _g_free0 (foo);
+       }
+       __finally1:
+       {
+       }
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/errors/bug762377.c-expected b/tests/errors/bug762377.c-expected
new file mode 100644
index 000000000..a2ccd31bf
--- /dev/null
+++ b/tests/errors/bug762377.c-expected
@@ -0,0 +1,233 @@
+/* errors_bug762377.c generated by valac, the Vala compiler
+ * generated from errors_bug762377.vala, do not modify */
+
+#include <gio/gio.h>
+#include <glib-object.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO_OUTPUT_STREAM (foo_output_stream_get_type ())
+#define FOO_OUTPUT_STREAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO_OUTPUT_STREAM, FooOutputStream))
+#define FOO_OUTPUT_STREAM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO_OUTPUT_STREAM, 
FooOutputStreamClass))
+#define IS_FOO_OUTPUT_STREAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO_OUTPUT_STREAM))
+#define IS_FOO_OUTPUT_STREAM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO_OUTPUT_STREAM))
+#define FOO_OUTPUT_STREAM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO_OUTPUT_STREAM, 
FooOutputStreamClass))
+
+typedef struct _FooOutputStream FooOutputStream;
+typedef struct _FooOutputStreamClass FooOutputStreamClass;
+typedef struct _FooOutputStreamPrivate FooOutputStreamPrivate;
+enum  {
+       FOO_OUTPUT_STREAM_0_PROPERTY,
+       FOO_OUTPUT_STREAM_NUM_PROPERTIES
+};
+static GParamSpec* foo_output_stream_properties[FOO_OUTPUT_STREAM_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+
+struct _FooOutputStream {
+       GOutputStream parent_instance;
+       FooOutputStreamPrivate * priv;
+};
+
+struct _FooOutputStreamClass {
+       GOutputStreamClass parent_class;
+};
+
+static gpointer foo_output_stream_parent_class = NULL;
+
+VALA_EXTERN GType foo_output_stream_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (FooOutputStream, g_object_unref)
+static gssize foo_output_stream_real_write (GOutputStream* base,
+                                     guint8* buffer,
+                                     gsize buffer_length1,
+                                     GCancellable* cancellable,
+                                     GError** error);
+static gboolean foo_output_stream_real_close (GOutputStream* base,
+                                       GCancellable* cancellable,
+                                       GError** error);
+VALA_EXTERN FooOutputStream* foo_output_stream_new (void);
+VALA_EXTERN FooOutputStream* foo_output_stream_construct (GType object_type);
+static GType foo_output_stream_get_type_once (void);
+static void _vala_main (void);
+
+static gssize
+foo_output_stream_real_write (GOutputStream* base,
+                              guint8* buffer,
+                              gsize buffer_length1,
+                              GCancellable* cancellable,
+                              GError** error)
+{
+       FooOutputStream * self;
+       GError* _tmp0_;
+       GError* _inner_error0_ = NULL;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_FOO_OUTPUT_STREAM, FooOutputStream);
+       g_return_val_if_fail ((cancellable == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (cancellable, 
g_cancellable_get_type ()), 0L);
+       _tmp0_ = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, "");
+       _inner_error0_ = _tmp0_;
+       if (_inner_error0_->domain == G_IO_ERROR) {
+               gssize _tmp1_ = -1L;
+               g_propagate_error (error, _inner_error0_);
+               return _tmp1_;
+       } else {
+               gssize _tmp2_ = -1L;
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return _tmp2_;
+       }
+}
+
+static gboolean
+foo_output_stream_real_close (GOutputStream* base,
+                              GCancellable* cancellable,
+                              GError** error)
+{
+       FooOutputStream * self;
+       gboolean result = FALSE;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_FOO_OUTPUT_STREAM, FooOutputStream);
+       g_return_val_if_fail ((cancellable == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (cancellable, 
g_cancellable_get_type ()), FALSE);
+       result = TRUE;
+       return result;
+}
+
+FooOutputStream*
+foo_output_stream_construct (GType object_type)
+{
+       FooOutputStream * self = NULL;
+       self = (FooOutputStream*) g_object_new (object_type, NULL);
+       return self;
+}
+
+FooOutputStream*
+foo_output_stream_new (void)
+{
+       return foo_output_stream_construct (TYPE_FOO_OUTPUT_STREAM);
+}
+
+static void
+foo_output_stream_class_init (FooOutputStreamClass * klass,
+                              gpointer klass_data)
+{
+       foo_output_stream_parent_class = g_type_class_peek_parent (klass);
+       ((GOutputStreamClass *) klass)->write_fn = (gssize (*) (GOutputStream*, guint8*, gsize, 
GCancellable*, GError**)) foo_output_stream_real_write;
+       ((GOutputStreamClass *) klass)->close_fn = (gboolean (*) (GOutputStream*, GCancellable*, GError**)) 
foo_output_stream_real_close;
+}
+
+static void
+foo_output_stream_instance_init (FooOutputStream * self,
+                                 gpointer klass)
+{
+}
+
+static GType
+foo_output_stream_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooOutputStreamClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_output_stream_class_init, (GClassFinalizeFunc) NULL, NULL, 
sizeof (FooOutputStream), 0, (GInstanceInitFunc) foo_output_stream_instance_init, NULL };
+       GType foo_output_stream_type_id;
+       foo_output_stream_type_id = g_type_register_static (g_output_stream_get_type (), "FooOutputStream", 
&g_define_type_info, 0);
+       return foo_output_stream_type_id;
+}
+
+GType
+foo_output_stream_get_type (void)
+{
+       static volatile gsize foo_output_stream_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_output_stream_type_id__volatile)) {
+               GType foo_output_stream_type_id;
+               foo_output_stream_type_id = foo_output_stream_get_type_once ();
+               g_once_init_leave (&foo_output_stream_type_id__volatile, foo_output_stream_type_id);
+       }
+       return foo_output_stream_type_id__volatile;
+}
+
+static guint8*
+string_get_data (const gchar* self,
+                 gint* result_length1)
+{
+       guint8* result;
+       guint8* res = NULL;
+       gint res_length1;
+       gint _res_size_;
+       gint _tmp0_;
+       gint _tmp1_;
+       guint8* _tmp2_;
+       gint _tmp2__length1;
+       g_return_val_if_fail (self != NULL, NULL);
+       res = (guint8*) self;
+       res_length1 = -1;
+       _res_size_ = res_length1;
+       _tmp0_ = strlen (self);
+       _tmp1_ = _tmp0_;
+       res_length1 = (gint) _tmp1_;
+       _tmp2_ = res;
+       _tmp2__length1 = res_length1;
+       if (result_length1) {
+               *result_length1 = _tmp2__length1;
+       }
+       result = _tmp2_;
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       GError* _inner_error0_ = NULL;
+       {
+               FooOutputStream* output = NULL;
+               FooOutputStream* _tmp0_;
+               gsize bytes_written = 0UL;
+               guint8* _tmp1_;
+               gint _tmp1__length1;
+               gint _tmp2_ = 0;
+               guint8* _tmp3_;
+               gint _tmp3__length1;
+               gsize _tmp4_ = 0UL;
+               _tmp0_ = foo_output_stream_new ();
+               output = _tmp0_;
+               _tmp1_ = string_get_data ("Hello world!", &_tmp2_);
+               _tmp1__length1 = _tmp2_;
+               _tmp3_ = _tmp1_;
+               _tmp3__length1 = _tmp1__length1;
+               g_output_stream_write_all (G_TYPE_CHECK_INSTANCE_CAST (output, g_output_stream_get_type (), 
GOutputStream), _tmp3_, (gsize) _tmp3__length1, &_tmp4_, NULL, &_inner_error0_);
+               bytes_written = _tmp4_;
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       _g_object_unref0 (output);
+                       if (_inner_error0_->domain == G_IO_ERROR) {
+                               goto __catch0_g_io_error;
+                       }
+                       g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+               _g_object_unref0 (output);
+       }
+       goto __finally0;
+       __catch0_g_io_error:
+       {
+               g_clear_error (&_inner_error0_);
+       }
+       __finally0:
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/errors/bug778224.c-expected b/tests/errors/bug778224.c-expected
new file mode 100644
index 000000000..7176e9395
--- /dev/null
+++ b/tests/errors/bug778224.c-expected
@@ -0,0 +1,95 @@
+/* errors_bug778224.c generated by valac, the Vala compiler
+ * generated from errors_bug778224.vala, do not modify */
+
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef struct _Foo Foo;
+
+typedef enum  {
+       FOO_ERROR_BAR
+} FooError;
+#define FOO_ERROR foo_error_quark ()
+struct _Foo {
+       gint i;
+};
+
+VALA_EXTERN gboolean true;
+gboolean true = TRUE;
+
+VALA_EXTERN GQuark foo_error_quark (void);
+VALA_EXTERN Foo foo (GError** error);
+static void _vala_main (void);
+
+GQuark
+foo_error_quark (void)
+{
+       return g_quark_from_static_string ("foo-error-quark");
+}
+
+Foo
+foo (GError** error)
+{
+       Foo _tmp3_ = {0};
+       GError* _inner_error0_ = NULL;
+       Foo result = {0};
+       if (true) {
+               GError* _tmp0_;
+               _tmp0_ = g_error_new_literal (FOO_ERROR, FOO_ERROR_BAR, "");
+               _inner_error0_ = _tmp0_;
+               if (_inner_error0_->domain == FOO_ERROR) {
+                       Foo _tmp1_ = {0};
+                       g_propagate_error (error, _inner_error0_);
+                       return _tmp1_;
+               } else {
+                       Foo _tmp2_ = {0};
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return _tmp2_;
+               }
+       }
+       _tmp3_.i = 1;
+       result = _tmp3_;
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       GError* _inner_error0_ = NULL;
+       {
+               foo (&_inner_error0_);
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       goto __catch0_g_error;
+               }
+       }
+       goto __finally0;
+       __catch0_g_error:
+       {
+               g_clear_error (&_inner_error0_);
+       }
+       __finally0:
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/errors/catch-error-code.c-expected b/tests/errors/catch-error-code.c-expected
new file mode 100644
index 000000000..e5132b736
--- /dev/null
+++ b/tests/errors/catch-error-code.c-expected
@@ -0,0 +1,91 @@
+/* errors_catch_error_code.c generated by valac, the Vala compiler
+ * generated from errors_catch_error_code.vala, do not modify */
+
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef enum  {
+       FOO_ERROR_BAR,
+       FOO_ERROR_FOO
+} FooError;
+#define FOO_ERROR foo_error_quark ()
+
+VALA_EXTERN GQuark foo_error_quark (void);
+static void _vala_main (void);
+
+GQuark
+foo_error_quark (void)
+{
+       return g_quark_from_static_string ("foo-error-quark");
+}
+
+static void
+_vala_main (void)
+{
+       gboolean cond = FALSE;
+       GError* _inner_error0_ = NULL;
+       cond = FALSE;
+       {
+               GError* _tmp1_;
+               if (cond) {
+                       GError* _tmp0_;
+                       _tmp0_ = g_error_new_literal (FOO_ERROR, FOO_ERROR_BAR, "bad");
+                       _inner_error0_ = _tmp0_;
+                       if (g_error_matches (_inner_error0_, FOO_ERROR, FOO_ERROR_FOO)) {
+                               goto __catch0_foo_error_foo;
+                       }
+                       if (_inner_error0_->domain == FOO_ERROR) {
+                               goto __catch0_foo_error;
+                       }
+                       g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+               _tmp1_ = g_error_new_literal (FOO_ERROR, FOO_ERROR_FOO, "worse");
+               _inner_error0_ = _tmp1_;
+               if (g_error_matches (_inner_error0_, FOO_ERROR, FOO_ERROR_FOO)) {
+                       goto __catch0_foo_error_foo;
+               }
+               if (_inner_error0_->domain == FOO_ERROR) {
+                       goto __catch0_foo_error;
+               }
+               g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       goto __finally0;
+       __catch0_foo_error_foo:
+       {
+               g_clear_error (&_inner_error0_);
+       }
+       goto __finally0;
+       __catch0_foo_error:
+       {
+               g_clear_error (&_inner_error0_);
+               g_assert_not_reached ();
+       }
+       __finally0:
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/errors/catch-in-finally.c-expected b/tests/errors/catch-in-finally.c-expected
new file mode 100644
index 000000000..43991a3dc
--- /dev/null
+++ b/tests/errors/catch-in-finally.c-expected
@@ -0,0 +1,283 @@
+/* errors_catch_in_finally.c generated by valac, the Vala compiler
+ * generated from errors_catch_in_finally.vala, do not modify */
+
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+typedef enum  {
+       FOO_ERROR_FAIL
+} FooError;
+#define FOO_ERROR foo_error_quark ()
+
+VALA_EXTERN GQuark foo_error_quark (void);
+VALA_EXTERN void fail (GError** error);
+VALA_EXTERN void may_fail (GError** error);
+VALA_EXTERN void foo (GError** error);
+VALA_EXTERN void bar (GError** error);
+static void _vala_main (void);
+
+GQuark
+foo_error_quark (void)
+{
+       return g_quark_from_static_string ("foo-error-quark");
+}
+
+void
+fail (GError** error)
+{
+       GError* _tmp0_;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = g_error_new_literal (FOO_ERROR, FOO_ERROR_FAIL, "fail");
+       _inner_error0_ = _tmp0_;
+       if (_inner_error0_->domain == FOO_ERROR) {
+               g_propagate_error (error, _inner_error0_);
+               return;
+       } else {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+}
+
+void
+may_fail (GError** error)
+{
+}
+
+void
+foo (GError** error)
+{
+       GError* _inner_error0_ = NULL;
+       {
+               fail (&_inner_error0_);
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       goto __finally0;
+               }
+       }
+       __finally0:
+       {
+               GError* _inner_error1_ = NULL;
+               {
+                       may_fail (&_inner_error1_);
+                       if (G_UNLIKELY (_inner_error1_ != NULL)) {
+                               if (_inner_error1_->domain == FOO_ERROR) {
+                                       goto __catch1_foo_error;
+                               }
+                       }
+               }
+               goto __finally1;
+               __catch1_foo_error:
+               {
+                       g_clear_error (&_inner_error1_);
+                       g_assert_not_reached ();
+               }
+               __finally1:
+               if (G_UNLIKELY (_inner_error1_ != NULL)) {
+                       if (_inner_error1_->domain == FOO_ERROR) {
+                               g_propagate_error (error, _inner_error1_);
+                               return;
+                       } else {
+                               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, 
__LINE__, _inner_error1_->message, g_quark_to_string (_inner_error1_->domain), _inner_error1_->code);
+                               g_clear_error (&_inner_error1_);
+                               return;
+                       }
+               }
+       }
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               if (_inner_error0_->domain == FOO_ERROR) {
+                       g_propagate_error (error, _inner_error0_);
+                       return;
+               } else {
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+       }
+       g_assert_not_reached ();
+}
+
+void
+bar (GError** error)
+{
+       GError* _inner_error0_ = NULL;
+       {
+               may_fail (&_inner_error0_);
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       goto __finally0;
+               }
+       }
+       __finally0:
+       {
+               GError* _inner_error1_ = NULL;
+               {
+                       fail (&_inner_error1_);
+                       if (G_UNLIKELY (_inner_error1_ != NULL)) {
+                               if (_inner_error1_->domain == FOO_ERROR) {
+                                       goto __catch1_foo_error;
+                               }
+                       }
+               }
+               goto __finally1;
+               __catch1_foo_error:
+               {
+                       g_clear_error (&_inner_error1_);
+               }
+               __finally1:
+               if (G_UNLIKELY (_inner_error1_ != NULL)) {
+                       if (_inner_error1_->domain == FOO_ERROR) {
+                               g_propagate_error (error, _inner_error1_);
+                               return;
+                       } else {
+                               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, 
__LINE__, _inner_error1_->message, g_quark_to_string (_inner_error1_->domain), _inner_error1_->code);
+                               g_clear_error (&_inner_error1_);
+                               return;
+                       }
+               }
+       }
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               if (_inner_error0_->domain == FOO_ERROR) {
+                       g_propagate_error (error, _inner_error0_);
+                       return;
+               } else {
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+       }
+       {
+               fail (&_inner_error0_);
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       goto __finally2;
+               }
+       }
+       __finally2:
+       {
+               GError* _inner_error1_ = NULL;
+               {
+                       may_fail (&_inner_error1_);
+                       if (G_UNLIKELY (_inner_error1_ != NULL)) {
+                               if (_inner_error1_->domain == FOO_ERROR) {
+                                       goto __catch3_foo_error;
+                               }
+                       }
+               }
+               goto __finally3;
+               __catch3_foo_error:
+               {
+                       g_clear_error (&_inner_error1_);
+                       g_assert_not_reached ();
+               }
+               __finally3:
+               if (G_UNLIKELY (_inner_error1_ != NULL)) {
+                       if (_inner_error1_->domain == FOO_ERROR) {
+                               g_propagate_error (error, _inner_error1_);
+                               return;
+                       } else {
+                               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, 
__LINE__, _inner_error1_->message, g_quark_to_string (_inner_error1_->domain), _inner_error1_->code);
+                               g_clear_error (&_inner_error1_);
+                               return;
+                       }
+               }
+       }
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               if (_inner_error0_->domain == FOO_ERROR) {
+                       g_propagate_error (error, _inner_error0_);
+                       return;
+               } else {
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+       }
+       g_assert_not_reached ();
+}
+
+static void
+_vala_main (void)
+{
+       GError* _inner_error0_ = NULL;
+       {
+               foo (&_inner_error0_);
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       if (_inner_error0_->domain == FOO_ERROR) {
+                               goto __catch0_foo_error;
+                       }
+                       g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+       }
+       goto __finally0;
+       __catch0_foo_error:
+       {
+               GError* e = NULL;
+               GError* _tmp0_;
+               const gchar* _tmp1_;
+               e = _inner_error0_;
+               _inner_error0_ = NULL;
+               _tmp0_ = e;
+               _tmp1_ = _tmp0_->message;
+               _vala_assert (g_strcmp0 (_tmp1_, "fail") == 0, "e.message == \"fail\"");
+               _g_error_free0 (e);
+       }
+       __finally0:
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       {
+               bar (&_inner_error0_);
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       if (_inner_error0_->domain == FOO_ERROR) {
+                               goto __catch1_foo_error;
+                       }
+                       g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+       }
+       goto __finally1;
+       __catch1_foo_error:
+       {
+               GError* e = NULL;
+               GError* _tmp2_;
+               const gchar* _tmp3_;
+               e = _inner_error0_;
+               _inner_error0_ = NULL;
+               _tmp2_ = e;
+               _tmp3_ = _tmp2_->message;
+               _vala_assert (g_strcmp0 (_tmp3_, "fail") == 0, "e.message == \"fail\"");
+               _g_error_free0 (e);
+       }
+       __finally1:
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/errors/default-gtype.c-expected b/tests/errors/default-gtype.c-expected
new file mode 100644
index 000000000..a65b92b1f
--- /dev/null
+++ b/tests/errors/default-gtype.c-expected
@@ -0,0 +1,49 @@
+/* errors_default_gtype.c generated by valac, the Vala compiler
+ * generated from errors_default_gtype.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+typedef enum  {
+       FOO_MANAM
+} Foo;
+#define FOO foo_quark ()
+
+VALA_EXTERN GQuark foo_quark (void);
+static void _vala_main (void);
+
+GQuark
+foo_quark (void)
+{
+       return g_quark_from_static_string ("foo-quark");
+}
+
+static void
+_vala_main (void)
+{
+       _vala_assert (G_TYPE_ERROR == G_TYPE_ERROR, "typeof (Foo) == typeof (GLib.Error)");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/errors/errorcode.c-expected b/tests/errors/errorcode.c-expected
new file mode 100644
index 000000000..fe2d65cd9
--- /dev/null
+++ b/tests/errors/errorcode.c-expected
@@ -0,0 +1,90 @@
+/* errors_errorcode.c generated by valac, the Vala compiler
+ * generated from errors_errorcode.vala, do not modify */
+
+#include <glib.h>
+#include <gio/gio.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+typedef enum  {
+       FOO_ERROR_REALLY_BAD,
+       FOO_ERROR_NOT_SO_GOOD,
+       FOO_ERROR_EVEN_WORSE = 23
+} FooError;
+#define FOO_ERROR foo_error_quark ()
+
+VALA_EXTERN GQuark foo_error_quark (void);
+static void _vala_main (void);
+
+GQuark
+foo_error_quark (void)
+{
+       return g_quark_from_static_string ("foo-error-quark");
+}
+
+static void
+_vala_main (void)
+{
+       {
+               GError* _error_ = NULL;
+               GError* _tmp0_;
+               _tmp0_ = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_NO_SPACE, "foo");
+               _error_ = _tmp0_;
+               _vala_assert (_error_->code == 12, "error.code == 12");
+               _g_error_free0 (_error_);
+       }
+       {
+               gint code = 0;
+               code = G_IO_ERROR_NO_SPACE;
+               _vala_assert (code == 12, "code == 12");
+       }
+       {
+               GError* _error_ = NULL;
+               GError* _tmp1_;
+               _tmp1_ = g_error_new_literal (FOO_ERROR, FOO_ERROR_NOT_SO_GOOD, "foo");
+               _error_ = _tmp1_;
+               _vala_assert (_error_->code == 1, "error.code == 1");
+               _g_error_free0 (_error_);
+       }
+       {
+               gint code = 0;
+               code = FOO_ERROR_NOT_SO_GOOD;
+               _vala_assert (code == 1, "code == 1");
+       }
+       {
+               GError* _error_ = NULL;
+               GError* _tmp2_;
+               _tmp2_ = g_error_new_literal (FOO_ERROR, FOO_ERROR_EVEN_WORSE, "foo");
+               _error_ = _tmp2_;
+               _vala_assert (_error_->code == 23, "error.code == 23");
+               _g_error_free0 (_error_);
+       }
+       {
+               gint code = 0;
+               code = FOO_ERROR_EVEN_WORSE;
+               _vala_assert (code == 23, "code == 23");
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/errors/errordomain-static-method.c-expected 
b/tests/errors/errordomain-static-method.c-expected
new file mode 100644
index 000000000..47319f68a
--- /dev/null
+++ b/tests/errors/errordomain-static-method.c-expected
@@ -0,0 +1,69 @@
+/* errors_errordomain_static_method.c generated by valac, the Vala compiler
+ * generated from errors_errordomain_static_method.vala, do not modify */
+
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+typedef enum  {
+       FOO_BAD = 23
+} Foo;
+#define FOO foo_quark ()
+
+VALA_EXTERN GQuark foo_quark (void);
+VALA_EXTERN GError* foo_from_string (const gchar* _error_);
+static void _vala_main (void);
+
+GError*
+foo_from_string (const gchar* _error_)
+{
+       GError* _tmp0_;
+       GError* result = NULL;
+       g_return_val_if_fail (_error_ != NULL, NULL);
+       _vala_assert (g_strcmp0 (_error_, "BAD") == 0, "error == \"BAD\"");
+       _tmp0_ = g_error_new_literal (FOO, FOO_BAD, "BAD");
+       result = _tmp0_;
+       return result;
+}
+
+GQuark
+foo_quark (void)
+{
+       return g_quark_from_static_string ("foo-quark");
+}
+
+static void
+_vala_main (void)
+{
+       GError* e = NULL;
+       GError* _tmp0_;
+       _tmp0_ = foo_from_string ("BAD");
+       e = _tmp0_;
+       _vala_assert (e->code == FOO_BAD, "e.code == Foo.BAD");
+       _g_error_free0 (e);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/errors/errordomain.c-expected b/tests/errors/errordomain.c-expected
new file mode 100644
index 000000000..3ef447771
--- /dev/null
+++ b/tests/errors/errordomain.c-expected
@@ -0,0 +1,42 @@
+/* errors_errordomain.c generated by valac, the Vala compiler
+ * generated from errors_errordomain.vala, do not modify */
+
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef enum  {
+       FOO_BAD
+} Foo;
+#define FOO foo_quark ()
+
+VALA_EXTERN GQuark foo_quark (void);
+static void _vala_main (void);
+
+GQuark
+foo_quark (void)
+{
+       return g_quark_from_static_string ("foo-quark");
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/errors/errors.c-expected b/tests/errors/errors.c-expected
new file mode 100644
index 000000000..4578d64f7
--- /dev/null
+++ b/tests/errors/errors.c-expected
@@ -0,0 +1,353 @@
+/* errors_errors.c generated by valac, the Vala compiler
+ * generated from errors_errors.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+#include <stdio.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+enum  {
+       BAR_0_PROPERTY,
+       BAR_NUM_PROPERTIES
+};
+static GParamSpec* bar_properties[BAR_NUM_PROPERTIES];
+#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+
+typedef enum  {
+       BAR_ERROR_FOO,
+       BAR_ERROR_BAR
+} BarError;
+#define BAR_ERROR bar_error_quark ()
+struct _Bar {
+       GObject parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       GObjectClass parent_class;
+};
+
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN GQuark bar_error_quark (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
+VALA_EXTERN void bar_foo (Bar* self,
+              GError** error);
+VALA_EXTERN gint bar_bad (Bar* self,
+              GError** error);
+VALA_EXTERN void bar_good (Bar* self,
+               GError** error);
+VALA_EXTERN void bar_error_cast_check (Bar* self,
+                           GError* e);
+VALA_EXTERN void bar_run (Bar* self);
+VALA_EXTERN void bar_test_generic_catch (void);
+VALA_EXTERN void bar_test_try_without_error (void);
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static GType bar_get_type_once (void);
+static void _vala_main (void);
+
+GQuark
+bar_error_quark (void)
+{
+       return g_quark_from_static_string ("bar-error-quark");
+}
+
+void
+bar_foo (Bar* self,
+         GError** error)
+{
+       FILE* _tmp0_;
+       GError* _tmp1_;
+       GError* _inner_error0_ = NULL;
+       g_return_if_fail (IS_BAR (self));
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, " 6");
+       _tmp1_ = g_error_new_literal (BAR_ERROR, BAR_ERROR_FOO, " 8");
+       _inner_error0_ = _tmp1_;
+       if (_inner_error0_->domain == BAR_ERROR) {
+               g_propagate_error (error, _inner_error0_);
+               return;
+       } else {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       g_assert_not_reached ();
+}
+
+gint
+bar_bad (Bar* self,
+         GError** error)
+{
+       FILE* _tmp0_;
+       GError* _inner_error0_ = NULL;
+       gint result = 0;
+       g_return_val_if_fail (IS_BAR (self), 0);
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, " 5");
+       bar_foo (self, &_inner_error0_);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               if (_inner_error0_->domain == BAR_ERROR) {
+                       gint _tmp1_ = -1;
+                       g_propagate_error (error, _inner_error0_);
+                       return _tmp1_;
+               } else {
+                       gint _tmp2_ = -1;
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return _tmp2_;
+               }
+       }
+       g_assert_not_reached ();
+       result = 0;
+       return result;
+}
+
+void
+bar_good (Bar* self,
+          GError** error)
+{
+       FILE* _tmp0_;
+       g_return_if_fail (IS_BAR (self));
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, " 4");
+}
+
+void
+bar_error_cast_check (Bar* self,
+                      GError* e)
+{
+       g_return_if_fail (IS_BAR (self));
+       g_return_if_fail (e != NULL);
+}
+
+void
+bar_run (Bar* self)
+{
+       FILE* _tmp0_;
+       FILE* _tmp6_;
+       GError* _inner_error0_ = NULL;
+       g_return_if_fail (IS_BAR (self));
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, " 2");
+       {
+               FILE* _tmp1_;
+               gint i = 0;
+               _tmp1_ = stdout;
+               fprintf (_tmp1_, " 3");
+               bar_good (self, &_inner_error0_);
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       if (_inner_error0_->domain == BAR_ERROR) {
+                               goto __catch0_bar_error;
+                       }
+                       g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+               i = bar_bad (self, &_inner_error0_);
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       if (_inner_error0_->domain == BAR_ERROR) {
+                               goto __catch0_bar_error;
+                       }
+                       g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+               bar_good (self, &_inner_error0_);
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       if (_inner_error0_->domain == BAR_ERROR) {
+                               goto __catch0_bar_error;
+                       }
+                       g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+               g_assert_not_reached ();
+       }
+       goto __finally0;
+       __catch0_bar_error:
+       {
+               GError* e = NULL;
+               FILE* _tmp2_;
+               FILE* _tmp3_;
+               const gchar* _tmp4_;
+               FILE* _tmp5_;
+               e = _inner_error0_;
+               _inner_error0_ = NULL;
+               _tmp2_ = stdout;
+               fprintf (_tmp2_, " 7");
+               _tmp3_ = stdout;
+               _tmp4_ = e->message;
+               fprintf (_tmp3_, "%s", _tmp4_);
+               _tmp5_ = stdout;
+               fprintf (_tmp5_, " 9");
+               _g_error_free0 (e);
+       }
+       __finally0:
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp6_ = stdout;
+       fprintf (_tmp6_, " 10");
+}
+
+void
+bar_test_generic_catch (void)
+{
+       GError* _inner_error0_ = NULL;
+       {
+               GError* _tmp0_;
+               _tmp0_ = g_error_new_literal (BAR_ERROR, BAR_ERROR_FOO, "error message");
+               _inner_error0_ = _tmp0_;
+               goto __catch0_g_error;
+       }
+       goto __finally0;
+       __catch0_g_error:
+       {
+               GError* e = NULL;
+               gboolean _tmp1_ = FALSE;
+               GError* _tmp2_;
+               e = _inner_error0_;
+               _inner_error0_ = NULL;
+               _tmp2_ = e;
+               if (_tmp2_->domain == BAR_ERROR) {
+                       GError* _tmp3_;
+                       _tmp3_ = e;
+                       _tmp1_ = g_error_matches (_tmp3_, BAR_ERROR, BAR_ERROR_FOO);
+               } else {
+                       _tmp1_ = FALSE;
+               }
+               if (_tmp1_) {
+                       _g_error_free0 (e);
+                       return;
+               }
+               _g_error_free0 (e);
+       }
+       __finally0:
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       g_assert_not_reached ();
+}
+
+void
+bar_test_try_without_error (void)
+{
+       GError* _inner_error0_ = NULL;
+       {
+       }
+       goto __finally0;
+       __catch0_g_error:
+       {
+               g_clear_error (&_inner_error0_);
+               g_assert_not_reached ();
+       }
+       __finally0:
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar * self = NULL;
+       self = (Bar*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (G_TYPE_OBJECT, "Bar", &g_define_type_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       FILE* _tmp0_;
+       Bar* bar = NULL;
+       Bar* _tmp1_;
+       FILE* _tmp2_;
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, "Exception Test: 1");
+       _tmp1_ = bar_new ();
+       bar = _tmp1_;
+       bar_run (bar);
+       _tmp2_ = stdout;
+       fprintf (_tmp2_, " 11\n");
+       bar_test_generic_catch ();
+       bar_test_try_without_error ();
+       _g_object_unref0 (bar);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/errors/loops.c-expected b/tests/errors/loops.c-expected
new file mode 100644
index 000000000..b85da1cf9
--- /dev/null
+++ b/tests/errors/loops.c-expected
@@ -0,0 +1,493 @@
+/* errors_loops.c generated by valac, the Vala compiler
+ * generated from errors_loops.vala, do not modify */
+
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+
+typedef enum  {
+       FOO_ERROR_FAIL
+} FooError;
+#define FOO_ERROR foo_error_quark ()
+
+VALA_EXTERN GQuark foo_error_quark (void);
+VALA_EXTERN gchar** get_array (gint* result_length1,
+                   GError** error);
+VALA_EXTERN gboolean get_bool (GError** error);
+VALA_EXTERN gint get_int (GError** error);
+VALA_EXTERN void error_in_for (void);
+VALA_EXTERN void error_in_foreach (void);
+VALA_EXTERN void error_in_do (void);
+VALA_EXTERN void error_in_while (void);
+static void _vala_main (void);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+GQuark
+foo_error_quark (void)
+{
+       return g_quark_from_static_string ("foo-error-quark");
+}
+
+gchar**
+get_array (gint* result_length1,
+           GError** error)
+{
+       GError* _tmp0_;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = g_error_new_literal (FOO_ERROR, FOO_ERROR_FAIL, "foo");
+       _inner_error0_ = _tmp0_;
+       g_propagate_error (error, _inner_error0_);
+       return NULL;
+}
+
+gboolean
+get_bool (GError** error)
+{
+       GError* _tmp0_;
+       gboolean _tmp1_ = FALSE;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = g_error_new_literal (FOO_ERROR, FOO_ERROR_FAIL, "foo");
+       _inner_error0_ = _tmp0_;
+       g_propagate_error (error, _inner_error0_);
+       return _tmp1_;
+}
+
+gint
+get_int (GError** error)
+{
+       GError* _tmp0_;
+       gint _tmp1_ = -1;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = g_error_new_literal (FOO_ERROR, FOO_ERROR_FAIL, "foo");
+       _inner_error0_ = _tmp0_;
+       g_propagate_error (error, _inner_error0_);
+       return _tmp1_;
+}
+
+void
+error_in_for (void)
+{
+       GError* _inner_error0_ = NULL;
+       {
+               {
+                       gint i = 0;
+                       i = get_int (&_inner_error0_);
+                       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                               goto __catch0_g_error;
+                       }
+                       {
+                               gboolean _tmp0_ = FALSE;
+                               _tmp0_ = TRUE;
+                               while (TRUE) {
+                                       if (!_tmp0_) {
+                                               gint _tmp1_;
+                                               _tmp1_ = i;
+                                               i = _tmp1_ + 1;
+                                       }
+                                       _tmp0_ = FALSE;
+                                       if (!(i < 2)) {
+                                               break;
+                                       }
+                                       g_assert_not_reached ();
+                               }
+                       }
+               }
+               g_assert_not_reached ();
+       }
+       goto __finally0;
+       __catch0_g_error:
+       {
+               g_clear_error (&_inner_error0_);
+       }
+       __finally0:
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       {
+               {
+                       gint i = 0;
+                       i = 0;
+                       {
+                               gboolean _tmp2_ = FALSE;
+                               _tmp2_ = TRUE;
+                               while (TRUE) {
+                                       gboolean _tmp4_ = FALSE;
+                                       if (!_tmp2_) {
+                                               gint _tmp3_;
+                                               _tmp3_ = i;
+                                               i = _tmp3_ + 1;
+                                       }
+                                       _tmp2_ = FALSE;
+                                       _tmp4_ = get_bool (&_inner_error0_);
+                                       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                                               goto __catch1_g_error;
+                                       }
+                                       if (!_tmp4_) {
+                                               break;
+                                       }
+                                       g_assert_not_reached ();
+                               }
+                       }
+               }
+               g_assert_not_reached ();
+       }
+       goto __finally1;
+       __catch1_g_error:
+       {
+               g_clear_error (&_inner_error0_);
+       }
+       __finally1:
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       {
+               gboolean reached = FALSE;
+               reached = FALSE;
+               {
+                       gint i = 0;
+                       i = 0;
+                       {
+                               gboolean _tmp5_ = FALSE;
+                               _tmp5_ = TRUE;
+                               while (TRUE) {
+                                       if (!_tmp5_) {
+                                               gint _tmp6_ = 0;
+                                               _tmp6_ = get_int (&_inner_error0_);
+                                               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                                                       goto __catch2_g_error;
+                                               }
+                                               i += _tmp6_;
+                                       }
+                                       _tmp5_ = FALSE;
+                                       if (!(i < 2)) {
+                                               break;
+                                       }
+                                       if (reached) {
+                                               g_assert_not_reached ();
+                                       } else {
+                                               reached = TRUE;
+                                       }
+                               }
+                       }
+               }
+               g_assert_not_reached ();
+       }
+       goto __finally2;
+       __catch2_g_error:
+       {
+               g_clear_error (&_inner_error0_);
+       }
+       __finally2:
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       {
+               {
+                       gint i = 0;
+                       i = 0;
+                       {
+                               gboolean _tmp7_ = FALSE;
+                               _tmp7_ = TRUE;
+                               while (TRUE) {
+                                       GError* _tmp9_;
+                                       if (!_tmp7_) {
+                                               gint _tmp8_;
+                                               _tmp8_ = i;
+                                               i = _tmp8_ + 1;
+                                       }
+                                       _tmp7_ = FALSE;
+                                       if (!(i < 2)) {
+                                               break;
+                                       }
+                                       _tmp9_ = g_error_new_literal (FOO_ERROR, FOO_ERROR_FAIL, "foo");
+                                       _inner_error0_ = _tmp9_;
+                                       goto __catch3_g_error;
+                               }
+                       }
+               }
+               g_assert_not_reached ();
+       }
+       goto __finally3;
+       __catch3_g_error:
+       {
+               g_clear_error (&_inner_error0_);
+       }
+       __finally3:
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+}
+
+void
+error_in_foreach (void)
+{
+       GError* _inner_error0_ = NULL;
+       {
+               gchar** _tmp0_ = NULL;
+               gint _tmp1_ = 0;
+               gchar** _tmp2_;
+               gint _tmp0__length1;
+               gint __tmp0__size_;
+               _tmp2_ = get_array (&_tmp1_, &_inner_error0_);
+               _tmp0_ = _tmp2_;
+               _tmp0__length1 = _tmp1_;
+               __tmp0__size_ = _tmp0__length1;
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       goto __catch0_g_error;
+               }
+               {
+                       gchar** s_collection = NULL;
+                       gint s_collection_length1 = 0;
+                       gint _s_collection_size_ = 0;
+                       gint s_it = 0;
+                       s_collection = _tmp0_;
+                       s_collection_length1 = _tmp0__length1;
+                       for (s_it = 0; s_it < s_collection_length1; s_it = s_it + 1) {
+                               gchar* _tmp3_;
+                               gchar* s = NULL;
+                               _tmp3_ = g_strdup (s_collection[s_it]);
+                               s = _tmp3_;
+                               {
+                                       g_assert_not_reached ();
+                                       _g_free0 (s);
+                               }
+                       }
+               }
+               g_assert_not_reached ();
+               _tmp0_ = (_vala_array_free (_tmp0_, _tmp0__length1, (GDestroyNotify) g_free), NULL);
+       }
+       goto __finally0;
+       __catch0_g_error:
+       {
+               g_clear_error (&_inner_error0_);
+       }
+       __finally0:
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       {
+               gchar** array = NULL;
+               gchar* _tmp4_;
+               gchar** _tmp5_;
+               gint array_length1;
+               gint _array_size_;
+               _tmp4_ = g_strdup ("bar");
+               _tmp5_ = g_new0 (gchar*, 1 + 1);
+               _tmp5_[0] = _tmp4_;
+               array = _tmp5_;
+               array_length1 = 1;
+               _array_size_ = array_length1;
+               {
+                       gchar** s_collection = NULL;
+                       gint s_collection_length1 = 0;
+                       gint _s_collection_size_ = 0;
+                       gint s_it = 0;
+                       s_collection = array;
+                       s_collection_length1 = array_length1;
+                       for (s_it = 0; s_it < s_collection_length1; s_it = s_it + 1) {
+                               gchar* _tmp6_;
+                               gchar* s = NULL;
+                               _tmp6_ = g_strdup (s_collection[s_it]);
+                               s = _tmp6_;
+                               {
+                                       GError* _tmp7_;
+                                       _tmp7_ = g_error_new_literal (FOO_ERROR, FOO_ERROR_FAIL, "foo");
+                                       _inner_error0_ = _tmp7_;
+                                       _g_free0 (s);
+                                       array = (_vala_array_free (array, array_length1, (GDestroyNotify) 
g_free), NULL);
+                                       goto __catch1_g_error;
+                               }
+                       }
+               }
+               g_assert_not_reached ();
+               array = (_vala_array_free (array, array_length1, (GDestroyNotify) g_free), NULL);
+       }
+       goto __finally1;
+       __catch1_g_error:
+       {
+               g_clear_error (&_inner_error0_);
+       }
+       __finally1:
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+}
+
+void
+error_in_do (void)
+{
+       GError* _inner_error0_ = NULL;
+       {
+               {
+                       gboolean _tmp0_ = FALSE;
+                       _tmp0_ = TRUE;
+                       while (TRUE) {
+                               if (!_tmp0_) {
+                                       gboolean _tmp1_ = FALSE;
+                                       _tmp1_ = get_bool (&_inner_error0_);
+                                       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                                               goto __catch0_g_error;
+                                       }
+                                       if (!_tmp1_) {
+                                               break;
+                                       }
+                               }
+                               _tmp0_ = FALSE;
+                       }
+               }
+               g_assert_not_reached ();
+       }
+       goto __finally0;
+       __catch0_g_error:
+       {
+               g_clear_error (&_inner_error0_);
+       }
+       __finally0:
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       {
+               while (TRUE) {
+                       GError* _tmp2_;
+                       _tmp2_ = g_error_new_literal (FOO_ERROR, FOO_ERROR_FAIL, "foo");
+                       _inner_error0_ = _tmp2_;
+                       goto __catch1_g_error;
+               }
+               g_assert_not_reached ();
+       }
+       goto __finally1;
+       __catch1_g_error:
+       {
+               g_clear_error (&_inner_error0_);
+       }
+       __finally1:
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+}
+
+void
+error_in_while (void)
+{
+       GError* _inner_error0_ = NULL;
+       {
+               while (TRUE) {
+                       gboolean _tmp0_ = FALSE;
+                       _tmp0_ = get_bool (&_inner_error0_);
+                       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                               goto __catch0_g_error;
+                       }
+                       if (!_tmp0_) {
+                               break;
+                       }
+                       g_assert_not_reached ();
+               }
+               g_assert_not_reached ();
+       }
+       goto __finally0;
+       __catch0_g_error:
+       {
+               g_clear_error (&_inner_error0_);
+       }
+       __finally0:
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       {
+               while (TRUE) {
+                       GError* _tmp1_;
+                       _tmp1_ = g_error_new_literal (FOO_ERROR, FOO_ERROR_FAIL, "foo");
+                       _inner_error0_ = _tmp1_;
+                       goto __catch1_g_error;
+               }
+               g_assert_not_reached ();
+       }
+       goto __finally1;
+       __catch1_g_error:
+       {
+               g_clear_error (&_inner_error0_);
+       }
+       __finally1:
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+}
+
+static void
+_vala_main (void)
+{
+       error_in_for ();
+       error_in_foreach ();
+       error_in_do ();
+       error_in_while ();
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/errors/method-throws.c-expected b/tests/errors/method-throws.c-expected
new file mode 100644
index 000000000..146c6bceb
--- /dev/null
+++ b/tests/errors/method-throws.c-expected
@@ -0,0 +1,36 @@
+/* errors_method_throws.c generated by valac, the Vala compiler
+ * generated from errors_method_throws.vala, do not modify */
+
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+VALA_EXTERN void foo (GError** error);
+static void _vala_main (void);
+
+void
+foo (GError** error)
+{
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/errors/unhandled.c-expected b/tests/errors/unhandled.c-expected
new file mode 100644
index 000000000..8bcf6bd45
--- /dev/null
+++ b/tests/errors/unhandled.c-expected
@@ -0,0 +1,294 @@
+/* errors_unhandled.c generated by valac, the Vala compiler
+ * generated from errors_unhandled.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_BAR_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+
+typedef enum  {
+       FOO_ERROR_FAIL
+} FooError;
+#define FOO_ERROR foo_error_quark ()
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GQuark foo_error_quark (void);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+VALA_EXTERN void foo_foo (Foo* self);
+VALA_EXTERN const gchar* foo_get_bar (Foo* self);
+VALA_EXTERN void foo_set_bar (Foo* self,
+                  const gchar* value);
+static GObject * foo_constructor (GType type,
+                           guint n_construct_properties,
+                           GObjectConstructParam * construct_properties);
+static void foo_base_finalize (FooClass * klass,
+                        gpointer klass_data);
+static void foo_finalize (GObject * obj);
+static GType foo_get_type_once (void);
+static void _vala_foo_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_foo_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec);
+static void _vala_main (void);
+
+GQuark
+foo_error_quark (void)
+{
+       return g_quark_from_static_string ("foo-error-quark");
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       GError* _tmp0_;
+       GError* _inner_error0_ = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       _tmp0_ = g_error_new_literal (FOO_ERROR, FOO_ERROR_FAIL, "creation method");
+       _inner_error0_ = _tmp0_;
+       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+       g_clear_error (&_inner_error0_);
+       return NULL;
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+void
+foo_foo (Foo* self)
+{
+       GError* _tmp0_;
+       GError* _inner_error0_ = NULL;
+       g_return_if_fail (IS_FOO (self));
+       _tmp0_ = g_error_new_literal (FOO_ERROR, FOO_ERROR_FAIL, "method");
+       _inner_error0_ = _tmp0_;
+       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+       g_clear_error (&_inner_error0_);
+       return;
+}
+
+const gchar*
+foo_get_bar (Foo* self)
+{
+       GError* _tmp0_;
+       GError* _inner_error0_ = NULL;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = g_error_new_literal (FOO_ERROR, FOO_ERROR_FAIL, "property getter");
+       _inner_error0_ = _tmp0_;
+       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+       g_clear_error (&_inner_error0_);
+       return NULL;
+}
+
+void
+foo_set_bar (Foo* self,
+             const gchar* value)
+{
+       GError* _tmp0_;
+       GError* _inner_error0_ = NULL;
+       g_return_if_fail (IS_FOO (self));
+       _tmp0_ = g_error_new_literal (FOO_ERROR, FOO_ERROR_FAIL, "property setter");
+       _inner_error0_ = _tmp0_;
+       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+       g_clear_error (&_inner_error0_);
+       return;
+}
+
+static GObject *
+foo_constructor (GType type,
+                 guint n_construct_properties,
+                 GObjectConstructParam * construct_properties)
+{
+       GObject * obj;
+       GObjectClass * parent_class;
+       Foo * self;
+       GError* _tmp0_;
+       GError* _inner_error0_ = NULL;
+       parent_class = G_OBJECT_CLASS (foo_parent_class);
+       obj = parent_class->constructor (type, n_construct_properties, construct_properties);
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       _tmp0_ = g_error_new_literal (FOO_ERROR, FOO_ERROR_FAIL, "constructor");
+       _inner_error0_ = _tmp0_;
+       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+       g_clear_error (&_inner_error0_);
+       return obj;
+}
+
+static void
+foo_base_init (FooClass * klass)
+{
+       GError* _tmp0_;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = g_error_new_literal (FOO_ERROR, FOO_ERROR_FAIL, "class constructor");
+       _inner_error0_ = _tmp0_;
+       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+       g_clear_error (&_inner_error0_);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       GError* _tmp0_;
+       GError* _inner_error0_ = NULL;
+       foo_parent_class = g_type_class_peek_parent (klass);
+       G_OBJECT_CLASS (klass)->get_property = _vala_foo_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_foo_set_property;
+       G_OBJECT_CLASS (klass)->constructor = foo_constructor;
+       G_OBJECT_CLASS (klass)->finalize = foo_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_BAR_PROPERTY, 
foo_properties[FOO_BAR_PROPERTY] = g_param_spec_string ("bar", "bar", "bar", NULL, G_PARAM_STATIC_STRINGS | 
G_PARAM_READABLE | G_PARAM_WRITABLE));
+       _tmp0_ = g_error_new_literal (FOO_ERROR, FOO_ERROR_FAIL, "static constructor");
+       _inner_error0_ = _tmp0_;
+       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+       g_clear_error (&_inner_error0_);
+}
+
+static void
+foo_base_finalize (FooClass * klass,
+                   gpointer klass_data)
+{
+       GError* _tmp0_;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = g_error_new_literal (FOO_ERROR, FOO_ERROR_FAIL, "class destructor");
+       _inner_error0_ = _tmp0_;
+       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+       g_clear_error (&_inner_error0_);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static void
+foo_finalize (GObject * obj)
+{
+       Foo * self;
+       GError* _tmp0_;
+       GError* _inner_error0_ = NULL;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       _tmp0_ = g_error_new_literal (FOO_ERROR, FOO_ERROR_FAIL, "destructor");
+       _inner_error0_ = _tmp0_;
+       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+       g_clear_error (&_inner_error0_);
+       G_OBJECT_CLASS (foo_parent_class)->finalize (obj);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) foo_base_init, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_foo_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_BAR_PROPERTY:
+               g_value_set_string (value, foo_get_bar (self));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_foo_set_property (GObject * object,
+                        guint property_id,
+                        const GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_BAR_PROPERTY:
+               foo_set_bar (self, g_value_get_string (value));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/generics/arrays.c-expected b/tests/generics/arrays.c-expected
new file mode 100644
index 000000000..f436fd7a1
--- /dev/null
+++ b/tests/generics/arrays.c-expected
@@ -0,0 +1,540 @@
+/* generics_arrays.c generated by valac, the Vala compiler
+ * generated from generics_arrays.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+       gpointer* ga;
+       gint ga_length1;
+       gint _ga_size_;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _FooPrivate {
+       GType g_type;
+       GBoxedCopyFunc g_dup_func;
+       GDestroyNotify g_destroy_func;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new (GType g_type,
+              GBoxedCopyFunc g_dup_func,
+              GDestroyNotify g_destroy_func,
+              gconstpointer g);
+VALA_EXTERN Foo* foo_construct (GType object_type,
+                    GType g_type,
+                    GBoxedCopyFunc g_dup_func,
+                    GDestroyNotify g_destroy_func,
+                    gconstpointer g);
+static gpointer* _vala_array_dup1 (gpointer* self,
+                            gssize length,
+                            GBoxedCopyFunc g_dup_func);
+VALA_EXTERN void foo_foo (Foo* self,
+              gpointer* gs,
+              gint gs_length1);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN void bar (GType g_type,
+          GBoxedCopyFunc g_dup_func,
+          GDestroyNotify g_destroy_func,
+          gconstpointer g);
+static gpointer* _vala_array_dup2 (gpointer* self,
+                            gssize length,
+                            GBoxedCopyFunc g_dup_func);
+static void _vala_main (void);
+static gchar** _vala_array_dup3 (gchar** self,
+                          gssize length);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+static gpointer*
+_vala_array_dup1 (gpointer* self,
+                  gssize length,
+                  GBoxedCopyFunc g_dup_func)
+{
+       if (length > 0) {
+               gpointer* result;
+               gssize i;
+               result = g_new0 (gpointer, length);
+               for (i = 0; i < length; i++) {
+                       gpointer _tmp0_;
+                       _tmp0_ = ((self[i] != NULL) && (g_dup_func != NULL)) ? g_dup_func ((gpointer) 
self[i]) : ((gpointer) self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+Foo*
+foo_construct (GType object_type,
+               GType g_type,
+               GBoxedCopyFunc g_dup_func,
+               GDestroyNotify g_destroy_func,
+               gconstpointer g)
+{
+       Foo* self = NULL;
+       gpointer* gs = NULL;
+       gpointer _tmp0_;
+       gpointer* _tmp1_;
+       gint gs_length1;
+       gint _gs_size_;
+       gconstpointer _tmp2_;
+       gpointer* _tmp3_;
+       gint _tmp3__length1;
+       gpointer* _tmp4_;
+       gint _tmp4__length1;
+       gpointer* _tmp5_;
+       gint _tmp5__length1;
+       gconstpointer _tmp6_;
+       self = (Foo*) g_type_create_instance (object_type);
+       self->priv->g_type = g_type;
+       self->priv->g_dup_func = g_dup_func;
+       self->priv->g_destroy_func = g_destroy_func;
+       _tmp0_ = ((g != NULL) && (g_dup_func != NULL)) ? g_dup_func ((gpointer) g) : ((gpointer) g);
+       _tmp1_ = g_new0 (gpointer, 1);
+       _tmp1_[0] = _tmp0_;
+       gs = _tmp1_;
+       gs_length1 = 1;
+       _gs_size_ = gs_length1;
+       _vala_assert (gs_length1 == 1, "gs.length == 1");
+       _tmp2_ = gs[0];
+       _vala_assert (g_strcmp0 (_tmp2_, "foo") == 0, "gs[0] == \"foo\"");
+       _tmp3_ = (gs != NULL) ? _vala_array_dup1 (gs, gs_length1, g_dup_func) : gs;
+       _tmp3__length1 = gs_length1;
+       self->ga = (_vala_array_free (self->ga, self->ga_length1, (GDestroyNotify) g_destroy_func), NULL);
+       self->ga = _tmp3_;
+       self->ga_length1 = _tmp3__length1;
+       self->_ga_size_ = self->ga_length1;
+       _tmp4_ = self->ga;
+       _tmp4__length1 = self->ga_length1;
+       _vala_assert (_tmp4__length1 == 1, "ga.length == 1");
+       _tmp5_ = self->ga;
+       _tmp5__length1 = self->ga_length1;
+       _tmp6_ = _tmp5_[0];
+       _vala_assert (g_strcmp0 (_tmp6_, "foo") == 0, "ga[0] == \"foo\"");
+       gs = (_vala_array_free (gs, gs_length1, (GDestroyNotify) g_destroy_func), NULL);
+       return self;
+}
+
+Foo*
+foo_new (GType g_type,
+         GBoxedCopyFunc g_dup_func,
+         GDestroyNotify g_destroy_func,
+         gconstpointer g)
+{
+       return foo_construct (TYPE_FOO, g_type, g_dup_func, g_destroy_func, g);
+}
+
+void
+foo_foo (Foo* self,
+         gpointer* gs,
+         gint gs_length1)
+{
+       gconstpointer _tmp0_;
+       g_return_if_fail (IS_FOO (self));
+       _vala_assert (gs_length1 == 1, "gs.length == 1");
+       _tmp0_ = gs[0];
+       _vala_assert (g_strcmp0 (_tmp0_, "foo") == 0, "gs[0] == \"foo\"");
+       gs = (_vala_array_free (gs, gs_length1, (GDestroyNotify) self->priv->g_destroy_func), NULL);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+       self->ga = (_vala_array_free (self->ga, self->ga_length1, (GDestroyNotify) 
self->priv->g_destroy_func), NULL);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static gpointer*
+_vala_array_dup2 (gpointer* self,
+                  gssize length,
+                  GBoxedCopyFunc g_dup_func)
+{
+       if (length > 0) {
+               gpointer* result;
+               gssize i;
+               result = g_new0 (gpointer, length);
+               for (i = 0; i < length; i++) {
+                       gpointer _tmp0_;
+                       _tmp0_ = ((self[i] != NULL) && (g_dup_func != NULL)) ? g_dup_func ((gpointer) 
self[i]) : ((gpointer) self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+void
+bar (GType g_type,
+     GBoxedCopyFunc g_dup_func,
+     GDestroyNotify g_destroy_func,
+     gconstpointer g)
+{
+       gpointer* gs = NULL;
+       gpointer _tmp0_;
+       gpointer* _tmp1_;
+       gint gs_length1;
+       gint _gs_size_;
+       gconstpointer _tmp2_;
+       gpointer* gs_copy = NULL;
+       gpointer* _tmp3_;
+       gint _tmp3__length1;
+       gint gs_copy_length1;
+       gint _gs_copy_size_;
+       gconstpointer _tmp4_;
+       _tmp0_ = ((g != NULL) && (g_dup_func != NULL)) ? g_dup_func ((gpointer) g) : ((gpointer) g);
+       _tmp1_ = g_new0 (gpointer, 1);
+       _tmp1_[0] = _tmp0_;
+       gs = _tmp1_;
+       gs_length1 = 1;
+       _gs_size_ = gs_length1;
+       _vala_assert (gs_length1 == 1, "gs.length == 1");
+       _tmp2_ = gs[0];
+       _vala_assert (g_strcmp0 (_tmp2_, "bar") == 0, "gs[0] == \"bar\"");
+       _tmp3_ = (gs != NULL) ? _vala_array_dup2 (gs, gs_length1, g_dup_func) : gs;
+       _tmp3__length1 = gs_length1;
+       gs_copy = _tmp3_;
+       gs_copy_length1 = _tmp3__length1;
+       _gs_copy_size_ = gs_copy_length1;
+       _vala_assert (gs_copy_length1 == 1, "gs_copy.length == 1");
+       _tmp4_ = gs_copy[0];
+       _vala_assert (g_strcmp0 (_tmp4_, "bar") == 0, "gs_copy[0] == \"bar\"");
+       gs_copy = (_vala_array_free (gs_copy, gs_copy_length1, (GDestroyNotify) g_destroy_func), NULL);
+       gs = (_vala_array_free (gs, gs_length1, (GDestroyNotify) g_destroy_func), NULL);
+}
+
+static gchar**
+_vala_array_dup3 (gchar** self,
+                  gssize length)
+{
+       if (length >= 0) {
+               gchar** result;
+               gssize i;
+               result = g_new0 (gchar*, length + 1);
+               for (i = 0; i < length; i++) {
+                       gchar* _tmp0_;
+                       _tmp0_ = g_strdup (self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       gpointer* _tmp1_;
+       gint _tmp1__length1;
+       gchar** _tmp2_;
+       gint _tmp2__length1;
+       _tmp0_ = foo_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, "foo");
+       foo = _tmp0_;
+       _tmp1_ = foo->ga;
+       _tmp1__length1 = foo->ga_length1;
+       _tmp2_ = (_tmp1_ != NULL) ? _vala_array_dup3 (_tmp1_, _tmp1__length1) : _tmp1_;
+       _tmp2__length1 = _tmp1__length1;
+       foo_foo (foo, _tmp2_, (gint) _tmp2__length1);
+       bar (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, "bar");
+       _foo_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/generics/bug694765-1.c-expected b/tests/generics/bug694765-1.c-expected
new file mode 100644
index 000000000..77cc98485
--- /dev/null
+++ b/tests/generics/bug694765-1.c-expected
@@ -0,0 +1,111 @@
+/* generics_bug694765_1.c generated by valac, the Vala compiler
+ * generated from generics_bug694765_1.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN GList* copy_list (GType g_type,
+                  GBoxedCopyFunc g_dup_func,
+                  GDestroyNotify g_destroy_func,
+                  GList* list);
+static void _vala_main (void);
+static void _g_free0_ (gpointer var);
+static inline void _g_list_free__g_free0_ (GList* self);
+
+GList*
+copy_list (GType g_type,
+           GBoxedCopyFunc g_dup_func,
+           GDestroyNotify g_destroy_func,
+           GList* list)
+{
+       GList* _result_ = NULL;
+       GList* result = NULL;
+       _result_ = NULL;
+       {
+               GList* item_collection = NULL;
+               GList* item_it = NULL;
+               item_collection = list;
+               for (item_it = item_collection; item_it != NULL; item_it = item_it->next) {
+                       gpointer _tmp0_;
+                       gpointer item = NULL;
+                       _tmp0_ = ((item_it->data != NULL) && (g_dup_func != NULL)) ? g_dup_func ((gpointer) 
item_it->data) : ((gpointer) item_it->data);
+                       item = _tmp0_;
+                       {
+                               gconstpointer _tmp1_;
+                               gpointer _tmp2_;
+                               _tmp1_ = item;
+                               _tmp2_ = ((_tmp1_ != NULL) && (g_dup_func != NULL)) ? g_dup_func ((gpointer) 
_tmp1_) : ((gpointer) _tmp1_);
+                               _result_ = g_list_prepend (_result_, _tmp2_);
+                               ((item == NULL) || (g_destroy_func == NULL)) ? NULL : (item = (g_destroy_func 
(item), NULL));
+                       }
+               }
+       }
+       _result_ = g_list_reverse (_result_);
+       result = _result_;
+       return result;
+}
+
+static void
+_g_free0_ (gpointer var)
+{
+       var = (g_free (var), NULL);
+}
+
+static inline void
+_g_list_free__g_free0_ (GList* self)
+{
+       g_list_free_full (self, (GDestroyNotify) _g_free0_);
+}
+
+static void
+_vala_main (void)
+{
+       GList* list = NULL;
+       gchar* _tmp0_;
+       GList* copy = NULL;
+       GList* _tmp1_;
+       GList* _tmp2_;
+       GList* _tmp3_;
+       gconstpointer _tmp4_;
+       list = NULL;
+       _tmp0_ = g_strdup ("foo");
+       list = g_list_prepend (list, _tmp0_);
+       _tmp1_ = list;
+       _tmp2_ = copy_list (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp1_);
+       copy = _tmp2_;
+       (list == NULL) ? NULL : (list = (_g_list_free__g_free0_ (list), NULL));
+       list = NULL;
+       _tmp3_ = copy;
+       _tmp4_ = g_list_nth_data (_tmp3_, (guint) 0);
+       _vala_assert (g_strcmp0 ((const gchar*) _tmp4_, "foo") == 0, "copy.nth_data (0) == \"foo\"");
+       (copy == NULL) ? NULL : (copy = (_g_list_free__g_free0_ (copy), NULL));
+       copy = NULL;
+       (copy == NULL) ? NULL : (copy = (_g_list_free__g_free0_ (copy), NULL));
+       (list == NULL) ? NULL : (list = (_g_list_free__g_free0_ (list), NULL));
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/generics/bug694765-2.c-expected b/tests/generics/bug694765-2.c-expected
new file mode 100644
index 000000000..d34ab0318
--- /dev/null
+++ b/tests/generics/bug694765-2.c-expected
@@ -0,0 +1,601 @@
+/* generics_bug694765_2.c generated by valac, the Vala compiler
+ * generated from generics_bug694765_2.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+enum  {
+       BAR_0_PROPERTY,
+       BAR_G_TYPE,
+       BAR_G_DUP_FUNC,
+       BAR_G_DESTROY_FUNC,
+       BAR_NUM_PROPERTIES
+};
+static GParamSpec* bar_properties[BAR_NUM_PROPERTIES];
+
+#define TYPE_BAZ (baz_get_type ())
+#define BAZ(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAZ, Baz))
+#define BAZ_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAZ, BazClass))
+#define IS_BAZ(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAZ))
+#define IS_BAZ_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAZ))
+#define BAZ_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAZ, BazClass))
+
+typedef struct _Baz Baz;
+typedef struct _BazClass BazClass;
+typedef struct _BazPrivate BazPrivate;
+enum  {
+       BAZ_0_PROPERTY,
+       BAZ_G_TYPE,
+       BAZ_G_DUP_FUNC,
+       BAZ_G_DESTROY_FUNC,
+       BAZ_NUM_PROPERTIES
+};
+static GParamSpec* baz_properties[BAZ_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _Bar {
+       GObject parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       GObjectClass parent_class;
+};
+
+struct _BarPrivate {
+       GType g_type;
+       GBoxedCopyFunc g_dup_func;
+       GDestroyNotify g_destroy_func;
+       GList* list;
+};
+
+struct _Baz {
+       GObject parent_instance;
+       BazPrivate * priv;
+};
+
+struct _BazClass {
+       GObjectClass parent_class;
+};
+
+struct _BazPrivate {
+       GType g_type;
+       GBoxedCopyFunc g_dup_func;
+       GDestroyNotify g_destroy_func;
+       GNode* node;
+};
+
+static gpointer foo_parent_class = NULL;
+static gint Bar_private_offset;
+static gpointer bar_parent_class = NULL;
+static gint Baz_private_offset;
+static gpointer baz_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static GType foo_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
+VALA_EXTERN void bar_add (Bar* self,
+              gconstpointer item);
+VALA_EXTERN Bar* bar_new (GType g_type,
+              GBoxedCopyFunc g_dup_func,
+              GDestroyNotify g_destroy_func);
+VALA_EXTERN Bar* bar_construct (GType object_type,
+                    GType g_type,
+                    GBoxedCopyFunc g_dup_func,
+                    GDestroyNotify g_destroy_func);
+static GObject * bar_constructor (GType type,
+                           guint n_construct_properties,
+                           GObjectConstructParam * construct_properties);
+static void bar_finalize (GObject * obj);
+static GType bar_get_type_once (void);
+static void _vala_bar_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_bar_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec);
+VALA_EXTERN GType baz_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Baz, g_object_unref)
+static gboolean _g_node_free_all_node (GNode* node,
+                                GDestroyNotify free_func);
+static void _g_node_free_all (GNode* self,
+                       GDestroyNotify free_func);
+VALA_EXTERN void baz_add (Baz* self,
+              gconstpointer item);
+VALA_EXTERN Baz* baz_new (GType g_type,
+              GBoxedCopyFunc g_dup_func,
+              GDestroyNotify g_destroy_func);
+VALA_EXTERN Baz* baz_construct (GType object_type,
+                    GType g_type,
+                    GBoxedCopyFunc g_dup_func,
+                    GDestroyNotify g_destroy_func);
+static GObject * baz_constructor (GType type,
+                           guint n_construct_properties,
+                           GObjectConstructParam * construct_properties);
+static void baz_finalize (GObject * obj);
+static GType baz_get_type_once (void);
+static void _vala_baz_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_baz_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec);
+static void _vala_main (void);
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static inline gpointer
+bar_get_instance_private (Bar* self)
+{
+       return G_STRUCT_MEMBER_P (self, Bar_private_offset);
+}
+
+void
+bar_add (Bar* self,
+         gconstpointer item)
+{
+       gpointer _tmp0_;
+       g_return_if_fail (IS_BAR (self));
+       _tmp0_ = ((item != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) 
item) : ((gpointer) item);
+       self->priv->list = g_list_append (self->priv->list, _tmp0_);
+}
+
+Bar*
+bar_construct (GType object_type,
+               GType g_type,
+               GBoxedCopyFunc g_dup_func,
+               GDestroyNotify g_destroy_func)
+{
+       Bar * self = NULL;
+       self = (Bar*) g_object_new (object_type, NULL);
+       self->priv->g_type = g_type;
+       self->priv->g_dup_func = g_dup_func;
+       self->priv->g_destroy_func = g_destroy_func;
+       return self;
+}
+
+Bar*
+bar_new (GType g_type,
+         GBoxedCopyFunc g_dup_func,
+         GDestroyNotify g_destroy_func)
+{
+       return bar_construct (TYPE_BAR, g_type, g_dup_func, g_destroy_func);
+}
+
+static GObject *
+bar_constructor (GType type,
+                 guint n_construct_properties,
+                 GObjectConstructParam * construct_properties)
+{
+       GObject * obj;
+       GObjectClass * parent_class;
+       Bar * self;
+       parent_class = G_OBJECT_CLASS (bar_parent_class);
+       obj = parent_class->constructor (type, n_construct_properties, construct_properties);
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       (self->priv->list == NULL) ? NULL : (self->priv->list = (g_list_free_full (self->priv->list, 
self->priv->g_destroy_func), NULL));
+       self->priv->list = NULL;
+       return obj;
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Bar_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_bar_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_bar_set_property;
+       G_OBJECT_CLASS (klass)->constructor = bar_constructor;
+       G_OBJECT_CLASS (klass)->finalize = bar_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), BAR_G_TYPE, g_param_spec_gtype ("g-type", 
"type", "type", G_TYPE_NONE, G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), BAR_G_DUP_FUNC, g_param_spec_pointer 
("g-dup-func", "dup func", "dup func", G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), BAR_G_DESTROY_FUNC, g_param_spec_pointer 
("g-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | 
G_PARAM_CONSTRUCT_ONLY));
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+       self->priv = bar_get_instance_private (self);
+}
+
+static void
+bar_finalize (GObject * obj)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       (self->priv->list == NULL) ? NULL : (self->priv->list = (g_list_free_full (self->priv->list, 
self->priv->g_destroy_func), NULL));
+       G_OBJECT_CLASS (bar_parent_class)->finalize (obj);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (G_TYPE_OBJECT, "Bar", &g_define_type_info, 0);
+       Bar_private_offset = g_type_add_instance_private (bar_type_id, sizeof (BarPrivate));
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_bar_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_BAR, Bar);
+       switch (property_id) {
+               case BAR_G_TYPE:
+               g_value_set_gtype (value, self->priv->g_type);
+               break;
+               case BAR_G_DUP_FUNC:
+               g_value_set_pointer (value, self->priv->g_dup_func);
+               break;
+               case BAR_G_DESTROY_FUNC:
+               g_value_set_pointer (value, self->priv->g_destroy_func);
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_bar_set_property (GObject * object,
+                        guint property_id,
+                        const GValue * value,
+                        GParamSpec * pspec)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_BAR, Bar);
+       switch (property_id) {
+               case BAR_G_TYPE:
+               self->priv->g_type = g_value_get_gtype (value);
+               break;
+               case BAR_G_DUP_FUNC:
+               self->priv->g_dup_func = g_value_get_pointer (value);
+               break;
+               case BAR_G_DESTROY_FUNC:
+               self->priv->g_destroy_func = g_value_get_pointer (value);
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static inline gpointer
+baz_get_instance_private (Baz* self)
+{
+       return G_STRUCT_MEMBER_P (self, Baz_private_offset);
+}
+
+static gboolean
+_g_node_free_all_node (GNode* node,
+                       GDestroyNotify free_func)
+{
+       (node->data == NULL) ? NULL : free_func (node->data);
+       return FALSE;
+}
+
+static void
+_g_node_free_all (GNode* self,
+                  GDestroyNotify free_func)
+{
+       (free_func == NULL) ? NULL : g_node_traverse (self, G_POST_ORDER, G_TRAVERSE_ALL, -1, 
(GNodeTraverseFunc) _g_node_free_all_node, free_func);
+       g_node_destroy (self);
+}
+
+void
+baz_add (Baz* self,
+         gconstpointer item)
+{
+       GNode* _tmp0_;
+       gpointer _tmp1_;
+       g_return_if_fail (IS_BAZ (self));
+       _tmp0_ = self->priv->node;
+       _tmp1_ = ((item != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) 
item) : ((gpointer) item);
+       g_node_append_data (_tmp0_, _tmp1_);
+}
+
+Baz*
+baz_construct (GType object_type,
+               GType g_type,
+               GBoxedCopyFunc g_dup_func,
+               GDestroyNotify g_destroy_func)
+{
+       Baz * self = NULL;
+       self = (Baz*) g_object_new (object_type, NULL);
+       self->priv->g_type = g_type;
+       self->priv->g_dup_func = g_dup_func;
+       self->priv->g_destroy_func = g_destroy_func;
+       return self;
+}
+
+Baz*
+baz_new (GType g_type,
+         GBoxedCopyFunc g_dup_func,
+         GDestroyNotify g_destroy_func)
+{
+       return baz_construct (TYPE_BAZ, g_type, g_dup_func, g_destroy_func);
+}
+
+static GObject *
+baz_constructor (GType type,
+                 guint n_construct_properties,
+                 GObjectConstructParam * construct_properties)
+{
+       GObject * obj;
+       GObjectClass * parent_class;
+       Baz * self;
+       GNode* _tmp0_;
+       parent_class = G_OBJECT_CLASS (baz_parent_class);
+       obj = parent_class->constructor (type, n_construct_properties, construct_properties);
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAZ, Baz);
+       _tmp0_ = g_node_new (NULL);
+       (self->priv->node == NULL) ? NULL : (self->priv->node = (_g_node_free_all (self->priv->node, 
self->priv->g_destroy_func), NULL));
+       self->priv->node = _tmp0_;
+       return obj;
+}
+
+static void
+baz_class_init (BazClass * klass,
+                gpointer klass_data)
+{
+       baz_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Baz_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_baz_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_baz_set_property;
+       G_OBJECT_CLASS (klass)->constructor = baz_constructor;
+       G_OBJECT_CLASS (klass)->finalize = baz_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), BAZ_G_TYPE, g_param_spec_gtype ("g-type", 
"type", "type", G_TYPE_NONE, G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), BAZ_G_DUP_FUNC, g_param_spec_pointer 
("g-dup-func", "dup func", "dup func", G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), BAZ_G_DESTROY_FUNC, g_param_spec_pointer 
("g-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | 
G_PARAM_CONSTRUCT_ONLY));
+}
+
+static void
+baz_instance_init (Baz * self,
+                   gpointer klass)
+{
+       self->priv = baz_get_instance_private (self);
+}
+
+static void
+baz_finalize (GObject * obj)
+{
+       Baz * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAZ, Baz);
+       (self->priv->node == NULL) ? NULL : (self->priv->node = (_g_node_free_all (self->priv->node, 
self->priv->g_destroy_func), NULL));
+       G_OBJECT_CLASS (baz_parent_class)->finalize (obj);
+}
+
+static GType
+baz_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BazClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) baz_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Baz), 0, 
(GInstanceInitFunc) baz_instance_init, NULL };
+       GType baz_type_id;
+       baz_type_id = g_type_register_static (G_TYPE_OBJECT, "Baz", &g_define_type_info, 0);
+       Baz_private_offset = g_type_add_instance_private (baz_type_id, sizeof (BazPrivate));
+       return baz_type_id;
+}
+
+GType
+baz_get_type (void)
+{
+       static volatile gsize baz_type_id__volatile = 0;
+       if (g_once_init_enter (&baz_type_id__volatile)) {
+               GType baz_type_id;
+               baz_type_id = baz_get_type_once ();
+               g_once_init_leave (&baz_type_id__volatile, baz_type_id);
+       }
+       return baz_type_id__volatile;
+}
+
+static void
+_vala_baz_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Baz * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_BAZ, Baz);
+       switch (property_id) {
+               case BAZ_G_TYPE:
+               g_value_set_gtype (value, self->priv->g_type);
+               break;
+               case BAZ_G_DUP_FUNC:
+               g_value_set_pointer (value, self->priv->g_dup_func);
+               break;
+               case BAZ_G_DESTROY_FUNC:
+               g_value_set_pointer (value, self->priv->g_destroy_func);
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_baz_set_property (GObject * object,
+                        guint property_id,
+                        const GValue * value,
+                        GParamSpec * pspec)
+{
+       Baz * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_BAZ, Baz);
+       switch (property_id) {
+               case BAZ_G_TYPE:
+               self->priv->g_type = g_value_get_gtype (value);
+               break;
+               case BAZ_G_DUP_FUNC:
+               self->priv->g_dup_func = g_value_get_pointer (value);
+               break;
+               case BAZ_G_DESTROY_FUNC:
+               self->priv->g_destroy_func = g_value_get_pointer (value);
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       Bar* bar = NULL;
+       Bar* _tmp1_;
+       Bar* _tmp2_;
+       Baz* baz = NULL;
+       Baz* _tmp3_;
+       Baz* _tmp4_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       _tmp1_ = bar_new (TYPE_FOO, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref);
+       bar = _tmp1_;
+       _tmp2_ = bar;
+       bar_add (_tmp2_, foo);
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 2), 
"foo.ref_count == 2");
+       _g_object_unref0 (bar);
+       bar = NULL;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"foo.ref_count == 1");
+       _tmp3_ = baz_new (TYPE_FOO, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref);
+       baz = _tmp3_;
+       _tmp4_ = baz;
+       baz_add (_tmp4_, foo);
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 2), 
"foo.ref_count == 2");
+       _g_object_unref0 (baz);
+       baz = NULL;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"foo.ref_count == 1");
+       _g_object_unref0 (baz);
+       _g_object_unref0 (bar);
+       _g_object_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/generics/bug694765-3.c-expected b/tests/generics/bug694765-3.c-expected
new file mode 100644
index 000000000..5dfd97d33
--- /dev/null
+++ b/tests/generics/bug694765-3.c-expected
@@ -0,0 +1,56 @@
+/* generics_bug694765_3.c generated by valac, the Vala compiler
+ * generated from generics_bug694765_3.vala, do not modify */
+
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
+
+static void _vala_main (void);
+static void _g_free0_ (gpointer var);
+static inline void _g_list_free__g_free0_ (GList* self);
+static void __g_list_free__g_free0_0_ (gpointer var);
+
+static void
+_g_free0_ (gpointer var)
+{
+       var = (g_free (var), NULL);
+}
+
+static inline void
+_g_list_free__g_free0_ (GList* self)
+{
+       g_list_free_full (self, (GDestroyNotify) _g_free0_);
+}
+
+static void
+__g_list_free__g_free0_0_ (gpointer var)
+{
+       (var == NULL) ? NULL : (var = (_g_list_free__g_free0_ (var), NULL));
+}
+
+static void
+_vala_main (void)
+{
+       GHashTable* table = NULL;
+       GHashFunc _tmp0_;
+       GEqualFunc _tmp1_;
+       GHashTable* _tmp2_;
+       _tmp0_ = g_str_hash;
+       _tmp1_ = g_str_equal;
+       _tmp2_ = g_hash_table_new_full (_tmp0_, _tmp1_, _g_free0_, __g_list_free__g_free0_0_);
+       table = _tmp2_;
+       _g_hash_table_unref0 (table);
+       table = NULL;
+       _g_hash_table_unref0 (table);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/generics/constructor-chain-up.c-expected b/tests/generics/constructor-chain-up.c-expected
new file mode 100644
index 000000000..c6a309523
--- /dev/null
+++ b/tests/generics/constructor-chain-up.c-expected
@@ -0,0 +1,241 @@
+/* generics_constructor_chain_up.c generated by valac, the Vala compiler
+ * generated from generics_constructor_chain_up.vala, do not modify */
+
+#include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_G_TYPE,
+       FOO_G_DUP_FUNC,
+       FOO_G_DESTROY_FUNC,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _FooPrivate {
+       GType g_type;
+       GBoxedCopyFunc g_dup_func;
+       GDestroyNotify g_destroy_func;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (GType g_type,
+              GBoxedCopyFunc g_dup_func,
+              GDestroyNotify g_destroy_func);
+VALA_EXTERN Foo* foo_construct (GType object_type,
+                    GType g_type,
+                    GBoxedCopyFunc g_dup_func,
+                    GDestroyNotify g_destroy_func);
+VALA_EXTERN Foo* foo_new_bar (GType g_type,
+                  GBoxedCopyFunc g_dup_func,
+                  GDestroyNotify g_destroy_func);
+VALA_EXTERN Foo* foo_construct_bar (GType object_type,
+                        GType g_type,
+                        GBoxedCopyFunc g_dup_func,
+                        GDestroyNotify g_destroy_func);
+static GType foo_get_type_once (void);
+static void _vala_foo_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_foo_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec);
+static void _vala_main (void);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct (GType object_type,
+               GType g_type,
+               GBoxedCopyFunc g_dup_func,
+               GDestroyNotify g_destroy_func)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       self->priv->g_type = g_type;
+       self->priv->g_dup_func = g_dup_func;
+       self->priv->g_destroy_func = g_destroy_func;
+       return self;
+}
+
+Foo*
+foo_new (GType g_type,
+         GBoxedCopyFunc g_dup_func,
+         GDestroyNotify g_destroy_func)
+{
+       return foo_construct (TYPE_FOO, g_type, g_dup_func, g_destroy_func);
+}
+
+Foo*
+foo_construct_bar (GType object_type,
+                   GType g_type,
+                   GBoxedCopyFunc g_dup_func,
+                   GDestroyNotify g_destroy_func)
+{
+       Foo * self = NULL;
+       self = (Foo*) foo_construct (object_type, g_type, g_dup_func, g_destroy_func);
+       self->priv->g_type = g_type;
+       self->priv->g_dup_func = g_dup_func;
+       self->priv->g_destroy_func = g_destroy_func;
+       return self;
+}
+
+Foo*
+foo_new_bar (GType g_type,
+             GBoxedCopyFunc g_dup_func,
+             GDestroyNotify g_destroy_func)
+{
+       return foo_construct_bar (TYPE_FOO, g_type, g_dup_func, g_destroy_func);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_foo_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_foo_set_property;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_G_TYPE, g_param_spec_gtype ("g-type", 
"type", "type", G_TYPE_NONE, G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_G_DUP_FUNC, g_param_spec_pointer 
("g-dup-func", "dup func", "dup func", G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_G_DESTROY_FUNC, g_param_spec_pointer 
("g-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | 
G_PARAM_CONSTRUCT_ONLY));
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_foo_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_G_TYPE:
+               g_value_set_gtype (value, self->priv->g_type);
+               break;
+               case FOO_G_DUP_FUNC:
+               g_value_set_pointer (value, self->priv->g_dup_func);
+               break;
+               case FOO_G_DESTROY_FUNC:
+               g_value_set_pointer (value, self->priv->g_destroy_func);
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_foo_set_property (GObject * object,
+                        guint property_id,
+                        const GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_G_TYPE:
+               self->priv->g_type = g_value_get_gtype (value);
+               break;
+               case FOO_G_DUP_FUNC:
+               self->priv->g_dup_func = g_value_get_pointer (value);
+               break;
+               case FOO_G_DESTROY_FUNC:
+               self->priv->g_destroy_func = g_value_get_pointer (value);
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       _tmp0_ = foo_new_bar (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free);
+       foo = _tmp0_;
+       _g_object_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/generics/floating-type-cast.c-expected b/tests/generics/floating-type-cast.c-expected
new file mode 100644
index 000000000..405a376d9
--- /dev/null
+++ b/tests/generics/floating-type-cast.c-expected
@@ -0,0 +1,164 @@
+/* generics_floating_type_cast.c generated by valac, the Vala compiler
+ * generated from generics_floating_type_cast.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <float.h>
+#include <math.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _g_free0(var) ((var == NULL) ? NULL : (var = (g_free (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN void foo (GType g_type,
+          GBoxedCopyFunc g_dup_func,
+          GDestroyNotify g_destroy_func,
+          GType t_type,
+          GBoxedCopyFunc t_dup_func,
+          GDestroyNotify t_destroy_func,
+          gconstpointer g,
+          gconstpointer t);
+static gboolean _float_equal (const gfloat * s1,
+                       const gfloat * s2);
+static gboolean _double_equal (const gdouble * s1,
+                        const gdouble * s2);
+static void _vala_main (void);
+static gfloat* _float_dup (gfloat* self);
+static gdouble* _double_dup (gdouble* self);
+
+static gboolean
+_float_equal (const gfloat * s1,
+              const gfloat * s2)
+{
+       if (s1 == s2) {
+               return TRUE;
+       }
+       if (s1 == NULL) {
+               return FALSE;
+       }
+       if (s2 == NULL) {
+               return FALSE;
+       }
+       return (*s1) == (*s2);
+}
+
+static gboolean
+_double_equal (const gdouble * s1,
+               const gdouble * s2)
+{
+       if (s1 == s2) {
+               return TRUE;
+       }
+       if (s1 == NULL) {
+               return FALSE;
+       }
+       if (s2 == NULL) {
+               return FALSE;
+       }
+       return (*s1) == (*s2);
+}
+
+void
+foo (GType g_type,
+     GBoxedCopyFunc g_dup_func,
+     GDestroyNotify g_destroy_func,
+     GType t_type,
+     GBoxedCopyFunc t_dup_func,
+     GDestroyNotify t_destroy_func,
+     gconstpointer g,
+     gconstpointer t)
+{
+       gfloat _tmp0_;
+       gdouble _tmp1_;
+       _tmp0_ = 23.0f;
+       _vala_assert (_float_equal ((gfloat*) g, &_tmp0_) == TRUE, "(float?) g == 23.0f");
+       _tmp1_ = 42.0;
+       _vala_assert (_double_equal ((gdouble*) t, &_tmp1_) == TRUE, "(double?) t == 42.0");
+}
+
+static gfloat*
+_float_dup (gfloat* self)
+{
+       gfloat* dup;
+       dup = g_new0 (gfloat, 1);
+       memcpy (dup, self, sizeof (gfloat));
+       return dup;
+}
+
+static gpointer
+__float_dup0 (gpointer self)
+{
+       return self ? _float_dup (self) : NULL;
+}
+
+static gdouble*
+_double_dup (gdouble* self)
+{
+       gdouble* dup;
+       dup = g_new0 (gdouble, 1);
+       memcpy (dup, self, sizeof (gdouble));
+       return dup;
+}
+
+static gpointer
+__double_dup0 (gpointer self)
+{
+       return self ? _double_dup (self) : NULL;
+}
+
+static void
+_vala_main (void)
+{
+       gfloat* _tmp0_ = NULL;
+       gfloat _tmp1_;
+       gfloat* _tmp2_;
+       gdouble* _tmp3_ = NULL;
+       gdouble _tmp4_;
+       gdouble* _tmp5_;
+       gfloat* _tmp6_ = NULL;
+       gfloat _tmp7_;
+       gfloat* _tmp8_;
+       gdouble* _tmp9_ = NULL;
+       gdouble _tmp10_;
+       gdouble* _tmp11_;
+       _tmp1_ = 23.0f;
+       _tmp2_ = __float_dup0 (&_tmp1_);
+       _tmp0_ = _tmp2_;
+       _tmp4_ = 42.0;
+       _tmp5_ = __double_dup0 (&_tmp4_);
+       _tmp3_ = _tmp5_;
+       foo (G_TYPE_FLOAT, (GBoxedCopyFunc) _float_dup, (GDestroyNotify) g_free, G_TYPE_DOUBLE, 
(GBoxedCopyFunc) _double_dup, (GDestroyNotify) g_free, _tmp0_, _tmp3_);
+       _tmp7_ = 23.0f;
+       _tmp8_ = __float_dup0 (&_tmp7_);
+       _tmp6_ = _tmp8_;
+       _tmp10_ = 42.0;
+       _tmp11_ = __double_dup0 (&_tmp10_);
+       _tmp9_ = _tmp11_;
+       foo (G_TYPE_FLOAT, (GBoxedCopyFunc) _float_dup, (GDestroyNotify) g_free, G_TYPE_DOUBLE, 
(GBoxedCopyFunc) _double_dup, (GDestroyNotify) g_free, _tmp6_, _tmp9_);
+       _g_free0 (_tmp9_);
+       _g_free0 (_tmp6_);
+       _g_free0 (_tmp3_);
+       _g_free0 (_tmp0_);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/generics/inference-argument-may-fail.c-expected 
b/tests/generics/inference-argument-may-fail.c-expected
new file mode 100644
index 000000000..0bba98d7e
--- /dev/null
+++ b/tests/generics/inference-argument-may-fail.c-expected
@@ -0,0 +1,395 @@
+/* generics_inference_argument_may_fail.c generated by valac, the Vala compiler
+ * generated from generics_inference_argument_may_fail.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _FooPrivate {
+       GType g_type;
+       GBoxedCopyFunc g_dup_func;
+       GDestroyNotify g_destroy_func;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new (GType g_type,
+              GBoxedCopyFunc g_dup_func,
+              GDestroyNotify g_destroy_func,
+              GError** error);
+VALA_EXTERN Foo* foo_construct (GType object_type,
+                    GType g_type,
+                    GBoxedCopyFunc g_dup_func,
+                    GDestroyNotify g_destroy_func,
+                    GError** error);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN Foo* foo (GError** error);
+VALA_EXTERN gpointer bar (GType g_type,
+              GBoxedCopyFunc g_dup_func,
+              GDestroyNotify g_destroy_func,
+              Foo* foo);
+static void _vala_main (void);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct (GType object_type,
+               GType g_type,
+               GBoxedCopyFunc g_dup_func,
+               GDestroyNotify g_destroy_func,
+               GError** error)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       self->priv->g_type = g_type;
+       self->priv->g_dup_func = g_dup_func;
+       self->priv->g_destroy_func = g_destroy_func;
+       return self;
+}
+
+Foo*
+foo_new (GType g_type,
+         GBoxedCopyFunc g_dup_func,
+         GDestroyNotify g_destroy_func,
+         GError** error)
+{
+       return foo_construct (TYPE_FOO, g_type, g_dup_func, g_destroy_func, error);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+Foo*
+foo (GError** error)
+{
+       Foo* result = NULL;
+       result = NULL;
+       return result;
+}
+
+gpointer
+bar (GType g_type,
+     GBoxedCopyFunc g_dup_func,
+     GDestroyNotify g_destroy_func,
+     Foo* foo)
+{
+       gpointer result = NULL;
+       g_return_val_if_fail ((foo == NULL) || IS_FOO (foo), NULL);
+       result = NULL;
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       GError* _inner_error0_ = NULL;
+       {
+               Foo* _tmp0_ = NULL;
+               Foo* _tmp1_;
+               gpointer _tmp2_;
+               gchar* _tmp3_;
+               Foo* _tmp4_ = NULL;
+               Foo* _tmp5_;
+               gpointer _tmp6_;
+               gchar* _tmp7_;
+               _tmp1_ = foo (&_inner_error0_);
+               _tmp0_ = _tmp1_;
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       goto __catch0_g_error;
+               }
+               _tmp2_ = bar (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp0_);
+               _tmp3_ = (gchar*) _tmp2_;
+               _g_free0 (_tmp3_);
+               _tmp5_ = foo_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, 
&_inner_error0_);
+               _tmp4_ = _tmp5_;
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       _foo_unref0 (_tmp0_);
+                       goto __catch0_g_error;
+               }
+               _tmp6_ = bar (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp4_);
+               _tmp7_ = (gchar*) _tmp6_;
+               _g_free0 (_tmp7_);
+               _foo_unref0 (_tmp4_);
+               _foo_unref0 (_tmp0_);
+       }
+       goto __finally0;
+       __catch0_g_error:
+       {
+               g_clear_error (&_inner_error0_);
+       }
+       __finally0:
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/generics/inference-static-function.c-expected 
b/tests/generics/inference-static-function.c-expected
new file mode 100644
index 000000000..e01e2be62
--- /dev/null
+++ b/tests/generics/inference-static-function.c-expected
@@ -0,0 +1,377 @@
+/* generics_inference_static_function.c generated by valac, the Vala compiler
+ * generated from generics_inference_static_function.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _FooPrivate {
+       GType g_type;
+       GBoxedCopyFunc g_dup_func;
+       GDestroyNotify g_destroy_func;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN gpointer* foo_bar (gint* result_length1);
+VALA_EXTERN Foo* foo_new (GType g_type,
+              GBoxedCopyFunc g_dup_func,
+              GDestroyNotify g_destroy_func);
+VALA_EXTERN Foo* foo_construct (GType object_type,
+                    GType g_type,
+                    GBoxedCopyFunc g_dup_func,
+                    GDestroyNotify g_destroy_func);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+gpointer*
+foo_bar (gint* result_length1)
+{
+       gpointer* _tmp0_;
+       gpointer* _tmp1_;
+       gint _tmp1__length1;
+       gpointer* result = NULL;
+       _tmp0_ = g_new0 (gpointer, 0);
+       _tmp1_ = _tmp0_;
+       _tmp1__length1 = 0;
+       if (result_length1) {
+               *result_length1 = _tmp1__length1;
+       }
+       result = _tmp1_;
+       return result;
+}
+
+Foo*
+foo_construct (GType object_type,
+               GType g_type,
+               GBoxedCopyFunc g_dup_func,
+               GDestroyNotify g_destroy_func)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       self->priv->g_type = g_type;
+       self->priv->g_dup_func = g_dup_func;
+       self->priv->g_destroy_func = g_destroy_func;
+       return self;
+}
+
+Foo*
+foo_new (GType g_type,
+         GBoxedCopyFunc g_dup_func,
+         GDestroyNotify g_destroy_func)
+{
+       return foo_construct (TYPE_FOO, g_type, g_dup_func, g_destroy_func);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       gint _tmp0_ = 0;
+       gpointer* _tmp1_;
+       gchar** _tmp2_;
+       gint _tmp2__length1;
+       _tmp1_ = foo_bar (&_tmp0_);
+       _tmp2_ = _tmp1_;
+       _tmp2__length1 = _tmp0_;
+       _tmp2_ = (_vala_array_free (_tmp2_, _tmp2__length1, (GDestroyNotify) g_free), NULL);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/generics/integer-member-access.c-expected b/tests/generics/integer-member-access.c-expected
new file mode 100644
index 000000000..5f73497de
--- /dev/null
+++ b/tests/generics/integer-member-access.c-expected
@@ -0,0 +1,378 @@
+/* generics_integer_member_access.c generated by valac, the Vala compiler
+ * generated from generics_integer_member_access.vala, do not modify */
+
+#include <glib-object.h>
+#include <gobject/gvaluecollector.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+       gpointer k;
+       gpointer v;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _FooPrivate {
+       GType k_type;
+       GBoxedCopyFunc k_dup_func;
+       GDestroyNotify k_destroy_func;
+       GType v_type;
+       GBoxedCopyFunc v_dup_func;
+       GDestroyNotify v_destroy_func;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new (GType k_type,
+              GBoxedCopyFunc k_dup_func,
+              GDestroyNotify k_destroy_func,
+              GType v_type,
+              GBoxedCopyFunc v_dup_func,
+              GDestroyNotify v_destroy_func);
+VALA_EXTERN Foo* foo_construct (GType object_type,
+                    GType k_type,
+                    GBoxedCopyFunc k_dup_func,
+                    GDestroyNotify k_destroy_func,
+                    GType v_type,
+                    GBoxedCopyFunc v_dup_func,
+                    GDestroyNotify v_destroy_func);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct (GType object_type,
+               GType k_type,
+               GBoxedCopyFunc k_dup_func,
+               GDestroyNotify k_destroy_func,
+               GType v_type,
+               GBoxedCopyFunc v_dup_func,
+               GDestroyNotify v_destroy_func)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       self->priv->k_type = k_type;
+       self->priv->k_dup_func = k_dup_func;
+       self->priv->k_destroy_func = k_destroy_func;
+       self->priv->v_type = v_type;
+       self->priv->v_dup_func = v_dup_func;
+       self->priv->v_destroy_func = v_destroy_func;
+       return self;
+}
+
+Foo*
+foo_new (GType k_type,
+         GBoxedCopyFunc k_dup_func,
+         GDestroyNotify k_destroy_func,
+         GType v_type,
+         GBoxedCopyFunc v_dup_func,
+         GDestroyNotify v_destroy_func)
+{
+       return foo_construct (TYPE_FOO, k_type, k_dup_func, k_destroy_func, v_type, v_dup_func, 
v_destroy_func);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+       ((self->k == NULL) || (self->priv->k_destroy_func == NULL)) ? NULL : (self->k = 
(self->priv->k_destroy_func (self->k), NULL));
+       ((self->v == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (self->v = 
(self->priv->v_destroy_func (self->v), NULL));
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       gconstpointer _tmp1_;
+       gconstpointer _tmp2_;
+       Foo* bar = NULL;
+       Foo* _tmp3_;
+       gconstpointer _tmp4_;
+       gconstpointer _tmp5_;
+       gconstpointer _tmp6_;
+       gconstpointer _tmp7_;
+       _tmp0_ = foo_new (G_TYPE_INT, NULL, NULL, G_TYPE_UINT, NULL, NULL);
+       foo = _tmp0_;
+       foo->k = (gpointer) ((gintptr) G_MININT);
+       foo->v = (gpointer) ((guintptr) G_MAXUINT);
+       _tmp1_ = foo->k;
+       _vala_assert (((gint) ((gintptr) _tmp1_)) == G_MININT, "foo.k == int.MIN");
+       _tmp2_ = foo->v;
+       _vala_assert (((guint) ((guintptr) _tmp2_)) == G_MAXUINT, "foo.v == uint.MAX");
+       _tmp3_ = foo_new (G_TYPE_INT, NULL, NULL, G_TYPE_UINT, NULL, NULL);
+       bar = _tmp3_;
+       _tmp4_ = foo->k;
+       bar->k = (gpointer) ((gintptr) _tmp4_);
+       _tmp5_ = foo->v;
+       bar->v = (gpointer) ((guintptr) _tmp5_);
+       _tmp6_ = bar->k;
+       _vala_assert (((gint) ((gintptr) _tmp6_)) == G_MININT, "bar.k == int.MIN");
+       _tmp7_ = bar->v;
+       _vala_assert (((guint) ((guintptr) _tmp7_)) == G_MAXUINT, "bar.v == uint.MAX");
+       _foo_unref0 (bar);
+       _foo_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/generics/integer-type-cast-return.c-expected 
b/tests/generics/integer-type-cast-return.c-expected
new file mode 100644
index 000000000..60222ea7e
--- /dev/null
+++ b/tests/generics/integer-type-cast-return.c-expected
@@ -0,0 +1,176 @@
+/* generics_integer_type_cast_return.c generated by valac, the Vala compiler
+ * generated from generics_integer_type_cast_return.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _g_free0(var) ((var == NULL) ? NULL : (var = (g_free (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN gpointer manam (GType t_type,
+                GBoxedCopyFunc t_dup_func,
+                GDestroyNotify t_destroy_func,
+                gint i);
+static gint* _int_dup (gint* self);
+VALA_EXTERN gpointer minim (GType t_type,
+                GBoxedCopyFunc t_dup_func,
+                GDestroyNotify t_destroy_func,
+                guint i);
+static guint* _uint_dup (guint* self);
+static void _vala_main (void);
+static gboolean _int_equal (const gint * s1,
+                     const gint * s2);
+static gboolean _uint_equal (const guint * s1,
+                      const guint * s2);
+
+static gint*
+_int_dup (gint* self)
+{
+       gint* dup;
+       dup = g_new0 (gint, 1);
+       memcpy (dup, self, sizeof (gint));
+       return dup;
+}
+
+static gpointer
+__int_dup0 (gpointer self)
+{
+       return self ? _int_dup (self) : NULL;
+}
+
+gpointer
+manam (GType t_type,
+       GBoxedCopyFunc t_dup_func,
+       GDestroyNotify t_destroy_func,
+       gint i)
+{
+       gint* _tmp0_ = NULL;
+       gint* _tmp1_;
+       gint* _tmp2_;
+       gpointer result = NULL;
+       _tmp1_ = __int_dup0 (&i);
+       _tmp0_ = _tmp1_;
+       _tmp2_ = _tmp0_;
+       _tmp0_ = NULL;
+       result = _tmp2_;
+       _g_free0 (_tmp0_);
+       return result;
+}
+
+static guint*
+_uint_dup (guint* self)
+{
+       guint* dup;
+       dup = g_new0 (guint, 1);
+       memcpy (dup, self, sizeof (guint));
+       return dup;
+}
+
+static gpointer
+__uint_dup0 (gpointer self)
+{
+       return self ? _uint_dup (self) : NULL;
+}
+
+gpointer
+minim (GType t_type,
+       GBoxedCopyFunc t_dup_func,
+       GDestroyNotify t_destroy_func,
+       guint i)
+{
+       guint* _tmp0_ = NULL;
+       guint* _tmp1_;
+       guint* _tmp2_;
+       gpointer result = NULL;
+       _tmp1_ = __uint_dup0 (&i);
+       _tmp0_ = _tmp1_;
+       _tmp2_ = _tmp0_;
+       _tmp0_ = NULL;
+       result = _tmp2_;
+       _g_free0 (_tmp0_);
+       return result;
+}
+
+static gboolean
+_int_equal (const gint * s1,
+            const gint * s2)
+{
+       if (s1 == s2) {
+               return TRUE;
+       }
+       if (s1 == NULL) {
+               return FALSE;
+       }
+       if (s2 == NULL) {
+               return FALSE;
+       }
+       return (*s1) == (*s2);
+}
+
+static gboolean
+_uint_equal (const guint * s1,
+             const guint * s2)
+{
+       if (s1 == s2) {
+               return TRUE;
+       }
+       if (s1 == NULL) {
+               return FALSE;
+       }
+       if (s2 == NULL) {
+               return FALSE;
+       }
+       return (*s1) == (*s2);
+}
+
+static void
+_vala_main (void)
+{
+       gpointer _tmp0_;
+       gint* _tmp1_;
+       gint _tmp2_;
+       gpointer _tmp3_;
+       guint* _tmp4_;
+       guint _tmp5_;
+       gpointer _tmp6_;
+       gpointer _tmp7_;
+       _tmp0_ = manam (G_TYPE_INT, (GBoxedCopyFunc) _int_dup, (GDestroyNotify) g_free, G_MININT);
+       _tmp1_ = (gint*) _tmp0_;
+       _tmp2_ = G_MININT;
+       _vala_assert (_int_equal (_tmp1_, &_tmp2_) == TRUE, "manam<int?> (int.MIN) == int.MIN");
+       _g_free0 (_tmp1_);
+       _tmp3_ = minim (G_TYPE_UINT, (GBoxedCopyFunc) _uint_dup, (GDestroyNotify) g_free, G_MAXUINT);
+       _tmp4_ = (guint*) _tmp3_;
+       _tmp5_ = G_MAXUINT;
+       _vala_assert (_uint_equal (_tmp4_, &_tmp5_) == TRUE, "minim<uint?> (uint.MAX) == uint.MAX");
+       _g_free0 (_tmp4_);
+       _tmp6_ = manam (G_TYPE_INT, (GBoxedCopyFunc) _int_dup, (GDestroyNotify) g_free, G_MININT);
+       _vala_assert (((gint) (*((gint*) ((gint*) _tmp6_)))) == G_MININT, "(int) ((int?) manam<int?> 
(int.MIN)) == int.MIN");
+       _g_free0 (_tmp6_);
+       _tmp7_ = minim (G_TYPE_UINT, (GBoxedCopyFunc) _uint_dup, (GDestroyNotify) g_free, G_MAXUINT);
+       _vala_assert (((guint) (*((guint*) ((guint*) _tmp7_)))) == G_MAXUINT, "(uint) ((uint?) minim<uint?> 
(uint.MAX)) == uint.MAX");
+       _g_free0 (_tmp7_);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/generics/integer-type-cast.c-expected b/tests/generics/integer-type-cast.c-expected
new file mode 100644
index 000000000..35f7fb6bc
--- /dev/null
+++ b/tests/generics/integer-type-cast.c-expected
@@ -0,0 +1,288 @@
+/* generics_integer_type_cast.c generated by valac, the Vala compiler
+ * generated from generics_integer_type_cast.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _g_free0(var) ((var == NULL) ? NULL : (var = (g_free (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN void foo (GType g_type,
+          GBoxedCopyFunc g_dup_func,
+          GDestroyNotify g_destroy_func,
+          GType t_type,
+          GBoxedCopyFunc t_dup_func,
+          GDestroyNotify t_destroy_func,
+          gconstpointer g,
+          gconstpointer t);
+static gboolean _int64_equal (const gint64 * s1,
+                       const gint64 * s2);
+static gboolean _uint64_equal (const guint64 * s1,
+                        const guint64 * s2);
+VALA_EXTERN void bar (GType g_type,
+          GBoxedCopyFunc g_dup_func,
+          GDestroyNotify g_destroy_func,
+          GType t_type,
+          GBoxedCopyFunc t_dup_func,
+          GDestroyNotify t_destroy_func,
+          gconstpointer g,
+          gconstpointer t);
+static gboolean _int_equal (const gint * s1,
+                     const gint * s2);
+static gboolean _uint_equal (const guint * s1,
+                      const guint * s2);
+static void _vala_main (void);
+static gint64* _int64_dup (gint64* self);
+static guint64* _uint64_dup (guint64* self);
+static gint* _int_dup (gint* self);
+static guint* _uint_dup (guint* self);
+
+static gboolean
+_int64_equal (const gint64 * s1,
+              const gint64 * s2)
+{
+       if (s1 == s2) {
+               return TRUE;
+       }
+       if (s1 == NULL) {
+               return FALSE;
+       }
+       if (s2 == NULL) {
+               return FALSE;
+       }
+       return (*s1) == (*s2);
+}
+
+static gboolean
+_uint64_equal (const guint64 * s1,
+               const guint64 * s2)
+{
+       if (s1 == s2) {
+               return TRUE;
+       }
+       if (s1 == NULL) {
+               return FALSE;
+       }
+       if (s2 == NULL) {
+               return FALSE;
+       }
+       return (*s1) == (*s2);
+}
+
+void
+foo (GType g_type,
+     GBoxedCopyFunc g_dup_func,
+     GDestroyNotify g_destroy_func,
+     GType t_type,
+     GBoxedCopyFunc t_dup_func,
+     GDestroyNotify t_destroy_func,
+     gconstpointer g,
+     gconstpointer t)
+{
+       gint64 _tmp0_;
+       guint64 _tmp1_;
+       _tmp0_ = G_MININT64;
+       _vala_assert (_int64_equal ((gint64*) g, &_tmp0_) == TRUE, "(int64?) g == int64.MIN");
+       _tmp1_ = G_MAXUINT64;
+       _vala_assert (_uint64_equal ((guint64*) t, &_tmp1_) == TRUE, "(uint64?) t == uint64.MAX");
+}
+
+static gboolean
+_int_equal (const gint * s1,
+            const gint * s2)
+{
+       if (s1 == s2) {
+               return TRUE;
+       }
+       if (s1 == NULL) {
+               return FALSE;
+       }
+       if (s2 == NULL) {
+               return FALSE;
+       }
+       return (*s1) == (*s2);
+}
+
+static gboolean
+_uint_equal (const guint * s1,
+             const guint * s2)
+{
+       if (s1 == s2) {
+               return TRUE;
+       }
+       if (s1 == NULL) {
+               return FALSE;
+       }
+       if (s2 == NULL) {
+               return FALSE;
+       }
+       return (*s1) == (*s2);
+}
+
+void
+bar (GType g_type,
+     GBoxedCopyFunc g_dup_func,
+     GDestroyNotify g_destroy_func,
+     GType t_type,
+     GBoxedCopyFunc t_dup_func,
+     GDestroyNotify t_destroy_func,
+     gconstpointer g,
+     gconstpointer t)
+{
+       gint _tmp0_;
+       guint _tmp1_;
+       _tmp0_ = G_MININT;
+       _vala_assert (_int_equal ((gint*) g, &_tmp0_) == TRUE, "(int?) g == int.MIN");
+       _tmp1_ = G_MAXUINT;
+       _vala_assert (_uint_equal ((guint*) t, &_tmp1_) == TRUE, "(uint?) t == uint.MAX");
+       _vala_assert (((gint) (*((gint*) g))) == G_MININT, "(int) ((int?) g) == int.MIN");
+       _vala_assert (((guint) (*((guint*) t))) == G_MAXUINT, "(uint) ((uint?) t) == uint.MAX");
+}
+
+static gint64*
+_int64_dup (gint64* self)
+{
+       gint64* dup;
+       dup = g_new0 (gint64, 1);
+       memcpy (dup, self, sizeof (gint64));
+       return dup;
+}
+
+static gpointer
+__int64_dup0 (gpointer self)
+{
+       return self ? _int64_dup (self) : NULL;
+}
+
+static guint64*
+_uint64_dup (guint64* self)
+{
+       guint64* dup;
+       dup = g_new0 (guint64, 1);
+       memcpy (dup, self, sizeof (guint64));
+       return dup;
+}
+
+static gpointer
+__uint64_dup0 (gpointer self)
+{
+       return self ? _uint64_dup (self) : NULL;
+}
+
+static gint*
+_int_dup (gint* self)
+{
+       gint* dup;
+       dup = g_new0 (gint, 1);
+       memcpy (dup, self, sizeof (gint));
+       return dup;
+}
+
+static gpointer
+__int_dup0 (gpointer self)
+{
+       return self ? _int_dup (self) : NULL;
+}
+
+static guint*
+_uint_dup (guint* self)
+{
+       guint* dup;
+       dup = g_new0 (guint, 1);
+       memcpy (dup, self, sizeof (guint));
+       return dup;
+}
+
+static gpointer
+__uint_dup0 (gpointer self)
+{
+       return self ? _uint_dup (self) : NULL;
+}
+
+static void
+_vala_main (void)
+{
+       gint64* _tmp0_ = NULL;
+       gint64 _tmp1_;
+       gint64* _tmp2_;
+       guint64* _tmp3_ = NULL;
+       guint64 _tmp4_;
+       guint64* _tmp5_;
+       gint64* _tmp6_ = NULL;
+       gint64 _tmp7_;
+       gint64* _tmp8_;
+       guint64* _tmp9_ = NULL;
+       guint64 _tmp10_;
+       guint64* _tmp11_;
+       gint* _tmp12_ = NULL;
+       gint _tmp13_;
+       gint* _tmp14_;
+       guint* _tmp15_ = NULL;
+       guint _tmp16_;
+       guint* _tmp17_;
+       gint* _tmp18_ = NULL;
+       gint _tmp19_;
+       gint* _tmp20_;
+       guint* _tmp21_ = NULL;
+       guint _tmp22_;
+       guint* _tmp23_;
+       _tmp1_ = G_MININT64;
+       _tmp2_ = __int64_dup0 (&_tmp1_);
+       _tmp0_ = _tmp2_;
+       _tmp4_ = G_MAXUINT64;
+       _tmp5_ = __uint64_dup0 (&_tmp4_);
+       _tmp3_ = _tmp5_;
+       foo (G_TYPE_INT64, (GBoxedCopyFunc) _int64_dup, (GDestroyNotify) g_free, G_TYPE_UINT64, 
(GBoxedCopyFunc) _uint64_dup, (GDestroyNotify) g_free, _tmp0_, _tmp3_);
+       _tmp7_ = G_MININT64;
+       _tmp8_ = __int64_dup0 (&_tmp7_);
+       _tmp6_ = _tmp8_;
+       _tmp10_ = G_MAXUINT64;
+       _tmp11_ = __uint64_dup0 (&_tmp10_);
+       _tmp9_ = _tmp11_;
+       foo (G_TYPE_INT64, (GBoxedCopyFunc) _int64_dup, (GDestroyNotify) g_free, G_TYPE_UINT64, 
(GBoxedCopyFunc) _uint64_dup, (GDestroyNotify) g_free, _tmp6_, _tmp9_);
+       _tmp13_ = G_MININT;
+       _tmp14_ = __int_dup0 (&_tmp13_);
+       _tmp12_ = _tmp14_;
+       _tmp16_ = G_MAXUINT;
+       _tmp17_ = __uint_dup0 (&_tmp16_);
+       _tmp15_ = _tmp17_;
+       bar (G_TYPE_INT, (GBoxedCopyFunc) _int_dup, (GDestroyNotify) g_free, G_TYPE_UINT, (GBoxedCopyFunc) 
_uint_dup, (GDestroyNotify) g_free, _tmp12_, _tmp15_);
+       _tmp19_ = G_MININT;
+       _tmp20_ = __int_dup0 (&_tmp19_);
+       _tmp18_ = _tmp20_;
+       _tmp22_ = G_MAXUINT;
+       _tmp23_ = __uint_dup0 (&_tmp22_);
+       _tmp21_ = _tmp23_;
+       bar (G_TYPE_INT, (GBoxedCopyFunc) _int_dup, (GDestroyNotify) g_free, G_TYPE_UINT, (GBoxedCopyFunc) 
_uint_dup, (GDestroyNotify) g_free, _tmp18_, _tmp21_);
+       _g_free0 (_tmp21_);
+       _g_free0 (_tmp18_);
+       _g_free0 (_tmp15_);
+       _g_free0 (_tmp12_);
+       _g_free0 (_tmp9_);
+       _g_free0 (_tmp6_);
+       _g_free0 (_tmp3_);
+       _g_free0 (_tmp0_);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/generics/member-dup-destroy.c-expected b/tests/generics/member-dup-destroy.c-expected
new file mode 100644
index 000000000..23a8fe41b
--- /dev/null
+++ b/tests/generics/member-dup-destroy.c-expected
@@ -0,0 +1,565 @@
+/* generics_member_dup_destroy.c generated by valac, the Vala compiler
+ * generated from generics_member_dup_destroy.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+#include <gio/gio.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef void (*FooFunc) (gpointer user_data);
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_G_TYPE,
+       FOO_G_DUP_FUNC,
+       FOO_G_DESTROY_FUNC,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+typedef struct _FooFooAsyncData FooFooAsyncData;
+typedef struct _BarAsyncData BarAsyncData;
+typedef struct _Block1Data Block1Data;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _FooPrivate {
+       GType g_type;
+       GBoxedCopyFunc g_dup_func;
+       GDestroyNotify g_destroy_func;
+};
+
+struct _FooFooAsyncData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Foo* self;
+       gpointer g;
+};
+
+struct _BarAsyncData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       gpointer t;
+       GType t_type;
+       GBoxedCopyFunc t_dup_func;
+       GDestroyNotify t_destroy_func;
+};
+
+struct _Block1Data {
+       int _ref_count_;
+       GType t_type;
+       GBoxedCopyFunc t_dup_func;
+       GDestroyNotify t_destroy_func;
+       gpointer t;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (GType g_type,
+              GBoxedCopyFunc g_dup_func,
+              GDestroyNotify g_destroy_func);
+VALA_EXTERN Foo* foo_construct (GType object_type,
+                    GType g_type,
+                    GBoxedCopyFunc g_dup_func,
+                    GDestroyNotify g_destroy_func);
+VALA_EXTERN void foo_foo (Foo* self);
+static void foo_foo_async_data_free (gpointer _data);
+VALA_EXTERN void foo_foo_async (Foo* self,
+                    GAsyncReadyCallback _callback_,
+                    gpointer _user_data_);
+VALA_EXTERN void foo_foo_finish (Foo* self,
+                     GAsyncResult* _res_);
+static gboolean foo_foo_async_co (FooFooAsyncData* _data_);
+VALA_EXTERN void foo_foo_captured (Foo* self);
+static void __lambda4_ (Foo* self);
+static void ___lambda4__foo_func (gpointer self);
+static GType foo_get_type_once (void);
+static void _vala_foo_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_foo_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec);
+VALA_EXTERN void bar (GType t_type,
+          GBoxedCopyFunc t_dup_func,
+          GDestroyNotify t_destroy_func,
+          gconstpointer t);
+static void bar_async_data_free (gpointer _data);
+VALA_EXTERN void bar_async (GType t_type,
+                GBoxedCopyFunc t_dup_func,
+                GDestroyNotify t_destroy_func,
+                gconstpointer t,
+                GAsyncReadyCallback _callback_,
+                gpointer _user_data_);
+VALA_EXTERN void bar_finish (GAsyncResult* _res_);
+static gboolean bar_async_co (BarAsyncData* _data_);
+VALA_EXTERN void bar_captured (GType t_type,
+                   GBoxedCopyFunc t_dup_func,
+                   GDestroyNotify t_destroy_func,
+                   gconstpointer t);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static void __lambda5_ (Block1Data* _data1_);
+static void ___lambda5__foo_func (gpointer self);
+static void _vala_main (void);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct (GType object_type,
+               GType g_type,
+               GBoxedCopyFunc g_dup_func,
+               GDestroyNotify g_destroy_func)
+{
+       Foo * self = NULL;
+       gpointer g = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       self->priv->g_type = g_type;
+       self->priv->g_dup_func = g_dup_func;
+       self->priv->g_destroy_func = g_destroy_func;
+       _vala_assert (g_type == G_TYPE_STRING, "typeof (G) == typeof (string)");
+       _vala_assert (g_dup_func == ((GBoxedCopyFunc) g_strdup), "G.dup == (BoxedCopyFunc) string.dup");
+       _vala_assert (g_destroy_func == ((GDestroyNotify) g_free), "G.destroy == (DestroyNotify) free");
+       g = NULL;
+       _vala_assert (g_dup_func == ((GBoxedCopyFunc) g_strdup), "g.dup == (BoxedCopyFunc) string.dup");
+       _vala_assert (g_destroy_func == ((GDestroyNotify) g_free), "g.destroy == (DestroyNotify) free");
+       ((g == NULL) || (g_destroy_func == NULL)) ? NULL : (g = (g_destroy_func (g), NULL));
+       return self;
+}
+
+Foo*
+foo_new (GType g_type,
+         GBoxedCopyFunc g_dup_func,
+         GDestroyNotify g_destroy_func)
+{
+       return foo_construct (TYPE_FOO, g_type, g_dup_func, g_destroy_func);
+}
+
+void
+foo_foo (Foo* self)
+{
+       gpointer g = NULL;
+       g_return_if_fail (IS_FOO (self));
+       _vala_assert (self->priv->g_type == G_TYPE_STRING, "typeof (G) == typeof (string)");
+       _vala_assert (self->priv->g_dup_func == ((GBoxedCopyFunc) g_strdup), "G.dup == (BoxedCopyFunc) 
string.dup");
+       _vala_assert (self->priv->g_destroy_func == ((GDestroyNotify) g_free), "G.destroy == (DestroyNotify) 
free");
+       g = NULL;
+       _vala_assert (self->priv->g_dup_func == ((GBoxedCopyFunc) g_strdup), "g.dup == (BoxedCopyFunc) 
string.dup");
+       _vala_assert (self->priv->g_destroy_func == ((GDestroyNotify) g_free), "g.destroy == (DestroyNotify) 
free");
+       ((g == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (g = (self->priv->g_destroy_func (g), 
NULL));
+}
+
+static void
+foo_foo_async_data_free (gpointer _data)
+{
+       FooFooAsyncData* _data_;
+       _data_ = _data;
+       _g_object_unref0 (_data_->self);
+       g_slice_free (FooFooAsyncData, _data_);
+}
+
+static gpointer
+_g_object_ref0 (gpointer self)
+{
+       return self ? g_object_ref (self) : NULL;
+}
+
+void
+foo_foo_async (Foo* self,
+               GAsyncReadyCallback _callback_,
+               gpointer _user_data_)
+{
+       FooFooAsyncData* _data_;
+       Foo* _tmp0_;
+       g_return_if_fail (IS_FOO (self));
+       _data_ = g_slice_new0 (FooFooAsyncData);
+       _data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, foo_foo_async_data_free);
+       _tmp0_ = _g_object_ref0 (self);
+       _data_->self = _tmp0_;
+       foo_foo_async_co (_data_);
+}
+
+void
+foo_foo_finish (Foo* self,
+                GAsyncResult* _res_)
+{
+       FooFooAsyncData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static gboolean
+foo_foo_async_co (FooFooAsyncData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _vala_assert (_data_->self->priv->g_type == G_TYPE_STRING, "typeof (G) == typeof (string)");
+       _vala_assert (_data_->self->priv->g_dup_func == ((GBoxedCopyFunc) g_strdup), "G.dup == 
(BoxedCopyFunc) string.dup");
+       _vala_assert (_data_->self->priv->g_destroy_func == ((GDestroyNotify) g_free), "G.destroy == 
(DestroyNotify) free");
+       _data_->g = NULL;
+       _vala_assert (_data_->self->priv->g_dup_func == ((GBoxedCopyFunc) g_strdup), "g.dup == 
(BoxedCopyFunc) string.dup");
+       _vala_assert (_data_->self->priv->g_destroy_func == ((GDestroyNotify) g_free), "g.destroy == 
(DestroyNotify) free");
+       ((_data_->g == NULL) || (_data_->self->priv->g_destroy_func == NULL)) ? NULL : (_data_->g = 
(_data_->self->priv->g_destroy_func (_data_->g), NULL));
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+__lambda4_ (Foo* self)
+{
+       gpointer g = NULL;
+       _vala_assert (self->priv->g_type == G_TYPE_STRING, "typeof (G) == typeof (string)");
+       _vala_assert (self->priv->g_dup_func == ((GBoxedCopyFunc) g_strdup), "G.dup == (BoxedCopyFunc) 
string.dup");
+       _vala_assert (self->priv->g_destroy_func == ((GDestroyNotify) g_free), "G.destroy == (DestroyNotify) 
free");
+       g = NULL;
+       _vala_assert (self->priv->g_dup_func == ((GBoxedCopyFunc) g_strdup), "g.dup == (BoxedCopyFunc) 
string.dup");
+       _vala_assert (self->priv->g_destroy_func == ((GDestroyNotify) g_free), "g.destroy == (DestroyNotify) 
free");
+       ((g == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (g = (self->priv->g_destroy_func (g), 
NULL));
+}
+
+static void
+___lambda4__foo_func (gpointer self)
+{
+       __lambda4_ ((Foo*) self);
+}
+
+void
+foo_foo_captured (Foo* self)
+{
+       FooFunc f = NULL;
+       gpointer f_target;
+       GDestroyNotify f_target_destroy_notify;
+       g_return_if_fail (IS_FOO (self));
+       f = ___lambda4__foo_func;
+       f_target = g_object_ref (self);
+       f_target_destroy_notify = g_object_unref;
+       f (f_target);
+       (f_target_destroy_notify == NULL) ? NULL : (f_target_destroy_notify (f_target), NULL);
+       f = NULL;
+       f_target = NULL;
+       f_target_destroy_notify = NULL;
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_foo_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_foo_set_property;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_G_TYPE, g_param_spec_gtype ("g-type", 
"type", "type", G_TYPE_NONE, G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_G_DUP_FUNC, g_param_spec_pointer 
("g-dup-func", "dup func", "dup func", G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_G_DESTROY_FUNC, g_param_spec_pointer 
("g-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | 
G_PARAM_CONSTRUCT_ONLY));
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_foo_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_G_TYPE:
+               g_value_set_gtype (value, self->priv->g_type);
+               break;
+               case FOO_G_DUP_FUNC:
+               g_value_set_pointer (value, self->priv->g_dup_func);
+               break;
+               case FOO_G_DESTROY_FUNC:
+               g_value_set_pointer (value, self->priv->g_destroy_func);
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_foo_set_property (GObject * object,
+                        guint property_id,
+                        const GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_G_TYPE:
+               self->priv->g_type = g_value_get_gtype (value);
+               break;
+               case FOO_G_DUP_FUNC:
+               self->priv->g_dup_func = g_value_get_pointer (value);
+               break;
+               case FOO_G_DESTROY_FUNC:
+               self->priv->g_destroy_func = g_value_get_pointer (value);
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+void
+bar (GType t_type,
+     GBoxedCopyFunc t_dup_func,
+     GDestroyNotify t_destroy_func,
+     gconstpointer t)
+{
+       _vala_assert (t_type == TYPE_FOO, "typeof (T) == typeof (Foo)");
+       _vala_assert (t_dup_func == ((GBoxedCopyFunc) g_object_ref), "T.dup == (BoxedCopyFunc) Object.@ref");
+       _vala_assert (t_destroy_func == ((GDestroyNotify) g_object_unref), "T.destroy == (DestroyNotify) 
Object.unref");
+       _vala_assert (t_dup_func == ((GBoxedCopyFunc) g_object_ref), "t.dup == (BoxedCopyFunc) Object.@ref");
+       _vala_assert (t_destroy_func == ((GDestroyNotify) g_object_unref), "t.destroy == (DestroyNotify) 
Object.unref");
+}
+
+static void
+bar_async_data_free (gpointer _data)
+{
+       BarAsyncData* _data_;
+       _data_ = _data;
+       ((_data_->t == NULL) || (_data_->t_destroy_func == NULL)) ? NULL : (_data_->t = 
(_data_->t_destroy_func (_data_->t), NULL));
+       g_slice_free (BarAsyncData, _data_);
+}
+
+void
+bar_async (GType t_type,
+           GBoxedCopyFunc t_dup_func,
+           GDestroyNotify t_destroy_func,
+           gconstpointer t,
+           GAsyncReadyCallback _callback_,
+           gpointer _user_data_)
+{
+       BarAsyncData* _data_;
+       gpointer _tmp0_;
+       _data_ = g_slice_new0 (BarAsyncData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, bar_async_data_free);
+       _tmp0_ = ((t != NULL) && (t_dup_func != NULL)) ? t_dup_func ((gpointer) t) : ((gpointer) t);
+       ((_data_->t == NULL) || (_data_->t_destroy_func == NULL)) ? NULL : (_data_->t = 
(_data_->t_destroy_func (_data_->t), NULL));
+       _data_->t = _tmp0_;
+       _data_->t_type = t_type;
+       _data_->t_dup_func = t_dup_func;
+       _data_->t_destroy_func = t_destroy_func;
+       bar_async_co (_data_);
+}
+
+void
+bar_finish (GAsyncResult* _res_)
+{
+       BarAsyncData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static gboolean
+bar_async_co (BarAsyncData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _vala_assert (_data_->t_type == TYPE_FOO, "typeof (T) == typeof (Foo)");
+       _vala_assert (_data_->t_dup_func == ((GBoxedCopyFunc) g_object_ref), "T.dup == (BoxedCopyFunc) 
Object.@ref");
+       _vala_assert (_data_->t_destroy_func == ((GDestroyNotify) g_object_unref), "T.destroy == 
(DestroyNotify) Object.unref");
+       _vala_assert (_data_->t_dup_func == ((GBoxedCopyFunc) g_object_ref), "t.dup == (BoxedCopyFunc) 
Object.@ref");
+       _vala_assert (_data_->t_destroy_func == ((GDestroyNotify) g_object_unref), "t.destroy == 
(DestroyNotify) Object.unref");
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               GType t_type;
+               GBoxedCopyFunc t_dup_func;
+               GDestroyNotify t_destroy_func;
+               t_type = _data1_->t_type;
+               t_dup_func = _data1_->t_dup_func;
+               t_destroy_func = _data1_->t_destroy_func;
+               ((_data1_->t == NULL) || (t_destroy_func == NULL)) ? NULL : (_data1_->t = (t_destroy_func 
(_data1_->t), NULL));
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static void
+__lambda5_ (Block1Data* _data1_)
+{
+       GType t_type;
+       GBoxedCopyFunc t_dup_func;
+       GDestroyNotify t_destroy_func;
+       t_type = _data1_->t_type;
+       t_dup_func = _data1_->t_dup_func;
+       t_destroy_func = _data1_->t_destroy_func;
+       _vala_assert (t_type == TYPE_FOO, "typeof (T) == typeof (Foo)");
+       _vala_assert (t_dup_func == ((GBoxedCopyFunc) g_object_ref), "T.dup == (BoxedCopyFunc) Object.@ref");
+       _vala_assert (t_destroy_func == ((GDestroyNotify) g_object_unref), "T.destroy == (DestroyNotify) 
Object.unref");
+       _vala_assert (t_dup_func == ((GBoxedCopyFunc) g_object_ref), "t.dup == (BoxedCopyFunc) Object.@ref");
+       _vala_assert (t_destroy_func == ((GDestroyNotify) g_object_unref), "t.destroy == (DestroyNotify) 
Object.unref");
+}
+
+static void
+___lambda5__foo_func (gpointer self)
+{
+       __lambda5_ (self);
+}
+
+void
+bar_captured (GType t_type,
+              GBoxedCopyFunc t_dup_func,
+              GDestroyNotify t_destroy_func,
+              gconstpointer t)
+{
+       Block1Data* _data1_;
+       gpointer _tmp0_;
+       FooFunc f = NULL;
+       gpointer f_target;
+       GDestroyNotify f_target_destroy_notify;
+       _data1_ = g_slice_new0 (Block1Data);
+       _data1_->_ref_count_ = 1;
+       _data1_->t_type = t_type;
+       _data1_->t_dup_func = t_dup_func;
+       _data1_->t_destroy_func = t_destroy_func;
+       _tmp0_ = ((t != NULL) && (t_dup_func != NULL)) ? t_dup_func ((gpointer) t) : ((gpointer) t);
+       ((_data1_->t == NULL) || (t_destroy_func == NULL)) ? NULL : (_data1_->t = (t_destroy_func 
(_data1_->t), NULL));
+       _data1_->t = _tmp0_;
+       f = ___lambda5__foo_func;
+       f_target = block1_data_ref (_data1_);
+       f_target_destroy_notify = block1_data_unref;
+       f (f_target);
+       (f_target_destroy_notify == NULL) ? NULL : (f_target_destroy_notify (f_target), NULL);
+       f = NULL;
+       f_target = NULL;
+       f_target_destroy_notify = NULL;
+       block1_data_unref (_data1_);
+       _data1_ = NULL;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       _tmp0_ = foo_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free);
+       foo = _tmp0_;
+       foo_foo (foo);
+       foo_foo_async (foo, NULL, NULL);
+       foo_foo_captured (foo);
+       bar (TYPE_FOO, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, foo);
+       bar_async (TYPE_FOO, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, foo, NULL, NULL);
+       bar_captured (TYPE_FOO, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, foo);
+       _g_object_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/generics/parameter-sizeof-initializer.c-expected 
b/tests/generics/parameter-sizeof-initializer.c-expected
new file mode 100644
index 000000000..cd21eb8d0
--- /dev/null
+++ b/tests/generics/parameter-sizeof-initializer.c-expected
@@ -0,0 +1,112 @@
+/* generics_parameter_sizeof_initializer.c generated by valac, the Vala compiler
+ * generated from generics_parameter_sizeof_initializer.vala, do not modify */
+
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef struct _Foo Foo;
+#define _g_array_unref0(var) ((var == NULL) ? NULL : (var = (g_array_unref (var), NULL)))
+#define _foo_free0(var) ((var == NULL) ? NULL : (var = (foo_free (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       int dummy;
+};
+
+VALA_EXTERN void foo_free (Foo * self);
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_free)
+static void foo_instance_init (Foo * self);
+VALA_EXTERN Foo* foo_new (gulong real_foo,
+              gulong foo);
+VALA_EXTERN void foo_bar (Foo* self,
+              gulong real_foo,
+              gulong foo);
+static void _vala_main (void);
+
+Foo*
+foo_new (gulong real_foo,
+         gulong foo)
+{
+       Foo* self;
+       self = g_slice_new0 (Foo);
+       foo_instance_init (self);
+       _vala_assert (foo == real_foo, "foo == real_foo");
+       return self;
+}
+
+void
+foo_bar (Foo* self,
+         gulong real_foo,
+         gulong foo)
+{
+       g_return_if_fail (self != NULL);
+       _vala_assert (foo == real_foo, "foo == real_foo");
+}
+
+static void
+foo_instance_init (Foo * self)
+{
+}
+
+void
+foo_free (Foo * self)
+{
+       g_slice_free (Foo, self);
+}
+
+static void
+_vala_main (void)
+{
+       {
+               GArray* garray = NULL;
+               GArray* _tmp0_;
+               _tmp0_ = g_array_new (TRUE, TRUE, sizeof (guint32));
+               garray = _tmp0_;
+               _g_array_unref0 (garray);
+       }
+       {
+               Foo* foo = NULL;
+               Foo* _tmp1_;
+               _tmp1_ = foo_new (sizeof (guint32), sizeof (guint32));
+               foo = _tmp1_;
+               foo_bar (foo, (gulong) 4, sizeof (guint32));
+               _foo_free0 (foo);
+       }
+       {
+               Foo* foo = NULL;
+               Foo* _tmp2_;
+               _tmp2_ = foo_new (sizeof (gint16), sizeof (gint16));
+               foo = _tmp2_;
+               foo_bar (foo, (gulong) 2, sizeof (gint16));
+               _foo_free0 (foo);
+       }
+       {
+               Foo* foo = NULL;
+               Foo* _tmp3_;
+               _tmp3_ = foo_new (sizeof (guint8), sizeof (guint8));
+               foo = _tmp3_;
+               foo_bar (foo, (gulong) 1, sizeof (guint8));
+               _foo_free0 (foo);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/generics/property-int-cast.c-expected b/tests/generics/property-int-cast.c-expected
new file mode 100644
index 000000000..617757bb2
--- /dev/null
+++ b/tests/generics/property-int-cast.c-expected
@@ -0,0 +1,368 @@
+/* generics_property_int_cast.c generated by valac, the Vala compiler
+ * generated from generics_property_int_cast.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _FooPrivate {
+       GType g_type;
+       GBoxedCopyFunc g_dup_func;
+       GDestroyNotify g_destroy_func;
+       gpointer _prop;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new (GType g_type,
+              GBoxedCopyFunc g_dup_func,
+              GDestroyNotify g_destroy_func,
+              gconstpointer g);
+VALA_EXTERN Foo* foo_construct (GType object_type,
+                    GType g_type,
+                    GBoxedCopyFunc g_dup_func,
+                    GDestroyNotify g_destroy_func,
+                    gconstpointer g);
+static void foo_set_prop (Foo* self,
+                   gconstpointer value);
+VALA_EXTERN gconstpointer foo_get_prop (Foo* self);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct (GType object_type,
+               GType g_type,
+               GBoxedCopyFunc g_dup_func,
+               GDestroyNotify g_destroy_func,
+               gconstpointer g)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       self->priv->g_type = g_type;
+       self->priv->g_dup_func = g_dup_func;
+       self->priv->g_destroy_func = g_destroy_func;
+       foo_set_prop (self, g);
+       return self;
+}
+
+Foo*
+foo_new (GType g_type,
+         GBoxedCopyFunc g_dup_func,
+         GDestroyNotify g_destroy_func,
+         gconstpointer g)
+{
+       return foo_construct (TYPE_FOO, g_type, g_dup_func, g_destroy_func, g);
+}
+
+gconstpointer
+foo_get_prop (Foo* self)
+{
+       gconstpointer result;
+       gconstpointer _tmp0_;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = self->priv->_prop;
+       result = _tmp0_;
+       return result;
+}
+
+static void
+foo_set_prop (Foo* self,
+              gconstpointer value)
+{
+       gpointer _tmp0_;
+       g_return_if_fail (IS_FOO (self));
+       _tmp0_ = ((value != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) 
value) : ((gpointer) value);
+       ((self->priv->_prop == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (self->priv->_prop = 
(self->priv->g_destroy_func (self->priv->_prop), NULL));
+       self->priv->_prop = _tmp0_;
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+       ((self->priv->_prop == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (self->priv->_prop = 
(self->priv->g_destroy_func (self->priv->_prop), NULL));
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       gconstpointer _tmp1_;
+       gconstpointer _tmp2_;
+       _tmp0_ = foo_new (G_TYPE_INT, NULL, NULL, (gpointer) ((gintptr) 23));
+       foo = _tmp0_;
+       _tmp1_ = foo_get_prop (foo);
+       _tmp2_ = _tmp1_;
+       _vala_assert (((gint) ((gintptr) _tmp2_)) == 23, "foo.prop == 23");
+       _foo_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/generics/reference-transfer.c-expected b/tests/generics/reference-transfer.c-expected
new file mode 100644
index 000000000..e0ce785b4
--- /dev/null
+++ b/tests/generics/reference-transfer.c-expected
@@ -0,0 +1,414 @@
+/* generics_reference_transfer.c generated by valac, the Vala compiler
+ * generated from generics_reference_transfer.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+typedef struct _ParamSpecBar ParamSpecBar;
+#define _bar_unref0(var) ((var == NULL) ? NULL : (var = (bar_unref (var), NULL)))
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Bar {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       BarPrivate * priv;
+       gpointer g;
+};
+
+struct _BarClass {
+       GTypeClass parent_class;
+       void (*finalize) (Bar *self);
+};
+
+struct _BarPrivate {
+       GType g_type;
+       GBoxedCopyFunc g_dup_func;
+       GDestroyNotify g_destroy_func;
+};
+
+struct _ParamSpecBar {
+       GParamSpec parent_instance;
+};
+
+static gint Bar_private_offset;
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN gpointer bar_ref (gpointer instance);
+VALA_EXTERN void bar_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_bar (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_bar (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_bar (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_bar (const GValue* value);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, bar_unref)
+VALA_EXTERN Bar* bar_new (GType g_type,
+              GBoxedCopyFunc g_dup_func,
+              GDestroyNotify g_destroy_func,
+              gconstpointer g);
+VALA_EXTERN Bar* bar_construct (GType object_type,
+                    GType g_type,
+                    GBoxedCopyFunc g_dup_func,
+                    GDestroyNotify g_destroy_func,
+                    gconstpointer g);
+static void bar_finalize (Bar * obj);
+static GType bar_get_type_once (void);
+VALA_EXTERN void bar (GType g_type,
+          GBoxedCopyFunc g_dup_func,
+          GDestroyNotify g_destroy_func,
+          Bar* g);
+VALA_EXTERN void foo (GType g_type,
+          GBoxedCopyFunc g_dup_func,
+          GDestroyNotify g_destroy_func,
+          gpointer g);
+static void _vala_main (void);
+
+static inline gpointer
+bar_get_instance_private (Bar* self)
+{
+       return G_STRUCT_MEMBER_P (self, Bar_private_offset);
+}
+
+Bar*
+bar_construct (GType object_type,
+               GType g_type,
+               GBoxedCopyFunc g_dup_func,
+               GDestroyNotify g_destroy_func,
+               gconstpointer g)
+{
+       Bar* self = NULL;
+       gpointer _tmp0_;
+       self = (Bar*) g_type_create_instance (object_type);
+       self->priv->g_type = g_type;
+       self->priv->g_dup_func = g_dup_func;
+       self->priv->g_destroy_func = g_destroy_func;
+       _tmp0_ = ((g != NULL) && (g_dup_func != NULL)) ? g_dup_func ((gpointer) g) : ((gpointer) g);
+       ((self->g == NULL) || (g_destroy_func == NULL)) ? NULL : (self->g = (g_destroy_func (self->g), NULL));
+       self->g = _tmp0_;
+       _vala_assert (g_strcmp0 (g, "bar") == 0, "g == \"bar\"");
+       return self;
+}
+
+Bar*
+bar_new (GType g_type,
+         GBoxedCopyFunc g_dup_func,
+         GDestroyNotify g_destroy_func,
+         gconstpointer g)
+{
+       return bar_construct (TYPE_BAR, g_type, g_dup_func, g_destroy_func, g);
+}
+
+static void
+value_bar_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_bar_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               bar_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_bar_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = bar_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_bar_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_bar_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Bar * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = bar_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_bar_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Bar ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = bar_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_bar (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecBar* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_BAR), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_bar (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_bar (GValue* value,
+               gpointer v_object)
+{
+       Bar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               bar_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_unref (old);
+       }
+}
+
+void
+value_take_bar (GValue* value,
+                gpointer v_object)
+{
+       Bar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_unref (old);
+       }
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       ((BarClass *) klass)->finalize = bar_finalize;
+       g_type_class_adjust_private_offset (klass, &Bar_private_offset);
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+       self->priv = bar_get_instance_private (self);
+       self->ref_count = 1;
+}
+
+static void
+bar_finalize (Bar * obj)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       g_signal_handlers_destroy (self);
+       ((self->g == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (self->g = 
(self->priv->g_destroy_func (self->g), NULL));
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_bar_init, value_bar_free_value, 
value_bar_copy_value, value_bar_peek_pointer, "p", value_bar_collect_value, "p", value_bar_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType bar_type_id;
+       bar_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Bar", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       Bar_private_offset = g_type_add_instance_private (bar_type_id, sizeof (BarPrivate));
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+gpointer
+bar_ref (gpointer instance)
+{
+       Bar * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+bar_unref (gpointer instance)
+{
+       Bar * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               BAR_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+void
+bar (GType g_type,
+     GBoxedCopyFunc g_dup_func,
+     GDestroyNotify g_destroy_func,
+     Bar* g)
+{
+       gpointer t = NULL;
+       gpointer _tmp0_;
+       gconstpointer _tmp1_;
+       g_return_if_fail (IS_BAR (g));
+       _tmp0_ = g->g;
+       g->g = NULL;
+       t = _tmp0_;
+       _tmp1_ = g->g;
+       _vala_assert (_tmp1_ == NULL, "g.g == null");
+       _vala_assert (g_strcmp0 (t, "bar") == 0, "t == \"bar\"");
+       ((t == NULL) || (g_destroy_func == NULL)) ? NULL : (t = (g_destroy_func (t), NULL));
+}
+
+void
+foo (GType g_type,
+     GBoxedCopyFunc g_dup_func,
+     GDestroyNotify g_destroy_func,
+     gpointer g)
+{
+       gpointer t = NULL;
+       gpointer _tmp0_;
+       _tmp0_ = g;
+       g = NULL;
+       t = _tmp0_;
+       _vala_assert (g == NULL, "g == null");
+       _vala_assert (g_strcmp0 (t, "foo") == 0, "t == \"foo\"");
+       ((t == NULL) || (g_destroy_func == NULL)) ? NULL : (t = (g_destroy_func (t), NULL));
+       ((g == NULL) || (g_destroy_func == NULL)) ? NULL : (g = (g_destroy_func (g), NULL));
+}
+
+static void
+_vala_main (void)
+{
+       {
+               gchar* _tmp0_;
+               _tmp0_ = g_strdup ("foo");
+               foo (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp0_);
+       }
+       {
+               Bar* _tmp1_;
+               Bar* _tmp2_;
+               _tmp1_ = bar_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, "bar");
+               _tmp2_ = _tmp1_;
+               bar (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp2_);
+               _bar_unref0 (_tmp2_);
+       }
+       {
+               Bar* bar = NULL;
+               Bar* _tmp3_;
+               gchar* t = NULL;
+               gpointer _tmp4_;
+               gconstpointer _tmp5_;
+               _tmp3_ = bar_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, "bar");
+               bar = _tmp3_;
+               _tmp4_ = bar->g;
+               bar->g = NULL;
+               t = _tmp4_;
+               _tmp5_ = bar->g;
+               _vala_assert (((const gchar*) _tmp5_) == NULL, "bar.g == null");
+               _vala_assert (g_strcmp0 (t, "bar") == 0, "t == \"bar\"");
+               _g_free0 (t);
+               _bar_unref0 (bar);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/generics/string-literal-comparison.c-expected 
b/tests/generics/string-literal-comparison.c-expected
new file mode 100644
index 000000000..4d456bfbd
--- /dev/null
+++ b/tests/generics/string-literal-comparison.c-expected
@@ -0,0 +1,344 @@
+/* generics_string_literal_comparison.c generated by valac, the Vala compiler
+ * generated from generics_string_literal_comparison.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _FooPrivate {
+       GType g_type;
+       GBoxedCopyFunc g_dup_func;
+       GDestroyNotify g_destroy_func;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new (GType g_type,
+              GBoxedCopyFunc g_dup_func,
+              GDestroyNotify g_destroy_func,
+              gconstpointer g);
+VALA_EXTERN Foo* foo_construct (GType object_type,
+                    GType g_type,
+                    GBoxedCopyFunc g_dup_func,
+                    GDestroyNotify g_destroy_func,
+                    gconstpointer g);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct (GType object_type,
+               GType g_type,
+               GBoxedCopyFunc g_dup_func,
+               GDestroyNotify g_destroy_func,
+               gconstpointer g)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       self->priv->g_type = g_type;
+       self->priv->g_dup_func = g_dup_func;
+       self->priv->g_destroy_func = g_destroy_func;
+       _vala_assert (g_strcmp0 (g, "foo") == 0, "g == \"foo\"");
+       return self;
+}
+
+Foo*
+foo_new (GType g_type,
+         GBoxedCopyFunc g_dup_func,
+         GDestroyNotify g_destroy_func,
+         gconstpointer g)
+{
+       return foo_construct (TYPE_FOO, g_type, g_dup_func, g_destroy_func, g);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       gchar* s = NULL;
+       gchar* _tmp0_;
+       Foo* foo = NULL;
+       Foo* _tmp1_;
+       _tmp0_ = g_strdup ("foo");
+       s = _tmp0_;
+       _tmp1_ = foo_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, s);
+       foo = _tmp1_;
+       _foo_unref0 (foo);
+       _g_free0 (s);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/generics/type-parameter-properties.c-expected 
b/tests/generics/type-parameter-properties.c-expected
new file mode 100644
index 000000000..1ae87f241
--- /dev/null
+++ b/tests/generics/type-parameter-properties.c-expected
@@ -0,0 +1,418 @@
+/* generics_type_parameter_properties.c generated by valac, the Vala compiler
+ * generated from generics_type_parameter_properties.vala, do not modify */
+
+#include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_G_TYPE,
+       FOO_G_DUP_FUNC,
+       FOO_G_DESTROY_FUNC,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+enum  {
+       BAR_0_PROPERTY,
+       BAR_T_TYPE,
+       BAR_T_DUP_FUNC,
+       BAR_T_DESTROY_FUNC,
+       BAR_NUM_PROPERTIES
+};
+static GParamSpec* bar_properties[BAR_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _FooPrivate {
+       GType g_type;
+       GBoxedCopyFunc g_dup_func;
+       GDestroyNotify g_destroy_func;
+};
+
+struct _Bar {
+       Foo parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       FooClass parent_class;
+};
+
+struct _BarPrivate {
+       GType t_type;
+       GBoxedCopyFunc t_dup_func;
+       GDestroyNotify t_destroy_func;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+static gint Bar_private_offset;
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (GType g_type,
+              GBoxedCopyFunc g_dup_func,
+              GDestroyNotify g_destroy_func);
+VALA_EXTERN Foo* foo_construct (GType object_type,
+                    GType g_type,
+                    GBoxedCopyFunc g_dup_func,
+                    GDestroyNotify g_destroy_func);
+static GType foo_get_type_once (void);
+static void _vala_foo_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_foo_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
+VALA_EXTERN Bar* bar_new (GType t_type,
+              GBoxedCopyFunc t_dup_func,
+              GDestroyNotify t_destroy_func);
+VALA_EXTERN Bar* bar_construct (GType object_type,
+                    GType t_type,
+                    GBoxedCopyFunc t_dup_func,
+                    GDestroyNotify t_destroy_func);
+static GType bar_get_type_once (void);
+static void _vala_bar_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_bar_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec);
+static void _vala_main (void);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct (GType object_type,
+               GType g_type,
+               GBoxedCopyFunc g_dup_func,
+               GDestroyNotify g_destroy_func)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       self->priv->g_type = g_type;
+       self->priv->g_dup_func = g_dup_func;
+       self->priv->g_destroy_func = g_destroy_func;
+       return self;
+}
+
+Foo*
+foo_new (GType g_type,
+         GBoxedCopyFunc g_dup_func,
+         GDestroyNotify g_destroy_func)
+{
+       return foo_construct (TYPE_FOO, g_type, g_dup_func, g_destroy_func);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_foo_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_foo_set_property;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_G_TYPE, g_param_spec_gtype ("g-type", 
"type", "type", G_TYPE_NONE, G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_G_DUP_FUNC, g_param_spec_pointer 
("g-dup-func", "dup func", "dup func", G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_G_DESTROY_FUNC, g_param_spec_pointer 
("g-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | 
G_PARAM_CONSTRUCT_ONLY));
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_foo_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_G_TYPE:
+               g_value_set_gtype (value, self->priv->g_type);
+               break;
+               case FOO_G_DUP_FUNC:
+               g_value_set_pointer (value, self->priv->g_dup_func);
+               break;
+               case FOO_G_DESTROY_FUNC:
+               g_value_set_pointer (value, self->priv->g_destroy_func);
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_foo_set_property (GObject * object,
+                        guint property_id,
+                        const GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_G_TYPE:
+               self->priv->g_type = g_value_get_gtype (value);
+               break;
+               case FOO_G_DUP_FUNC:
+               self->priv->g_dup_func = g_value_get_pointer (value);
+               break;
+               case FOO_G_DESTROY_FUNC:
+               self->priv->g_destroy_func = g_value_get_pointer (value);
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static inline gpointer
+bar_get_instance_private (Bar* self)
+{
+       return G_STRUCT_MEMBER_P (self, Bar_private_offset);
+}
+
+Bar*
+bar_construct (GType object_type,
+               GType t_type,
+               GBoxedCopyFunc t_dup_func,
+               GDestroyNotify t_destroy_func)
+{
+       Bar * self = NULL;
+       self = (Bar*) foo_construct (object_type, t_type, (GBoxedCopyFunc) t_dup_func, (GDestroyNotify) 
t_destroy_func);
+       self->priv->t_type = t_type;
+       self->priv->t_dup_func = t_dup_func;
+       self->priv->t_destroy_func = t_destroy_func;
+       return self;
+}
+
+Bar*
+bar_new (GType t_type,
+         GBoxedCopyFunc t_dup_func,
+         GDestroyNotify t_destroy_func)
+{
+       return bar_construct (TYPE_BAR, t_type, t_dup_func, t_destroy_func);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Bar_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_bar_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_bar_set_property;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), BAR_T_TYPE, g_param_spec_gtype ("t-type", 
"type", "type", G_TYPE_NONE, G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), BAR_T_DUP_FUNC, g_param_spec_pointer 
("t-dup-func", "dup func", "dup func", G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), BAR_T_DESTROY_FUNC, g_param_spec_pointer 
("t-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | 
G_PARAM_CONSTRUCT_ONLY));
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+       self->priv = bar_get_instance_private (self);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (TYPE_FOO, "Bar", &g_define_type_info, 0);
+       Bar_private_offset = g_type_add_instance_private (bar_type_id, sizeof (BarPrivate));
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_bar_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_BAR, Bar);
+       switch (property_id) {
+               case BAR_T_TYPE:
+               g_value_set_gtype (value, self->priv->t_type);
+               break;
+               case BAR_T_DUP_FUNC:
+               g_value_set_pointer (value, self->priv->t_dup_func);
+               break;
+               case BAR_T_DESTROY_FUNC:
+               g_value_set_pointer (value, self->priv->t_destroy_func);
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_bar_set_property (GObject * object,
+                        guint property_id,
+                        const GValue * value,
+                        GParamSpec * pspec)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_BAR, Bar);
+       switch (property_id) {
+               case BAR_T_TYPE:
+               self->priv->t_type = g_value_get_gtype (value);
+               break;
+               case BAR_T_DUP_FUNC:
+               self->priv->t_dup_func = g_value_get_pointer (value);
+               break;
+               case BAR_T_DESTROY_FUNC:
+               self->priv->t_destroy_func = g_value_get_pointer (value);
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Bar* bar = NULL;
+       Bar* _tmp0_;
+       _tmp0_ = bar_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free);
+       bar = _tmp0_;
+       {
+               GType type = 0UL;
+               GBoxedCopyFunc dup_func = NULL;
+               GDestroyNotify destroy_func = NULL;
+               GType _tmp1_ = 0UL;
+               GBoxedCopyFunc _tmp2_ = NULL;
+               GDestroyNotify _tmp3_ = NULL;
+               g_object_get (G_TYPE_CHECK_INSTANCE_CAST (bar, G_TYPE_OBJECT, GObject), "t-type", &_tmp1_, 
"t-dup-func", &_tmp2_, "t-destroy-func", &_tmp3_, NULL);
+               type = _tmp1_;
+               dup_func = _tmp2_;
+               destroy_func = _tmp3_;
+               _vala_assert (type == G_TYPE_STRING, "type == typeof(string)");
+               _vala_assert (dup_func == ((GBoxedCopyFunc) g_strdup), "dup_func == (BoxedCopyFunc) 
string.dup");
+               _vala_assert (destroy_func == ((GDestroyNotify) g_free), "destroy_func == (DestroyNotify) 
free");
+       }
+       {
+               GType type = 0UL;
+               GBoxedCopyFunc dup_func = NULL;
+               GDestroyNotify destroy_func = NULL;
+               GType _tmp4_ = 0UL;
+               GBoxedCopyFunc _tmp5_ = NULL;
+               GDestroyNotify _tmp6_ = NULL;
+               g_object_get (G_TYPE_CHECK_INSTANCE_CAST (bar, G_TYPE_OBJECT, GObject), "g-type", &_tmp4_, 
"g-dup-func", &_tmp5_, "g-destroy-func", &_tmp6_, NULL);
+               type = _tmp4_;
+               dup_func = _tmp5_;
+               destroy_func = _tmp6_;
+               _vala_assert (type == G_TYPE_STRING, "type == typeof(string)");
+               _vala_assert (dup_func == ((GBoxedCopyFunc) g_strdup), "dup_func == (BoxedCopyFunc) 
string.dup");
+               _vala_assert (destroy_func == ((GDestroyNotify) g_free), "destroy_func == (DestroyNotify) 
free");
+       }
+       _g_object_unref0 (bar);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/generics/value-pointer-type-access.c-expected 
b/tests/generics/value-pointer-type-access.c-expected
new file mode 100644
index 000000000..82670288d
--- /dev/null
+++ b/tests/generics/value-pointer-type-access.c-expected
@@ -0,0 +1,417 @@
+/* generics_value_pointer_type_access.c generated by valac, the Vala compiler
+ * generated from generics_value_pointer_type_access.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+#define TYPE_BAR (bar_get_type ())
+typedef struct _Bar Bar;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _FooPrivate {
+       GType g_type;
+       GBoxedCopyFunc g_dup_func;
+       GDestroyNotify g_destroy_func;
+       gpointer g;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+struct _Bar {
+       gint i;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN void foo_set_g (Foo* self,
+                gconstpointer data);
+VALA_EXTERN gpointer foo_get_g (Foo* self);
+VALA_EXTERN Foo* foo_new (GType g_type,
+              GBoxedCopyFunc g_dup_func,
+              GDestroyNotify g_destroy_func);
+VALA_EXTERN Foo* foo_construct (GType object_type,
+                    GType g_type,
+                    GBoxedCopyFunc g_dup_func,
+                    GDestroyNotify g_destroy_func);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Bar* bar_dup (const Bar* self);
+VALA_EXTERN void bar_free (Bar* self);
+static void _vala_main (void);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+void
+foo_set_g (Foo* self,
+           gconstpointer data)
+{
+       gpointer _tmp0_;
+       g_return_if_fail (IS_FOO (self));
+       _tmp0_ = ((data != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) 
data) : ((gpointer) data);
+       ((self->priv->g == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (self->priv->g = 
(self->priv->g_destroy_func (self->priv->g), NULL));
+       self->priv->g = _tmp0_;
+}
+
+gpointer
+foo_get_g (Foo* self)
+{
+       gconstpointer _tmp0_;
+       gpointer _tmp1_;
+       gpointer result = NULL;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = self->priv->g;
+       _tmp1_ = ((_tmp0_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) 
_tmp0_) : ((gpointer) _tmp0_);
+       result = _tmp1_;
+       return result;
+}
+
+Foo*
+foo_construct (GType object_type,
+               GType g_type,
+               GBoxedCopyFunc g_dup_func,
+               GDestroyNotify g_destroy_func)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       self->priv->g_type = g_type;
+       self->priv->g_dup_func = g_dup_func;
+       self->priv->g_destroy_func = g_destroy_func;
+       return self;
+}
+
+Foo*
+foo_new (GType g_type,
+         GBoxedCopyFunc g_dup_func,
+         GDestroyNotify g_destroy_func)
+{
+       return foo_construct (TYPE_FOO, g_type, g_dup_func, g_destroy_func);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+       ((self->priv->g == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (self->priv->g = 
(self->priv->g_destroy_func (self->priv->g), NULL));
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+Bar*
+bar_dup (const Bar* self)
+{
+       Bar* dup;
+       dup = g_new0 (Bar, 1);
+       memcpy (dup, self, sizeof (Bar));
+       return dup;
+}
+
+void
+bar_free (Bar* self)
+{
+       g_free (self);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       GType bar_type_id;
+       bar_type_id = g_boxed_type_register_static ("Bar", (GBoxedCopyFunc) bar_dup, (GBoxedFreeFunc) 
bar_free);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Bar bar = {0};
+       Bar _tmp0_ = {0};
+       Foo* foo = NULL;
+       Foo* _tmp1_;
+       gpointer _tmp2_;
+       gpointer _tmp3_;
+       _tmp0_.i = 42;
+       bar = _tmp0_;
+       _tmp1_ = foo_new (G_TYPE_POINTER, NULL, NULL);
+       foo = _tmp1_;
+       foo_set_g (foo, &bar);
+       _tmp2_ = foo_get_g (foo);
+       _vala_assert ((*((Bar*) _tmp2_)).i == 42, "foo.get_g ()->i == 42");
+       _tmp3_ = foo_get_g (foo);
+       _vala_assert ((*((Bar*) _tmp3_)).i == 42, "((Bar*) foo.get_g ())->i == 42");
+       _foo_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/genie/class.c-expected b/tests/genie/class.c-expected
new file mode 100644
index 000000000..12591d1d6
--- /dev/null
+++ b/tests/genie/class.c-expected
@@ -0,0 +1,315 @@
+/* genie_class.c generated by valac, the Vala compiler
+ * generated from genie_class.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+#include <glib-object.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TEST, TestClass))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define IS_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TEST))
+#define TEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TEST, TestClass))
+
+typedef struct _Test Test;
+typedef struct _TestClass TestClass;
+typedef struct _TestPrivate TestPrivate;
+#define _test_unref0(var) ((var == NULL) ? NULL : (var = (test_unref (var), NULL)))
+#define _g_free0(var) (var = (g_free (var), NULL))
+typedef struct _ParamSpecTest ParamSpecTest;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Test {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       TestPrivate * priv;
+       gchar* empty;
+};
+
+struct _TestClass {
+       GTypeClass parent_class;
+       void (*finalize) (Test *self);
+};
+
+struct _ParamSpecTest {
+       GParamSpec parent_instance;
+};
+
+static gpointer test_parent_class = NULL;
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+VALA_EXTERN gpointer test_ref (gpointer instance);
+VALA_EXTERN void test_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_test (const gchar* name,
+                             const gchar* nick,
+                             const gchar* blurb,
+                             GType object_type,
+                             GParamFlags flags);
+VALA_EXTERN void value_set_test (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN void value_take_test (GValue* value,
+                      gpointer v_object);
+VALA_EXTERN gpointer value_get_test (const GValue* value);
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, test_unref)
+VALA_EXTERN Test* test_new (void);
+VALA_EXTERN Test* test_construct (GType object_type);
+static void test_finalize (Test * obj);
+static GType test_get_type_once (void);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       Test* a = NULL;
+       Test* _tmp0_;
+       const gchar* _tmp1_;
+       _tmp0_ = test_new ();
+       a = _tmp0_;
+       _tmp1_ = a->empty;
+       _vala_assert (g_strcmp0 (_tmp1_, "") == 0, "a.empty == \"\"");
+       _test_unref0 (a);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
+Test*
+test_construct (GType object_type)
+{
+       Test* self = NULL;
+       self = (Test*) g_type_create_instance (object_type);
+       return self;
+}
+
+Test*
+test_new (void)
+{
+       return test_construct (TYPE_TEST);
+}
+
+static void
+value_test_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_test_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               test_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_test_copy_value (const GValue* src_value,
+                       GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = test_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_test_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_test_collect_value (GValue* value,
+                          guint n_collect_values,
+                          GTypeCValue* collect_values,
+                          guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Test * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = test_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_test_lcopy_value (const GValue* value,
+                        guint n_collect_values,
+                        GTypeCValue* collect_values,
+                        guint collect_flags)
+{
+       Test ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = test_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_test (const gchar* name,
+                 const gchar* nick,
+                 const gchar* blurb,
+                 GType object_type,
+                 GParamFlags flags)
+{
+       ParamSpecTest* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_TEST), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_test (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_TEST), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_test (GValue* value,
+                gpointer v_object)
+{
+       Test * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_TEST));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_TEST));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               test_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               test_unref (old);
+       }
+}
+
+void
+value_take_test (GValue* value,
+                 gpointer v_object)
+{
+       Test * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_TEST));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_TEST));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               test_unref (old);
+       }
+}
+
+static void
+test_class_init (TestClass * klass,
+                 gpointer klass_data)
+{
+       test_parent_class = g_type_class_peek_parent (klass);
+       ((TestClass *) klass)->finalize = test_finalize;
+}
+
+static void
+test_instance_init (Test * self,
+                    gpointer klass)
+{
+       gchar* _tmp0_;
+       _tmp0_ = g_strdup ("");
+       self->empty = _tmp0_;
+       self->ref_count = 1;
+}
+
+static void
+test_finalize (Test * obj)
+{
+       Test * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_TEST, Test);
+       g_signal_handlers_destroy (self);
+       _g_free0 (self->empty);
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_test_init, value_test_free_value, 
value_test_copy_value, value_test_peek_pointer, "p", value_test_collect_value, "p", value_test_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (TestClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Test), 
0, (GInstanceInitFunc) test_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType test_type_id;
+       test_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Test", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+gpointer
+test_ref (gpointer instance)
+{
+       Test * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+test_unref (gpointer instance)
+{
+       Test * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               TEST_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
diff --git a/tests/genie/control-flow-if-do.c-expected b/tests/genie/control-flow-if-do.c-expected
new file mode 100644
index 000000000..e12b66865
--- /dev/null
+++ b/tests/genie/control-flow-if-do.c-expected
@@ -0,0 +1,33 @@
+/* genie_control_flow_if_do.c generated by valac, the Vala compiler
+ * generated from genie_control_flow_if_do.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       if (TRUE) {
+               _vala_assert (TRUE, "true");
+       }
+       return;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/control-flow-if-else-if.c-expected b/tests/genie/control-flow-if-else-if.c-expected
new file mode 100644
index 000000000..41ed9beb4
--- /dev/null
+++ b/tests/genie/control-flow-if-else-if.c-expected
@@ -0,0 +1,38 @@
+/* genie_control_flow_if_else_if.c generated by valac, the Vala compiler
+ * generated from genie_control_flow_if_else_if.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       if (FALSE) {
+               g_assert_not_reached ();
+       } else {
+               if (TRUE) {
+                       _vala_assert (TRUE, "true");
+                       return;
+               }
+       }
+       g_assert_not_reached ();
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/control-flow-if-else.c-expected b/tests/genie/control-flow-if-else.c-expected
new file mode 100644
index 000000000..2662e5d1c
--- /dev/null
+++ b/tests/genie/control-flow-if-else.c-expected
@@ -0,0 +1,36 @@
+/* genie_control_flow_if_else.c generated by valac, the Vala compiler
+ * generated from genie_control_flow_if_else.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       if (FALSE) {
+               g_assert_not_reached ();
+       } else {
+               _vala_assert (TRUE, "true");
+               return;
+       }
+       g_assert_not_reached ();
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/control-flow-if-greater-than.c-expected 
b/tests/genie/control-flow-if-greater-than.c-expected
new file mode 100644
index 000000000..d9c9a2146
--- /dev/null
+++ b/tests/genie/control-flow-if-greater-than.c-expected
@@ -0,0 +1,36 @@
+/* genie_control_flow_if_greater_than.c generated by valac, the Vala compiler
+ * generated from genie_control_flow_if_greater_than.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       gint a = 0;
+       a = G_MAXINT;
+       if (a > 0) {
+               _vala_assert (TRUE, "true");
+               return;
+       }
+       g_assert_not_reached ();
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/control-flow-if-identity.c-expected b/tests/genie/control-flow-if-identity.c-expected
new file mode 100644
index 000000000..a8f2b2bc4
--- /dev/null
+++ b/tests/genie/control-flow-if-identity.c-expected
@@ -0,0 +1,40 @@
+/* genie_control_flow_if_identity.c generated by valac, the Vala compiler
+ * generated from genie_control_flow_if_identity.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       gchar* a = NULL;
+       gchar* _tmp0_;
+       _tmp0_ = g_strdup ("test");
+       a = _tmp0_;
+       if (g_strcmp0 (a, "test") == 0) {
+               _vala_assert (g_strcmp0 (a, "test") == 0, "a == \"test\"");
+               _g_free0 (a);
+               return;
+       }
+       g_assert_not_reached ();
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/control-flow-if-less-than.c-expected 
b/tests/genie/control-flow-if-less-than.c-expected
new file mode 100644
index 000000000..ad03ce963
--- /dev/null
+++ b/tests/genie/control-flow-if-less-than.c-expected
@@ -0,0 +1,36 @@
+/* genie_control_flow_if_less_than.c generated by valac, the Vala compiler
+ * generated from genie_control_flow_if_less_than.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       gint a = 0;
+       a = -1;
+       if (a < 0) {
+               _vala_assert (TRUE, "true");
+               return;
+       }
+       g_assert_not_reached ();
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/control-flow-if.c-expected b/tests/genie/control-flow-if.c-expected
new file mode 100644
index 000000000..749c45ce7
--- /dev/null
+++ b/tests/genie/control-flow-if.c-expected
@@ -0,0 +1,34 @@
+/* genie_control_flow_if.c generated by valac, the Vala compiler
+ * generated from genie_control_flow_if.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       if (TRUE) {
+               _vala_assert (TRUE, "true");
+               return;
+       }
+       g_assert_not_reached ();
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/enum-with-keyword-values.c-expected b/tests/genie/enum-with-keyword-values.c-expected
new file mode 100644
index 000000000..53c07c26a
--- /dev/null
+++ b/tests/genie/enum-with-keyword-values.c-expected
@@ -0,0 +1,82 @@
+/* genie_enum_with_keyword_values.c generated by valac, the Vala compiler
+ * generated from genie_enum_with_keyword_values.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+#include <glib-object.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef enum  {
+       TEST_ONE,
+       TEST_ABSTRACT,
+       TEST_DEF,
+       TEST_FOUR
+} Test;
+
+#define TYPE_TEST (test_get_type ())
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       Test a = 0;
+       Test b = 0;
+       Test c = 0;
+       Test d = 0;
+       a = TEST_ONE;
+       b = TEST_ABSTRACT;
+       c = TEST_DEF;
+       d = TEST_FOUR;
+       _vala_assert (a == TEST_ONE, "a == Test.ONE");
+       _vala_assert (b == TEST_ABSTRACT, "b == Test.ABSTRACT");
+       _vala_assert (c == TEST_DEF, "c == Test.DEF");
+       _vala_assert (d == TEST_FOUR, "d == Test.FOUR");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GEnumValue values[] = {{TEST_ONE, "TEST_ONE", "one"}, {TEST_ABSTRACT, "TEST_ABSTRACT", 
"abstract"}, {TEST_DEF, "TEST_DEF", "def"}, {TEST_FOUR, "TEST_FOUR", "four"}, {0, NULL, NULL}};
+       GType test_type_id;
+       test_type_id = g_enum_register_static ("Test", values);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
diff --git a/tests/genie/enum.c-expected b/tests/genie/enum.c-expected
new file mode 100644
index 000000000..6f946842e
--- /dev/null
+++ b/tests/genie/enum.c-expected
@@ -0,0 +1,70 @@
+/* genie_enum.c generated by valac, the Vala compiler
+ * generated from genie_enum.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+#include <glib-object.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef enum  {
+       TEST_ONE
+} Test;
+
+#define TYPE_TEST (test_get_type ())
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       Test a = 0;
+       a = TEST_ONE;
+       _vala_assert (a == TEST_ONE, "a == Test.ONE");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GEnumValue values[] = {{TEST_ONE, "TEST_ONE", "one"}, {0, NULL, NULL}};
+       GType test_type_id;
+       test_type_id = g_enum_register_static ("Test", values);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
diff --git a/tests/genie/function-returns-closure.c-expected b/tests/genie/function-returns-closure.c-expected
new file mode 100644
index 000000000..5a88a3624
--- /dev/null
+++ b/tests/genie/function-returns-closure.c-expected
@@ -0,0 +1,92 @@
+/* genie_function_returns_closure.c generated by valac, the Vala compiler
+ * generated from genie_function_returns_closure.gs, do not modify */
+
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef gboolean (*TestFunction) (gpointer user_data);
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+VALA_EXTERN TestFunction test (gpointer* result_target,
+                   GDestroyNotify* result_target_destroy_notify);
+static gboolean __lambda4_ (void);
+static gboolean ___lambda4__test_function (gpointer self);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       gpointer _tmp0_ = NULL;
+       GDestroyNotify _tmp1_ = NULL;
+       TestFunction _tmp2_;
+       TestFunction _tmp3_;
+       gpointer _tmp3__target;
+       GDestroyNotify _tmp3__target_destroy_notify;
+       _tmp2_ = test (&_tmp0_, &_tmp1_);
+       _tmp3_ = _tmp2_;
+       _tmp3__target = _tmp0_;
+       _tmp3__target_destroy_notify = _tmp1_;
+       _vala_assert (_tmp3_ (_tmp0_) == TRUE, "test()() == true");
+       (_tmp3__target_destroy_notify == NULL) ? NULL : (_tmp3__target_destroy_notify (_tmp3__target), NULL);
+       _tmp3_ = NULL;
+       _tmp3__target = NULL;
+       _tmp3__target_destroy_notify = NULL;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
+static gboolean
+__lambda4_ (void)
+{
+       gboolean result = FALSE;
+       result = TRUE;
+       return result;
+}
+
+static gboolean
+___lambda4__test_function (gpointer self)
+{
+       gboolean result;
+       result = __lambda4_ ();
+       return result;
+}
+
+TestFunction
+test (gpointer* result_target,
+      GDestroyNotify* result_target_destroy_notify)
+{
+       TestFunction _tmp0_;
+       gpointer _tmp0__target;
+       GDestroyNotify _tmp0__target_destroy_notify;
+       TestFunction result = NULL;
+       _tmp0_ = ___lambda4__test_function;
+       _tmp0__target = NULL;
+       _tmp0__target_destroy_notify = NULL;
+       *result_target = _tmp0__target;
+       *result_target_destroy_notify = _tmp0__target_destroy_notify;
+       result = _tmp0_;
+       return result;
+}
+
diff --git a/tests/genie/function-with-argument.c-expected b/tests/genie/function-with-argument.c-expected
new file mode 100644
index 000000000..fc6293b79
--- /dev/null
+++ b/tests/genie/function-with-argument.c-expected
@@ -0,0 +1,47 @@
+/* genie_function_with_argument.c generated by valac, the Vala compiler
+ * generated from genie_function_with_argument.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+VALA_EXTERN void test (gint a);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       test (2);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
+void
+test (gint a)
+{
+       _vala_assert (a == 2, "a == 2");
+}
+
diff --git a/tests/genie/function-with-return-value.c-expected 
b/tests/genie/function-with-return-value.c-expected
new file mode 100644
index 000000000..f683f8ed5
--- /dev/null
+++ b/tests/genie/function-with-return-value.c-expected
@@ -0,0 +1,57 @@
+/* genie_function_with_return_value.c generated by valac, the Vala compiler
+ * generated from genie_function_with_return_value.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+VALA_EXTERN gchar* test (void);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       gchar* _tmp0_;
+       gchar* _tmp1_;
+       _tmp0_ = test ();
+       _tmp1_ = _tmp0_;
+       _vala_assert (g_strcmp0 (_tmp1_, "passed") == 0, "test() == \"passed\"");
+       _g_free0 (_tmp1_);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
+gchar*
+test (void)
+{
+       gchar* _tmp0_;
+       gchar* result = NULL;
+       _tmp0_ = g_strdup ("passed");
+       result = _tmp0_;
+       return result;
+}
+
diff --git a/tests/genie/function.c-expected b/tests/genie/function.c-expected
new file mode 100644
index 000000000..f3955085d
--- /dev/null
+++ b/tests/genie/function.c-expected
@@ -0,0 +1,51 @@
+/* genie_function.c generated by valac, the Vala compiler
+ * generated from genie_function.gs, do not modify */
+
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN gint global;
+gint global = 0;
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+VALA_EXTERN void test (void);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       test ();
+       _vala_assert (global == 1, "global == 1");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
+void
+test (void)
+{
+       global = global + 1;
+}
+
diff --git a/tests/genie/indentation-with-spaces.c-expected b/tests/genie/indentation-with-spaces.c-expected
new file mode 100644
index 000000000..a157ee993
--- /dev/null
+++ b/tests/genie/indentation-with-spaces.c-expected
@@ -0,0 +1,30 @@
+/* genie_indentation_with_spaces.c generated by valac, the Vala compiler
+ * generated from genie_indentation_with_spaces.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       _vala_assert (TRUE, "true");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/init-int.c-expected b/tests/genie/init-int.c-expected
new file mode 100644
index 000000000..06ba63331
--- /dev/null
+++ b/tests/genie/init-int.c-expected
@@ -0,0 +1,26 @@
+/* genie_init_int.c generated by valac, the Vala compiler
+ * generated from genie_init_int.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+static gint _vala_main (gchar** args,
+                 gint args_length1);
+
+static gint
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       gint result = 0;
+       result = 0;
+       return result;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       return _vala_main (argv, argc);
+}
+
diff --git a/tests/genie/init.c-expected b/tests/genie/init.c-expected
new file mode 100644
index 000000000..e97f519df
--- /dev/null
+++ b/tests/genie/init.c-expected
@@ -0,0 +1,30 @@
+/* genie_init.c generated by valac, the Vala compiler
+ * generated from genie_init.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       _vala_assert (TRUE, "true");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/literal-boolean-assignment.c-expected 
b/tests/genie/literal-boolean-assignment.c-expected
new file mode 100644
index 000000000..77b90dc18
--- /dev/null
+++ b/tests/genie/literal-boolean-assignment.c-expected
@@ -0,0 +1,32 @@
+/* genie_literal_boolean_assignment.c generated by valac, the Vala compiler
+ * generated from genie_literal_boolean_assignment.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       gboolean a = FALSE;
+       a = TRUE;
+       _vala_assert (a == TRUE, "a == true");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/literal-boolean.c-expected b/tests/genie/literal-boolean.c-expected
new file mode 100644
index 000000000..4d04b24e8
--- /dev/null
+++ b/tests/genie/literal-boolean.c-expected
@@ -0,0 +1,35 @@
+/* genie_literal_boolean.c generated by valac, the Vala compiler
+ * generated from genie_literal_boolean.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       if (TRUE) {
+               _vala_assert (TRUE, "true");
+       }
+       if (!FALSE) {
+               _vala_assert (!FALSE, "!false");
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/literal-character.c-expected b/tests/genie/literal-character.c-expected
new file mode 100644
index 000000000..3a8e35e6f
--- /dev/null
+++ b/tests/genie/literal-character.c-expected
@@ -0,0 +1,32 @@
+/* genie_literal_character.c generated by valac, the Vala compiler
+ * generated from genie_literal_character.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       gchar a = '\0';
+       a = 'a';
+       _vala_assert (a == 'a', "a == 'a'");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/literal-hexadecimal.c-expected b/tests/genie/literal-hexadecimal.c-expected
new file mode 100644
index 000000000..f7098075d
--- /dev/null
+++ b/tests/genie/literal-hexadecimal.c-expected
@@ -0,0 +1,32 @@
+/* genie_literal_hexadecimal.c generated by valac, the Vala compiler
+ * generated from genie_literal_hexadecimal.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       gint a = 0;
+       a = 0x10;
+       _vala_assert (a == 16, "a == 16");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/literal-integer-long-long-suffix.c-expected 
b/tests/genie/literal-integer-long-long-suffix.c-expected
new file mode 100644
index 000000000..ad71e61dc
--- /dev/null
+++ b/tests/genie/literal-integer-long-long-suffix.c-expected
@@ -0,0 +1,32 @@
+/* genie_literal_integer_long_long_suffix.c generated by valac, the Vala compiler
+ * generated from genie_literal_integer_long_long_suffix.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       gint64 a = 0LL;
+       a = 1234567890123456789LL;
+       _vala_assert (a == 1234567890123456789LL, "a == 1234567890123456789");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/literal-integer.c-expected b/tests/genie/literal-integer.c-expected
new file mode 100644
index 000000000..1f9418103
--- /dev/null
+++ b/tests/genie/literal-integer.c-expected
@@ -0,0 +1,32 @@
+/* genie_literal_integer.c generated by valac, the Vala compiler
+ * generated from genie_literal_integer.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       gint a = 0;
+       a = 101;
+       _vala_assert (a == 101, "a == 101");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/literal-null.c-expected b/tests/genie/literal-null.c-expected
new file mode 100644
index 000000000..822f14b26
--- /dev/null
+++ b/tests/genie/literal-null.c-expected
@@ -0,0 +1,34 @@
+/* genie_literal_null.c generated by valac, the Vala compiler
+ * generated from genie_literal_null.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       gchar* test = NULL;
+       test = NULL;
+       _vala_assert (test == NULL, "test == null");
+       _g_free0 (test);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/literal-octal.c-expected b/tests/genie/literal-octal.c-expected
new file mode 100644
index 000000000..8feeb804c
--- /dev/null
+++ b/tests/genie/literal-octal.c-expected
@@ -0,0 +1,32 @@
+/* genie_literal_octal.c generated by valac, the Vala compiler
+ * generated from genie_literal_octal.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       gint a = 0;
+       a = 022;
+       _vala_assert (a == 18, "a == 18");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/literal-real.c-expected b/tests/genie/literal-real.c-expected
new file mode 100644
index 000000000..2d6a8c7d6
--- /dev/null
+++ b/tests/genie/literal-real.c-expected
@@ -0,0 +1,36 @@
+/* genie_literal_real.c generated by valac, the Vala compiler
+ * generated from genie_literal_real.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+#include <float.h>
+#include <math.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       gdouble a = 0.0;
+       gdouble b = 0.0;
+       a = 1.1;
+       b = 1.2;
+       _vala_assert ((a + b) > ((gdouble) 2), "a + b > 2");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/literal-regex.c-expected b/tests/genie/literal-regex.c-expected
new file mode 100644
index 000000000..2c3496e4a
--- /dev/null
+++ b/tests/genie/literal-regex.c-expected
@@ -0,0 +1,62 @@
+/* genie_literal_regex.c generated by valac, the Vala compiler
+ * generated from genie_literal_regex.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static GRegex* _tmp_regex_0 = NULL;
+
+static inline GRegex*
+_thread_safe_regex_init (GRegex** re,
+                         const gchar * pattern,
+                         GRegexCompileFlags compile_flags)
+{
+       if (g_once_init_enter ((volatile gsize*) re)) {
+               GRegex* val = g_regex_new (pattern, compile_flags, 0, NULL);
+               g_once_init_leave ((volatile gsize*) re, (gsize) val);
+       }
+       return *re;
+}
+
+static gpointer
+_g_regex_ref0 (gpointer self)
+{
+       return self ? g_regex_ref (self) : NULL;
+}
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       GRegex* a = NULL;
+       GRegex* _tmp0_;
+       gchar* b = NULL;
+       gchar* _tmp1_;
+       _tmp0_ = _g_regex_ref0 (_thread_safe_regex_init (&_tmp_regex_0, "^test", 0));
+       a = _tmp0_;
+       _tmp1_ = g_strdup ("test string");
+       b = _tmp1_;
+       _vala_assert (g_regex_match (a, b, 0, NULL), "a.match( b )");
+       _g_free0 (b);
+       _g_regex_unref0 (a);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/literal-template-string.c-expected b/tests/genie/literal-template-string.c-expected
new file mode 100644
index 000000000..d392fdc78
--- /dev/null
+++ b/tests/genie/literal-template-string.c-expected
@@ -0,0 +1,61 @@
+/* genie_literal_template_string.c generated by valac, the Vala compiler
+ * generated from genie_literal_template_string.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static const gchar*
+string_to_string (const gchar* self)
+{
+       const gchar* result = NULL;
+       g_return_val_if_fail (self != NULL, NULL);
+       result = self;
+       return result;
+}
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       gchar* a = NULL;
+       gchar* _tmp0_;
+       gint b = 0;
+       gchar* c = NULL;
+       const gchar* _tmp1_;
+       gchar* _tmp2_;
+       gchar* _tmp3_;
+       gchar* _tmp4_;
+       gchar* _tmp5_;
+       _tmp0_ = g_strdup ("test");
+       a = _tmp0_;
+       b = 100;
+       _tmp1_ = string_to_string (a);
+       _tmp2_ = g_strdup_printf ("%i", b);
+       _tmp3_ = _tmp2_;
+       _tmp4_ = g_strconcat (_tmp1_, _tmp3_, NULL);
+       _tmp5_ = _tmp4_;
+       _g_free0 (_tmp3_);
+       c = _tmp5_;
+       _vala_assert (g_strcmp0 (c, "test100") == 0, "c == \"test100\"");
+       _g_free0 (c);
+       _g_free0 (a);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/literal-verbatim-string.c-expected b/tests/genie/literal-verbatim-string.c-expected
new file mode 100644
index 000000000..d10367a7a
--- /dev/null
+++ b/tests/genie/literal-verbatim-string.c-expected
@@ -0,0 +1,36 @@
+/* genie_literal_verbatim_string.c generated by valac, the Vala compiler
+ * generated from genie_literal_verbatim_string.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       gchar* a = NULL;
+       gchar* _tmp0_;
+       _tmp0_ = g_strdup ("multi\nline\nstring");
+       a = _tmp0_;
+       _vala_assert (g_strcmp0 (a, "multi\nline\nstring") == 0, "a == \"multi\\nline\\nstring\"");
+       _g_free0 (a);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/operator-addition.c-expected b/tests/genie/operator-addition.c-expected
new file mode 100644
index 000000000..867d27f05
--- /dev/null
+++ b/tests/genie/operator-addition.c-expected
@@ -0,0 +1,32 @@
+/* genie_operator_addition.c generated by valac, the Vala compiler
+ * generated from genie_operator_addition.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       gint a = 0;
+       a = 1 + 1;
+       _vala_assert (a == 2, "a == 2");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/operator-assignment-combined.c-expected 
b/tests/genie/operator-assignment-combined.c-expected
new file mode 100644
index 000000000..f92f2010b
--- /dev/null
+++ b/tests/genie/operator-assignment-combined.c-expected
@@ -0,0 +1,59 @@
+/* genie_operator_assignment_combined.c generated by valac, the Vala compiler
+ * generated from genie_operator_assignment_combined.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       gint a = 0;
+       gint _tmp0_;
+       gint _tmp1_;
+       a = 2;
+       a += 1;
+       _vala_assert (a == 3, "a == 3");
+       a -= 1;
+       _vala_assert (a == 2, "a == 2");
+       a /= 2;
+       _vala_assert (a == 1, "a == 1");
+       a *= 2;
+       _vala_assert (a == 2, "a == 2");
+       a %= 2;
+       _vala_assert (a == 0, "a == 0");
+       _tmp0_ = a;
+       a = _tmp0_ + 1;
+       _vala_assert (a == 1, "a == 1");
+       _tmp1_ = a;
+       a = _tmp1_ - 1;
+       _vala_assert (a == 0, "a == 0");
+       a |= 1;
+       _vala_assert (a == 1, "a == 1");
+       a &= 3;
+       _vala_assert (a == 1, "a == 1");
+       a ^= 3;
+       _vala_assert (a == 2, "a == 2");
+       a >>= 1;
+       _vala_assert (a == 1, "a == 1");
+       a <<= 1;
+       _vala_assert (a == 2, "a == 2");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/operator-assignment.c-expected b/tests/genie/operator-assignment.c-expected
new file mode 100644
index 000000000..39020a6c4
--- /dev/null
+++ b/tests/genie/operator-assignment.c-expected
@@ -0,0 +1,32 @@
+/* genie_operator_assignment.c generated by valac, the Vala compiler
+ * generated from genie_operator_assignment.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       gint a = 0;
+       a = 1;
+       _vala_assert (a == 1, "a == 1");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/operator-bitwise-and.c-expected b/tests/genie/operator-bitwise-and.c-expected
new file mode 100644
index 000000000..cb7dc1850
--- /dev/null
+++ b/tests/genie/operator-bitwise-and.c-expected
@@ -0,0 +1,34 @@
+/* genie_operator_bitwise_and.c generated by valac, the Vala compiler
+ * generated from genie_operator_bitwise_and.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       gint a = 0;
+       gint b = 0;
+       a = 5;
+       b = a & 7;
+       _vala_assert (b == 5, "b == 5");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/operator-bitwise-left-shift.c-expected 
b/tests/genie/operator-bitwise-left-shift.c-expected
new file mode 100644
index 000000000..79aa349c9
--- /dev/null
+++ b/tests/genie/operator-bitwise-left-shift.c-expected
@@ -0,0 +1,34 @@
+/* genie_operator_bitwise_left_shift.c generated by valac, the Vala compiler
+ * generated from genie_operator_bitwise_left_shift.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       gint a = 0;
+       gint b = 0;
+       a = 5;
+       b = a << 1;
+       _vala_assert (b == 10, "b == 10");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/operator-bitwise-not.c-expected b/tests/genie/operator-bitwise-not.c-expected
new file mode 100644
index 000000000..526bc2dd6
--- /dev/null
+++ b/tests/genie/operator-bitwise-not.c-expected
@@ -0,0 +1,34 @@
+/* genie_operator_bitwise_not.c generated by valac, the Vala compiler
+ * generated from genie_operator_bitwise_not.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       gint a = 0;
+       gint b = 0;
+       a = 5;
+       b = ~a;
+       _vala_assert (b == (-6), "b == -6");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/operator-bitwise-or.c-expected b/tests/genie/operator-bitwise-or.c-expected
new file mode 100644
index 000000000..d14ba9f53
--- /dev/null
+++ b/tests/genie/operator-bitwise-or.c-expected
@@ -0,0 +1,34 @@
+/* genie_operator_bitwise_or.c generated by valac, the Vala compiler
+ * generated from genie_operator_bitwise_or.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       gint a = 0;
+       gint b = 0;
+       a = 5;
+       b = a | 3;
+       _vala_assert (b == 7, "b == 7");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/operator-bitwise-right-shift.c-expected 
b/tests/genie/operator-bitwise-right-shift.c-expected
new file mode 100644
index 000000000..c0700350e
--- /dev/null
+++ b/tests/genie/operator-bitwise-right-shift.c-expected
@@ -0,0 +1,34 @@
+/* genie_operator_bitwise_right_shift.c generated by valac, the Vala compiler
+ * generated from genie_operator_bitwise_right_shift.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       gint a = 0;
+       gint b = 0;
+       a = 5;
+       b = a >> 1;
+       _vala_assert (b == 2, "b == 2");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/operator-bitwise-xor.c-expected b/tests/genie/operator-bitwise-xor.c-expected
new file mode 100644
index 000000000..6a8db99dc
--- /dev/null
+++ b/tests/genie/operator-bitwise-xor.c-expected
@@ -0,0 +1,34 @@
+/* genie_operator_bitwise_xor.c generated by valac, the Vala compiler
+ * generated from genie_operator_bitwise_xor.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       gint a = 0;
+       gint b = 0;
+       a = 5;
+       b = a ^ 7;
+       _vala_assert (b == 2, "b == 2");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/operator-division.c-expected b/tests/genie/operator-division.c-expected
new file mode 100644
index 000000000..edcf30541
--- /dev/null
+++ b/tests/genie/operator-division.c-expected
@@ -0,0 +1,32 @@
+/* genie_operator_division.c generated by valac, the Vala compiler
+ * generated from genie_operator_division.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       gint a = 0;
+       a = 100 / 10;
+       _vala_assert (a == 10, "a == 10");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/operator-equal.c-expected b/tests/genie/operator-equal.c-expected
new file mode 100644
index 000000000..c481f40cf
--- /dev/null
+++ b/tests/genie/operator-equal.c-expected
@@ -0,0 +1,40 @@
+/* genie_operator_equal.c generated by valac, the Vala compiler
+ * generated from genie_operator_equal.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       gchar* a = NULL;
+       gchar* _tmp0_;
+       _tmp0_ = g_strdup ("test");
+       a = _tmp0_;
+       if (g_strcmp0 (a, "test") == 0) {
+               _vala_assert (g_strcmp0 (a, "test") == 0, "a == \"test\"");
+       } else {
+               g_assert_not_reached ();
+       }
+       _g_free0 (a);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/operator-greater-than-equal.c-expected 
b/tests/genie/operator-greater-than-equal.c-expected
new file mode 100644
index 000000000..20c23ce14
--- /dev/null
+++ b/tests/genie/operator-greater-than-equal.c-expected
@@ -0,0 +1,36 @@
+/* genie_operator_greater_than_equal.c generated by valac, the Vala compiler
+ * generated from genie_operator_greater_than_equal.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       gint a = 0;
+       a = 10;
+       if (a >= 10) {
+               _vala_assert (a >= 10, "a >= 10");
+       } else {
+               g_assert_not_reached ();
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/operator-less-than-equal.c-expected b/tests/genie/operator-less-than-equal.c-expected
new file mode 100644
index 000000000..8d742948c
--- /dev/null
+++ b/tests/genie/operator-less-than-equal.c-expected
@@ -0,0 +1,36 @@
+/* genie_operator_less_than_equal.c generated by valac, the Vala compiler
+ * generated from genie_operator_less_than_equal.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       gint a = 0;
+       a = 10;
+       if (a <= 10) {
+               _vala_assert (a <= 10, "a <= 10");
+       } else {
+               g_assert_not_reached ();
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/operator-less-than.c-expected b/tests/genie/operator-less-than.c-expected
new file mode 100644
index 000000000..7996517c2
--- /dev/null
+++ b/tests/genie/operator-less-than.c-expected
@@ -0,0 +1,36 @@
+/* genie_operator_less_than.c generated by valac, the Vala compiler
+ * generated from genie_operator_less_than.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       gint a = 0;
+       a = 10;
+       if (a < 11) {
+               _vala_assert (a < 11, "a < 11");
+       } else {
+               g_assert_not_reached ();
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/operator-logical-and.c-expected b/tests/genie/operator-logical-and.c-expected
new file mode 100644
index 000000000..ee0de64b6
--- /dev/null
+++ b/tests/genie/operator-logical-and.c-expected
@@ -0,0 +1,47 @@
+/* genie_operator_logical_and.c generated by valac, the Vala compiler
+ * generated from genie_operator_logical_and.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       gboolean a = FALSE;
+       gboolean b = FALSE;
+       gboolean _tmp0_ = FALSE;
+       gboolean _tmp1_ = FALSE;
+       a = TRUE;
+       b = TRUE;
+       if (a) {
+               _tmp0_ = b;
+       } else {
+               _tmp0_ = FALSE;
+       }
+       _vala_assert (_tmp0_, "a and b");
+       if (a) {
+               _tmp1_ = b;
+       } else {
+               _tmp1_ = FALSE;
+       }
+       _vala_assert (_tmp1_, "a && b");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/operator-logical-not.c-expected b/tests/genie/operator-logical-not.c-expected
new file mode 100644
index 000000000..011303303
--- /dev/null
+++ b/tests/genie/operator-logical-not.c-expected
@@ -0,0 +1,36 @@
+/* genie_operator_logical_not.c generated by valac, the Vala compiler
+ * generated from genie_operator_logical_not.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       gboolean a = FALSE;
+       a = FALSE;
+       if (!a) {
+               _vala_assert (!a, "!a");
+       } else {
+               g_assert_not_reached ();
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/operator-logical-or.c-expected b/tests/genie/operator-logical-or.c-expected
new file mode 100644
index 000000000..d90e3dfad
--- /dev/null
+++ b/tests/genie/operator-logical-or.c-expected
@@ -0,0 +1,47 @@
+/* genie_operator_logical_or.c generated by valac, the Vala compiler
+ * generated from genie_operator_logical_or.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       gboolean a = FALSE;
+       gboolean b = FALSE;
+       gboolean _tmp0_ = FALSE;
+       gboolean _tmp1_ = FALSE;
+       a = FALSE;
+       b = TRUE;
+       if (a) {
+               _tmp0_ = TRUE;
+       } else {
+               _tmp0_ = b;
+       }
+       _vala_assert (_tmp0_, "a or b");
+       if (a) {
+               _tmp1_ = TRUE;
+       } else {
+               _tmp1_ = b;
+       }
+       _vala_assert (_tmp1_, "a || b");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/operator-modulo.c-expected b/tests/genie/operator-modulo.c-expected
new file mode 100644
index 000000000..23560bdb6
--- /dev/null
+++ b/tests/genie/operator-modulo.c-expected
@@ -0,0 +1,32 @@
+/* genie_operator_modulo.c generated by valac, the Vala compiler
+ * generated from genie_operator_modulo.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       gint a = 0;
+       a = 11 % 10;
+       _vala_assert (a == 1, "a == 1");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/operator-multiply.c-expected b/tests/genie/operator-multiply.c-expected
new file mode 100644
index 000000000..ec6032578
--- /dev/null
+++ b/tests/genie/operator-multiply.c-expected
@@ -0,0 +1,32 @@
+/* genie_operator_multiply.c generated by valac, the Vala compiler
+ * generated from genie_operator_multiply.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       gint a = 0;
+       a = 1 * 2;
+       _vala_assert (a == 2, "a == 2");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/operator-not-equal.c-expected b/tests/genie/operator-not-equal.c-expected
new file mode 100644
index 000000000..35b3326c5
--- /dev/null
+++ b/tests/genie/operator-not-equal.c-expected
@@ -0,0 +1,40 @@
+/* genie_operator_not_equal.c generated by valac, the Vala compiler
+ * generated from genie_operator_not_equal.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       gchar* a = NULL;
+       gchar* _tmp0_;
+       _tmp0_ = g_strdup ("not");
+       a = _tmp0_;
+       if (g_strcmp0 (a, "test") != 0) {
+               _vala_assert (g_strcmp0 (a, "test") != 0, "a != \"test\"");
+       } else {
+               g_assert_not_reached ();
+       }
+       _g_free0 (a);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/operator-post-decrement.c-expected b/tests/genie/operator-post-decrement.c-expected
new file mode 100644
index 000000000..855e92401
--- /dev/null
+++ b/tests/genie/operator-post-decrement.c-expected
@@ -0,0 +1,38 @@
+/* genie_operator_post_decrement.c generated by valac, the Vala compiler
+ * generated from genie_operator_post_decrement.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       gint a = 0;
+       gint b = 0;
+       gint _tmp0_;
+       a = 1;
+       _tmp0_ = a;
+       a = _tmp0_ - 1;
+       b = _tmp0_;
+       _vala_assert (a == 0, "a == 0");
+       _vala_assert (b == 1, "b == 1");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/operator-post-increment.c-expected b/tests/genie/operator-post-increment.c-expected
new file mode 100644
index 000000000..3ff86cfb7
--- /dev/null
+++ b/tests/genie/operator-post-increment.c-expected
@@ -0,0 +1,38 @@
+/* genie_operator_post_increment.c generated by valac, the Vala compiler
+ * generated from genie_operator_post_increment.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       gint a = 0;
+       gint b = 0;
+       gint _tmp0_;
+       a = 1;
+       _tmp0_ = a;
+       a = _tmp0_ + 1;
+       b = _tmp0_;
+       _vala_assert (a == 2, "a == 2");
+       _vala_assert (b == 1, "b == 1");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/operator-pre-decrement.c-expected b/tests/genie/operator-pre-decrement.c-expected
new file mode 100644
index 000000000..3841761c6
--- /dev/null
+++ b/tests/genie/operator-pre-decrement.c-expected
@@ -0,0 +1,38 @@
+/* genie_operator_pre_decrement.c generated by valac, the Vala compiler
+ * generated from genie_operator_pre_decrement.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       gint a = 0;
+       gint b = 0;
+       gint _tmp0_;
+       a = 1;
+       a = a - 1;
+       _tmp0_ = a;
+       b = _tmp0_;
+       _vala_assert (a == 0, "a == 0");
+       _vala_assert (b == 0, "b == 0");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/operator-pre-increment.c-expected b/tests/genie/operator-pre-increment.c-expected
new file mode 100644
index 000000000..d02e3b06b
--- /dev/null
+++ b/tests/genie/operator-pre-increment.c-expected
@@ -0,0 +1,38 @@
+/* genie_operator_pre_increment.c generated by valac, the Vala compiler
+ * generated from genie_operator_pre_increment.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       gint a = 0;
+       gint b = 0;
+       gint _tmp0_;
+       a = 1;
+       a = a + 1;
+       _tmp0_ = a;
+       b = _tmp0_;
+       _vala_assert (a == 2, "a == 2");
+       _vala_assert (b == 2, "b == 2");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/operator-subtraction.c-expected b/tests/genie/operator-subtraction.c-expected
new file mode 100644
index 000000000..b5cbf4fe6
--- /dev/null
+++ b/tests/genie/operator-subtraction.c-expected
@@ -0,0 +1,32 @@
+/* genie_operator_subtraction.c generated by valac, the Vala compiler
+ * generated from genie_operator_subtraction.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       gint a = 0;
+       a = 2 - 1;
+       _vala_assert (a == 1, "a == 1");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/operator-ternary.c-expected b/tests/genie/operator-ternary.c-expected
new file mode 100644
index 000000000..e22d41c8d
--- /dev/null
+++ b/tests/genie/operator-ternary.c-expected
@@ -0,0 +1,44 @@
+/* genie_operator_ternary.c generated by valac, the Vala compiler
+ * generated from genie_operator_ternary.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       gboolean a = FALSE;
+       const gchar* _tmp0_ = NULL;
+       gchar* b = NULL;
+       gchar* _tmp1_;
+       a = FALSE;
+       if (a) {
+               _tmp0_ = "true";
+       } else {
+               _tmp0_ = "false";
+       }
+       _tmp1_ = g_strdup (_tmp0_);
+       b = _tmp1_;
+       _vala_assert (g_strcmp0 (b, "false") == 0, "b == \"false\"");
+       _g_free0 (b);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/operators-greater-than.c-expected b/tests/genie/operators-greater-than.c-expected
new file mode 100644
index 000000000..85d707767
--- /dev/null
+++ b/tests/genie/operators-greater-than.c-expected
@@ -0,0 +1,36 @@
+/* genie_operators_greater_than.c generated by valac, the Vala compiler
+ * generated from genie_operators_greater_than.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       gint a = 0;
+       a = 10;
+       if (a > 9) {
+               _vala_assert (a > 9, "a > 9");
+       } else {
+               g_assert_not_reached ();
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/preparser-and-expression.c-expected b/tests/genie/preparser-and-expression.c-expected
new file mode 100644
index 000000000..b1c2e293b
--- /dev/null
+++ b/tests/genie/preparser-and-expression.c-expected
@@ -0,0 +1,30 @@
+/* genie_preparser_and_expression.c generated by valac, the Vala compiler
+ * generated from genie_preparser_and_expression.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       _vala_assert (TRUE, "true");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/preparser-elif.c-expected b/tests/genie/preparser-elif.c-expected
new file mode 100644
index 000000000..785a90927
--- /dev/null
+++ b/tests/genie/preparser-elif.c-expected
@@ -0,0 +1,30 @@
+/* genie_preparser_elif.c generated by valac, the Vala compiler
+ * generated from genie_preparser_elif.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       _vala_assert (TRUE, "true");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/preparser-equality-expression.c-expected 
b/tests/genie/preparser-equality-expression.c-expected
new file mode 100644
index 000000000..fced1071e
--- /dev/null
+++ b/tests/genie/preparser-equality-expression.c-expected
@@ -0,0 +1,30 @@
+/* genie_preparser_equality_expression.c generated by valac, the Vala compiler
+ * generated from genie_preparser_equality_expression.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       _vala_assert (TRUE, "true");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/preparser-not.c-expected b/tests/genie/preparser-not.c-expected
new file mode 100644
index 000000000..ddc0b1e91
--- /dev/null
+++ b/tests/genie/preparser-not.c-expected
@@ -0,0 +1,30 @@
+/* genie_preparser_not.c generated by valac, the Vala compiler
+ * generated from genie_preparser_not.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       _vala_assert (TRUE, "true");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/preparser-or-expression.c-expected b/tests/genie/preparser-or-expression.c-expected
new file mode 100644
index 000000000..0967bc9b7
--- /dev/null
+++ b/tests/genie/preparser-or-expression.c-expected
@@ -0,0 +1,30 @@
+/* genie_preparser_or_expression.c generated by valac, the Vala compiler
+ * generated from genie_preparser_or_expression.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       _vala_assert (TRUE, "true");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/preparser.c-expected b/tests/genie/preparser.c-expected
new file mode 100644
index 000000000..a472a63b0
--- /dev/null
+++ b/tests/genie/preparser.c-expected
@@ -0,0 +1,45 @@
+/* genie_preparser.c generated by valac, the Vala compiler
+ * generated from genie_preparser.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       gchar* _result_ = NULL;
+       gchar* _tmp0_;
+       gchar* _tmp1_;
+       const gchar* _tmp2_;
+       const gchar* _tmp3_;
+       _tmp0_ = g_strdup ("");
+       _result_ = _tmp0_;
+       _tmp1_ = g_strdup ("0.16+");
+       _g_free0 (_result_);
+       _result_ = _tmp1_;
+       _tmp2_ = _result_;
+       _vala_assert (g_strcmp0 (_tmp2_, "") != 0, "result != \"\"");
+       _tmp3_ = _result_;
+       _vala_assert (g_strcmp0 (_tmp3_, "0.16+") == 0, "result == \"0.16+\"");
+       _g_free0 (_result_);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/struct-after-class.c-expected b/tests/genie/struct-after-class.c-expected
new file mode 100644
index 000000000..907506622
--- /dev/null
+++ b/tests/genie/struct-after-class.c-expected
@@ -0,0 +1,400 @@
+/* genie_struct_after_class.c generated by valac, the Vala compiler
+ * generated from genie_struct_after_class.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+#include <glib-object.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TESTCLASS (testclass_get_type ())
+#define TESTCLASS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TESTCLASS, TestClass))
+#define TESTCLASS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TESTCLASS, TestClassClass))
+#define IS_TESTCLASS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TESTCLASS))
+#define IS_TESTCLASS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TESTCLASS))
+#define TESTCLASS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TESTCLASS, TestClassClass))
+
+typedef struct _TestClass TestClass;
+typedef struct _TestClassClass TestClassClass;
+
+#define TYPE_TEST_STRUCT (test_struct_get_type ())
+typedef struct _TestStruct TestStruct;
+typedef struct _TestClassPrivate TestClassPrivate;
+#define _testclass_unref0(var) ((var == NULL) ? NULL : (var = (testclass_unref (var), NULL)))
+#define _g_free0(var) (var = (g_free (var), NULL))
+typedef struct _ParamSpecTestClass ParamSpecTestClass;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _TestStruct {
+       gchar* empty;
+};
+
+struct _TestClass {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       TestClassPrivate * priv;
+       gchar* empty;
+};
+
+struct _TestClassClass {
+       GTypeClass parent_class;
+       void (*finalize) (TestClass *self);
+};
+
+struct _ParamSpecTestClass {
+       GParamSpec parent_instance;
+};
+
+static gpointer testclass_parent_class = NULL;
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+VALA_EXTERN gpointer testclass_ref (gpointer instance);
+VALA_EXTERN void testclass_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_testclass (const gchar* name,
+                                  const gchar* nick,
+                                  const gchar* blurb,
+                                  GType object_type,
+                                  GParamFlags flags);
+VALA_EXTERN void value_set_testclass (GValue* value,
+                          gpointer v_object);
+VALA_EXTERN void value_take_testclass (GValue* value,
+                           gpointer v_object);
+VALA_EXTERN gpointer value_get_testclass (const GValue* value);
+VALA_EXTERN GType testclass_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (TestClass, testclass_unref)
+VALA_EXTERN TestClass* testclass_new (void);
+VALA_EXTERN TestClass* testclass_construct (GType object_type);
+VALA_EXTERN GType test_struct_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN TestStruct* test_struct_dup (const TestStruct* self);
+VALA_EXTERN void test_struct_free (TestStruct* self);
+VALA_EXTERN void test_struct_copy (const TestStruct* self,
+                       TestStruct* dest);
+VALA_EXTERN void test_struct_destroy (TestStruct* self);
+VALA_EXTERN void test_struct_init (TestStruct *self);
+static void testclass_finalize (TestClass * obj);
+static GType testclass_get_type_once (void);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       TestClass* a = NULL;
+       TestClass* _tmp0_;
+       TestStruct b = {0};
+       const gchar* _tmp1_;
+       TestStruct _tmp2_;
+       const gchar* _tmp3_;
+       _tmp0_ = testclass_new ();
+       a = _tmp0_;
+       test_struct_init (&b);
+       _tmp1_ = a->empty;
+       _tmp2_ = b;
+       _tmp3_ = _tmp2_.empty;
+       _vala_assert (g_strcmp0 (_tmp1_, _tmp3_) == 0, "a.empty == b.empty");
+       test_struct_destroy (&b);
+       _testclass_unref0 (a);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
+TestClass*
+testclass_construct (GType object_type)
+{
+       TestClass* self = NULL;
+       self = (TestClass*) g_type_create_instance (object_type);
+       return self;
+}
+
+TestClass*
+testclass_new (void)
+{
+       return testclass_construct (TYPE_TESTCLASS);
+}
+
+static void
+value_testclass_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_testclass_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               testclass_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_testclass_copy_value (const GValue* src_value,
+                            GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = testclass_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_testclass_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_testclass_collect_value (GValue* value,
+                               guint n_collect_values,
+                               GTypeCValue* collect_values,
+                               guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               TestClass * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = testclass_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_testclass_lcopy_value (const GValue* value,
+                             guint n_collect_values,
+                             GTypeCValue* collect_values,
+                             guint collect_flags)
+{
+       TestClass ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = testclass_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_testclass (const gchar* name,
+                      const gchar* nick,
+                      const gchar* blurb,
+                      GType object_type,
+                      GParamFlags flags)
+{
+       ParamSpecTestClass* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_TESTCLASS), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_testclass (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_TESTCLASS), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_testclass (GValue* value,
+                     gpointer v_object)
+{
+       TestClass * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_TESTCLASS));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_TESTCLASS));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               testclass_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               testclass_unref (old);
+       }
+}
+
+void
+value_take_testclass (GValue* value,
+                      gpointer v_object)
+{
+       TestClass * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_TESTCLASS));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_TESTCLASS));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               testclass_unref (old);
+       }
+}
+
+static void
+testclass_class_init (TestClassClass * klass,
+                      gpointer klass_data)
+{
+       testclass_parent_class = g_type_class_peek_parent (klass);
+       ((TestClassClass *) klass)->finalize = testclass_finalize;
+}
+
+static void
+testclass_instance_init (TestClass * self,
+                         gpointer klass)
+{
+       gchar* _tmp0_;
+       _tmp0_ = g_strdup ("");
+       self->empty = _tmp0_;
+       self->ref_count = 1;
+}
+
+static void
+testclass_finalize (TestClass * obj)
+{
+       TestClass * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_TESTCLASS, TestClass);
+       g_signal_handlers_destroy (self);
+       _g_free0 (self->empty);
+}
+
+static GType
+testclass_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_testclass_init, 
value_testclass_free_value, value_testclass_copy_value, value_testclass_peek_pointer, "p", 
value_testclass_collect_value, "p", value_testclass_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (TestClassClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) testclass_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(TestClass), 0, (GInstanceInitFunc) testclass_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType testclass_type_id;
+       testclass_type_id = g_type_register_fundamental (g_type_fundamental_next (), "TestClass", 
&g_define_type_info, &g_define_type_fundamental_info, 0);
+       return testclass_type_id;
+}
+
+GType
+testclass_get_type (void)
+{
+       static volatile gsize testclass_type_id__volatile = 0;
+       if (g_once_init_enter (&testclass_type_id__volatile)) {
+               GType testclass_type_id;
+               testclass_type_id = testclass_get_type_once ();
+               g_once_init_leave (&testclass_type_id__volatile, testclass_type_id);
+       }
+       return testclass_type_id__volatile;
+}
+
+gpointer
+testclass_ref (gpointer instance)
+{
+       TestClass * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+testclass_unref (gpointer instance)
+{
+       TestClass * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               TESTCLASS_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+void
+test_struct_init (TestStruct *self)
+{
+       gchar* _tmp0_;
+       memset (self, 0, sizeof (TestStruct));
+       _tmp0_ = g_strdup ("");
+       _g_free0 ((*self).empty);
+       (*self).empty = _tmp0_;
+}
+
+void
+test_struct_copy (const TestStruct* self,
+                  TestStruct* dest)
+{
+       const gchar* _tmp0_;
+       gchar* _tmp1_;
+       _tmp0_ = (*self).empty;
+       _tmp1_ = g_strdup (_tmp0_);
+       _g_free0 ((*dest).empty);
+       (*dest).empty = _tmp1_;
+}
+
+void
+test_struct_destroy (TestStruct* self)
+{
+       _g_free0 ((*self).empty);
+}
+
+TestStruct*
+test_struct_dup (const TestStruct* self)
+{
+       TestStruct* dup;
+       dup = g_new0 (TestStruct, 1);
+       test_struct_copy (self, dup);
+       return dup;
+}
+
+void
+test_struct_free (TestStruct* self)
+{
+       test_struct_destroy (self);
+       g_free (self);
+}
+
+static GType
+test_struct_get_type_once (void)
+{
+       GType test_struct_type_id;
+       test_struct_type_id = g_boxed_type_register_static ("TestStruct", (GBoxedCopyFunc) test_struct_dup, 
(GBoxedFreeFunc) test_struct_free);
+       return test_struct_type_id;
+}
+
+GType
+test_struct_get_type (void)
+{
+       static volatile gsize test_struct_type_id__volatile = 0;
+       if (g_once_init_enter (&test_struct_type_id__volatile)) {
+               GType test_struct_type_id;
+               test_struct_type_id = test_struct_get_type_once ();
+               g_once_init_leave (&test_struct_type_id__volatile, test_struct_type_id);
+       }
+       return test_struct_type_id__volatile;
+}
+
diff --git a/tests/genie/struct.c-expected b/tests/genie/struct.c-expected
new file mode 100644
index 000000000..c7c367c87
--- /dev/null
+++ b/tests/genie/struct.c-expected
@@ -0,0 +1,126 @@
+/* genie_struct.c generated by valac, the Vala compiler
+ * generated from genie_struct.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+#include <glib-object.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+typedef struct _Test Test;
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Test {
+       gchar* empty;
+};
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Test* test_dup (const Test* self);
+VALA_EXTERN void test_free (Test* self);
+VALA_EXTERN void test_copy (const Test* self,
+                Test* dest);
+VALA_EXTERN void test_destroy (Test* self);
+VALA_EXTERN void test_init (Test *self);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       Test a = {0};
+       Test _tmp0_;
+       const gchar* _tmp1_;
+       test_init (&a);
+       _tmp0_ = a;
+       _tmp1_ = _tmp0_.empty;
+       _vala_assert (g_strcmp0 (_tmp1_, "") == 0, "a.empty == \"\"");
+       test_destroy (&a);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
+void
+test_init (Test *self)
+{
+       gchar* _tmp0_;
+       memset (self, 0, sizeof (Test));
+       _tmp0_ = g_strdup ("");
+       _g_free0 ((*self).empty);
+       (*self).empty = _tmp0_;
+}
+
+void
+test_copy (const Test* self,
+           Test* dest)
+{
+       const gchar* _tmp0_;
+       gchar* _tmp1_;
+       _tmp0_ = (*self).empty;
+       _tmp1_ = g_strdup (_tmp0_);
+       _g_free0 ((*dest).empty);
+       (*dest).empty = _tmp1_;
+}
+
+void
+test_destroy (Test* self)
+{
+       _g_free0 ((*self).empty);
+}
+
+Test*
+test_dup (const Test* self)
+{
+       Test* dup;
+       dup = g_new0 (Test, 1);
+       test_copy (self, dup);
+       return dup;
+}
+
+void
+test_free (Test* self)
+{
+       test_destroy (self);
+       g_free (self);
+}
+
+static GType
+test_get_type_once (void)
+{
+       GType test_type_id;
+       test_type_id = g_boxed_type_register_static ("Test", (GBoxedCopyFunc) test_dup, (GBoxedFreeFunc) 
test_free);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
diff --git a/tests/glib/conditional-glib-api.c-expected b/tests/glib/conditional-glib-api.c-expected
new file mode 100644
index 000000000..135890686
--- /dev/null
+++ b/tests/glib/conditional-glib-api.c-expected
@@ -0,0 +1,757 @@
+/* glib_conditional_glib_api.c generated by valac, the Vala compiler
+ * generated from glib_conditional_glib_api.vala, do not modify */
+
+/* glib 2.54 g_enum_to_string / g_flags_to_string*/
+/* glib 2.58 G_GNUC_NO_INLINE*/
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+#include <stdlib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef enum  {
+       FOO_ENUM_BAR
+} FooEnum;
+
+#define TYPE_FOO_ENUM (foo_enum_get_type ())
+#define _g_free0(var) (var = (g_free (var), NULL))
+typedef enum  {
+       FOO_FLAG_BAR = 1 << 0
+} FooFlag;
+
+#define TYPE_FOO_FLAG (foo_flag_get_type ())
+
+#define TYPE_FOO_MEM_DUP2 (foo_mem_dup2_get_type ())
+typedef struct _FooMemDup2 FooMemDup2;
+#define _foo_mem_dup2_free0(var) ((var == NULL) ? NULL : (var = (foo_mem_dup2_free (var), NULL)))
+#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
+
+#define TYPE_FOO_VOLATILE (foo_volatile_get_type ())
+#define FOO_VOLATILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO_VOLATILE, FooVolatile))
+#define FOO_VOLATILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO_VOLATILE, FooVolatileClass))
+#define IS_FOO_VOLATILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO_VOLATILE))
+#define IS_FOO_VOLATILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO_VOLATILE))
+#define FOO_VOLATILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO_VOLATILE, FooVolatileClass))
+
+typedef struct _FooVolatile FooVolatile;
+typedef struct _FooVolatileClass FooVolatileClass;
+typedef struct _FooVolatilePrivate FooVolatilePrivate;
+enum  {
+       FOO_VOLATILE_0_PROPERTY,
+       FOO_VOLATILE_NUM_PROPERTIES
+};
+static GParamSpec* foo_volatile_properties[FOO_VOLATILE_NUM_PROPERTIES];
+
+#define TYPE_BAR_VOLATILE (bar_volatile_get_type ())
+#define BAR_VOLATILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR_VOLATILE, BarVolatile))
+#define BAR_VOLATILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR_VOLATILE, BarVolatileClass))
+#define IS_BAR_VOLATILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR_VOLATILE))
+#define IS_BAR_VOLATILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR_VOLATILE))
+#define BAR_VOLATILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR_VOLATILE, BarVolatileClass))
+
+typedef struct _BarVolatile BarVolatile;
+typedef struct _BarVolatileClass BarVolatileClass;
+typedef struct _BarVolatilePrivate BarVolatilePrivate;
+typedef struct _ParamSpecBarVolatile ParamSpecBarVolatile;
+#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
+
+struct _FooMemDup2 {
+       gint i;
+};
+
+struct _FooVolatile {
+       GObject parent_instance;
+       FooVolatilePrivate * priv;
+};
+
+struct _FooVolatileClass {
+       GObjectClass parent_class;
+};
+
+struct _BarVolatile {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       BarVolatilePrivate * priv;
+};
+
+struct _BarVolatileClass {
+       GTypeClass parent_class;
+       void (*finalize) (BarVolatile *self);
+};
+
+struct _ParamSpecBarVolatile {
+       GParamSpec parent_instance;
+};
+
+static gpointer foo_volatile_parent_class = NULL;
+static gpointer bar_volatile_parent_class = NULL;
+
+VALA_EXTERN GType foo_enum_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN void use_g_enum_to_string (void);
+VALA_EXTERN GType foo_flag_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN void use_g_flags_to_string (void);
+VALA_EXTERN GType foo_mem_dup2_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN FooMemDup2* foo_mem_dup2_dup (const FooMemDup2* self);
+VALA_EXTERN void foo_mem_dup2_free (FooMemDup2* self);
+VALA_EXTERN void use_g_memdup2 (void);
+static const gchar** _vala_array_dup1 (const gchar** self,
+                                gssize length);
+static guint8* _vala_array_dup2 (guint8* self,
+                          gssize length);
+static GVariant* _variant_new1 (guint8* value,
+                         gint value_length1);
+static guint8* _variant_get1 (GVariant* value,
+                       gint* result_length1);
+static GVariant* _variant_new2 (FooMemDup2* value);
+static FooMemDup2* _variant_get2 (GVariant* value);
+VALA_EXTERN GType foo_volatile_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (FooVolatile, g_object_unref)
+VALA_EXTERN FooVolatile* foo_volatile_new (void);
+VALA_EXTERN FooVolatile* foo_volatile_construct (GType object_type);
+static GObject * foo_volatile_constructor (GType type,
+                                    guint n_construct_properties,
+                                    GObjectConstructParam * construct_properties);
+static GType foo_volatile_get_type_once (void);
+VALA_EXTERN gpointer bar_volatile_ref (gpointer instance);
+VALA_EXTERN void bar_volatile_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_bar_volatile (const gchar* name,
+                                     const gchar* nick,
+                                     const gchar* blurb,
+                                     GType object_type,
+                                     GParamFlags flags);
+VALA_EXTERN void value_set_bar_volatile (GValue* value,
+                             gpointer v_object);
+VALA_EXTERN void value_take_bar_volatile (GValue* value,
+                              gpointer v_object);
+VALA_EXTERN gpointer value_get_bar_volatile (const GValue* value);
+VALA_EXTERN GType bar_volatile_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (BarVolatile, bar_volatile_unref)
+VALA_EXTERN BarVolatile* bar_volatile_new (void);
+VALA_EXTERN BarVolatile* bar_volatile_construct (GType object_type);
+static void bar_volatile_finalize (BarVolatile * obj);
+static GType bar_volatile_get_type_once (void);
+VALA_EXTERN void no_use_volatile (void);
+static void _vala_main (void);
+
+static GRegex* _tmp_regex_0 = NULL;
+
+ G_GNUC_NO_INLINE static GType
+foo_enum_get_type_once (void)
+{
+       static const GEnumValue values[] = {{FOO_ENUM_BAR, "FOO_ENUM_BAR", "bar"}, {0, NULL, NULL}};
+       GType foo_enum_type_id;
+       foo_enum_type_id = g_enum_register_static ("FooEnum", values);
+       return foo_enum_type_id;
+}
+
+GType
+foo_enum_get_type (void)
+{
+       static gsize foo_enum_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_enum_type_id__volatile)) {
+               GType foo_enum_type_id;
+               foo_enum_type_id = foo_enum_get_type_once ();
+               g_once_init_leave (&foo_enum_type_id__volatile, foo_enum_type_id);
+       }
+       return foo_enum_type_id__volatile;
+}
+
+void
+use_g_enum_to_string (void)
+{
+       gchar* _tmp0_;
+       _tmp0_ = g_enum_to_string (TYPE_FOO_ENUM, FOO_ENUM_BAR);
+       _g_free0 (_tmp0_);
+}
+
+ G_GNUC_NO_INLINE static GType
+foo_flag_get_type_once (void)
+{
+       static const GFlagsValue values[] = {{FOO_FLAG_BAR, "FOO_FLAG_BAR", "bar"}, {0, NULL, NULL}};
+       GType foo_flag_type_id;
+       foo_flag_type_id = g_flags_register_static ("FooFlag", values);
+       return foo_flag_type_id;
+}
+
+GType
+foo_flag_get_type (void)
+{
+       static gsize foo_flag_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_flag_type_id__volatile)) {
+               GType foo_flag_type_id;
+               foo_flag_type_id = foo_flag_get_type_once ();
+               g_once_init_leave (&foo_flag_type_id__volatile, foo_flag_type_id);
+       }
+       return foo_flag_type_id__volatile;
+}
+
+void
+use_g_flags_to_string (void)
+{
+       gchar* _tmp0_;
+       _tmp0_ = g_flags_to_string (TYPE_FOO_FLAG, FOO_FLAG_BAR);
+       _g_free0 (_tmp0_);
+}
+
+FooMemDup2*
+foo_mem_dup2_dup (const FooMemDup2* self)
+{
+       FooMemDup2* dup;
+       dup = g_new0 (FooMemDup2, 1);
+       memcpy (dup, self, sizeof (FooMemDup2));
+       return dup;
+}
+
+void
+foo_mem_dup2_free (FooMemDup2* self)
+{
+       g_free (self);
+}
+
+ G_GNUC_NO_INLINE static GType
+foo_mem_dup2_get_type_once (void)
+{
+       GType foo_mem_dup2_type_id;
+       foo_mem_dup2_type_id = g_boxed_type_register_static ("FooMemDup2", (GBoxedCopyFunc) foo_mem_dup2_dup, 
(GBoxedFreeFunc) foo_mem_dup2_free);
+       return foo_mem_dup2_type_id;
+}
+
+GType
+foo_mem_dup2_get_type (void)
+{
+       static gsize foo_mem_dup2_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_mem_dup2_type_id__volatile)) {
+               GType foo_mem_dup2_type_id;
+               foo_mem_dup2_type_id = foo_mem_dup2_get_type_once ();
+               g_once_init_leave (&foo_mem_dup2_type_id__volatile, foo_mem_dup2_type_id);
+       }
+       return foo_mem_dup2_type_id__volatile;
+}
+
+static const gchar**
+_vala_array_dup1 (const gchar** self,
+                  gssize length)
+{
+       if (length > 0) {
+               return g_memdup2 (self, length * sizeof (const gchar*));
+       }
+       return NULL;
+}
+
+static guint8*
+string_get_data (const gchar* self,
+                 gint* result_length1)
+{
+       guint8* result;
+       guint8* res = NULL;
+       gint res_length1;
+       gint _res_size_;
+       gint _tmp0_;
+       gint _tmp1_;
+       guint8* _tmp2_;
+       gint _tmp2__length1;
+       g_return_val_if_fail (self != NULL, NULL);
+       res = (guint8*) self;
+       res_length1 = -1;
+       _res_size_ = res_length1;
+       _tmp0_ = strlen (self);
+       _tmp1_ = _tmp0_;
+       res_length1 = (gint) _tmp1_;
+       _tmp2_ = res;
+       _tmp2__length1 = res_length1;
+       if (result_length1) {
+               *result_length1 = _tmp2__length1;
+       }
+       result = _tmp2_;
+       return result;
+}
+
+static guint8*
+_vala_array_dup2 (guint8* self,
+                  gssize length)
+{
+       if (length > 0) {
+               return g_memdup2 (self, length * sizeof (guint8));
+       }
+       return NULL;
+}
+
+static GVariant*
+_variant_new1 (guint8* value,
+               gint value_length1)
+{
+       guint8* _tmp7_;
+       _tmp7_ = g_memdup2 (value, value_length1);
+       return g_variant_ref_sink (g_variant_new_from_data (G_VARIANT_TYPE ("ay"), _tmp7_, value_length1, 
TRUE, g_free, _tmp7_));
+}
+
+static guint8*
+_variant_get1 (GVariant* value,
+               gint* result_length1)
+{
+       gsize _tmp10__length;
+       guint8* _tmp10_;
+       _tmp10__length = g_variant_get_size (value);
+       _tmp10_ = g_memdup2 (g_variant_get_data (value), _tmp10__length);
+       *result_length1 = _tmp10__length;
+       return _tmp10_;
+}
+
+static gpointer
+_foo_mem_dup2_dup0 (gpointer self)
+{
+       return self ? foo_mem_dup2_dup (self) : NULL;
+}
+
+static GVariant*
+_variant_new2 (FooMemDup2* value)
+{
+       GVariantBuilder _tmp14_;
+       g_variant_builder_init (&_tmp14_, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_tmp14_, g_variant_new_int32 ((*value).i));
+       return g_variant_ref_sink (g_variant_builder_end (&_tmp14_));
+}
+
+static FooMemDup2*
+_variant_get2 (GVariant* value)
+{
+       FooMemDup2 _tmp17_;
+       GVariantIter _tmp18_;
+       GVariant* _tmp19_;
+       g_variant_iter_init (&_tmp18_, value);
+       _tmp19_ = g_variant_iter_next_value (&_tmp18_);
+       _tmp17_.i = g_variant_get_int32 (_tmp19_);
+       g_variant_unref (_tmp19_);
+       return g_memdup2 (&_tmp17_, sizeof (FooMemDup2));
+}
+
+void
+use_g_memdup2 (void)
+{
+       const gchar** foo = NULL;
+       const gchar** _tmp0_;
+       gint foo_length1;
+       gint _foo_size_;
+       const gchar** bar = NULL;
+       const gchar** _tmp1_;
+       gint _tmp1__length1;
+       gint bar_length1;
+       gint _bar_size_;
+       guint8* minim = NULL;
+       guint8* _tmp2_;
+       gint _tmp2__length1;
+       gint _tmp3_ = 0;
+       guint8* _tmp4_;
+       gint _tmp4__length1;
+       guint8* _tmp5_;
+       gint _tmp5__length1;
+       gint minim_length1;
+       gint _minim_size_;
+       GVariant* minim_v = NULL;
+       guint8* _tmp6_;
+       gint _tmp6__length1;
+       GVariant* _tmp8_;
+       guint8* _tmp9_ = NULL;
+       gint _tmp9__length1 = 0;
+       FooMemDup2* manam = NULL;
+       FooMemDup2 _tmp11_ = {0};
+       FooMemDup2* _tmp12_;
+       GVariant* manam_v = NULL;
+       FooMemDup2* _tmp13_;
+       GVariant* _tmp15_;
+       FooMemDup2* _tmp16_;
+       _tmp0_ = g_new0 (const gchar*, 3 + 1);
+       _tmp0_[0] = "foo";
+       _tmp0_[1] = "bar";
+       _tmp0_[2] = "manam";
+       foo = _tmp0_;
+       foo_length1 = 3;
+       _foo_size_ = foo_length1;
+       _tmp1_ = (foo != NULL) ? _vala_array_dup1 (foo, foo_length1) : foo;
+       _tmp1__length1 = foo_length1;
+       bar = _tmp1_;
+       bar_length1 = _tmp1__length1;
+       _bar_size_ = bar_length1;
+       _tmp2_ = string_get_data ("minim", &_tmp3_);
+       _tmp2__length1 = _tmp3_;
+       _tmp4_ = _tmp2_;
+       _tmp4__length1 = _tmp2__length1;
+       _tmp5_ = (_tmp4_ != NULL) ? _vala_array_dup2 (_tmp4_, _tmp4__length1) : _tmp4_;
+       _tmp5__length1 = _tmp4__length1;
+       minim = _tmp5_;
+       minim_length1 = _tmp5__length1;
+       _minim_size_ = minim_length1;
+       _tmp6_ = minim;
+       _tmp6__length1 = minim_length1;
+       _tmp8_ = _variant_new1 (_tmp6_, _tmp6__length1);
+       minim_v = _tmp8_;
+       _tmp9_ = _variant_get1 (minim_v, &_tmp9__length1);
+       minim = (g_free (minim), NULL);
+       minim = _tmp9_;
+       minim_length1 = _tmp9__length1;
+       _minim_size_ = minim_length1;
+       _tmp11_.i = 42;
+       _tmp12_ = _foo_mem_dup2_dup0 (&_tmp11_);
+       manam = _tmp12_;
+       _tmp13_ = manam;
+       _tmp15_ = _variant_new2 (_tmp13_);
+       manam_v = _tmp15_;
+       _tmp16_ = _variant_get2 (manam_v);
+       _foo_mem_dup2_free0 (manam);
+       manam = _tmp16_;
+       _g_variant_unref0 (manam_v);
+       _foo_mem_dup2_free0 (manam);
+       _g_variant_unref0 (minim_v);
+       minim = (g_free (minim), NULL);
+       bar = (g_free (bar), NULL);
+       foo = (g_free (foo), NULL);
+}
+
+FooVolatile*
+foo_volatile_construct (GType object_type)
+{
+       FooVolatile * self = NULL;
+       self = (FooVolatile*) g_object_new (object_type, NULL);
+       return self;
+}
+
+FooVolatile*
+foo_volatile_new (void)
+{
+       return foo_volatile_construct (TYPE_FOO_VOLATILE);
+}
+
+static GObject *
+foo_volatile_constructor (GType type,
+                          guint n_construct_properties,
+                          GObjectConstructParam * construct_properties)
+{
+       GObject * obj;
+       GObjectClass * parent_class;
+       static GObject * FooVolatile_singleton__ref = NULL;
+       static GMutex FooVolatile_singleton__lock;
+       static gsize FooVolatile_singleton__volatile = 0;
+       FooVolatile * self;
+       if (g_once_init_enter (&FooVolatile_singleton__volatile)) {
+               g_mutex_init (&FooVolatile_singleton__lock);
+               g_once_init_leave (&FooVolatile_singleton__volatile, 42);
+       }
+       g_mutex_lock (&FooVolatile_singleton__lock);
+       if (FooVolatile_singleton__ref != NULL) {
+               g_object_ref (FooVolatile_singleton__ref);
+               g_mutex_unlock (&FooVolatile_singleton__lock);
+               return FooVolatile_singleton__ref;
+       }
+       parent_class = G_OBJECT_CLASS (foo_volatile_parent_class);
+       obj = parent_class->constructor (type, n_construct_properties, construct_properties);
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO_VOLATILE, FooVolatile);
+       FooVolatile_singleton__ref = obj;
+       g_object_add_weak_pointer (FooVolatile_singleton__ref, (gpointer) (&FooVolatile_singleton__ref));
+       g_mutex_unlock (&FooVolatile_singleton__lock);
+       return obj;
+}
+
+static void
+foo_volatile_class_init (FooVolatileClass * klass,
+                         gpointer klass_data)
+{
+       foo_volatile_parent_class = g_type_class_peek_parent (klass);
+       G_OBJECT_CLASS (klass)->constructor = foo_volatile_constructor;
+}
+
+static void
+foo_volatile_instance_init (FooVolatile * self,
+                            gpointer klass)
+{
+}
+
+ G_GNUC_NO_INLINE static GType
+foo_volatile_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooVolatileClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_volatile_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(FooVolatile), 0, (GInstanceInitFunc) foo_volatile_instance_init, NULL };
+       GType foo_volatile_type_id;
+       foo_volatile_type_id = g_type_register_static (G_TYPE_OBJECT, "FooVolatile", &g_define_type_info, 0);
+       return foo_volatile_type_id;
+}
+
+GType
+foo_volatile_get_type (void)
+{
+       static gsize foo_volatile_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_volatile_type_id__volatile)) {
+               GType foo_volatile_type_id;
+               foo_volatile_type_id = foo_volatile_get_type_once ();
+               g_once_init_leave (&foo_volatile_type_id__volatile, foo_volatile_type_id);
+       }
+       return foo_volatile_type_id__volatile;
+}
+
+BarVolatile*
+bar_volatile_construct (GType object_type)
+{
+       BarVolatile* self = NULL;
+       self = (BarVolatile*) g_type_create_instance (object_type);
+       return self;
+}
+
+BarVolatile*
+bar_volatile_new (void)
+{
+       return bar_volatile_construct (TYPE_BAR_VOLATILE);
+}
+
+static void
+value_bar_volatile_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_bar_volatile_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               bar_volatile_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_bar_volatile_copy_value (const GValue* src_value,
+                               GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = bar_volatile_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_bar_volatile_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_bar_volatile_collect_value (GValue* value,
+                                  guint n_collect_values,
+                                  GTypeCValue* collect_values,
+                                  guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               BarVolatile * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = bar_volatile_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_bar_volatile_lcopy_value (const GValue* value,
+                                guint n_collect_values,
+                                GTypeCValue* collect_values,
+                                guint collect_flags)
+{
+       BarVolatile ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = bar_volatile_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_bar_volatile (const gchar* name,
+                         const gchar* nick,
+                         const gchar* blurb,
+                         GType object_type,
+                         GParamFlags flags)
+{
+       ParamSpecBarVolatile* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_BAR_VOLATILE), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_bar_volatile (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR_VOLATILE), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_bar_volatile (GValue* value,
+                        gpointer v_object)
+{
+       BarVolatile * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR_VOLATILE));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR_VOLATILE));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               bar_volatile_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_volatile_unref (old);
+       }
+}
+
+void
+value_take_bar_volatile (GValue* value,
+                         gpointer v_object)
+{
+       BarVolatile * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR_VOLATILE));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR_VOLATILE));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_volatile_unref (old);
+       }
+}
+
+static void
+bar_volatile_class_init (BarVolatileClass * klass,
+                         gpointer klass_data)
+{
+       bar_volatile_parent_class = g_type_class_peek_parent (klass);
+       ((BarVolatileClass *) klass)->finalize = bar_volatile_finalize;
+}
+
+static void
+bar_volatile_instance_init (BarVolatile * self,
+                            gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+bar_volatile_finalize (BarVolatile * obj)
+{
+       BarVolatile * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR_VOLATILE, BarVolatile);
+       g_signal_handlers_destroy (self);
+}
+
+ G_GNUC_NO_INLINE static GType
+bar_volatile_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_bar_volatile_init, 
value_bar_volatile_free_value, value_bar_volatile_copy_value, value_bar_volatile_peek_pointer, "p", 
value_bar_volatile_collect_value, "p", value_bar_volatile_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (BarVolatileClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_volatile_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(BarVolatile), 0, (GInstanceInitFunc) bar_volatile_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType bar_volatile_type_id;
+       bar_volatile_type_id = g_type_register_fundamental (g_type_fundamental_next (), "BarVolatile", 
&g_define_type_info, &g_define_type_fundamental_info, 0);
+       return bar_volatile_type_id;
+}
+
+GType
+bar_volatile_get_type (void)
+{
+       static gsize bar_volatile_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_volatile_type_id__volatile)) {
+               GType bar_volatile_type_id;
+               bar_volatile_type_id = bar_volatile_get_type_once ();
+               g_once_init_leave (&bar_volatile_type_id__volatile, bar_volatile_type_id);
+       }
+       return bar_volatile_type_id__volatile;
+}
+
+gpointer
+bar_volatile_ref (gpointer instance)
+{
+       BarVolatile * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+bar_volatile_unref (gpointer instance)
+{
+       BarVolatile * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               BAR_VOLATILE_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static inline GRegex*
+_thread_safe_regex_init (GRegex** re,
+                         const gchar * pattern,
+                         GRegexCompileFlags compile_flags)
+{
+       if (g_once_init_enter ((gsize*) re)) {
+               GRegex* val = g_regex_new (pattern, compile_flags, 0, NULL);
+               g_once_init_leave ((gsize*) re, (gsize) val);
+       }
+       return *re;
+}
+
+static gpointer
+_g_regex_ref0 (gpointer self)
+{
+       return self ? g_regex_ref (self) : NULL;
+}
+
+void
+no_use_volatile (void)
+{
+       GRegex* re = NULL;
+       GRegex* _tmp0_;
+       _tmp0_ = _g_regex_ref0 (_thread_safe_regex_init (&_tmp_regex_0, "mon(str.*o)n", 0 | 
G_REGEX_CASELESS));
+       re = _tmp0_;
+       _g_regex_unref0 (re);
+}
+
+static void
+_vala_main (void)
+{
+       use_g_enum_to_string ();
+       use_g_flags_to_string ();
+       use_g_memdup2 ();
+       no_use_volatile ();
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/linux/bug793444.c-expected b/tests/linux/bug793444.c-expected
new file mode 100644
index 000000000..0d4973b08
--- /dev/null
+++ b/tests/linux/bug793444.c-expected
@@ -0,0 +1,25 @@
+/* linux_bug793444.c generated by valac, the Vala compiler
+ * generated from linux_bug793444.vala, do not modify */
+
+#define _GNU_SOURCE
+
+#include <glib.h>
+#include <fcntl.h>
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+       gint flag = 0;
+       flag = O_DIRECT;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/linux/file-commandpipe.c-expected b/tests/linux/file-commandpipe.c-expected
new file mode 100644
index 000000000..be210e2a6
--- /dev/null
+++ b/tests/linux/file-commandpipe.c-expected
@@ -0,0 +1,47 @@
+/* linux_file_commandpipe.c generated by valac, the Vala compiler
+ * generated from linux_file_commandpipe.vala, do not modify */
+
+#include <stdio.h>
+#include <glib.h>
+
+#define _pclose0(var) ((var == NULL) ? NULL : (var = (pclose (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+       {
+               FILE* pipe = NULL;
+               FILE* _tmp0_;
+               gint _result_ = 0;
+               FILE* _tmp1_;
+               _tmp0_ = popen ("sleep 0", "r");
+               pipe = _tmp0_;
+               _tmp1_ = pipe;
+               pipe = NULL;
+               _result_ = pclose (_tmp1_);
+               _vala_assert (_result_ == 0, "result == 0");
+               _pclose0 (pipe);
+       }
+       {
+               FILE* _tmp2_;
+               FILE* _tmp3_;
+               _tmp2_ = popen ("ls *", "r");
+               _tmp3_ = _tmp2_;
+               _pclose0 (_tmp3_);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/argument-array-initilizer.c-expected 
b/tests/methods/argument-array-initilizer.c-expected
new file mode 100644
index 000000000..5dc269565
--- /dev/null
+++ b/tests/methods/argument-array-initilizer.c-expected
@@ -0,0 +1,187 @@
+/* methods_argument_array_initilizer.c generated by valac, the Vala compiler
+ * generated from methods_argument_array_initilizer.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static GType foo_get_type_once (void);
+VALA_EXTERN gpointer get_object (GType g_type,
+                     GBoxedCopyFunc g_dup_func,
+                     GDestroyNotify g_destroy_func,
+                     GObject** o,
+                     gint o_length1);
+VALA_EXTERN Foo* get_foo (void);
+static void _vala_main (void);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+get_object (GType g_type,
+            GBoxedCopyFunc g_dup_func,
+            GDestroyNotify g_destroy_func,
+            GObject** o,
+            gint o_length1)
+{
+       gpointer result = NULL;
+       result = NULL;
+       return result;
+}
+
+Foo*
+get_foo (void)
+{
+       Foo* _tmp0_;
+       GObject** _tmp1_;
+       GObject** _tmp2_;
+       gint _tmp2__length1;
+       gpointer _tmp3_;
+       Foo* _tmp4_;
+       Foo* result = NULL;
+       _tmp0_ = foo_new ();
+       _tmp1_ = g_new0 (GObject*, 1 + 1);
+       _tmp1_[0] = G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, G_TYPE_OBJECT, GObject);
+       _tmp2_ = _tmp1_;
+       _tmp2__length1 = 1;
+       _tmp3_ = get_object (TYPE_FOO, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, 
_tmp2_, (gint) 1);
+       _tmp4_ = (Foo*) _tmp3_;
+       _tmp2_ = (_vala_array_free (_tmp2_, _tmp2__length1, (GDestroyNotify) g_object_unref), NULL);
+       result = _tmp4_;
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* _tmp0_;
+       Foo* _tmp1_;
+       _tmp0_ = get_foo ();
+       _tmp1_ = _tmp0_;
+       _g_object_unref0 (_tmp1_);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/methods/argument-named.c-expected b/tests/methods/argument-named.c-expected
new file mode 100644
index 000000000..b86950951
--- /dev/null
+++ b/tests/methods/argument-named.c-expected
@@ -0,0 +1,348 @@
+/* methods_argument_named.c generated by valac, the Vala compiler
+ * generated from methods_argument_named.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <stdarg.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN void foo_bar (Foo* self,
+              ...);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN void foo (gint first,
+          ...);
+static void _vala_main (void);
+
+void
+foo_bar (Foo* self,
+         ...)
+{
+       va_list va = {0};
+       const gchar* _tmp0_;
+       const gchar* _tmp1_;
+       const gchar* _tmp2_;
+       g_return_if_fail (IS_FOO (self));
+       va_start (va, self);
+       _tmp0_ = va_arg (va, gchar*);
+       _vala_assert (g_strcmp0 (_tmp0_, "foo") == 0, "va.arg<string> () == \"foo\"");
+       _tmp1_ = va_arg (va, gchar*);
+       _vala_assert (g_strcmp0 (_tmp1_, "FOO") == 0, "va.arg<string> () == \"FOO\"");
+       _tmp2_ = va_arg (va, gchar*);
+       _vala_assert (g_strcmp0 (_tmp2_, "manam") == 0, "va.arg<string> () == \"manam\"");
+       _vala_assert (va_arg (va, gint) == 4711, "va.arg<int> () == 4711");
+       va_end (va);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+void
+foo (gint first,
+     ...)
+{
+       va_list va = {0};
+       const gchar* _tmp0_;
+       const gchar* _tmp1_;
+       const gchar* _tmp2_;
+       va_start (va, first);
+       _tmp0_ = va_arg (va, gchar*);
+       _vala_assert (g_strcmp0 (_tmp0_, "bar") == 0, "va.arg<string> () == \"bar\"");
+       _tmp1_ = va_arg (va, gchar*);
+       _vala_assert (g_strcmp0 (_tmp1_, "BAR") == 0, "va.arg<string> () == \"BAR\"");
+       _tmp2_ = va_arg (va, gchar*);
+       _vala_assert (g_strcmp0 (_tmp2_, "manam") == 0, "va.arg<string> () == \"manam\"");
+       _vala_assert (va_arg (va, gint) == 42, "va.arg<int> () == 42");
+       va_end (va);
+}
+
+static void
+_vala_main (void)
+{
+       Foo* _tmp0_;
+       Foo* _tmp1_;
+       foo (23, "bar", "BAR", "manam", 42, NULL);
+       _tmp0_ = foo_new ();
+       _tmp1_ = _tmp0_;
+       foo_bar (_tmp1_, "foo", "FOO", "manam", 4711, NULL);
+       _foo_unref0 (_tmp1_);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/array-length-type.c-expected b/tests/methods/array-length-type.c-expected
new file mode 100644
index 000000000..807f80040
--- /dev/null
+++ b/tests/methods/array-length-type.c-expected
@@ -0,0 +1,1463 @@
+/* methods_array_length_type.c generated by valac, the Vala compiler
+ * generated from methods_array_length_type.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gobject/gvaluecollector.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef gint* (*FooFunc) (gint* p, guint8 p_length1, guint8* result_length1, gpointer user_data);
+
+#define TYPE_IFOO (ifoo_get_type ())
+#define IFOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IFOO, IFoo))
+#define IS_IFOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IFOO))
+#define IFOO_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_IFOO, IFooIface))
+
+typedef struct _IFoo IFoo;
+typedef struct _IFooIface IFooIface;
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _IFooIface {
+       GTypeInterface parent_iface;
+       gint* (*get_foo) (IFoo* self, guint8* result_length1);
+       void (*set_foo) (IFoo* self, gint** p, guint8* p_length1);
+       gint* (*get_manam) (IFoo* self, guint8* result_length1);
+       void (*set_manam) (IFoo* self, gint* value, guint8 value_length1);
+};
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+       gint* (*get_bar) (Foo* self, guint8* result_length1);
+       void (*set_bar) (Foo* self, gint** p, guint8* p_length1);
+       gint* (*get_manar) (Foo* self, guint8* result_length1);
+       void (*set_manar) (Foo* self, gint* value, guint8 value_length1);
+};
+
+struct _FooPrivate {
+       gint* _manam;
+       gint _manam_length1;
+       gint __manam_size_;
+       gint* _manar;
+       gint _manar_length1;
+       gint __manar_size_;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+struct _Bar {
+       Foo parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       FooClass parent_class;
+};
+
+struct _BarPrivate {
+       gint* _manar;
+       gint _manar_length1;
+       gint __manar_size_;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+static IFooIface * foo_ifoo_parent_iface = NULL;
+static gint Bar_private_offset;
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN GType ifoo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN gint* ifoo_get_foo (IFoo* self,
+                    guint8* result_length1);
+VALA_EXTERN void ifoo_set_foo (IFoo* self,
+                   gint** p,
+                   guint8* p_length1);
+VALA_EXTERN gint* ifoo_get_manam (IFoo* self,
+                      guint8* result_length1);
+VALA_EXTERN void ifoo_set_manam (IFoo* self,
+                     gint* value,
+                     guint8 value_length1);
+static GType ifoo_get_type_once (void);
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN gint* foo_get_bar (Foo* self,
+                   guint8* result_length1);
+VALA_EXTERN void foo_set_bar (Foo* self,
+                  gint** p,
+                  guint8* p_length1);
+VALA_EXTERN gint* foo_get_manar (Foo* self,
+                     guint8* result_length1);
+VALA_EXTERN void foo_set_manar (Foo* self,
+                    gint* value,
+                    guint8 value_length1);
+static gint* foo_real_get_foo (IFoo* base,
+                        guint8* result_length1);
+static void foo_real_set_foo (IFoo* base,
+                       gint** p,
+                       guint8* p_length1);
+static gint* foo_real_get_bar (Foo* self,
+                        guint8* result_length1);
+static void foo_real_set_bar (Foo* self,
+                       gint** p,
+                       guint8* p_length1);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static gint* _vala_array_dup1 (gint* self,
+                        gssize length);
+static gint* _vala_array_dup2 (gint* self,
+                        gssize length);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, foo_unref)
+static gint* bar_real_get_bar (Foo* base,
+                        guint8* result_length1);
+static void bar_real_set_bar (Foo* base,
+                       gint** p,
+                       guint8* p_length1);
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static gint* _vala_array_dup3 (gint* self,
+                        gssize length);
+static void bar_finalize (Foo * obj);
+static GType bar_get_type_once (void);
+VALA_EXTERN gint* get_foo (guint8* result_length1);
+VALA_EXTERN void set_foo (gint** p,
+              guint8* p_length1);
+VALA_EXTERN gint* foo_func (gint* p,
+                guint8 p_length1,
+                guint8* result_length1);
+static gint* _vala_array_dup4 (gint* self,
+                        gssize length);
+static void _vala_main (void);
+static gint* ___lambda4_ (gint* a,
+                   guint8 a_length1,
+                   guint8* result_length1);
+static gint* _vala_array_dup5 (gint* self,
+                        gssize length);
+static gint* ____lambda4__foo_func (gint* p,
+                             guint8 p_length1,
+                             guint8* result_length1,
+                             gpointer self);
+static inline gpointer _vala_memdup2 (gconstpointer mem,
+                        gsize byte_size);
+
+gint*
+ifoo_get_foo (IFoo* self,
+              guint8* result_length1)
+{
+       IFooIface* _iface_;
+       g_return_val_if_fail (IS_IFOO (self), NULL);
+       _iface_ = IFOO_GET_INTERFACE (self);
+       if (_iface_->get_foo) {
+               return _iface_->get_foo (self, result_length1);
+       }
+       return NULL;
+}
+
+void
+ifoo_set_foo (IFoo* self,
+              gint** p,
+              guint8* p_length1)
+{
+       IFooIface* _iface_;
+       g_return_if_fail (IS_IFOO (self));
+       _iface_ = IFOO_GET_INTERFACE (self);
+       if (_iface_->set_foo) {
+               _iface_->set_foo (self, p, p_length1);
+       }
+}
+
+gint*
+ifoo_get_manam (IFoo* self,
+                guint8* result_length1)
+{
+       IFooIface* _iface_;
+       g_return_val_if_fail (IS_IFOO (self), NULL);
+       _iface_ = IFOO_GET_INTERFACE (self);
+       if (_iface_->get_manam) {
+               return _iface_->get_manam (self, result_length1);
+       }
+       return NULL;
+}
+
+void
+ifoo_set_manam (IFoo* self,
+                gint* value,
+                guint8 value_length1)
+{
+       IFooIface* _iface_;
+       g_return_if_fail (IS_IFOO (self));
+       _iface_ = IFOO_GET_INTERFACE (self);
+       if (_iface_->set_manam) {
+               _iface_->set_manam (self, value, value_length1);
+       }
+}
+
+static void
+ifoo_default_init (IFooIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+ifoo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (IFooIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) ifoo_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType ifoo_type_id;
+       ifoo_type_id = g_type_register_static (G_TYPE_INTERFACE, "IFoo", &g_define_type_info, 0);
+       return ifoo_type_id;
+}
+
+GType
+ifoo_get_type (void)
+{
+       static volatile gsize ifoo_type_id__volatile = 0;
+       if (g_once_init_enter (&ifoo_type_id__volatile)) {
+               GType ifoo_type_id;
+               ifoo_type_id = ifoo_get_type_once ();
+               g_once_init_leave (&ifoo_type_id__volatile, ifoo_type_id);
+       }
+       return ifoo_type_id__volatile;
+}
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+static gint*
+foo_real_get_foo (IFoo* base,
+                  guint8* result_length1)
+{
+       Foo * self;
+       gint* res = NULL;
+       gint* _tmp0_;
+       gint res_length1;
+       gint _res_size_;
+       gint* _tmp1_;
+       gint _tmp1__length1;
+       gint* result = NULL;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_FOO, Foo);
+       _tmp0_ = g_new0 (gint, 255);
+       res = _tmp0_;
+       res_length1 = 255;
+       _res_size_ = res_length1;
+       res[254] = 4711;
+       _tmp1_ = res;
+       _tmp1__length1 = res_length1;
+       if (result_length1) {
+               *result_length1 = _tmp1__length1;
+       }
+       result = _tmp1_;
+       return result;
+}
+
+static void
+foo_real_set_foo (IFoo* base,
+                  gint** p,
+                  guint8* p_length1)
+{
+       Foo * self;
+       gint* _vala_p = NULL;
+       guint8 _vala_p_length1 = 0;
+       gint* _tmp0_;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_FOO, Foo);
+       _tmp0_ = g_new0 (gint, 255);
+       _vala_p = (g_free (_vala_p), NULL);
+       _vala_p = _tmp0_;
+       _vala_p_length1 = 255;
+       _vala_p[254] = 4711;
+       if (p) {
+               *p = _vala_p;
+       } else {
+               _vala_p = (g_free (_vala_p), NULL);
+       }
+       if (p_length1) {
+               *p_length1 = _vala_p_length1;
+       }
+}
+
+static gint*
+foo_real_get_bar (Foo* self,
+                  guint8* result_length1)
+{
+       gint* res = NULL;
+       gint* _tmp0_;
+       gint res_length1;
+       gint _res_size_;
+       gint* _tmp1_;
+       gint _tmp1__length1;
+       gint* result = NULL;
+       _tmp0_ = g_new0 (gint, 255);
+       res = _tmp0_;
+       res_length1 = 255;
+       _res_size_ = res_length1;
+       res[254] = 4711;
+       _tmp1_ = res;
+       _tmp1__length1 = res_length1;
+       if (result_length1) {
+               *result_length1 = _tmp1__length1;
+       }
+       result = _tmp1_;
+       return result;
+}
+
+gint*
+foo_get_bar (Foo* self,
+             guint8* result_length1)
+{
+       FooClass* _klass_;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->get_bar) {
+               return _klass_->get_bar (self, result_length1);
+       }
+       return NULL;
+}
+
+static void
+foo_real_set_bar (Foo* self,
+                  gint** p,
+                  guint8* p_length1)
+{
+       gint* _vala_p = NULL;
+       guint8 _vala_p_length1 = 0;
+       gint* _tmp0_;
+       _tmp0_ = g_new0 (gint, 255);
+       _vala_p = (g_free (_vala_p), NULL);
+       _vala_p = _tmp0_;
+       _vala_p_length1 = 255;
+       _vala_p[254] = 4711;
+       if (p) {
+               *p = _vala_p;
+       } else {
+               _vala_p = (g_free (_vala_p), NULL);
+       }
+       if (p_length1) {
+               *p_length1 = _vala_p_length1;
+       }
+}
+
+void
+foo_set_bar (Foo* self,
+             gint** p,
+             guint8* p_length1)
+{
+       FooClass* _klass_;
+       g_return_if_fail (IS_FOO (self));
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->set_bar) {
+               _klass_->set_bar (self, p, p_length1);
+       }
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       {
+               gint* a = NULL;
+               guint8 _tmp0_ = 0;
+               gint* _tmp1_;
+               gint a_length1;
+               gint _a_size_;
+               gint _tmp2_;
+               _tmp1_ = ifoo_get_foo (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_IFOO, IFoo), &_tmp0_);
+               a = _tmp1_;
+               a_length1 = _tmp0_;
+               _a_size_ = a_length1;
+               _vala_assert (a_length1 == 255, "a.length == 255");
+               _tmp2_ = a[254];
+               _vala_assert (_tmp2_ == 4711, "a[254] == 4711");
+               a = (g_free (a), NULL);
+       }
+       {
+               gint* a = NULL;
+               gint a_length1;
+               gint _a_size_;
+               gint* _tmp3_ = NULL;
+               guint8 _tmp4_ = 0;
+               gint* _tmp5_;
+               gint _tmp5__length1;
+               gint* _tmp6_;
+               gint _tmp6__length1;
+               gint _tmp7_;
+               a = NULL;
+               a_length1 = 0;
+               _a_size_ = a_length1;
+               ifoo_set_foo (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_IFOO, IFoo), &_tmp3_, &_tmp4_);
+               a = (g_free (a), NULL);
+               a = _tmp3_;
+               a_length1 = _tmp4_;
+               _a_size_ = a_length1;
+               _tmp5_ = a;
+               _tmp5__length1 = a_length1;
+               _vala_assert (_tmp5__length1 == 255, "a.length == 255");
+               _tmp6_ = a;
+               _tmp6__length1 = a_length1;
+               _tmp7_ = _tmp6_[254];
+               _vala_assert (_tmp7_ == 4711, "a[254] == 4711");
+               a = (g_free (a), NULL);
+       }
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static gint*
+foo_real_get_manam (IFoo* base,
+                    guint8* result_length1)
+{
+       gint* result;
+       Foo* self;
+       gint* _tmp0_;
+       gint _tmp0__length1;
+       gint* _tmp1_;
+       gint _tmp1__length1;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_FOO, Foo);
+       _tmp0_ = self->priv->_manam;
+       _tmp0__length1 = self->priv->_manam_length1;
+       _tmp1_ = _tmp0_;
+       _tmp1__length1 = _tmp0__length1;
+       if (result_length1) {
+               *result_length1 = _tmp1__length1;
+       }
+       result = _tmp1_;
+       return result;
+}
+
+static gint*
+_vala_array_dup1 (gint* self,
+                  gssize length)
+{
+       if (length > 0) {
+               return _vala_memdup2 (self, length * sizeof (gint));
+       }
+       return NULL;
+}
+
+static void
+foo_real_set_manam (IFoo* base,
+                    gint* value,
+                    guint8 value_length1)
+{
+       Foo* self;
+       gint* _tmp0_;
+       gint _tmp0__length1;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_FOO, Foo);
+       _tmp0_ = (value != NULL) ? _vala_array_dup1 (value, value_length1) : value;
+       _tmp0__length1 = value_length1;
+       self->priv->_manam = (g_free (self->priv->_manam), NULL);
+       self->priv->_manam = _tmp0_;
+       self->priv->_manam_length1 = _tmp0__length1;
+       self->priv->__manam_size_ = self->priv->_manam_length1;
+}
+
+gint*
+foo_get_manar (Foo* self,
+               guint8* result_length1)
+{
+       FooClass* _klass_;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->get_manar) {
+               return _klass_->get_manar (self, result_length1);
+       }
+       return NULL;
+}
+
+static gint*
+foo_real_get_manar (Foo* base,
+                    guint8* result_length1)
+{
+       gint* result;
+       Foo* self;
+       gint* _tmp0_;
+       gint _tmp0__length1;
+       gint* _tmp1_;
+       gint _tmp1__length1;
+       self = base;
+       _tmp0_ = self->priv->_manar;
+       _tmp0__length1 = self->priv->_manar_length1;
+       _tmp1_ = _tmp0_;
+       _tmp1__length1 = _tmp0__length1;
+       if (result_length1) {
+               *result_length1 = _tmp1__length1;
+       }
+       result = _tmp1_;
+       return result;
+}
+
+void
+foo_set_manar (Foo* self,
+               gint* value,
+               guint8 value_length1)
+{
+       FooClass* _klass_;
+       g_return_if_fail (IS_FOO (self));
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->set_manar) {
+               _klass_->set_manar (self, value, value_length1);
+       }
+}
+
+static gint*
+_vala_array_dup2 (gint* self,
+                  gssize length)
+{
+       if (length > 0) {
+               return _vala_memdup2 (self, length * sizeof (gint));
+       }
+       return NULL;
+}
+
+static void
+foo_real_set_manar (Foo* base,
+                    gint* value,
+                    guint8 value_length1)
+{
+       Foo* self;
+       gint* _tmp0_;
+       gint _tmp0__length1;
+       self = base;
+       _tmp0_ = (value != NULL) ? _vala_array_dup2 (value, value_length1) : value;
+       _tmp0__length1 = value_length1;
+       self->priv->_manar = (g_free (self->priv->_manar), NULL);
+       self->priv->_manar = _tmp0_;
+       self->priv->_manar_length1 = _tmp0__length1;
+       self->priv->__manar_size_ = self->priv->_manar_length1;
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+       ((FooClass *) klass)->get_bar = (gint* (*) (Foo*, guint8*)) foo_real_get_bar;
+       ((FooClass *) klass)->set_bar = (void (*) (Foo*, gint**, guint8*)) foo_real_set_bar;
+       FOO_CLASS (klass)->get_manar = foo_real_get_manar;
+       FOO_CLASS (klass)->set_manar = foo_real_set_manar;
+}
+
+static void
+foo_ifoo_interface_init (IFooIface * iface,
+                         gpointer iface_data)
+{
+       foo_ifoo_parent_iface = g_type_interface_peek_parent (iface);
+       iface->get_foo = (gint* (*) (IFoo*, guint8*)) foo_real_get_foo;
+       iface->set_foo = (void (*) (IFoo*, gint**, guint8*)) foo_real_set_foo;
+       iface->get_manam = foo_real_get_manam;
+       iface->set_manam = foo_real_set_manam;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+       self->priv->_manam = (g_free (self->priv->_manam), NULL);
+       self->priv->_manar = (g_free (self->priv->_manar), NULL);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       static const GInterfaceInfo ifoo_info = { (GInterfaceInitFunc) foo_ifoo_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       g_type_add_interface_static (foo_type_id, TYPE_IFOO, &ifoo_info);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static inline gpointer
+bar_get_instance_private (Bar* self)
+{
+       return G_STRUCT_MEMBER_P (self, Bar_private_offset);
+}
+
+static gint*
+bar_real_get_bar (Foo* base,
+                  guint8* result_length1)
+{
+       Bar * self;
+       gint* res = NULL;
+       gint* _tmp0_;
+       gint res_length1;
+       gint _res_size_;
+       gint* _tmp1_;
+       gint _tmp1__length1;
+       gint* result = NULL;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAR, Bar);
+       _tmp0_ = g_new0 (gint, 255);
+       res = _tmp0_;
+       res_length1 = 255;
+       _res_size_ = res_length1;
+       res[254] = 4711;
+       _tmp1_ = res;
+       _tmp1__length1 = res_length1;
+       if (result_length1) {
+               *result_length1 = _tmp1__length1;
+       }
+       result = _tmp1_;
+       return result;
+}
+
+static void
+bar_real_set_bar (Foo* base,
+                  gint** p,
+                  guint8* p_length1)
+{
+       Bar * self;
+       gint* _vala_p = NULL;
+       guint8 _vala_p_length1 = 0;
+       gint* _tmp0_;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAR, Bar);
+       _tmp0_ = g_new0 (gint, 255);
+       _vala_p = (g_free (_vala_p), NULL);
+       _vala_p = _tmp0_;
+       _vala_p_length1 = 255;
+       _vala_p[254] = 4711;
+       if (p) {
+               *p = _vala_p;
+       } else {
+               _vala_p = (g_free (_vala_p), NULL);
+       }
+       if (p_length1) {
+               *p_length1 = _vala_p_length1;
+       }
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar* self = NULL;
+       self = (Bar*) foo_construct (object_type);
+       {
+               gint* a = NULL;
+               guint8 _tmp0_ = 0;
+               gint* _tmp1_;
+               gint a_length1;
+               gint _a_size_;
+               gint _tmp2_;
+               _tmp1_ = ifoo_get_foo (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_IFOO, IFoo), &_tmp0_);
+               a = _tmp1_;
+               a_length1 = _tmp0_;
+               _a_size_ = a_length1;
+               _vala_assert (a_length1 == 255, "a.length == 255");
+               _tmp2_ = a[254];
+               _vala_assert (_tmp2_ == 4711, "a[254] == 4711");
+               a = (g_free (a), NULL);
+       }
+       {
+               gint* a = NULL;
+               gint a_length1;
+               gint _a_size_;
+               gint* _tmp3_ = NULL;
+               guint8 _tmp4_ = 0;
+               gint* _tmp5_;
+               gint _tmp5__length1;
+               gint* _tmp6_;
+               gint _tmp6__length1;
+               gint _tmp7_;
+               a = NULL;
+               a_length1 = 0;
+               _a_size_ = a_length1;
+               ifoo_set_foo (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_IFOO, IFoo), &_tmp3_, &_tmp4_);
+               a = (g_free (a), NULL);
+               a = _tmp3_;
+               a_length1 = _tmp4_;
+               _a_size_ = a_length1;
+               _tmp5_ = a;
+               _tmp5__length1 = a_length1;
+               _vala_assert (_tmp5__length1 == 255, "a.length == 255");
+               _tmp6_ = a;
+               _tmp6__length1 = a_length1;
+               _tmp7_ = _tmp6_[254];
+               _vala_assert (_tmp7_ == 4711, "a[254] == 4711");
+               a = (g_free (a), NULL);
+       }
+       {
+               gint* a = NULL;
+               guint8 _tmp8_ = 0;
+               gint* _tmp9_;
+               gint a_length1;
+               gint _a_size_;
+               gint _tmp10_;
+               _tmp9_ = foo_get_bar (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_FOO, Foo), &_tmp8_);
+               a = _tmp9_;
+               a_length1 = _tmp8_;
+               _a_size_ = a_length1;
+               _vala_assert (a_length1 == 255, "a.length == 255");
+               _tmp10_ = a[254];
+               _vala_assert (_tmp10_ == 4711, "a[254] == 4711");
+               a = (g_free (a), NULL);
+       }
+       {
+               gint* a = NULL;
+               gint a_length1;
+               gint _a_size_;
+               gint* _tmp11_ = NULL;
+               guint8 _tmp12_ = 0;
+               gint* _tmp13_;
+               gint _tmp13__length1;
+               gint* _tmp14_;
+               gint _tmp14__length1;
+               gint _tmp15_;
+               a = NULL;
+               a_length1 = 0;
+               _a_size_ = a_length1;
+               foo_set_bar (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_FOO, Foo), &_tmp11_, &_tmp12_);
+               a = (g_free (a), NULL);
+               a = _tmp11_;
+               a_length1 = _tmp12_;
+               _a_size_ = a_length1;
+               _tmp13_ = a;
+               _tmp13__length1 = a_length1;
+               _vala_assert (_tmp13__length1 == 255, "a.length == 255");
+               _tmp14_ = a;
+               _tmp14__length1 = a_length1;
+               _tmp15_ = _tmp14_[254];
+               _vala_assert (_tmp15_ == 4711, "a[254] == 4711");
+               a = (g_free (a), NULL);
+       }
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static gint*
+bar_real_get_manar (Foo* base,
+                    guint8* result_length1)
+{
+       gint* result;
+       Bar* self;
+       gint* _tmp0_;
+       gint _tmp0__length1;
+       gint* _tmp1_;
+       gint _tmp1__length1;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAR, Bar);
+       _tmp0_ = self->priv->_manar;
+       _tmp0__length1 = self->priv->_manar_length1;
+       _tmp1_ = _tmp0_;
+       _tmp1__length1 = _tmp0__length1;
+       if (result_length1) {
+               *result_length1 = _tmp1__length1;
+       }
+       result = _tmp1_;
+       return result;
+}
+
+static gint*
+_vala_array_dup3 (gint* self,
+                  gssize length)
+{
+       if (length > 0) {
+               return _vala_memdup2 (self, length * sizeof (gint));
+       }
+       return NULL;
+}
+
+static void
+bar_real_set_manar (Foo* base,
+                    gint* value,
+                    guint8 value_length1)
+{
+       Bar* self;
+       gint* _tmp0_;
+       gint _tmp0__length1;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAR, Bar);
+       _tmp0_ = (value != NULL) ? _vala_array_dup3 (value, value_length1) : value;
+       _tmp0__length1 = value_length1;
+       self->priv->_manar = (g_free (self->priv->_manar), NULL);
+       self->priv->_manar = _tmp0_;
+       self->priv->_manar_length1 = _tmp0__length1;
+       self->priv->__manar_size_ = self->priv->_manar_length1;
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = bar_finalize;
+       g_type_class_adjust_private_offset (klass, &Bar_private_offset);
+       ((FooClass *) klass)->get_bar = (gint* (*) (Foo*, guint8*)) bar_real_get_bar;
+       ((FooClass *) klass)->set_bar = (void (*) (Foo*, gint**, guint8*)) bar_real_set_bar;
+       FOO_CLASS (klass)->get_manar = bar_real_get_manar;
+       FOO_CLASS (klass)->set_manar = bar_real_set_manar;
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+       self->priv = bar_get_instance_private (self);
+}
+
+static void
+bar_finalize (Foo * obj)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       self->priv->_manar = (g_free (self->priv->_manar), NULL);
+       FOO_CLASS (bar_parent_class)->finalize (obj);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (TYPE_FOO, "Bar", &g_define_type_info, 0);
+       Bar_private_offset = g_type_add_instance_private (bar_type_id, sizeof (BarPrivate));
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+gint*
+get_foo (guint8* result_length1)
+{
+       gint* res = NULL;
+       gint* _tmp0_;
+       gint res_length1;
+       gint _res_size_;
+       gint* _tmp1_;
+       gint _tmp1__length1;
+       gint* result = NULL;
+       _tmp0_ = g_new0 (gint, 255);
+       res = _tmp0_;
+       res_length1 = 255;
+       _res_size_ = res_length1;
+       res[254] = 4711;
+       _tmp1_ = res;
+       _tmp1__length1 = res_length1;
+       if (result_length1) {
+               *result_length1 = _tmp1__length1;
+       }
+       result = _tmp1_;
+       return result;
+}
+
+void
+set_foo (gint** p,
+         guint8* p_length1)
+{
+       gint* _vala_p = NULL;
+       guint8 _vala_p_length1 = 0;
+       gint* _tmp0_;
+       _tmp0_ = g_new0 (gint, 255);
+       _vala_p = (g_free (_vala_p), NULL);
+       _vala_p = _tmp0_;
+       _vala_p_length1 = 255;
+       _vala_p[254] = 4711;
+       if (p) {
+               *p = _vala_p;
+       } else {
+               _vala_p = (g_free (_vala_p), NULL);
+       }
+       if (p_length1) {
+               *p_length1 = _vala_p_length1;
+       }
+}
+
+static gint*
+_vala_array_dup4 (gint* self,
+                  gssize length)
+{
+       if (length > 0) {
+               return _vala_memdup2 (self, length * sizeof (gint));
+       }
+       return NULL;
+}
+
+gint*
+foo_func (gint* p,
+          guint8 p_length1,
+          guint8* result_length1)
+{
+       gint* _tmp0_;
+       gint _tmp0__length1;
+       gint* _tmp1_;
+       gint _tmp1__length1;
+       gint* result = NULL;
+       _tmp0_ = (p != NULL) ? _vala_array_dup4 (p, p_length1) : p;
+       _tmp0__length1 = p_length1;
+       _tmp1_ = _tmp0_;
+       _tmp1__length1 = _tmp0__length1;
+       if (result_length1) {
+               *result_length1 = _tmp1__length1;
+       }
+       result = _tmp1_;
+       p = (g_free (p), NULL);
+       return result;
+}
+
+static gint*
+_vala_array_dup5 (gint* self,
+                  gssize length)
+{
+       if (length > 0) {
+               return _vala_memdup2 (self, length * sizeof (gint));
+       }
+       return NULL;
+}
+
+static gint*
+___lambda4_ (gint* a,
+             guint8 a_length1,
+             guint8* result_length1)
+{
+       gint* _tmp0_;
+       gint _tmp0__length1;
+       gint* _tmp1_;
+       gint _tmp1__length1;
+       gint* result = NULL;
+       _tmp0_ = (a != NULL) ? _vala_array_dup5 (a, a_length1) : a;
+       _tmp0__length1 = a_length1;
+       _tmp1_ = _tmp0_;
+       _tmp1__length1 = _tmp0__length1;
+       if (result_length1) {
+               *result_length1 = _tmp1__length1;
+       }
+       result = _tmp1_;
+       a = (g_free (a), NULL);
+       return result;
+}
+
+static gint*
+____lambda4__foo_func (gint* p,
+                       guint8 p_length1,
+                       guint8* result_length1,
+                       gpointer self)
+{
+       gint* result;
+       result = ___lambda4_ (p, p_length1, result_length1);
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       {
+               FooFunc f = NULL;
+               gpointer f_target;
+               GDestroyNotify f_target_destroy_notify;
+               gint* a = NULL;
+               gint* _tmp0_;
+               gint a_length1;
+               gint _a_size_;
+               gint* _tmp1_;
+               gint _tmp1__length1;
+               gint* _tmp2_;
+               gint _tmp2__length1;
+               guint8 _tmp3_ = 0;
+               gint* _tmp4_;
+               gint* _tmp5_;
+               gint _tmp5__length1;
+               gint* _tmp6_;
+               gint _tmp6__length1;
+               gint _tmp7_;
+               f = ____lambda4__foo_func;
+               f_target = NULL;
+               f_target_destroy_notify = NULL;
+               _tmp0_ = g_new0 (gint, 255);
+               a = _tmp0_;
+               a_length1 = 255;
+               _a_size_ = a_length1;
+               _tmp1_ = a;
+               _tmp1__length1 = a_length1;
+               _tmp1_[254] = 4711;
+               _tmp2_ = a;
+               _tmp2__length1 = a_length1;
+               a = NULL;
+               a_length1 = 0;
+               _tmp4_ = f (_tmp2_, (guint8) _tmp2__length1, &_tmp3_, f_target);
+               a = (g_free (a), NULL);
+               a = _tmp4_;
+               a_length1 = _tmp3_;
+               _a_size_ = a_length1;
+               _tmp5_ = a;
+               _tmp5__length1 = a_length1;
+               _vala_assert (_tmp5__length1 == 255, "a.length == 255");
+               _tmp6_ = a;
+               _tmp6__length1 = a_length1;
+               _tmp7_ = _tmp6_[254];
+               _vala_assert (_tmp7_ == 4711, "a[254] == 4711");
+               a = (g_free (a), NULL);
+               (f_target_destroy_notify == NULL) ? NULL : (f_target_destroy_notify (f_target), NULL);
+               f = NULL;
+               f_target = NULL;
+               f_target_destroy_notify = NULL;
+       }
+       {
+               FooFunc f = NULL;
+               gpointer f_target;
+               GDestroyNotify f_target_destroy_notify;
+               gint* a = NULL;
+               gint* _tmp8_;
+               gint a_length1;
+               gint _a_size_;
+               gint* _tmp9_;
+               gint _tmp9__length1;
+               gint* _tmp10_;
+               gint _tmp10__length1;
+               guint8 _tmp11_ = 0;
+               gint* _tmp12_;
+               gint* _tmp13_;
+               gint _tmp13__length1;
+               gint* _tmp14_;
+               gint _tmp14__length1;
+               gint _tmp15_;
+               f = (FooFunc) foo_func;
+               f_target = NULL;
+               f_target_destroy_notify = NULL;
+               _tmp8_ = g_new0 (gint, 255);
+               a = _tmp8_;
+               a_length1 = 255;
+               _a_size_ = a_length1;
+               _tmp9_ = a;
+               _tmp9__length1 = a_length1;
+               _tmp9_[254] = 4711;
+               _tmp10_ = a;
+               _tmp10__length1 = a_length1;
+               a = NULL;
+               a_length1 = 0;
+               _tmp12_ = f (_tmp10_, (guint8) _tmp10__length1, &_tmp11_, f_target);
+               a = (g_free (a), NULL);
+               a = _tmp12_;
+               a_length1 = _tmp11_;
+               _a_size_ = a_length1;
+               _tmp13_ = a;
+               _tmp13__length1 = a_length1;
+               _vala_assert (_tmp13__length1 == 255, "a.length == 255");
+               _tmp14_ = a;
+               _tmp14__length1 = a_length1;
+               _tmp15_ = _tmp14_[254];
+               _vala_assert (_tmp15_ == 4711, "a[254] == 4711");
+               a = (g_free (a), NULL);
+               (f_target_destroy_notify == NULL) ? NULL : (f_target_destroy_notify (f_target), NULL);
+               f = NULL;
+               f_target = NULL;
+               f_target_destroy_notify = NULL;
+       }
+       {
+               gint* a = NULL;
+               guint8 _tmp16_ = 0;
+               gint* _tmp17_;
+               gint a_length1;
+               gint _a_size_;
+               gint _tmp18_;
+               _tmp17_ = get_foo (&_tmp16_);
+               a = _tmp17_;
+               a_length1 = _tmp16_;
+               _a_size_ = a_length1;
+               _vala_assert (a_length1 == 255, "a.length == 255");
+               _tmp18_ = a[254];
+               _vala_assert (_tmp18_ == 4711, "a[254] == 4711");
+               a = (g_free (a), NULL);
+       }
+       {
+               gint* a = NULL;
+               gint a_length1;
+               gint _a_size_;
+               gint* _tmp19_ = NULL;
+               guint8 _tmp20_ = 0;
+               gint* _tmp21_;
+               gint _tmp21__length1;
+               gint* _tmp22_;
+               gint _tmp22__length1;
+               gint _tmp23_;
+               a = NULL;
+               a_length1 = 0;
+               _a_size_ = a_length1;
+               set_foo (&_tmp19_, &_tmp20_);
+               a = (g_free (a), NULL);
+               a = _tmp19_;
+               a_length1 = _tmp20_;
+               _a_size_ = a_length1;
+               _tmp21_ = a;
+               _tmp21__length1 = a_length1;
+               _vala_assert (_tmp21__length1 == 255, "a.length == 255");
+               _tmp22_ = a;
+               _tmp22__length1 = a_length1;
+               _tmp23_ = _tmp22_[254];
+               _vala_assert (_tmp23_ == 4711, "a[254] == 4711");
+               a = (g_free (a), NULL);
+       }
+       {
+               Foo* foo = NULL;
+               Foo* _tmp24_;
+               gint* _tmp25_;
+               gint* _tmp26_;
+               gint _tmp26__length1;
+               gint* _tmp27_;
+               gint _tmp27__length1;
+               guint8 _tmp28_ = 0;
+               gint* _tmp29_;
+               gint _tmp29__length1;
+               gint* _tmp30_;
+               gint _tmp30__length1;
+               guint8 _tmp31_ = 0;
+               gint* _tmp32_;
+               gint _tmp32__length1;
+               gint* _tmp33_;
+               gint _tmp33__length1;
+               guint8 _tmp34_ = 0;
+               gint* _tmp35_;
+               gint _tmp35__length1;
+               gint _tmp36_;
+               _tmp24_ = foo_new ();
+               foo = _tmp24_;
+               _tmp25_ = g_new0 (gint, 255);
+               _tmp26_ = _tmp25_;
+               _tmp26__length1 = 255;
+               ifoo_set_manam (G_TYPE_CHECK_INSTANCE_CAST (foo, TYPE_IFOO, IFoo), _tmp26_, 255);
+               _tmp26_ = (g_free (_tmp26_), NULL);
+               _tmp27_ = ifoo_get_manam (G_TYPE_CHECK_INSTANCE_CAST (foo, TYPE_IFOO, IFoo), &_tmp28_);
+               _tmp27__length1 = _tmp28_;
+               _tmp29_ = _tmp27_;
+               _tmp29__length1 = _tmp27__length1;
+               _tmp29_[254] = 4711;
+               _tmp30_ = ifoo_get_manam (G_TYPE_CHECK_INSTANCE_CAST (foo, TYPE_IFOO, IFoo), &_tmp31_);
+               _tmp30__length1 = _tmp31_;
+               _tmp32_ = _tmp30_;
+               _tmp32__length1 = _tmp30__length1;
+               _vala_assert (_tmp32__length1 == 255, "foo.manam.length == 255");
+               _tmp33_ = ifoo_get_manam (G_TYPE_CHECK_INSTANCE_CAST (foo, TYPE_IFOO, IFoo), &_tmp34_);
+               _tmp33__length1 = _tmp34_;
+               _tmp35_ = _tmp33_;
+               _tmp35__length1 = _tmp33__length1;
+               _tmp36_ = _tmp35_[254];
+               _vala_assert (_tmp36_ == 4711, "foo.manam[254] == 4711");
+               _foo_unref0 (foo);
+       }
+       {
+               Bar* bar = NULL;
+               Bar* _tmp37_;
+               gint* _tmp38_;
+               gint* _tmp39_;
+               gint _tmp39__length1;
+               gint* _tmp40_;
+               gint _tmp40__length1;
+               guint8 _tmp41_ = 0;
+               gint* _tmp42_;
+               gint _tmp42__length1;
+               gint* _tmp43_;
+               gint _tmp43__length1;
+               guint8 _tmp44_ = 0;
+               gint* _tmp45_;
+               gint _tmp45__length1;
+               gint* _tmp46_;
+               gint _tmp46__length1;
+               guint8 _tmp47_ = 0;
+               gint* _tmp48_;
+               gint _tmp48__length1;
+               gint _tmp49_;
+               _tmp37_ = bar_new ();
+               bar = _tmp37_;
+               _tmp38_ = g_new0 (gint, 255);
+               _tmp39_ = _tmp38_;
+               _tmp39__length1 = 255;
+               foo_set_manar (G_TYPE_CHECK_INSTANCE_CAST (bar, TYPE_FOO, Foo), _tmp39_, 255);
+               _tmp39_ = (g_free (_tmp39_), NULL);
+               _tmp40_ = foo_get_manar (G_TYPE_CHECK_INSTANCE_CAST (bar, TYPE_FOO, Foo), &_tmp41_);
+               _tmp40__length1 = _tmp41_;
+               _tmp42_ = _tmp40_;
+               _tmp42__length1 = _tmp40__length1;
+               _tmp42_[254] = 4711;
+               _tmp43_ = foo_get_manar (G_TYPE_CHECK_INSTANCE_CAST (bar, TYPE_FOO, Foo), &_tmp44_);
+               _tmp43__length1 = _tmp44_;
+               _tmp45_ = _tmp43_;
+               _tmp45__length1 = _tmp43__length1;
+               _vala_assert (_tmp45__length1 == 255, "bar.manar.length == 255");
+               _tmp46_ = foo_get_manar (G_TYPE_CHECK_INSTANCE_CAST (bar, TYPE_FOO, Foo), &_tmp47_);
+               _tmp46__length1 = _tmp47_;
+               _tmp48_ = _tmp46_;
+               _tmp48__length1 = _tmp46__length1;
+               _tmp49_ = _tmp48_[254];
+               _vala_assert (_tmp49_ == 4711, "bar.manar[254] == 4711");
+               _foo_unref0 (bar);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static inline gpointer
+_vala_memdup2 (gconstpointer mem,
+               gsize byte_size)
+{
+       gpointer new_mem;
+       if (mem && byte_size != 0) {
+               new_mem = g_malloc (byte_size);
+               memcpy (new_mem, mem, byte_size);
+       } else {
+               new_mem = NULL;
+       }
+       return new_mem;
+}
+
diff --git a/tests/methods/bug540483.c-expected b/tests/methods/bug540483.c-expected
new file mode 100644
index 000000000..6b07829db
--- /dev/null
+++ b/tests/methods/bug540483.c-expected
@@ -0,0 +1,858 @@
+/* methods_bug540483.c generated by valac, the Vala compiler
+ * generated from methods_bug540483.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_IFOO (ifoo_get_type ())
+#define IFOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IFOO, IFoo))
+#define IS_IFOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IFOO))
+#define IFOO_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_IFOO, IFooIface))
+
+typedef struct _IFoo IFoo;
+typedef struct _IFooIface IFooIface;
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+
+#define TYPE_BAZ (baz_get_type ())
+#define BAZ(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAZ, Baz))
+#define BAZ_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAZ, BazClass))
+#define IS_BAZ(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAZ))
+#define IS_BAZ_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAZ))
+#define BAZ_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAZ, BazClass))
+
+typedef struct _Baz Baz;
+typedef struct _BazClass BazClass;
+typedef struct _BazPrivate BazPrivate;
+typedef struct _ParamSpecBaz ParamSpecBaz;
+
+#define TYPE_MANAM (manam_get_type ())
+#define MANAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MANAM, Manam))
+#define MANAM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MANAM, ManamClass))
+#define IS_MANAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MANAM))
+#define IS_MANAM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MANAM))
+#define MANAM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MANAM, ManamClass))
+
+typedef struct _Manam Manam;
+typedef struct _ManamClass ManamClass;
+typedef struct _ManamPrivate ManamPrivate;
+#define _baz_unref0(var) ((var == NULL) ? NULL : (var = (baz_unref (var), NULL)))
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _IFooIface {
+       GTypeInterface parent_iface;
+       void (*foo) (gint i, IFoo* self);
+};
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+       void (*foo) (gint i, Foo* self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+struct _Bar {
+       Foo parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       FooClass parent_class;
+};
+
+struct _Baz {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       BazPrivate * priv;
+};
+
+struct _BazClass {
+       GTypeClass parent_class;
+       void (*finalize) (Baz *self);
+       void (*foo) (gint i, Baz* self);
+};
+
+struct _ParamSpecBaz {
+       GParamSpec parent_instance;
+};
+
+struct _Manam {
+       Baz parent_instance;
+       ManamPrivate * priv;
+};
+
+struct _ManamClass {
+       BazClass parent_class;
+};
+
+static gpointer foo_parent_class = NULL;
+static IFooIface * foo_ifoo_parent_iface = NULL;
+static gpointer bar_parent_class = NULL;
+static gpointer baz_parent_class = NULL;
+static gpointer manam_parent_class = NULL;
+
+VALA_EXTERN GType ifoo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN void ifoo_foo (gint i,
+               IFoo* self);
+static GType ifoo_get_type_once (void);
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN void foo_foo (gint i,
+              Foo* self);
+static void foo_real_foo (gint i,
+                   Foo* self);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, foo_unref)
+static void bar_real_foo (gint i,
+                   Foo* base);
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static GType bar_get_type_once (void);
+VALA_EXTERN gpointer baz_ref (gpointer instance);
+VALA_EXTERN void baz_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_baz (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_baz (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_baz (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_baz (const GValue* value);
+VALA_EXTERN GType baz_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Baz, baz_unref)
+VALA_EXTERN void baz_foo (gint i,
+              Baz* self);
+static void baz_real_foo (gint i,
+                   Baz* self);
+VALA_EXTERN Baz* baz_construct (GType object_type);
+static void baz_finalize (Baz * obj);
+static GType baz_get_type_once (void);
+VALA_EXTERN GType manam_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Manam, baz_unref)
+static void manam_real_foo (gint i,
+                     Baz* base);
+VALA_EXTERN Manam* manam_new (void);
+VALA_EXTERN Manam* manam_construct (GType object_type);
+static GType manam_get_type_once (void);
+static void _vala_main (void);
+
+void
+ifoo_foo (gint i,
+          IFoo* self)
+{
+       IFooIface* _iface_;
+       g_return_if_fail (IS_IFOO (self));
+       _iface_ = IFOO_GET_INTERFACE (self);
+       if (_iface_->foo) {
+               _iface_->foo (i, self);
+       }
+}
+
+static void
+ifoo_default_init (IFooIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+ifoo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (IFooIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) ifoo_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType ifoo_type_id;
+       ifoo_type_id = g_type_register_static (G_TYPE_INTERFACE, "IFoo", &g_define_type_info, 0);
+       return ifoo_type_id;
+}
+
+GType
+ifoo_get_type (void)
+{
+       static volatile gsize ifoo_type_id__volatile = 0;
+       if (g_once_init_enter (&ifoo_type_id__volatile)) {
+               GType ifoo_type_id;
+               ifoo_type_id = ifoo_get_type_once ();
+               g_once_init_leave (&ifoo_type_id__volatile, ifoo_type_id);
+       }
+       return ifoo_type_id__volatile;
+}
+
+static void
+foo_real_foo (gint i,
+              Foo* self)
+{
+       _vala_assert (i == 23, "i == 23");
+}
+
+void
+foo_foo (gint i,
+         Foo* self)
+{
+       FooClass* _klass_;
+       g_return_if_fail (IS_FOO (self));
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->foo) {
+               _klass_->foo (i, self);
+       }
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       ((FooClass *) klass)->foo = (void (*) (gint, Foo*)) foo_real_foo;
+}
+
+static void
+foo_ifoo_interface_init (IFooIface * iface,
+                         gpointer iface_data)
+{
+       foo_ifoo_parent_iface = g_type_interface_peek_parent (iface);
+       iface->foo = (void (*) (gint, IFoo*)) foo_foo;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       static const GInterfaceInfo ifoo_info = { (GInterfaceInitFunc) foo_ifoo_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       g_type_add_interface_static (foo_type_id, TYPE_IFOO, &ifoo_info);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+bar_real_foo (gint i,
+              Foo* base)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAR, Bar);
+       _vala_assert (i == 42, "i == 42");
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar* self = NULL;
+       self = (Bar*) foo_construct (object_type);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->foo = (void (*) (gint, Foo*)) bar_real_foo;
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (TYPE_FOO, "Bar", &g_define_type_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+baz_real_foo (gint i,
+              Baz* self)
+{
+       g_critical ("Type `%s' does not implement abstract method `baz_foo'", g_type_name 
(G_TYPE_FROM_INSTANCE (self)));
+       return;
+}
+
+void
+baz_foo (gint i,
+         Baz* self)
+{
+       BazClass* _klass_;
+       g_return_if_fail (IS_BAZ (self));
+       _klass_ = BAZ_GET_CLASS (self);
+       if (_klass_->foo) {
+               _klass_->foo (i, self);
+       }
+}
+
+Baz*
+baz_construct (GType object_type)
+{
+       Baz* self = NULL;
+       self = (Baz*) g_type_create_instance (object_type);
+       return self;
+}
+
+static void
+value_baz_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_baz_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               baz_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_baz_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = baz_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_baz_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_baz_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Baz * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = baz_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_baz_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Baz ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = baz_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_baz (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecBaz* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_BAZ), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_baz (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAZ), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_baz (GValue* value,
+               gpointer v_object)
+{
+       Baz * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAZ));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAZ));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               baz_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               baz_unref (old);
+       }
+}
+
+void
+value_take_baz (GValue* value,
+                gpointer v_object)
+{
+       Baz * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAZ));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAZ));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               baz_unref (old);
+       }
+}
+
+static void
+baz_class_init (BazClass * klass,
+                gpointer klass_data)
+{
+       baz_parent_class = g_type_class_peek_parent (klass);
+       ((BazClass *) klass)->finalize = baz_finalize;
+       ((BazClass *) klass)->foo = (void (*) (gint, Baz*)) baz_real_foo;
+}
+
+static void
+baz_instance_init (Baz * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+baz_finalize (Baz * obj)
+{
+       Baz * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAZ, Baz);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+baz_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_baz_init, value_baz_free_value, 
value_baz_copy_value, value_baz_peek_pointer, "p", value_baz_collect_value, "p", value_baz_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (BazClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) baz_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Baz), 0, 
(GInstanceInitFunc) baz_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType baz_type_id;
+       baz_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Baz", &g_define_type_info, 
&g_define_type_fundamental_info, G_TYPE_FLAG_ABSTRACT);
+       return baz_type_id;
+}
+
+GType
+baz_get_type (void)
+{
+       static volatile gsize baz_type_id__volatile = 0;
+       if (g_once_init_enter (&baz_type_id__volatile)) {
+               GType baz_type_id;
+               baz_type_id = baz_get_type_once ();
+               g_once_init_leave (&baz_type_id__volatile, baz_type_id);
+       }
+       return baz_type_id__volatile;
+}
+
+gpointer
+baz_ref (gpointer instance)
+{
+       Baz * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+baz_unref (gpointer instance)
+{
+       Baz * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               BAZ_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+manam_real_foo (gint i,
+                Baz* base)
+{
+       Manam * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_MANAM, Manam);
+       _vala_assert (i == 4711, "i == 4711");
+}
+
+Manam*
+manam_construct (GType object_type)
+{
+       Manam* self = NULL;
+       self = (Manam*) baz_construct (object_type);
+       return self;
+}
+
+Manam*
+manam_new (void)
+{
+       return manam_construct (TYPE_MANAM);
+}
+
+static void
+manam_class_init (ManamClass * klass,
+                  gpointer klass_data)
+{
+       manam_parent_class = g_type_class_peek_parent (klass);
+       ((BazClass *) klass)->foo = (void (*) (gint, Baz*)) manam_real_foo;
+}
+
+static void
+manam_instance_init (Manam * self,
+                     gpointer klass)
+{
+}
+
+static GType
+manam_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (ManamClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) manam_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Manam), 
0, (GInstanceInitFunc) manam_instance_init, NULL };
+       GType manam_type_id;
+       manam_type_id = g_type_register_static (TYPE_BAZ, "Manam", &g_define_type_info, 0);
+       return manam_type_id;
+}
+
+GType
+manam_get_type (void)
+{
+       static volatile gsize manam_type_id__volatile = 0;
+       if (g_once_init_enter (&manam_type_id__volatile)) {
+               GType manam_type_id;
+               manam_type_id = manam_get_type_once ();
+               g_once_init_leave (&manam_type_id__volatile, manam_type_id);
+       }
+       return manam_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       Bar* bar = NULL;
+       Bar* _tmp1_;
+       Manam* manam = NULL;
+       Manam* _tmp2_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       foo_foo (23, foo);
+       _tmp1_ = bar_new ();
+       bar = _tmp1_;
+       foo_foo (42, G_TYPE_CHECK_INSTANCE_CAST (bar, TYPE_FOO, Foo));
+       _tmp2_ = manam_new ();
+       manam = _tmp2_;
+       baz_foo (4711, G_TYPE_CHECK_INSTANCE_CAST (manam, TYPE_BAZ, Baz));
+       _baz_unref0 (manam);
+       _foo_unref0 (bar);
+       _foo_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/bug595538.c-expected b/tests/methods/bug595538.c-expected
new file mode 100644
index 000000000..4cca222a1
--- /dev/null
+++ b/tests/methods/bug595538.c-expected
@@ -0,0 +1,102 @@
+/* methods_bug595538.c generated by valac, the Vala compiler
+ * generated from methods_bug595538.vala, do not modify */
+
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef void (*Foo) (gpointer user_data);
+typedef struct _Block1Data Block1Data;
+
+struct _Block1Data {
+       int _ref_count_;
+       gint i;
+};
+
+VALA_EXTERN void do_foo (Foo foo,
+             gpointer foo_target);
+static void _vala_main (void);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static void __lambda4_ (Block1Data* _data1_);
+static void __lambda5_ (Block1Data* _data1_);
+static void ___lambda5__foo (gpointer self);
+static void ___lambda4__foo (gpointer self);
+
+void
+do_foo (Foo foo,
+        gpointer foo_target)
+{
+       foo (foo_target);
+}
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static void
+__lambda5_ (Block1Data* _data1_)
+{
+       gint j = 0;
+       j = _data1_->i;
+}
+
+static void
+___lambda5__foo (gpointer self)
+{
+       __lambda5_ (self);
+}
+
+static void
+__lambda4_ (Block1Data* _data1_)
+{
+       do_foo (___lambda5__foo, _data1_);
+}
+
+static void
+___lambda4__foo (gpointer self)
+{
+       __lambda4_ (self);
+}
+
+static void
+_vala_main (void)
+{
+       Block1Data* _data1_;
+       _data1_ = g_slice_new0 (Block1Data);
+       _data1_->_ref_count_ = 1;
+       _data1_->i = 42;
+       do_foo (___lambda4__foo, _data1_);
+       block1_data_unref (_data1_);
+       _data1_ = NULL;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/bug596726.c-expected b/tests/methods/bug596726.c-expected
new file mode 100644
index 000000000..5908f7db5
--- /dev/null
+++ b/tests/methods/bug596726.c-expected
@@ -0,0 +1,117 @@
+/* methods_bug596726.c generated by valac, the Vala compiler
+ * generated from methods_bug596726.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef void (*Func) (gpointer user_data);
+typedef struct _Block1Data Block1Data;
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+
+struct _Block1Data {
+       int _ref_count_;
+       GObject* _result_;
+};
+
+VALA_EXTERN void do_bar (Func f,
+             gpointer f_target);
+VALA_EXTERN GObject* do_foo (void);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static void __lambda4_ (Block1Data* _data1_);
+static void ___lambda4__func (gpointer self);
+static void _vala_main (void);
+
+void
+do_bar (Func f,
+        gpointer f_target)
+{
+}
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               _g_object_unref0 (_data1_->_result_);
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static gpointer
+_g_object_ref0 (gpointer self)
+{
+       return self ? g_object_ref (self) : NULL;
+}
+
+static void
+__lambda4_ (Block1Data* _data1_)
+{
+       GObject* v = NULL;
+       GObject* _tmp0_;
+       _tmp0_ = _g_object_ref0 (_data1_->_result_);
+       v = _tmp0_;
+       _g_object_unref0 (v);
+}
+
+static void
+___lambda4__func (gpointer self)
+{
+       __lambda4_ (self);
+}
+
+GObject*
+do_foo (void)
+{
+       Block1Data* _data1_;
+       GObject* _tmp0_;
+       GObject* _tmp1_;
+       GObject* result = NULL;
+       _data1_ = g_slice_new0 (Block1Data);
+       _data1_->_ref_count_ = 1;
+       _tmp0_ = g_object_new (G_TYPE_OBJECT, NULL);
+       _data1_->_result_ = _tmp0_;
+       do_bar (___lambda4__func, _data1_);
+       _tmp1_ = _g_object_ref0 (_data1_->_result_);
+       result = _tmp1_;
+       block1_data_unref (_data1_);
+       _data1_ = NULL;
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       GObject* _tmp0_;
+       GObject* _tmp1_;
+       _tmp0_ = do_foo ();
+       _tmp1_ = _tmp0_;
+       _g_object_unref0 (_tmp1_);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/bug597426.c-expected b/tests/methods/bug597426.c-expected
new file mode 100644
index 000000000..f58cbfae9
--- /dev/null
+++ b/tests/methods/bug597426.c-expected
@@ -0,0 +1,127 @@
+/* methods_bug597426.c generated by valac, the Vala compiler
+ * generated from methods_bug597426.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (GObject* o);
+VALA_EXTERN Foo* foo_construct (GType object_type,
+                    GObject* o);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+Foo*
+foo_construct (GType object_type,
+               GObject* o)
+{
+       Foo * self = NULL;
+       g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (o, G_TYPE_OBJECT), NULL);
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (GObject* o)
+{
+       return foo_construct (TYPE_FOO, o);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       GObject* _tmp0_;
+       GObject* _tmp1_;
+       Foo* _tmp2_;
+       Foo* _tmp3_;
+       _tmp0_ = g_object_new (G_TYPE_OBJECT, NULL);
+       _tmp1_ = _tmp0_;
+       _tmp2_ = foo_new (_tmp1_);
+       _tmp3_ = _tmp2_;
+       _g_object_unref0 (_tmp1_);
+       foo = _tmp3_;
+       _g_object_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/bug598738.c-expected b/tests/methods/bug598738.c-expected
new file mode 100644
index 000000000..8eb818bcc
--- /dev/null
+++ b/tests/methods/bug598738.c-expected
@@ -0,0 +1,89 @@
+/* methods_bug598738.c generated by valac, the Vala compiler
+ * generated from methods_bug598738.vala, do not modify */
+
+#include <glib.h>
+
+typedef void (*Func) (gpointer user_data);
+typedef struct _Block1Data Block1Data;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Block1Data {
+       int _ref_count_;
+       gint* array;
+       gint array_length1;
+       gint _array_size_;
+};
+
+static void _vala_main (void);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static void __lambda4_ (Block1Data* _data1_);
+static void ___lambda4__func (gpointer self);
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               _data1_->array = (g_free (_data1_->array), NULL);
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static void
+__lambda4_ (Block1Data* _data1_)
+{
+       _vala_assert (_data1_->array_length1 == 10, "array.length == 10");
+}
+
+static void
+___lambda4__func (gpointer self)
+{
+       __lambda4_ (self);
+}
+
+static void
+_vala_main (void)
+{
+       Block1Data* _data1_;
+       gint* _tmp0_;
+       Func foo = NULL;
+       gpointer foo_target;
+       GDestroyNotify foo_target_destroy_notify;
+       _data1_ = g_slice_new0 (Block1Data);
+       _data1_->_ref_count_ = 1;
+       _tmp0_ = g_new0 (gint, 10);
+       _data1_->array = _tmp0_;
+       _data1_->array_length1 = 10;
+       _data1_->_array_size_ = _data1_->array_length1;
+       foo = ___lambda4__func;
+       foo_target = block1_data_ref (_data1_);
+       foo_target_destroy_notify = block1_data_unref;
+       foo (foo_target);
+       (foo_target_destroy_notify == NULL) ? NULL : (foo_target_destroy_notify (foo_target), NULL);
+       foo = NULL;
+       foo_target = NULL;
+       foo_target_destroy_notify = NULL;
+       block1_data_unref (_data1_);
+       _data1_ = NULL;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/bug599892.c-expected b/tests/methods/bug599892.c-expected
new file mode 100644
index 000000000..135864bcf
--- /dev/null
+++ b/tests/methods/bug599892.c-expected
@@ -0,0 +1,336 @@
+/* methods_bug599892.c generated by valac, the Vala compiler
+ * generated from methods_bug599892.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gpointer foo_parent_class = NULL;
+static gint foo__bar;
+static gint foo__bar = 0;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN void foo_do_foo (Foo* self);
+VALA_EXTERN void foo_set_bar (gint value);
+VALA_EXTERN gint foo_get_bar (void);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+void
+foo_do_foo (Foo* self)
+{
+       gint i = 0;
+       gint _tmp0_;
+       gint _tmp1_;
+       g_return_if_fail (IS_FOO (self));
+       i = 42;
+       foo_set_bar (i);
+       _tmp0_ = foo_get_bar ();
+       _tmp1_ = _tmp0_;
+       _vala_assert (_tmp1_ == 42, "bar == 42");
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+gint
+foo_get_bar (void)
+{
+       gint result;
+       result = foo__bar;
+       return result;
+}
+
+void
+foo_set_bar (gint value)
+{
+       foo__bar = value;
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       foo_do_foo (foo);
+       _foo_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/bug613483.c-expected b/tests/methods/bug613483.c-expected
new file mode 100644
index 000000000..2a25a331c
--- /dev/null
+++ b/tests/methods/bug613483.c-expected
@@ -0,0 +1,361 @@
+/* methods_bug613483.c generated by valac, the Vala compiler
+ * generated from methods_bug613483.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _Block1Data Block1Data;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _Block1Data {
+       int _ref_count_;
+       Foo* self;
+       gint value;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_set_bar (Foo* self,
+                  gint value);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static gboolean _foo_bar___lambda4_ (Block1Data* _data1_);
+static gboolean __foo_bar___lambda4__gsource_func (gpointer self);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               Foo* self;
+               self = _data1_->self;
+               _foo_unref0 (self);
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static gboolean
+_foo_bar___lambda4_ (Block1Data* _data1_)
+{
+       Foo* self;
+       gint i = 0;
+       gboolean result = FALSE;
+       self = _data1_->self;
+       i = _data1_->value;
+       result = FALSE;
+       return result;
+}
+
+static gboolean
+__foo_bar___lambda4__gsource_func (gpointer self)
+{
+       gboolean result;
+       result = _foo_bar___lambda4_ (self);
+       return result;
+}
+
+static void
+foo_set_bar (Foo* self,
+             gint value)
+{
+       Block1Data* _data1_;
+       g_return_if_fail (IS_FOO (self));
+       _data1_ = g_slice_new0 (Block1Data);
+       _data1_->_ref_count_ = 1;
+       _data1_->self = foo_ref (self);
+       _data1_->value = value;
+       g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, __foo_bar___lambda4__gsource_func, block1_data_ref 
(_data1_), block1_data_unref);
+       block1_data_unref (_data1_);
+       _data1_ = NULL;
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/bug622570.c-expected b/tests/methods/bug622570.c-expected
new file mode 100644
index 000000000..93285b91f
--- /dev/null
+++ b/tests/methods/bug622570.c-expected
@@ -0,0 +1,116 @@
+/* methods_bug622570.c generated by valac, the Vala compiler
+ * generated from methods_bug622570.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+
+typedef gint (*Deleg1) (gint* foo, gpointer user_data);
+typedef void (*Deleg2) (GValue* foo, gint* bar, gpointer user_data);
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (void);
+static gint __lambda4_ (gint* foo);
+static gint ___lambda4__deleg1 (gint* foo,
+                         gpointer self);
+static void __lambda5_ (GValue* foo,
+                 gint* bar);
+static void ___lambda5__deleg2 (GValue* foo,
+                         gint* bar,
+                         gpointer self);
+
+static gint
+__lambda4_ (gint* foo)
+{
+       gint result = 0;
+       result = (*foo) + 5;
+       return result;
+}
+
+static gint
+___lambda4__deleg1 (gint* foo,
+                    gpointer self)
+{
+       gint result;
+       result = __lambda4_ (foo);
+       return result;
+}
+
+static void
+__lambda5_ (GValue* foo,
+            gint* bar)
+{
+       GValue _vala_foo = {0};
+       GValue _tmp0_ = {0};
+       g_value_init (&_tmp0_, G_TYPE_INT);
+       g_value_set_int (&_tmp0_, 10);
+       G_IS_VALUE (&_vala_foo) ? (g_value_unset (&_vala_foo), NULL) : NULL;
+       _vala_foo = _tmp0_;
+       *bar = 3;
+       if (foo) {
+               *foo = _vala_foo;
+       } else {
+               G_IS_VALUE (&_vala_foo) ? (g_value_unset (&_vala_foo), NULL) : NULL;
+       }
+}
+
+static void
+___lambda5__deleg2 (GValue* foo,
+                    gint* bar,
+                    gpointer self)
+{
+       __lambda5_ (foo, bar);
+}
+
+static void
+_vala_main (void)
+{
+       gint a = 0;
+       gint b = 0;
+       GValue c = {0};
+       Deleg1 d1 = NULL;
+       gpointer d1_target;
+       GDestroyNotify d1_target_destroy_notify;
+       Deleg2 d2 = NULL;
+       gpointer d2_target;
+       GDestroyNotify d2_target_destroy_notify;
+       gint _tmp0_;
+       GValue _tmp1_ = {0};
+       GValue _tmp2_;
+       a = 3;
+       b = 4;
+       d1 = ___lambda4__deleg1;
+       d1_target = NULL;
+       d1_target_destroy_notify = NULL;
+       d2 = ___lambda5__deleg2;
+       d2_target = NULL;
+       d2_target_destroy_notify = NULL;
+       _tmp0_ = d1 (&a, d1_target);
+       _vala_assert (_tmp0_ == 8, "d1 (ref a) == 8");
+       d2 (&_tmp1_, &b, d2_target);
+       G_IS_VALUE (&c) ? (g_value_unset (&c), NULL) : NULL;
+       c = _tmp1_;
+       _tmp2_ = c;
+       _vala_assert (g_value_get_int (&_tmp2_) == 10, "c == 10");
+       _vala_assert (b == 3, "b == 3");
+       (d2_target_destroy_notify == NULL) ? NULL : (d2_target_destroy_notify (d2_target), NULL);
+       d2 = NULL;
+       d2_target = NULL;
+       d2_target_destroy_notify = NULL;
+       (d1_target_destroy_notify == NULL) ? NULL : (d1_target_destroy_notify (d1_target), NULL);
+       d1 = NULL;
+       d1_target = NULL;
+       d1_target_destroy_notify = NULL;
+       G_IS_VALUE (&c) ? (g_value_unset (&c), NULL) : NULL;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/bug626783.c-expected b/tests/methods/bug626783.c-expected
new file mode 100644
index 000000000..529233886
--- /dev/null
+++ b/tests/methods/bug626783.c-expected
@@ -0,0 +1,401 @@
+/* methods_bug626783.c generated by valac, the Vala compiler
+ * generated from methods_bug626783.vala, do not modify */
+
+#include <glib-object.h>
+#include <gobject/gvaluecollector.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TEST, TestClass))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define IS_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TEST))
+#define TEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TEST, TestClass))
+
+typedef struct _Test Test;
+typedef struct _TestClass TestClass;
+typedef struct _TestPrivate TestPrivate;
+typedef struct _ParamSpecTest ParamSpecTest;
+#define _test_unref0(var) ((var == NULL) ? NULL : (var = (test_unref (var), NULL)))
+
+struct _Test {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       TestPrivate * priv;
+};
+
+struct _TestClass {
+       GTypeClass parent_class;
+       void (*finalize) (Test *self);
+};
+
+struct _TestPrivate {
+       GType g_type;
+       GBoxedCopyFunc g_dup_func;
+       GDestroyNotify g_destroy_func;
+       GType h_type;
+       GBoxedCopyFunc h_dup_func;
+       GDestroyNotify h_destroy_func;
+};
+
+struct _ParamSpecTest {
+       GParamSpec parent_instance;
+};
+
+static gint Test_private_offset;
+static gpointer test_parent_class = NULL;
+
+VALA_EXTERN gpointer test_ref (gpointer instance);
+VALA_EXTERN void test_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_test (const gchar* name,
+                             const gchar* nick,
+                             const gchar* blurb,
+                             GType object_type,
+                             GParamFlags flags);
+VALA_EXTERN void value_set_test (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN void value_take_test (GValue* value,
+                      gpointer v_object);
+VALA_EXTERN gpointer value_get_test (const GValue* value);
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, test_unref)
+VALA_EXTERN Test* test_new (GType g_type,
+                GBoxedCopyFunc g_dup_func,
+                GDestroyNotify g_destroy_func,
+                GType h_type,
+                GBoxedCopyFunc h_dup_func,
+                GDestroyNotify h_destroy_func);
+VALA_EXTERN Test* test_construct (GType object_type,
+                      GType g_type,
+                      GBoxedCopyFunc g_dup_func,
+                      GDestroyNotify g_destroy_func,
+                      GType h_type,
+                      GBoxedCopyFunc h_dup_func,
+                      GDestroyNotify h_destroy_func);
+static void test_finalize (Test * obj);
+static GType test_get_type_once (void);
+VALA_EXTERN void foo (GType t_type,
+          GBoxedCopyFunc t_dup_func,
+          GDestroyNotify t_destroy_func,
+          Test* t);
+VALA_EXTERN void bar (GType a_type,
+          GBoxedCopyFunc a_dup_func,
+          GDestroyNotify a_destroy_func,
+          GType b_type,
+          GBoxedCopyFunc b_dup_func,
+          GDestroyNotify b_destroy_func,
+          Test* t);
+VALA_EXTERN gconstpointer* baz (GType t_type,
+                    GBoxedCopyFunc t_dup_func,
+                    GDestroyNotify t_destroy_func);
+static void _vala_main (void);
+
+static inline gpointer
+test_get_instance_private (Test* self)
+{
+       return G_STRUCT_MEMBER_P (self, Test_private_offset);
+}
+
+Test*
+test_construct (GType object_type,
+                GType g_type,
+                GBoxedCopyFunc g_dup_func,
+                GDestroyNotify g_destroy_func,
+                GType h_type,
+                GBoxedCopyFunc h_dup_func,
+                GDestroyNotify h_destroy_func)
+{
+       Test* self = NULL;
+       self = (Test*) g_type_create_instance (object_type);
+       self->priv->g_type = g_type;
+       self->priv->g_dup_func = g_dup_func;
+       self->priv->g_destroy_func = g_destroy_func;
+       self->priv->h_type = h_type;
+       self->priv->h_dup_func = h_dup_func;
+       self->priv->h_destroy_func = h_destroy_func;
+       return self;
+}
+
+Test*
+test_new (GType g_type,
+          GBoxedCopyFunc g_dup_func,
+          GDestroyNotify g_destroy_func,
+          GType h_type,
+          GBoxedCopyFunc h_dup_func,
+          GDestroyNotify h_destroy_func)
+{
+       return test_construct (TYPE_TEST, g_type, g_dup_func, g_destroy_func, h_type, h_dup_func, 
h_destroy_func);
+}
+
+static void
+value_test_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_test_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               test_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_test_copy_value (const GValue* src_value,
+                       GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = test_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_test_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_test_collect_value (GValue* value,
+                          guint n_collect_values,
+                          GTypeCValue* collect_values,
+                          guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Test * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = test_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_test_lcopy_value (const GValue* value,
+                        guint n_collect_values,
+                        GTypeCValue* collect_values,
+                        guint collect_flags)
+{
+       Test ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = test_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_test (const gchar* name,
+                 const gchar* nick,
+                 const gchar* blurb,
+                 GType object_type,
+                 GParamFlags flags)
+{
+       ParamSpecTest* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_TEST), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_test (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_TEST), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_test (GValue* value,
+                gpointer v_object)
+{
+       Test * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_TEST));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_TEST));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               test_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               test_unref (old);
+       }
+}
+
+void
+value_take_test (GValue* value,
+                 gpointer v_object)
+{
+       Test * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_TEST));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_TEST));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               test_unref (old);
+       }
+}
+
+static void
+test_class_init (TestClass * klass,
+                 gpointer klass_data)
+{
+       test_parent_class = g_type_class_peek_parent (klass);
+       ((TestClass *) klass)->finalize = test_finalize;
+       g_type_class_adjust_private_offset (klass, &Test_private_offset);
+}
+
+static void
+test_instance_init (Test * self,
+                    gpointer klass)
+{
+       self->priv = test_get_instance_private (self);
+       self->ref_count = 1;
+}
+
+static void
+test_finalize (Test * obj)
+{
+       Test * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_TEST, Test);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_test_init, value_test_free_value, 
value_test_copy_value, value_test_peek_pointer, "p", value_test_collect_value, "p", value_test_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (TestClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Test), 
0, (GInstanceInitFunc) test_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType test_type_id;
+       test_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Test", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       Test_private_offset = g_type_add_instance_private (test_type_id, sizeof (TestPrivate));
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+gpointer
+test_ref (gpointer instance)
+{
+       Test * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+test_unref (gpointer instance)
+{
+       Test * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               TEST_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+void
+foo (GType t_type,
+     GBoxedCopyFunc t_dup_func,
+     GDestroyNotify t_destroy_func,
+     Test* t)
+{
+       g_return_if_fail (IS_TEST (t));
+}
+
+void
+bar (GType a_type,
+     GBoxedCopyFunc a_dup_func,
+     GDestroyNotify a_destroy_func,
+     GType b_type,
+     GBoxedCopyFunc b_dup_func,
+     GDestroyNotify b_destroy_func,
+     Test* t)
+{
+       g_return_if_fail (IS_TEST (t));
+}
+
+gconstpointer*
+baz (GType t_type,
+     GBoxedCopyFunc t_dup_func,
+     GDestroyNotify t_destroy_func)
+{
+       gconstpointer* result = NULL;
+       result = NULL;
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       Test* f = NULL;
+       Test* _tmp0_;
+       Test* g = NULL;
+       Test* _tmp1_;
+       gint* i = NULL;
+       gconstpointer* _tmp2_;
+       _tmp0_ = test_new (G_TYPE_INT, NULL, NULL, G_TYPE_INT, NULL, NULL);
+       f = _tmp0_;
+       foo (G_TYPE_INT, NULL, NULL, f);
+       _tmp1_ = test_new (TYPE_TEST, (GBoxedCopyFunc) test_ref, (GDestroyNotify) test_unref, G_TYPE_INT, 
NULL, NULL);
+       g = _tmp1_;
+       bar (G_TYPE_CHAR, NULL, NULL, G_TYPE_UINT, NULL, NULL, g);
+       _tmp2_ = baz (G_TYPE_INT, NULL, NULL);
+       i = _tmp2_;
+       _test_unref0 (g);
+       _test_unref0 (f);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/bug634753.c-expected b/tests/methods/bug634753.c-expected
new file mode 100644
index 000000000..e6398fe2e
--- /dev/null
+++ b/tests/methods/bug634753.c-expected
@@ -0,0 +1,57 @@
+/* methods_bug634753.c generated by valac, the Vala compiler
+ * generated from methods_bug634753.vala, do not modify */
+
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+VALA_EXTERN void foo (guint8** a,
+          gsize* a_length1);
+VALA_EXTERN void bar (guint8* a,
+          gsize a_length1);
+static void _vala_main (void);
+
+void
+foo (guint8** a,
+     gsize* a_length1)
+{
+}
+
+void
+bar (guint8* a,
+     gsize a_length1)
+{
+}
+
+static void
+_vala_main (void)
+{
+       guint8* a = NULL;
+       guint8* _tmp0_;
+       gint a_length1;
+       gint _a_size_;
+       _tmp0_ = g_new0 (guint8, 32);
+       a = _tmp0_;
+       a_length1 = 32;
+       _a_size_ = a_length1;
+       foo (&a, (gsize*) (&a_length1));
+       _a_size_ = a_length1;
+       a = (g_free (a), NULL);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/bug639054.c-expected b/tests/methods/bug639054.c-expected
new file mode 100644
index 000000000..84343a0fc
--- /dev/null
+++ b/tests/methods/bug639054.c-expected
@@ -0,0 +1,349 @@
+/* methods_bug639054.c generated by valac, the Vala compiler
+ * generated from methods_bug639054.vala, do not modify */
+
+#include <glib.h>
+#include <gio/gio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib-object.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef struct _Baz Baz;
+typedef struct _Block1Data Block1Data;
+typedef struct _FooData FooData;
+typedef struct _Block2Data Block2Data;
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+#define _baz_free0(var) ((var == NULL) ? NULL : (var = (baz_free (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Baz {
+       int dummy;
+};
+
+struct _Block1Data {
+       int _ref_count_;
+       guint8* bar;
+       gint bar_length1;
+       Baz* baz;
+       gpointer _async_data_;
+};
+
+struct _FooData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       guint8* bar;
+       gint bar_length1;
+       Baz* baz;
+       Block1Data* _data1_;
+       GSourceFunc f;
+       gpointer f_target;
+       GDestroyNotify f_target_destroy_notify;
+};
+
+struct _Block2Data {
+       int _ref_count_;
+       GMainLoop* loop;
+       guint8* bar;
+       gint bar_length1;
+       gint _bar_size_;
+};
+
+VALA_EXTERN void baz_free (Baz * self);
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Baz, baz_free)
+static void baz_instance_init (Baz * self);
+VALA_EXTERN Baz* baz_new (void);
+static void foo_data_free (gpointer _data);
+VALA_EXTERN void foo (guint8* bar,
+          gint bar_length1,
+          Baz* baz,
+          GAsyncReadyCallback _callback_,
+          gpointer _user_data_);
+VALA_EXTERN void foo_finish (GAsyncResult* _res_);
+static gboolean foo_co (FooData* _data_);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static gboolean __lambda4_ (Block1Data* _data1_);
+static gboolean ___lambda4__gsource_func (gpointer self);
+static void _vala_main (void);
+static Block2Data* block2_data_ref (Block2Data* _data2_);
+static void block2_data_unref (void * _userdata_);
+static guint8* _vala_array_dup1 (guint8* self,
+                          gssize length);
+static void __lambda5_ (Block2Data* _data2_);
+static void ___lambda5__gasync_ready_callback (GObject* source_object,
+                                        GAsyncResult* res,
+                                        gpointer self);
+static inline gpointer _vala_memdup2 (gconstpointer mem,
+                        gsize byte_size);
+
+Baz*
+baz_new (void)
+{
+       Baz* self;
+       self = g_slice_new0 (Baz);
+       baz_instance_init (self);
+       return self;
+}
+
+static void
+baz_instance_init (Baz * self)
+{
+}
+
+void
+baz_free (Baz * self)
+{
+       g_slice_free (Baz, self);
+}
+
+static void
+foo_data_free (gpointer _data)
+{
+       FooData* _data_;
+       _data_ = _data;
+       g_slice_free (FooData, _data_);
+}
+
+void
+foo (guint8* bar,
+     gint bar_length1,
+     Baz* baz,
+     GAsyncReadyCallback _callback_,
+     gpointer _user_data_)
+{
+       FooData* _data_;
+       g_return_if_fail (baz != NULL);
+       _data_ = g_slice_new0 (FooData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, foo_data_free);
+       _data_->bar = bar;
+       _data_->bar_length1 = bar_length1;
+       _data_->baz = baz;
+       foo_co (_data_);
+}
+
+void
+foo_finish (GAsyncResult* _res_)
+{
+       FooData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static gboolean
+__lambda4_ (Block1Data* _data1_)
+{
+       gboolean result = FALSE;
+       _data1_->bar[0] = (guint8) 'b';
+       _data1_->baz = NULL;
+       result = FALSE;
+       return result;
+}
+
+static gboolean
+___lambda4__gsource_func (gpointer self)
+{
+       gboolean result;
+       result = __lambda4_ (self);
+       return result;
+}
+
+static gboolean
+foo_co (FooData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->_data1_ = g_slice_new0 (Block1Data);
+       _data_->_data1_->_ref_count_ = 1;
+       _data_->_data1_->bar = _data_->bar;
+       _data_->_data1_->bar_length1 = _data_->bar_length1;
+       _data_->_data1_->baz = _data_->baz;
+       _data_->_data1_->_async_data_ = _data_;
+       _data_->f = ___lambda4__gsource_func;
+       _data_->f_target = block1_data_ref (_data_->_data1_);
+       _data_->f_target_destroy_notify = block1_data_unref;
+       _data_->f (_data_->f_target);
+       (_data_->f_target_destroy_notify == NULL) ? NULL : (_data_->f_target_destroy_notify 
(_data_->f_target), NULL);
+       _data_->f = NULL;
+       _data_->f_target = NULL;
+       _data_->f_target_destroy_notify = NULL;
+       block1_data_unref (_data_->_data1_);
+       _data_->_data1_ = NULL;
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static Block2Data*
+block2_data_ref (Block2Data* _data2_)
+{
+       g_atomic_int_inc (&_data2_->_ref_count_);
+       return _data2_;
+}
+
+static void
+block2_data_unref (void * _userdata_)
+{
+       Block2Data* _data2_;
+       _data2_ = (Block2Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data2_->_ref_count_)) {
+               _data2_->bar = (g_free (_data2_->bar), NULL);
+               _g_main_loop_unref0 (_data2_->loop);
+               g_slice_free (Block2Data, _data2_);
+       }
+}
+
+static guint8*
+string_get_data (const gchar* self,
+                 gint* result_length1)
+{
+       guint8* result;
+       guint8* res = NULL;
+       gint res_length1;
+       gint _res_size_;
+       gint _tmp0_;
+       gint _tmp1_;
+       guint8* _tmp2_;
+       gint _tmp2__length1;
+       g_return_val_if_fail (self != NULL, NULL);
+       res = (guint8*) self;
+       res_length1 = -1;
+       _res_size_ = res_length1;
+       _tmp0_ = strlen (self);
+       _tmp1_ = _tmp0_;
+       res_length1 = (gint) _tmp1_;
+       _tmp2_ = res;
+       _tmp2__length1 = res_length1;
+       if (result_length1) {
+               *result_length1 = _tmp2__length1;
+       }
+       result = _tmp2_;
+       return result;
+}
+
+static guint8*
+_vala_array_dup1 (guint8* self,
+                  gssize length)
+{
+       if (length > 0) {
+               return _vala_memdup2 (self, length * sizeof (guint8));
+       }
+       return NULL;
+}
+
+static void
+__lambda5_ (Block2Data* _data2_)
+{
+       guint8 _tmp0_;
+       _tmp0_ = _data2_->bar[0];
+       _vala_assert (_tmp0_ == ((guint8) 'b'), "bar[0] == 'b'");
+       g_main_loop_quit (_data2_->loop);
+}
+
+static void
+___lambda5__gasync_ready_callback (GObject* source_object,
+                                   GAsyncResult* res,
+                                   gpointer self)
+{
+       __lambda5_ (self);
+       block2_data_unref (self);
+}
+
+static void
+_vala_main (void)
+{
+       Block2Data* _data2_;
+       GMainLoop* _tmp0_;
+       guint8* _tmp1_;
+       gint _tmp1__length1;
+       gint _tmp2_ = 0;
+       guint8* _tmp3_;
+       gint _tmp3__length1;
+       guint8* _tmp4_;
+       gint _tmp4__length1;
+       Baz* _tmp5_;
+       Baz* _tmp6_;
+       _data2_ = g_slice_new0 (Block2Data);
+       _data2_->_ref_count_ = 1;
+       _tmp0_ = g_main_loop_new (NULL, FALSE);
+       _data2_->loop = _tmp0_;
+       _tmp1_ = string_get_data ("foo", &_tmp2_);
+       _tmp1__length1 = _tmp2_;
+       _tmp3_ = _tmp1_;
+       _tmp3__length1 = _tmp1__length1;
+       _tmp4_ = (_tmp3_ != NULL) ? _vala_array_dup1 (_tmp3_, _tmp3__length1) : _tmp3_;
+       _tmp4__length1 = _tmp3__length1;
+       _data2_->bar = _tmp4_;
+       _data2_->bar_length1 = _tmp4__length1;
+       _data2_->_bar_size_ = _data2_->bar_length1;
+       _tmp5_ = baz_new ();
+       _tmp6_ = _tmp5_;
+       foo (_data2_->bar, (gint) _data2_->bar_length1, _tmp6_, ___lambda5__gasync_ready_callback, 
block2_data_ref (_data2_));
+       _baz_free0 (_tmp6_);
+       g_main_loop_run (_data2_->loop);
+       block2_data_unref (_data2_);
+       _data2_ = NULL;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static inline gpointer
+_vala_memdup2 (gconstpointer mem,
+               gsize byte_size)
+{
+       gpointer new_mem;
+       if (mem && byte_size != 0) {
+               new_mem = g_malloc (byte_size);
+               memcpy (new_mem, mem, byte_size);
+       } else {
+               new_mem = NULL;
+       }
+       return new_mem;
+}
+
diff --git a/tests/methods/bug642350.c-expected b/tests/methods/bug642350.c-expected
new file mode 100644
index 000000000..98ebea8be
--- /dev/null
+++ b/tests/methods/bug642350.c-expected
@@ -0,0 +1,413 @@
+/* methods_bug642350.c generated by valac, the Vala compiler
+ * generated from methods_bug642350.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+#include <glib/gi18n-lib.h>
+#include <glib-object.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+#define _g_free0(var) (var = (g_free (var), NULL))
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+enum  {
+       BAR_0_PROPERTY,
+       BAR_BAR_PROPERTY,
+       BAR_NUM_PROPERTIES
+};
+static GParamSpec* bar_properties[BAR_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       gchar* foo;
+       const gchar* bar;
+};
+
+struct _Bar {
+       GObject parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       GObjectClass parent_class;
+};
+
+static gpointer bar_parent_class = NULL;
+VALA_EXTERN gchar* bar_foo;
+gchar* bar_foo = NULL;
+
+#define BAZ N_ ("bar")
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN void foo_copy (const Foo* self,
+               Foo* dest);
+VALA_EXTERN void foo_destroy (Foo* self);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
+VALA_EXTERN gchar* bar_get_baz (Bar* self);
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+VALA_EXTERN const gchar* bar_get_bar (Bar* self);
+static void bar_finalize (GObject * obj);
+static GType bar_get_type_once (void);
+static void _vala_bar_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_main (void);
+static gchar** _vala_array_dup1 (gchar** self,
+                          gssize length);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+const gchar* FOO[2] = {N_ ("foo"), NC_ ("valac", "bar")};
+const Foo STRUCT = {"foo", N_ ("bar")};
+
+void
+foo_copy (const Foo* self,
+          Foo* dest)
+{
+       const gchar* _tmp0_;
+       gchar* _tmp1_;
+       const gchar* _tmp2_;
+       _tmp0_ = (*self).foo;
+       _tmp1_ = g_strdup (_tmp0_);
+       _g_free0 ((*dest).foo);
+       (*dest).foo = _tmp1_;
+       _tmp2_ = (*self).bar;
+       (*dest).bar = _tmp2_;
+}
+
+void
+foo_destroy (Foo* self)
+{
+       _g_free0 ((*self).foo);
+}
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       foo_copy (self, dup);
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       foo_destroy (self);
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gchar*
+bar_get_baz (Bar* self)
+{
+       gchar* _tmp0_;
+       gchar* result = NULL;
+       g_return_val_if_fail (IS_BAR (self), NULL);
+       _tmp0_ = g_strdup (N_ ("baz"));
+       result = _tmp0_;
+       return result;
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar * self = NULL;
+       self = (Bar*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+const gchar*
+bar_get_bar (Bar* self)
+{
+       const gchar* result;
+       g_return_val_if_fail (IS_BAR (self), NULL);
+       result = N_ ("bar");
+       return result;
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       gchar* _tmp0_;
+       bar_parent_class = g_type_class_peek_parent (klass);
+       G_OBJECT_CLASS (klass)->get_property = _vala_bar_get_property;
+       G_OBJECT_CLASS (klass)->finalize = bar_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), BAR_BAR_PROPERTY, 
bar_properties[BAR_BAR_PROPERTY] = g_param_spec_string ("bar", "bar", "bar", NULL, G_PARAM_STATIC_STRINGS | 
G_PARAM_READABLE));
+       _tmp0_ = g_strdup (N_ ("foo"));
+       bar_foo = _tmp0_;
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static void
+bar_finalize (GObject * obj)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       G_OBJECT_CLASS (bar_parent_class)->finalize (obj);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (G_TYPE_OBJECT, "Bar", &g_define_type_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_bar_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_BAR, Bar);
+       switch (property_id) {
+               case BAR_BAR_PROPERTY:
+               g_value_set_string (value, bar_get_bar (self));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static gchar**
+_vala_array_dup1 (gchar** self,
+                  gssize length)
+{
+       if (length >= 0) {
+               gchar** result;
+               gssize i;
+               result = g_new0 (gchar*, length + 1);
+               for (i = 0; i < length; i++) {
+                       gchar* _tmp0_;
+                       _tmp0_ = g_strdup (self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+static void
+_vala_main (void)
+{
+       const gchar* _tmp0_;
+       const gchar* _tmp1_;
+       static const gchar* LOCAL_FOO[2] = {N_ ("foo"), N_ ("bar")};
+       const gchar* _tmp2_;
+       static const char LOCAL_BAZ[] = N_ ("bar");
+       static const Foo LOCAL_STRUCT = {"foo", N_ ("bar")};
+       const gchar* _tmp3_;
+       Foo f = {0};
+       gchar* _tmp4_;
+       Foo _tmp5_ = {0};
+       Foo _tmp6_;
+       const gchar* _tmp7_;
+       Foo _tmp8_;
+       const gchar* _tmp9_;
+       Bar* b = NULL;
+       Bar* _tmp10_;
+       const gchar* _tmp11_;
+       const gchar* _tmp12_;
+       const gchar* _tmp13_;
+       gchar* _tmp14_;
+       gchar* _tmp15_;
+       gchar* s1 = NULL;
+       gchar* _tmp16_;
+       const gchar* _tmp17_;
+       const gchar* _tmp18_;
+       gchar* _tmp19_;
+       const gchar* _tmp20_;
+       const gchar* s2 = NULL;
+       const gchar* _tmp21_;
+       const gchar* _tmp22_;
+       const gchar* _tmp23_;
+       gchar** a1 = NULL;
+       gchar** _tmp24_;
+       gint _tmp24__length1;
+       gint a1_length1;
+       gint _a1_size_;
+       const gchar* _tmp25_;
+       gchar** a2 = NULL;
+       gint a2_length1;
+       gint _a2_size_;
+       const gchar* _tmp26_;
+       _tmp0_ = FOO[1];
+       _vala_assert (g_strcmp0 (_tmp0_, "bar") == 0, "FOO[1] == \"bar\"");
+       _vala_assert (g_strcmp0 (BAZ, "bar") == 0, "BAZ == \"bar\"");
+       _tmp1_ = STRUCT.bar;
+       _vala_assert (g_strcmp0 (_tmp1_, "bar") == 0, "STRUCT.bar == \"bar\"");
+       _tmp2_ = LOCAL_FOO[1];
+       _vala_assert (g_strcmp0 (_tmp2_, "bar") == 0, "LOCAL_FOO[1] == \"bar\"");
+       _vala_assert (g_strcmp0 (LOCAL_BAZ, "bar") == 0, "LOCAL_BAZ == \"bar\"");
+       _tmp3_ = LOCAL_STRUCT.bar;
+       _vala_assert (g_strcmp0 (_tmp3_, "bar") == 0, "LOCAL_STRUCT.bar == \"bar\"");
+       _tmp4_ = g_strdup (N_ ("foo"));
+       _g_free0 (_tmp5_.foo);
+       _tmp5_.foo = _tmp4_;
+       _tmp5_.bar = NC_ ("valac", "bar");
+       f = _tmp5_;
+       _tmp6_ = f;
+       _tmp7_ = _tmp6_.foo;
+       _vala_assert (g_strcmp0 (_tmp7_, "foo") == 0, "f.foo == \"foo\"");
+       _tmp8_ = f;
+       _tmp9_ = _tmp8_.bar;
+       _vala_assert (g_strcmp0 (_tmp9_, "bar") == 0, "f.bar == \"bar\"");
+       _tmp10_ = bar_new ();
+       b = _tmp10_;
+       _tmp11_ = bar_foo;
+       _vala_assert (g_strcmp0 (_tmp11_, "foo") == 0, "b.foo == \"foo\"");
+       _tmp12_ = bar_get_bar (b);
+       _tmp13_ = _tmp12_;
+       _vala_assert (g_strcmp0 (_tmp13_, "bar") == 0, "b.bar == \"bar\"");
+       _tmp14_ = bar_get_baz (b);
+       _tmp15_ = _tmp14_;
+       _vala_assert (g_strcmp0 (_tmp15_, "baz") == 0, "b.get_baz () == \"baz\"");
+       _g_free0 (_tmp15_);
+       _tmp16_ = g_strdup (N_ ("bar"));
+       s1 = _tmp16_;
+       _tmp17_ = s1;
+       _vala_assert (g_strcmp0 (_tmp17_, "bar") == 0, "s1 == \"bar\"");
+       _tmp18_ = s1;
+       _tmp19_ = g_strdup (N_ (_tmp18_));
+       _g_free0 (s1);
+       s1 = _tmp19_;
+       _tmp20_ = s1;
+       _vala_assert (g_strcmp0 (_tmp20_, "bar") == 0, "s1 == \"bar\"");
+       s2 = N_ ("bar");
+       _tmp21_ = s2;
+       _vala_assert (g_strcmp0 (_tmp21_, "bar") == 0, "s2 == \"bar\"");
+       _tmp22_ = s2;
+       s2 = N_ (_tmp22_);
+       _tmp23_ = s2;
+       _vala_assert (g_strcmp0 (_tmp23_, "bar") == 0, "s2 == \"bar\"");
+       _tmp24_ = _vala_array_dup1 (FOO, G_N_ELEMENTS (FOO));
+       _tmp24__length1 = G_N_ELEMENTS (FOO);
+       a1 = _tmp24_;
+       a1_length1 = _tmp24__length1;
+       _a1_size_ = a1_length1;
+       _tmp25_ = a1[1];
+       _vala_assert (g_strcmp0 (_tmp25_, "bar") == 0, "a1[1] == \"bar\"");
+       a2 = FOO;
+       a2_length1 = G_N_ELEMENTS (FOO);
+       _a2_size_ = a2_length1;
+       _tmp26_ = a2[0];
+       _vala_assert (g_strcmp0 (_tmp26_, "foo") == 0, "a2[0] == \"foo\"");
+       a1 = (_vala_array_free (a1, a1_length1, (GDestroyNotify) g_free), NULL);
+       _g_free0 (s1);
+       _g_object_unref0 (b);
+       foo_destroy (&f);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/methods/bug642885.c-expected b/tests/methods/bug642885.c-expected
new file mode 100644
index 000000000..b751ce150
--- /dev/null
+++ b/tests/methods/bug642885.c-expected
@@ -0,0 +1,277 @@
+/* methods_bug642885.c generated by valac, the Vala compiler
+ * generated from methods_bug642885.vala, do not modify */
+
+#include <gio/gio.h>
+#include <glib-object.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_option_context_free0(var) ((var == NULL) ? NULL : (var = (g_option_context_free (var), NULL)))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GApplication parent_instance;
+       FooPrivate * priv;
+       gboolean activated;
+};
+
+struct _FooClass {
+       GApplicationClass parent_class;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_real_activate (GApplication* base);
+static gboolean foo_real_local_command_line (GApplication* base,
+                                      gchar*** arguments,
+                                      gint* exit_status);
+static void foo_finalize (GObject * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+static gssize _vala_array_length (gpointer array);
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, "application-id", "org.foo.bar", NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+foo_real_activate (GApplication* base)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_FOO, Foo);
+       self->activated = TRUE;
+}
+
+static gboolean
+foo_real_local_command_line (GApplication* base,
+                             gchar*** arguments,
+                             gint* exit_status)
+{
+       Foo * self;
+       gint _vala_exit_status = 0;
+       GOptionContext* option_context = NULL;
+       GOptionContext* _tmp0_;
+       gchar** args = NULL;
+       gint args_length1;
+       gint _args_size_;
+       gint _tmp4_ = 0;
+       gboolean _tmp5_;
+       GError* _inner_error0_ = NULL;
+       gboolean result = FALSE;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_FOO, Foo);
+       _tmp0_ = g_option_context_new (NULL);
+       option_context = _tmp0_;
+       args = *arguments;
+       args_length1 = _vala_array_length (*arguments);
+       _args_size_ = args_length1;
+       {
+               GOptionContext* _tmp1_;
+               _tmp1_ = option_context;
+               g_option_context_parse (_tmp1_, (gint*) (&args_length1), &args, &_inner_error0_);
+               _args_size_ = args_length1;
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       gboolean _tmp2_ = FALSE;
+                       if (_inner_error0_->domain == G_OPTION_ERROR) {
+                               goto __catch0_g_option_error;
+                       }
+                       _g_option_context_free0 (option_context);
+                       g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return _tmp2_;
+               }
+       }
+       goto __finally0;
+       __catch0_g_option_error:
+       {
+               g_clear_error (&_inner_error0_);
+               _vala_exit_status = 1;
+               result = TRUE;
+               _g_option_context_free0 (option_context);
+               if (exit_status) {
+                       *exit_status = _vala_exit_status;
+               }
+               return result;
+       }
+       __finally0:
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               gboolean _tmp3_ = FALSE;
+               _g_option_context_free0 (option_context);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return _tmp3_;
+       }
+       _tmp5_ = G_APPLICATION_CLASS (foo_parent_class)->local_command_line (G_TYPE_CHECK_INSTANCE_CAST 
(self, g_application_get_type (), GApplication), arguments, &_tmp4_);
+       _vala_exit_status = _tmp4_;
+       result = _tmp5_;
+       _g_option_context_free0 (option_context);
+       if (exit_status) {
+               *exit_status = _vala_exit_status;
+       }
+       return result;
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((GApplicationClass *) klass)->activate = (void (*) (GApplication*)) foo_real_activate;
+       ((GApplicationClass *) klass)->local_command_line = (gboolean (*) (GApplication*, gchar***, gint*)) 
foo_real_local_command_line;
+       G_OBJECT_CLASS (klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->activated = FALSE;
+}
+
+static void
+foo_finalize (GObject * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       G_OBJECT_CLASS (foo_parent_class)->finalize (obj);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (g_application_get_type (), "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       gchar** args = NULL;
+       gchar* _tmp0_;
+       gchar** _tmp1_;
+       gint args_length1;
+       gint _args_size_;
+       Foo* app = NULL;
+       Foo* _tmp2_;
+       _tmp0_ = g_strdup ("");
+       _tmp1_ = g_new0 (gchar*, 1 + 1);
+       _tmp1_[0] = _tmp0_;
+       args = _tmp1_;
+       args_length1 = 1;
+       _args_size_ = args_length1;
+       _tmp2_ = foo_new ();
+       app = _tmp2_;
+       g_application_run (G_TYPE_CHECK_INSTANCE_CAST (app, g_application_get_type (), GApplication), (gint) 
args_length1, args);
+       _vala_assert (app->activated, "app.activated");
+       _g_object_unref0 (app);
+       args = (_vala_array_free (args, args_length1, (GDestroyNotify) g_free), NULL);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
+static gssize
+_vala_array_length (gpointer array)
+{
+       gssize length;
+       length = 0;
+       if (array) {
+               while (((gpointer*) array)[length]) {
+                       length++;
+               }
+       }
+       return length;
+}
+
diff --git a/tests/methods/bug642899.c-expected b/tests/methods/bug642899.c-expected
new file mode 100644
index 000000000..e8522262f
--- /dev/null
+++ b/tests/methods/bug642899.c-expected
@@ -0,0 +1,394 @@
+/* methods_bug642899.c generated by valac, the Vala compiler
+ * generated from methods_bug642899.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+typedef struct _Block1Data Block1Data;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _FooPrivate {
+       GObject* bar;
+};
+
+struct _Block1Data {
+       int _ref_count_;
+       Foo* self;
+       GObject* baz;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static gboolean __lambda4_ (Block1Data* _data1_);
+static gboolean ___lambda4__gsource_func (gpointer self);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               Foo* self;
+               self = _data1_->self;
+               _g_object_unref0 (_data1_->baz);
+               _foo_unref0 (self);
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static gpointer
+_g_object_ref0 (gpointer self)
+{
+       return self ? g_object_ref (self) : NULL;
+}
+
+static gboolean
+__lambda4_ (Block1Data* _data1_)
+{
+       Foo* self;
+       GObject* _tmp0_;
+       GObject* _tmp1_;
+       gboolean result = FALSE;
+       self = _data1_->self;
+       _tmp0_ = self->priv->bar;
+       _tmp1_ = _g_object_ref0 (_tmp0_);
+       _g_object_unref0 (_data1_->baz);
+       _data1_->baz = _tmp1_;
+       result = FALSE;
+       return result;
+}
+
+static gboolean
+___lambda4__gsource_func (gpointer self)
+{
+       gboolean result;
+       result = __lambda4_ (self);
+       return result;
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       Block1Data* _data1_;
+       GSourceFunc f = NULL;
+       gpointer f_target;
+       GDestroyNotify f_target_destroy_notify;
+       self = (Foo*) g_type_create_instance (object_type);
+       _data1_ = g_slice_new0 (Block1Data);
+       _data1_->_ref_count_ = 1;
+       _data1_->self = foo_ref (self);
+       _data1_->baz = NULL;
+       f = ___lambda4__gsource_func;
+       f_target = block1_data_ref (_data1_);
+       f_target_destroy_notify = block1_data_unref;
+       f (f_target);
+       (f_target_destroy_notify == NULL) ? NULL : (f_target_destroy_notify (f_target), NULL);
+       f = NULL;
+       f_target = NULL;
+       f_target_destroy_notify = NULL;
+       block1_data_unref (_data1_);
+       _data1_ = NULL;
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+       _g_object_unref0 (self->priv->bar);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Foo* _tmp0_;
+       Foo* _tmp1_;
+       _tmp0_ = foo_new ();
+       _tmp1_ = _tmp0_;
+       _foo_unref0 (_tmp1_);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/bug646345.c-expected b/tests/methods/bug646345.c-expected
new file mode 100644
index 000000000..2f0d31508
--- /dev/null
+++ b/tests/methods/bug646345.c-expected
@@ -0,0 +1,184 @@
+/* methods_bug646345.c generated by valac, the Vala compiler
+ * generated from methods_bug646345.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+typedef struct _Block1Data Block1Data;
+#define _g_free0(var) (var = (g_free (var), NULL))
+typedef struct _Block2Data Block2Data;
+
+struct _Block1Data {
+       int _ref_count_;
+       gchar* outervar;
+};
+
+struct _Block2Data {
+       int _ref_count_;
+       gchar* innervar;
+};
+
+static void _vala_main (void);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static gboolean __lambda4_ (Block1Data* _data1_);
+static gboolean ___lambda4__gsource_func (gpointer self);
+static gboolean __lambda5_ (void);
+static Block2Data* block2_data_ref (Block2Data* _data2_);
+static void block2_data_unref (void * _userdata_);
+static gboolean __lambda6_ (Block2Data* _data2_);
+static gboolean ___lambda6__gsource_func (gpointer self);
+static gboolean ___lambda5__gsource_func (gpointer self);
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               _g_free0 (_data1_->outervar);
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static gboolean
+__lambda4_ (Block1Data* _data1_)
+{
+       gchar* _tmp0_;
+       gboolean result = FALSE;
+       _tmp0_ = g_strdup ("outerbar");
+       _g_free0 (_data1_->outervar);
+       _data1_->outervar = _tmp0_;
+       result = FALSE;
+       return result;
+}
+
+static gboolean
+___lambda4__gsource_func (gpointer self)
+{
+       gboolean result;
+       result = __lambda4_ (self);
+       return result;
+}
+
+static Block2Data*
+block2_data_ref (Block2Data* _data2_)
+{
+       g_atomic_int_inc (&_data2_->_ref_count_);
+       return _data2_;
+}
+
+static void
+block2_data_unref (void * _userdata_)
+{
+       Block2Data* _data2_;
+       _data2_ = (Block2Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data2_->_ref_count_)) {
+               _g_free0 (_data2_->innervar);
+               g_slice_free (Block2Data, _data2_);
+       }
+}
+
+static gboolean
+__lambda6_ (Block2Data* _data2_)
+{
+       gchar* _tmp0_;
+       gboolean result = FALSE;
+       _tmp0_ = g_strdup ("innerbar");
+       _g_free0 (_data2_->innervar);
+       _data2_->innervar = _tmp0_;
+       result = FALSE;
+       return result;
+}
+
+static gboolean
+___lambda6__gsource_func (gpointer self)
+{
+       gboolean result;
+       result = __lambda6_ (self);
+       return result;
+}
+
+static gboolean
+__lambda5_ (void)
+{
+       Block2Data* _data2_;
+       gchar* _tmp0_;
+       GSourceFunc innerfunc = NULL;
+       gpointer innerfunc_target;
+       GDestroyNotify innerfunc_target_destroy_notify;
+       gboolean result = FALSE;
+       _data2_ = g_slice_new0 (Block2Data);
+       _data2_->_ref_count_ = 1;
+       _tmp0_ = g_strdup ("innerfoo");
+       _data2_->innervar = _tmp0_;
+       innerfunc = ___lambda6__gsource_func;
+       innerfunc_target = block2_data_ref (_data2_);
+       innerfunc_target_destroy_notify = block2_data_unref;
+       result = FALSE;
+       (innerfunc_target_destroy_notify == NULL) ? NULL : (innerfunc_target_destroy_notify 
(innerfunc_target), NULL);
+       innerfunc = NULL;
+       innerfunc_target = NULL;
+       innerfunc_target_destroy_notify = NULL;
+       block2_data_unref (_data2_);
+       _data2_ = NULL;
+       return result;
+}
+
+static gboolean
+___lambda5__gsource_func (gpointer self)
+{
+       gboolean result;
+       result = __lambda5_ ();
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       Block1Data* _data1_;
+       gchar* _tmp0_;
+       GSourceFunc firstfunc = NULL;
+       gpointer firstfunc_target;
+       GDestroyNotify firstfunc_target_destroy_notify;
+       GSourceFunc secondfunc = NULL;
+       gpointer secondfunc_target;
+       GDestroyNotify secondfunc_target_destroy_notify;
+       _data1_ = g_slice_new0 (Block1Data);
+       _data1_->_ref_count_ = 1;
+       _tmp0_ = g_strdup ("outerfoo");
+       _data1_->outervar = _tmp0_;
+       firstfunc = ___lambda4__gsource_func;
+       firstfunc_target = block1_data_ref (_data1_);
+       firstfunc_target_destroy_notify = block1_data_unref;
+       secondfunc = ___lambda5__gsource_func;
+       secondfunc_target = NULL;
+       secondfunc_target_destroy_notify = NULL;
+       (secondfunc_target_destroy_notify == NULL) ? NULL : (secondfunc_target_destroy_notify 
(secondfunc_target), NULL);
+       secondfunc = NULL;
+       secondfunc_target = NULL;
+       secondfunc_target_destroy_notify = NULL;
+       (firstfunc_target_destroy_notify == NULL) ? NULL : (firstfunc_target_destroy_notify 
(firstfunc_target), NULL);
+       firstfunc = NULL;
+       firstfunc_target = NULL;
+       firstfunc_target_destroy_notify = NULL;
+       block1_data_unref (_data1_);
+       _data1_ = NULL;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/bug648320.c-expected b/tests/methods/bug648320.c-expected
new file mode 100644
index 000000000..272b547c8
--- /dev/null
+++ b/tests/methods/bug648320.c-expected
@@ -0,0 +1,180 @@
+/* methods_bug648320.c generated by valac, the Vala compiler
+ * generated from methods_bug648320.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define FOO_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_FOO, FooIface))
+
+typedef struct _Foo Foo;
+typedef struct _FooIface FooIface;
+typedef struct _Block1Data Block1Data;
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+
+struct _FooIface {
+       GTypeInterface parent_iface;
+       gint (*get_i) (Foo* self);
+       void (*set_i) (Foo* self, gint value);
+};
+
+struct _Block1Data {
+       int _ref_count_;
+       Foo* self;
+       gint j;
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN void foo_foo (Foo* self);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static gboolean __lambda4_ (Block1Data* _data1_);
+VALA_EXTERN gint foo_get_i (Foo* self);
+static gboolean ___lambda4__gsource_func (gpointer self);
+VALA_EXTERN void foo_set_i (Foo* self,
+                gint value);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               Foo* self;
+               self = _data1_->self;
+               _g_object_unref0 (self);
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static gboolean
+__lambda4_ (Block1Data* _data1_)
+{
+       Foo* self;
+       gint _tmp0_;
+       gint _tmp1_;
+       gboolean result = FALSE;
+       self = _data1_->self;
+       _tmp0_ = foo_get_i (self);
+       _tmp1_ = _tmp0_;
+       result = _data1_->j == _tmp1_;
+       return result;
+}
+
+static gboolean
+___lambda4__gsource_func (gpointer self)
+{
+       gboolean result;
+       result = __lambda4_ (self);
+       return result;
+}
+
+void
+foo_foo (Foo* self)
+{
+       Block1Data* _data1_;
+       GSourceFunc bar = NULL;
+       gpointer bar_target;
+       GDestroyNotify bar_target_destroy_notify;
+       _data1_ = g_slice_new0 (Block1Data);
+       _data1_->_ref_count_ = 1;
+       _data1_->self = g_object_ref (self);
+       _data1_->j = 0;
+       bar = ___lambda4__gsource_func;
+       bar_target = block1_data_ref (_data1_);
+       bar_target_destroy_notify = block1_data_unref;
+       (bar_target_destroy_notify == NULL) ? NULL : (bar_target_destroy_notify (bar_target), NULL);
+       bar = NULL;
+       bar_target = NULL;
+       bar_target_destroy_notify = NULL;
+       block1_data_unref (_data1_);
+       _data1_ = NULL;
+}
+
+gint
+foo_get_i (Foo* self)
+{
+       FooIface* _iface_;
+       g_return_val_if_fail (IS_FOO (self), 0);
+       _iface_ = FOO_GET_INTERFACE (self);
+       if (_iface_->get_i) {
+               return _iface_->get_i (self);
+       }
+       return -1;
+}
+
+void
+foo_set_i (Foo* self,
+           gint value)
+{
+       FooIface* _iface_;
+       g_return_if_fail (IS_FOO (self));
+       _iface_ = FOO_GET_INTERFACE (self);
+       if (_iface_->set_i) {
+               _iface_->set_i (self, value);
+       }
+}
+
+static void
+foo_default_init (FooIface * iface,
+                  gpointer iface_data)
+{
+       g_object_interface_install_property (iface, g_param_spec_int ("i", "i", "i", G_MININT, G_MAXINT, 0, 
G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_INTERFACE, "Foo", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (foo_type_id, G_TYPE_OBJECT);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/bug649562.c-expected b/tests/methods/bug649562.c-expected
new file mode 100644
index 000000000..b1be937c5
--- /dev/null
+++ b/tests/methods/bug649562.c-expected
@@ -0,0 +1,52 @@
+/* methods_bug649562.c generated by valac, the Vala compiler
+ * generated from methods_bug649562.vala, do not modify */
+
+#include <glib.h>
+
+static void _vala_main (void);
+static gboolean __lambda4_ (void);
+static gboolean ___lambda4__gsource_func (gpointer self);
+
+static gboolean
+__lambda4_ (void)
+{
+       static const gint b = 3;
+       gboolean result = FALSE;
+       result = FALSE;
+       return result;
+}
+
+static gboolean
+___lambda4__gsource_func (gpointer self)
+{
+       gboolean result;
+       result = __lambda4_ ();
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       GSourceFunc f = NULL;
+       gpointer f_target;
+       GDestroyNotify f_target_destroy_notify;
+       {
+               static const gint a = 2;
+       }
+       f = ___lambda4__gsource_func;
+       f_target = NULL;
+       f_target_destroy_notify = NULL;
+       (f_target_destroy_notify == NULL) ? NULL : (f_target_destroy_notify (f_target), NULL);
+       f = NULL;
+       f_target = NULL;
+       f_target_destroy_notify = NULL;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/bug652098.c-expected b/tests/methods/bug652098.c-expected
new file mode 100644
index 000000000..81acc0910
--- /dev/null
+++ b/tests/methods/bug652098.c-expected
@@ -0,0 +1,682 @@
+/* methods_bug652098.c generated by valac, the Vala compiler
+ * generated from methods_bug652098.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_IFACE1 (iface1_get_type ())
+#define IFACE1(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IFACE1, Iface1))
+#define IS_IFACE1(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IFACE1))
+#define IFACE1_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_IFACE1, Iface1Iface))
+
+typedef struct _Iface1 Iface1;
+typedef struct _Iface1Iface Iface1Iface;
+
+#define TYPE_IFACE2 (iface2_get_type ())
+#define IFACE2(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IFACE2, Iface2))
+#define IS_IFACE2(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IFACE2))
+#define IFACE2_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_IFACE2, Iface2Iface))
+
+typedef struct _Iface2 Iface2;
+typedef struct _Iface2Iface Iface2Iface;
+
+#define TYPE_OBJ1 (obj1_get_type ())
+#define OBJ1(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_OBJ1, Obj1))
+#define OBJ1_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_OBJ1, Obj1Class))
+#define IS_OBJ1(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_OBJ1))
+#define IS_OBJ1_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_OBJ1))
+#define OBJ1_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_OBJ1, Obj1Class))
+
+typedef struct _Obj1 Obj1;
+typedef struct _Obj1Class Obj1Class;
+typedef struct _Obj1Private Obj1Private;
+enum  {
+       OBJ1_0_PROPERTY,
+       OBJ1_NUM_PROPERTIES
+};
+static GParamSpec* obj1_properties[OBJ1_NUM_PROPERTIES];
+
+#define TYPE_OBJ2 (obj2_get_type ())
+#define OBJ2(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_OBJ2, Obj2))
+#define OBJ2_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_OBJ2, Obj2Class))
+#define IS_OBJ2(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_OBJ2))
+#define IS_OBJ2_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_OBJ2))
+#define OBJ2_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_OBJ2, Obj2Class))
+
+typedef struct _Obj2 Obj2;
+typedef struct _Obj2Class Obj2Class;
+typedef struct _Obj2Private Obj2Private;
+enum  {
+       OBJ2_0_PROPERTY,
+       OBJ2_NUM_PROPERTIES
+};
+static GParamSpec* obj2_properties[OBJ2_NUM_PROPERTIES];
+
+#define TYPE_BASE (base_get_type ())
+#define BASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BASE, Base))
+#define BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BASE, BaseClass))
+#define IS_BASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BASE))
+#define IS_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BASE))
+#define BASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BASE, BaseClass))
+
+typedef struct _Base Base;
+typedef struct _BaseClass BaseClass;
+typedef struct _BasePrivate BasePrivate;
+enum  {
+       BASE_0_PROPERTY,
+       BASE_NUM_PROPERTIES
+};
+static GParamSpec* base_properties[BASE_NUM_PROPERTIES];
+
+#define TYPE_IFACE (iface_get_type ())
+#define IFACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IFACE, Iface))
+#define IS_IFACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IFACE))
+#define IFACE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_IFACE, IfaceIface))
+
+typedef struct _Iface Iface;
+typedef struct _IfaceIface IfaceIface;
+
+#define TYPE_CONCRETE (concrete_get_type ())
+#define CONCRETE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_CONCRETE, Concrete))
+#define CONCRETE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_CONCRETE, ConcreteClass))
+#define IS_CONCRETE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_CONCRETE))
+#define IS_CONCRETE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_CONCRETE))
+#define CONCRETE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_CONCRETE, ConcreteClass))
+
+typedef struct _Concrete Concrete;
+typedef struct _ConcreteClass ConcreteClass;
+typedef struct _ConcretePrivate ConcretePrivate;
+enum  {
+       CONCRETE_0_PROPERTY,
+       CONCRETE_NUM_PROPERTIES
+};
+static GParamSpec* concrete_properties[CONCRETE_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Iface1Iface {
+       GTypeInterface parent_iface;
+       gint (*foo) (Iface1* self);
+};
+
+struct _Iface2Iface {
+       GTypeInterface parent_iface;
+       gint (*foo) (Iface2* self);
+};
+
+struct _Obj1 {
+       GObject parent_instance;
+       Obj1Private * priv;
+};
+
+struct _Obj1Class {
+       GObjectClass parent_class;
+};
+
+struct _Obj2 {
+       GObject parent_instance;
+       Obj2Private * priv;
+};
+
+struct _Obj2Class {
+       GObjectClass parent_class;
+};
+
+struct _Base {
+       GObject parent_instance;
+       BasePrivate * priv;
+};
+
+struct _BaseClass {
+       GObjectClass parent_class;
+};
+
+struct _IfaceIface {
+       GTypeInterface parent_iface;
+       gint (*foo) (Iface* self);
+};
+
+struct _Concrete {
+       Base parent_instance;
+       ConcretePrivate * priv;
+};
+
+struct _ConcreteClass {
+       BaseClass parent_class;
+};
+
+static gpointer obj1_parent_class = NULL;
+static Iface1Iface * obj1_iface1_parent_iface = NULL;
+static Iface2Iface * obj1_iface2_parent_iface = NULL;
+static gpointer obj2_parent_class = NULL;
+static Iface1Iface * obj2_iface1_parent_iface = NULL;
+static Iface2Iface * obj2_iface2_parent_iface = NULL;
+static gpointer base_parent_class = NULL;
+static gpointer concrete_parent_class = NULL;
+static IfaceIface * concrete_iface_parent_iface = NULL;
+
+VALA_EXTERN GType iface1_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN gint iface1_foo (Iface1* self);
+static GType iface1_get_type_once (void);
+VALA_EXTERN GType iface2_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN gint iface2_foo (Iface2* self);
+static GType iface2_get_type_once (void);
+VALA_EXTERN GType obj1_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Obj1, g_object_unref)
+static gint obj1_real_iface1_foo (Iface1* base);
+static gint obj1_real_iface2_foo (Iface2* base);
+VALA_EXTERN Obj1* obj1_new (void);
+VALA_EXTERN Obj1* obj1_construct (GType object_type);
+static GType obj1_get_type_once (void);
+VALA_EXTERN GType obj2_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Obj2, g_object_unref)
+static gint obj2_real_iface1_foo (Iface1* base);
+static gint obj2_real_foo (Iface2* base);
+VALA_EXTERN Obj2* obj2_new (void);
+VALA_EXTERN Obj2* obj2_construct (GType object_type);
+static GType obj2_get_type_once (void);
+VALA_EXTERN GType base_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Base, g_object_unref)
+VALA_EXTERN gint base_foo (Base* self);
+VALA_EXTERN Base* base_new (void);
+VALA_EXTERN Base* base_construct (GType object_type);
+static GType base_get_type_once (void);
+VALA_EXTERN GType iface_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN gint iface_foo (Iface* self);
+static GType iface_get_type_once (void);
+VALA_EXTERN GType concrete_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Concrete, g_object_unref)
+VALA_EXTERN Concrete* concrete_new (void);
+VALA_EXTERN Concrete* concrete_construct (GType object_type);
+static GType concrete_get_type_once (void);
+static void _vala_main (void);
+
+gint
+iface1_foo (Iface1* self)
+{
+       Iface1Iface* _iface_;
+       g_return_val_if_fail (IS_IFACE1 (self), 0);
+       _iface_ = IFACE1_GET_INTERFACE (self);
+       if (_iface_->foo) {
+               return _iface_->foo (self);
+       }
+       return -1;
+}
+
+static void
+iface1_default_init (Iface1Iface * iface,
+                     gpointer iface_data)
+{
+}
+
+static GType
+iface1_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (Iface1Iface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) iface1_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType iface1_type_id;
+       iface1_type_id = g_type_register_static (G_TYPE_INTERFACE, "Iface1", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (iface1_type_id, G_TYPE_OBJECT);
+       return iface1_type_id;
+}
+
+GType
+iface1_get_type (void)
+{
+       static volatile gsize iface1_type_id__volatile = 0;
+       if (g_once_init_enter (&iface1_type_id__volatile)) {
+               GType iface1_type_id;
+               iface1_type_id = iface1_get_type_once ();
+               g_once_init_leave (&iface1_type_id__volatile, iface1_type_id);
+       }
+       return iface1_type_id__volatile;
+}
+
+gint
+iface2_foo (Iface2* self)
+{
+       Iface2Iface* _iface_;
+       g_return_val_if_fail (IS_IFACE2 (self), 0);
+       _iface_ = IFACE2_GET_INTERFACE (self);
+       if (_iface_->foo) {
+               return _iface_->foo (self);
+       }
+       return -1;
+}
+
+static void
+iface2_default_init (Iface2Iface * iface,
+                     gpointer iface_data)
+{
+}
+
+static GType
+iface2_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (Iface2Iface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) iface2_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType iface2_type_id;
+       iface2_type_id = g_type_register_static (G_TYPE_INTERFACE, "Iface2", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (iface2_type_id, G_TYPE_OBJECT);
+       return iface2_type_id;
+}
+
+GType
+iface2_get_type (void)
+{
+       static volatile gsize iface2_type_id__volatile = 0;
+       if (g_once_init_enter (&iface2_type_id__volatile)) {
+               GType iface2_type_id;
+               iface2_type_id = iface2_get_type_once ();
+               g_once_init_leave (&iface2_type_id__volatile, iface2_type_id);
+       }
+       return iface2_type_id__volatile;
+}
+
+static gint
+obj1_real_iface1_foo (Iface1* base)
+{
+       Obj1 * self;
+       gint result = 0;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_OBJ1, Obj1);
+       result = 1;
+       return result;
+}
+
+static gint
+obj1_real_iface2_foo (Iface2* base)
+{
+       Obj1 * self;
+       gint result = 0;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_OBJ1, Obj1);
+       result = 2;
+       return result;
+}
+
+Obj1*
+obj1_construct (GType object_type)
+{
+       Obj1 * self = NULL;
+       self = (Obj1*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Obj1*
+obj1_new (void)
+{
+       return obj1_construct (TYPE_OBJ1);
+}
+
+static void
+obj1_class_init (Obj1Class * klass,
+                 gpointer klass_data)
+{
+       obj1_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+obj1_iface1_interface_init (Iface1Iface * iface,
+                            gpointer iface_data)
+{
+       obj1_iface1_parent_iface = g_type_interface_peek_parent (iface);
+       iface->foo = (gint (*) (Iface1*)) obj1_real_iface1_foo;
+}
+
+static void
+obj1_iface2_interface_init (Iface2Iface * iface,
+                            gpointer iface_data)
+{
+       obj1_iface2_parent_iface = g_type_interface_peek_parent (iface);
+       iface->foo = (gint (*) (Iface2*)) obj1_real_iface2_foo;
+}
+
+static void
+obj1_instance_init (Obj1 * self,
+                    gpointer klass)
+{
+}
+
+static GType
+obj1_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (Obj1Class), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) obj1_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Obj1), 
0, (GInstanceInitFunc) obj1_instance_init, NULL };
+       static const GInterfaceInfo iface1_info = { (GInterfaceInitFunc) obj1_iface1_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       static const GInterfaceInfo iface2_info = { (GInterfaceInitFunc) obj1_iface2_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       GType obj1_type_id;
+       obj1_type_id = g_type_register_static (G_TYPE_OBJECT, "Obj1", &g_define_type_info, 0);
+       g_type_add_interface_static (obj1_type_id, TYPE_IFACE1, &iface1_info);
+       g_type_add_interface_static (obj1_type_id, TYPE_IFACE2, &iface2_info);
+       return obj1_type_id;
+}
+
+GType
+obj1_get_type (void)
+{
+       static volatile gsize obj1_type_id__volatile = 0;
+       if (g_once_init_enter (&obj1_type_id__volatile)) {
+               GType obj1_type_id;
+               obj1_type_id = obj1_get_type_once ();
+               g_once_init_leave (&obj1_type_id__volatile, obj1_type_id);
+       }
+       return obj1_type_id__volatile;
+}
+
+static gint
+obj2_real_iface1_foo (Iface1* base)
+{
+       Obj2 * self;
+       gint result = 0;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_OBJ2, Obj2);
+       result = 1;
+       return result;
+}
+
+static gint
+obj2_real_foo (Iface2* base)
+{
+       Obj2 * self;
+       gint result = 0;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_OBJ2, Obj2);
+       result = 2;
+       return result;
+}
+
+Obj2*
+obj2_construct (GType object_type)
+{
+       Obj2 * self = NULL;
+       self = (Obj2*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Obj2*
+obj2_new (void)
+{
+       return obj2_construct (TYPE_OBJ2);
+}
+
+static void
+obj2_class_init (Obj2Class * klass,
+                 gpointer klass_data)
+{
+       obj2_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+obj2_iface1_interface_init (Iface1Iface * iface,
+                            gpointer iface_data)
+{
+       obj2_iface1_parent_iface = g_type_interface_peek_parent (iface);
+       iface->foo = (gint (*) (Iface1*)) obj2_real_iface1_foo;
+}
+
+static void
+obj2_iface2_interface_init (Iface2Iface * iface,
+                            gpointer iface_data)
+{
+       obj2_iface2_parent_iface = g_type_interface_peek_parent (iface);
+       iface->foo = (gint (*) (Iface2*)) obj2_real_foo;
+}
+
+static void
+obj2_instance_init (Obj2 * self,
+                    gpointer klass)
+{
+}
+
+static GType
+obj2_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (Obj2Class), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) obj2_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Obj2), 
0, (GInstanceInitFunc) obj2_instance_init, NULL };
+       static const GInterfaceInfo iface1_info = { (GInterfaceInitFunc) obj2_iface1_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       static const GInterfaceInfo iface2_info = { (GInterfaceInitFunc) obj2_iface2_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       GType obj2_type_id;
+       obj2_type_id = g_type_register_static (G_TYPE_OBJECT, "Obj2", &g_define_type_info, 0);
+       g_type_add_interface_static (obj2_type_id, TYPE_IFACE1, &iface1_info);
+       g_type_add_interface_static (obj2_type_id, TYPE_IFACE2, &iface2_info);
+       return obj2_type_id;
+}
+
+GType
+obj2_get_type (void)
+{
+       static volatile gsize obj2_type_id__volatile = 0;
+       if (g_once_init_enter (&obj2_type_id__volatile)) {
+               GType obj2_type_id;
+               obj2_type_id = obj2_get_type_once ();
+               g_once_init_leave (&obj2_type_id__volatile, obj2_type_id);
+       }
+       return obj2_type_id__volatile;
+}
+
+gint
+base_foo (Base* self)
+{
+       gint result = 0;
+       g_return_val_if_fail (IS_BASE (self), 0);
+       result = 42;
+       return result;
+}
+
+Base*
+base_construct (GType object_type)
+{
+       Base * self = NULL;
+       self = (Base*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Base*
+base_new (void)
+{
+       return base_construct (TYPE_BASE);
+}
+
+static void
+base_class_init (BaseClass * klass,
+                 gpointer klass_data)
+{
+       base_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+base_instance_init (Base * self,
+                    gpointer klass)
+{
+}
+
+static GType
+base_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BaseClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) base_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Base), 
0, (GInstanceInitFunc) base_instance_init, NULL };
+       GType base_type_id;
+       base_type_id = g_type_register_static (G_TYPE_OBJECT, "Base", &g_define_type_info, 0);
+       return base_type_id;
+}
+
+GType
+base_get_type (void)
+{
+       static volatile gsize base_type_id__volatile = 0;
+       if (g_once_init_enter (&base_type_id__volatile)) {
+               GType base_type_id;
+               base_type_id = base_get_type_once ();
+               g_once_init_leave (&base_type_id__volatile, base_type_id);
+       }
+       return base_type_id__volatile;
+}
+
+gint
+iface_foo (Iface* self)
+{
+       IfaceIface* _iface_;
+       g_return_val_if_fail (IS_IFACE (self), 0);
+       _iface_ = IFACE_GET_INTERFACE (self);
+       if (_iface_->foo) {
+               return _iface_->foo (self);
+       }
+       return -1;
+}
+
+static void
+iface_default_init (IfaceIface * iface,
+                    gpointer iface_data)
+{
+}
+
+static GType
+iface_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (IfaceIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) iface_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType iface_type_id;
+       iface_type_id = g_type_register_static (G_TYPE_INTERFACE, "Iface", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (iface_type_id, G_TYPE_OBJECT);
+       return iface_type_id;
+}
+
+GType
+iface_get_type (void)
+{
+       static volatile gsize iface_type_id__volatile = 0;
+       if (g_once_init_enter (&iface_type_id__volatile)) {
+               GType iface_type_id;
+               iface_type_id = iface_get_type_once ();
+               g_once_init_leave (&iface_type_id__volatile, iface_type_id);
+       }
+       return iface_type_id__volatile;
+}
+
+Concrete*
+concrete_construct (GType object_type)
+{
+       Concrete * self = NULL;
+       self = (Concrete*) base_construct (object_type);
+       return self;
+}
+
+Concrete*
+concrete_new (void)
+{
+       return concrete_construct (TYPE_CONCRETE);
+}
+
+static void
+concrete_class_init (ConcreteClass * klass,
+                     gpointer klass_data)
+{
+       concrete_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+concrete_iface_interface_init (IfaceIface * iface,
+                               gpointer iface_data)
+{
+       concrete_iface_parent_iface = g_type_interface_peek_parent (iface);
+       iface->foo = (gint (*) (Iface*)) base_foo;
+}
+
+static void
+concrete_instance_init (Concrete * self,
+                        gpointer klass)
+{
+}
+
+static GType
+concrete_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (ConcreteClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) concrete_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(Concrete), 0, (GInstanceInitFunc) concrete_instance_init, NULL };
+       static const GInterfaceInfo iface_info = { (GInterfaceInitFunc) concrete_iface_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       GType concrete_type_id;
+       concrete_type_id = g_type_register_static (TYPE_BASE, "Concrete", &g_define_type_info, 0);
+       g_type_add_interface_static (concrete_type_id, TYPE_IFACE, &iface_info);
+       return concrete_type_id;
+}
+
+GType
+concrete_get_type (void)
+{
+       static volatile gsize concrete_type_id__volatile = 0;
+       if (g_once_init_enter (&concrete_type_id__volatile)) {
+               GType concrete_type_id;
+               concrete_type_id = concrete_get_type_once ();
+               g_once_init_leave (&concrete_type_id__volatile, concrete_type_id);
+       }
+       return concrete_type_id__volatile;
+}
+
+static gpointer
+_g_object_ref0 (gpointer self)
+{
+       return self ? g_object_ref (self) : NULL;
+}
+
+static void
+_vala_main (void)
+{
+       Obj1* obj1 = NULL;
+       Obj1* _tmp0_;
+       Iface1* iface1 = NULL;
+       Iface1* _tmp1_;
+       Iface2* iface2 = NULL;
+       Iface2* _tmp2_;
+       Iface1* _tmp3_;
+       Iface2* _tmp4_;
+       Obj2* obj2 = NULL;
+       Obj2* _tmp5_;
+       Iface1* _tmp6_;
+       Iface2* _tmp7_;
+       Iface1* _tmp8_;
+       Iface2* _tmp9_;
+       Concrete* concrete = NULL;
+       Concrete* _tmp10_;
+       _tmp0_ = obj1_new ();
+       obj1 = _tmp0_;
+       _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (obj1, TYPE_IFACE1, Iface1));
+       iface1 = _tmp1_;
+       _tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (obj1, TYPE_IFACE2, Iface2));
+       iface2 = _tmp2_;
+       _tmp3_ = iface1;
+       _vala_assert (iface1_foo (_tmp3_) == 1, "iface1.foo () == 1");
+       _tmp4_ = iface2;
+       _vala_assert (iface2_foo (_tmp4_) == 2, "iface2.foo () == 2");
+       _tmp5_ = obj2_new ();
+       obj2 = _tmp5_;
+       _tmp6_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (obj2, TYPE_IFACE1, Iface1));
+       _g_object_unref0 (iface1);
+       iface1 = _tmp6_;
+       _tmp7_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (obj2, TYPE_IFACE2, Iface2));
+       _g_object_unref0 (iface2);
+       iface2 = _tmp7_;
+       _tmp8_ = iface1;
+       _vala_assert (iface1_foo (_tmp8_) == 1, "iface1.foo () == 1");
+       _tmp9_ = iface2;
+       _vala_assert (iface2_foo (_tmp9_) == 2, "iface2.foo () == 2");
+       _tmp10_ = concrete_new ();
+       concrete = _tmp10_;
+       _vala_assert (iface_foo (G_TYPE_CHECK_INSTANCE_CAST (concrete, TYPE_IFACE, Iface)) == 42, "((Iface) 
concrete).foo () == 42");
+       _g_object_unref0 (concrete);
+       _g_object_unref0 (obj2);
+       _g_object_unref0 (iface2);
+       _g_object_unref0 (iface1);
+       _g_object_unref0 (obj1);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/bug653391.c-expected b/tests/methods/bug653391.c-expected
new file mode 100644
index 000000000..58535062b
--- /dev/null
+++ b/tests/methods/bug653391.c-expected
@@ -0,0 +1,136 @@
+/* methods_bug653391.c generated by valac, the Vala compiler
+ * generated from methods_bug653391.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef gchar* (*Deleg) (gpointer user_data);
+#define _g_free0(var) (var = (g_free (var), NULL))
+typedef struct _Block1Data Block1Data;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Block1Data {
+       int _ref_count_;
+       gchar* bar;
+};
+
+VALA_EXTERN Deleg foo (gchar* bar,
+           gpointer* result_target,
+           GDestroyNotify* result_target_destroy_notify);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static gchar* __lambda4_ (Block1Data* _data1_);
+static gchar* ___lambda4__deleg (gpointer self);
+static void _vala_main (void);
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               _g_free0 (_data1_->bar);
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static gchar*
+__lambda4_ (Block1Data* _data1_)
+{
+       gchar* _tmp0_;
+       gchar* result = NULL;
+       _tmp0_ = g_strdup (_data1_->bar);
+       result = _tmp0_;
+       return result;
+}
+
+static gchar*
+___lambda4__deleg (gpointer self)
+{
+       gchar* result;
+       result = __lambda4_ (self);
+       return result;
+}
+
+Deleg
+foo (gchar* bar,
+     gpointer* result_target,
+     GDestroyNotify* result_target_destroy_notify)
+{
+       Block1Data* _data1_;
+       Deleg _tmp0_;
+       gpointer _tmp0__target;
+       GDestroyNotify _tmp0__target_destroy_notify;
+       Deleg result = NULL;
+       g_return_val_if_fail (bar != NULL, NULL);
+       _data1_ = g_slice_new0 (Block1Data);
+       _data1_->_ref_count_ = 1;
+       _g_free0 (_data1_->bar);
+       _data1_->bar = bar;
+       _tmp0_ = ___lambda4__deleg;
+       _tmp0__target = block1_data_ref (_data1_);
+       _tmp0__target_destroy_notify = block1_data_unref;
+       *result_target = _tmp0__target;
+       *result_target_destroy_notify = _tmp0__target_destroy_notify;
+       result = _tmp0_;
+       block1_data_unref (_data1_);
+       _data1_ = NULL;
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       gchar* _tmp0_;
+       gpointer _tmp1_ = NULL;
+       GDestroyNotify _tmp2_ = NULL;
+       Deleg _tmp3_;
+       Deleg _tmp4_;
+       gpointer _tmp4__target;
+       GDestroyNotify _tmp4__target_destroy_notify;
+       gchar* _tmp5_;
+       gchar* _tmp6_;
+       _tmp0_ = g_strdup ("foo");
+       _tmp3_ = foo (_tmp0_, &_tmp1_, &_tmp2_);
+       _tmp4_ = _tmp3_;
+       _tmp4__target = _tmp1_;
+       _tmp4__target_destroy_notify = _tmp2_;
+       _tmp5_ = _tmp4_ (_tmp1_);
+       _tmp6_ = _tmp5_;
+       _vala_assert (g_strcmp0 (_tmp6_, "foo") == 0, "foo (\"foo\")() == \"foo\"");
+       _g_free0 (_tmp6_);
+       (_tmp4__target_destroy_notify == NULL) ? NULL : (_tmp4__target_destroy_notify (_tmp4__target), NULL);
+       _tmp4_ = NULL;
+       _tmp4__target = NULL;
+       _tmp4__target_destroy_notify = NULL;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/bug653908.c-expected b/tests/methods/bug653908.c-expected
new file mode 100644
index 000000000..5d68d6fc7
--- /dev/null
+++ b/tests/methods/bug653908.c-expected
@@ -0,0 +1,99 @@
+/* methods_bug653908.c generated by valac, the Vala compiler
+ * generated from methods_bug653908.vala, do not modify */
+
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN gint* foo (gint* result_length1);
+static gint* _vala_array_dup1 (gint* self,
+                        gssize length);
+static void _vala_main (void);
+static inline gpointer _vala_memdup2 (gconstpointer mem,
+                        gsize byte_size);
+
+static gint*
+_vala_array_dup1 (gint* self,
+                  gssize length)
+{
+       if (length > 0) {
+               return _vala_memdup2 (self, length * sizeof (gint));
+       }
+       return NULL;
+}
+
+gint*
+foo (gint* result_length1)
+{
+       gint bar[8] = {0};
+       gint* _tmp0_;
+       gint _tmp0__length1;
+       gint* _tmp1_;
+       gint _tmp1__length1;
+       gint* result = NULL;
+       bar[7] = 42;
+       _tmp0_ = _vala_array_dup1 (bar, 8);
+       _tmp0__length1 = 8;
+       _tmp1_ = _tmp0_;
+       _tmp1__length1 = _tmp0__length1;
+       if (result_length1) {
+               *result_length1 = _tmp1__length1;
+       }
+       result = _tmp1_;
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       gint* bar = NULL;
+       gint _tmp0_ = 0;
+       gint* _tmp1_;
+       gint bar_length1;
+       gint _bar_size_;
+       gint _tmp2_;
+       _tmp1_ = foo (&_tmp0_);
+       bar = _tmp1_;
+       bar_length1 = _tmp0_;
+       _bar_size_ = bar_length1;
+       _tmp2_ = bar[7];
+       _vala_assert (_tmp2_ == 42, "bar[7] == 42");
+       bar = (g_free (bar), NULL);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static inline gpointer
+_vala_memdup2 (gconstpointer mem,
+               gsize byte_size)
+{
+       gpointer new_mem;
+       if (mem && byte_size != 0) {
+               new_mem = g_malloc (byte_size);
+               memcpy (new_mem, mem, byte_size);
+       } else {
+               new_mem = NULL;
+       }
+       return new_mem;
+}
+
diff --git a/tests/methods/bug663210.c-expected b/tests/methods/bug663210.c-expected
new file mode 100644
index 000000000..e51ba76f4
--- /dev/null
+++ b/tests/methods/bug663210.c-expected
@@ -0,0 +1,393 @@
+/* methods_bug663210.c generated by valac, the Vala compiler
+ * generated from methods_bug663210.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _Block1Data Block1Data;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _Block1Data {
+       int _ref_count_;
+       Foo* self;
+       GType t_type;
+       GBoxedCopyFunc t_dup_func;
+       GDestroyNotify t_destroy_func;
+       gpointer retval;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+static void foo_foo (Foo* self,
+              GType t_type,
+              GBoxedCopyFunc t_dup_func,
+              GDestroyNotify t_destroy_func);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static gboolean __lambda4_ (Block1Data* _data1_);
+static gboolean ___lambda4__gsource_func (gpointer self);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               Foo* self;
+               GType t_type;
+               GBoxedCopyFunc t_dup_func;
+               GDestroyNotify t_destroy_func;
+               self = _data1_->self;
+               t_type = _data1_->t_type;
+               t_dup_func = _data1_->t_dup_func;
+               t_destroy_func = _data1_->t_destroy_func;
+               ((_data1_->retval == NULL) || (t_destroy_func == NULL)) ? NULL : (_data1_->retval = 
(t_destroy_func (_data1_->retval), NULL));
+               _foo_unref0 (self);
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static gboolean
+__lambda4_ (Block1Data* _data1_)
+{
+       Foo* self;
+       GType t_type;
+       GBoxedCopyFunc t_dup_func;
+       GDestroyNotify t_destroy_func;
+       gboolean result = FALSE;
+       self = _data1_->self;
+       t_type = _data1_->t_type;
+       t_dup_func = _data1_->t_dup_func;
+       t_destroy_func = _data1_->t_destroy_func;
+       ((_data1_->retval == NULL) || (t_destroy_func == NULL)) ? NULL : (_data1_->retval = (t_destroy_func 
(_data1_->retval), NULL));
+       _data1_->retval = NULL;
+       result = FALSE;
+       return result;
+}
+
+static gboolean
+___lambda4__gsource_func (gpointer self)
+{
+       gboolean result;
+       result = __lambda4_ (self);
+       return result;
+}
+
+static void
+foo_foo (Foo* self,
+         GType t_type,
+         GBoxedCopyFunc t_dup_func,
+         GDestroyNotify t_destroy_func)
+{
+       Block1Data* _data1_;
+       GSourceFunc f = NULL;
+       gpointer f_target;
+       GDestroyNotify f_target_destroy_notify;
+       g_return_if_fail (IS_FOO (self));
+       _data1_ = g_slice_new0 (Block1Data);
+       _data1_->_ref_count_ = 1;
+       _data1_->self = foo_ref (self);
+       _data1_->t_type = t_type;
+       _data1_->t_dup_func = t_dup_func;
+       _data1_->t_destroy_func = t_destroy_func;
+       _data1_->retval = NULL;
+       f = ___lambda4__gsource_func;
+       f_target = block1_data_ref (_data1_);
+       f_target_destroy_notify = block1_data_unref;
+       (f_target_destroy_notify == NULL) ? NULL : (f_target_destroy_notify (f_target), NULL);
+       f = NULL;
+       f_target = NULL;
+       f_target_destroy_notify = NULL;
+       block1_data_unref (_data1_);
+       _data1_ = NULL;
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/bug699956.c-expected b/tests/methods/bug699956.c-expected
new file mode 100644
index 000000000..22a2e5bf2
--- /dev/null
+++ b/tests/methods/bug699956.c-expected
@@ -0,0 +1,381 @@
+/* methods_bug699956.c generated by valac, the Vala compiler
+ * generated from methods_bug699956.vala, do not modify */
+
+#include <glib-object.h>
+#include <gobject/gvaluecollector.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+struct _Bar {
+       Foo parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       FooClass parent_class;
+};
+
+static gpointer foo_parent_class = NULL;
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, foo_unref)
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static GType bar_get_type_once (void);
+VALA_EXTERN Foo* foo (void);
+static void _vala_main (void);
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar* self = NULL;
+       self = (Bar*) foo_construct (object_type);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (TYPE_FOO, "Bar", &g_define_type_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+Foo*
+foo (void)
+{
+       Bar* result = NULL;
+       result = NULL;
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       Bar* _tmp0_;
+       Bar* _tmp1_;
+       _tmp0_ = (Bar*) foo ();
+       _tmp1_ = _tmp0_;
+       _foo_unref0 (_tmp1_);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/bug710862.c-expected b/tests/methods/bug710862.c-expected
new file mode 100644
index 000000000..497685ff8
--- /dev/null
+++ b/tests/methods/bug710862.c-expected
@@ -0,0 +1,309 @@
+/* methods_bug710862.c generated by valac, the Vala compiler
+ * generated from methods_bug710862.vala, do not modify */
+
+#include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+#include <stdarg.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+       void (*print_vfunc_vargs) (Foo* self, const gchar* format, va_list vargs)  G_GNUC_PRINTF(2,0) ;
+       void (*print_vfunc_shift_vargs) (Foo* self, const gchar* format, gint shift, va_list vargs)  
G_GNUC_PRINTF(2,0) ;
+       void (*scan_vfunc_vargs) (Foo* self, const gchar* input, const gchar* format, va_list vargs) 
G_GNUC_SCANF(3,0) ;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN void foo_print (Foo* self,
+                const gchar* format,
+                ...)  G_GNUC_PRINTF(2,3) ;
+VALA_EXTERN void foo_print_vargs (Foo* self,
+                      const gchar* format,
+                      va_list vargs)  G_GNUC_PRINTF(2,0) ;
+VALA_EXTERN void foo_print_shift (Foo* self,
+                      const gchar* format,
+                      gint shift,
+                      ...)  G_GNUC_PRINTF(2,4) ;
+VALA_EXTERN void foo_print_shift_vargs (Foo* self,
+                            const gchar* format,
+                            gint shift,
+                            va_list vargs)  G_GNUC_PRINTF(2,0) ;
+static void foo_real_print_vfunc_vargs (Foo* self,
+                                 const gchar* format,
+                                 va_list vargs)  G_GNUC_PRINTF(2,0) ;
+static void foo_real_print_vfunc_shift_vargs (Foo* self,
+                                       const gchar* format,
+                                       gint shift,
+                                       va_list vargs)  G_GNUC_PRINTF(2,0) ;
+VALA_EXTERN void foo_scan (Foo* self,
+               const gchar* input,
+               const gchar* format,
+               ...) G_GNUC_SCANF(3,4) ;
+static void foo_real_scan_vfunc_vargs (Foo* self,
+                                const gchar* input,
+                                const gchar* format,
+                                va_list vargs) G_GNUC_SCANF(3,0) ;
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static GType foo_get_type_once (void);
+VALA_EXTERN void print_something (const gchar* format,
+                      ...)  G_GNUC_PRINTF(1,2) ;
+VALA_EXTERN void print_something_vargs (const gchar* format,
+                            va_list vargs)  G_GNUC_PRINTF(1,0) ;
+VALA_EXTERN void print_something_shift (const gchar* format,
+                            gint shift,
+                            ...)  G_GNUC_PRINTF(1,3) ;
+VALA_EXTERN void print_something_shift_vargs (const gchar* format,
+                                  gint shift,
+                                  va_list vargs)  G_GNUC_PRINTF(1,0) ;
+VALA_EXTERN void scan_something (const gchar* input,
+                     const gchar* format,
+                     ...) G_GNUC_SCANF(2,3) ;
+static void _vala_main (void);
+
+void
+foo_print (Foo* self,
+           const gchar* format,
+           ...)
+{
+       va_list vargs = {0};
+       g_return_if_fail (IS_FOO (self));
+       g_return_if_fail (format != NULL);
+       va_start (vargs, format);
+       foo_print_vargs (self, format, vargs);
+       va_end (vargs);
+}
+
+void
+foo_print_shift (Foo* self,
+                 const gchar* format,
+                 gint shift,
+                 ...)
+{
+       va_list vargs = {0};
+       g_return_if_fail (IS_FOO (self));
+       g_return_if_fail (format != NULL);
+       va_start (vargs, shift);
+       foo_print_shift_vargs (self, format, shift, vargs);
+       va_end (vargs);
+}
+
+void
+foo_print_vargs (Foo* self,
+                 const gchar* format,
+                 va_list vargs)
+{
+       g_return_if_fail (IS_FOO (self));
+       g_return_if_fail (format != NULL);
+}
+
+void
+foo_print_shift_vargs (Foo* self,
+                       const gchar* format,
+                       gint shift,
+                       va_list vargs)
+{
+       g_return_if_fail (IS_FOO (self));
+       g_return_if_fail (format != NULL);
+}
+
+static void
+foo_real_print_vfunc_vargs (Foo* self,
+                            const gchar* format,
+                            va_list vargs)
+{
+       g_return_if_fail (format != NULL);
+}
+
+static void
+foo_real_print_vfunc_shift_vargs (Foo* self,
+                                  const gchar* format,
+                                  gint shift,
+                                  va_list vargs)
+{
+       g_return_if_fail (format != NULL);
+}
+
+void
+foo_scan (Foo* self,
+          const gchar* input,
+          const gchar* format,
+          ...)
+{
+       g_return_if_fail (IS_FOO (self));
+       g_return_if_fail (input != NULL);
+       g_return_if_fail (format != NULL);
+}
+
+static void
+foo_real_scan_vfunc_vargs (Foo* self,
+                           const gchar* input,
+                           const gchar* format,
+                           va_list vargs)
+{
+       g_return_if_fail (input != NULL);
+       g_return_if_fail (format != NULL);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->print_vfunc_vargs = (void (*) (Foo*, const gchar*, va_list)) 
foo_real_print_vfunc_vargs;
+       ((FooClass *) klass)->print_vfunc_shift_vargs = (void (*) (Foo*, const gchar*, gint, va_list)) 
foo_real_print_vfunc_shift_vargs;
+       ((FooClass *) klass)->scan_vfunc_vargs = (void (*) (Foo*, const gchar*, const gchar*, va_list)) 
foo_real_scan_vfunc_vargs;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+void
+print_something (const gchar* format,
+                 ...)
+{
+       va_list vargs = {0};
+       g_return_if_fail (format != NULL);
+       va_start (vargs, format);
+       print_something_vargs (format, vargs);
+       va_end (vargs);
+}
+
+void
+print_something_shift (const gchar* format,
+                       gint shift,
+                       ...)
+{
+       va_list vargs = {0};
+       g_return_if_fail (format != NULL);
+       va_start (vargs, shift);
+       print_something_vargs (format, vargs);
+       va_end (vargs);
+}
+
+void
+print_something_vargs (const gchar* format,
+                       va_list vargs)
+{
+       g_return_if_fail (format != NULL);
+}
+
+void
+print_something_shift_vargs (const gchar* format,
+                             gint shift,
+                             va_list vargs)
+{
+       g_return_if_fail (format != NULL);
+}
+
+void
+scan_something (const gchar* input,
+                const gchar* format,
+                ...)
+{
+       g_return_if_fail (input != NULL);
+       g_return_if_fail (format != NULL);
+}
+
+static void
+_vala_main (void)
+{
+       gint i = 0;
+       gint _tmp0_ = 0;
+       Foo* foo = NULL;
+       Foo* _tmp1_;
+       gint _tmp2_ = 0;
+       print_something ("%d", 42);
+       print_something_shift ("%d", 0, 42);
+       scan_something ("42", "%d", &_tmp0_);
+       i = _tmp0_;
+       _tmp1_ = foo_new ();
+       foo = _tmp1_;
+       foo_print (foo, "%d", 42);
+       foo_scan (foo, "42", "%d", &_tmp2_);
+       i = _tmp2_;
+       _g_object_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/bug723009.c-expected b/tests/methods/bug723009.c-expected
new file mode 100644
index 000000000..cbcccfda4
--- /dev/null
+++ b/tests/methods/bug723009.c-expected
@@ -0,0 +1,75 @@
+/* methods_bug723009.c generated by valac, the Vala compiler
+ * generated from methods_bug723009.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+#include <glib-object.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN gchar* foo (GError** error);
+static void _vala_main (void);
+
+gchar*
+foo (GError** error)
+{
+       gchar* _tmp0_;
+       gchar* result = NULL;
+       _tmp0_ = g_strdup ("foo");
+       result = _tmp0_;
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       GValue bar = {0};
+       gchar* _tmp0_ = NULL;
+       gchar* _tmp1_;
+       gchar* _tmp2_;
+       GValue _tmp3_ = {0};
+       GValue _tmp4_;
+       GError* _inner_error0_ = NULL;
+       _tmp1_ = foo (&_inner_error0_);
+       _tmp0_ = _tmp1_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               G_IS_VALUE (&bar) ? (g_value_unset (&bar), NULL) : NULL;
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp2_ = _tmp0_;
+       _tmp0_ = NULL;
+       g_value_init (&_tmp3_, G_TYPE_STRING);
+       g_value_take_string (&_tmp3_, _tmp2_);
+       G_IS_VALUE (&bar) ? (g_value_unset (&bar), NULL) : NULL;
+       bar = _tmp3_;
+       _tmp4_ = bar;
+       _vala_assert (g_strcmp0 (g_value_get_string (&_tmp4_), "foo") == 0, "(string) bar == \"foo\"");
+       _g_free0 (_tmp0_);
+       G_IS_VALUE (&bar) ? (g_value_unset (&bar), NULL) : NULL;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/bug723195.c-expected b/tests/methods/bug723195.c-expected
new file mode 100644
index 000000000..4ba16552b
--- /dev/null
+++ b/tests/methods/bug723195.c-expected
@@ -0,0 +1,283 @@
+/* methods_bug723195.c generated by valac, the Vala compiler
+ * generated from methods_bug723195.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (void);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static gchar*
+_vala_g_strjoinv (const gchar* separator,
+                  gchar** str_array,
+                  gint str_array_length1)
+{
+       gboolean _tmp0_ = FALSE;
+       gchar* result = NULL;
+       if (separator == NULL) {
+               separator = "";
+       }
+       if (str_array != NULL) {
+               gboolean _tmp1_ = FALSE;
+               if (str_array_length1 > 0) {
+                       _tmp1_ = TRUE;
+               } else {
+                       gboolean _tmp2_ = FALSE;
+                       if (str_array_length1 == -1) {
+                               const gchar* _tmp3_;
+                               _tmp3_ = str_array[0];
+                               _tmp2_ = _tmp3_ != NULL;
+                       } else {
+                               _tmp2_ = FALSE;
+                       }
+                       _tmp1_ = _tmp2_;
+               }
+               _tmp0_ = _tmp1_;
+       } else {
+               _tmp0_ = FALSE;
+       }
+       if (_tmp0_) {
+               gint i = 0;
+               gsize len = 0UL;
+               gint _tmp16_;
+               gint _tmp17_;
+               const gchar* res = NULL;
+               void* _tmp18_;
+               void* ptr = NULL;
+               const gchar* _tmp19_;
+               const gchar* _tmp20_;
+               void* _tmp21_;
+               const gchar* _tmp31_;
+               len = (gsize) 1;
+               {
+                       gboolean _tmp4_ = FALSE;
+                       i = 0;
+                       _tmp4_ = TRUE;
+                       while (TRUE) {
+                               gboolean _tmp6_ = FALSE;
+                               gboolean _tmp7_ = FALSE;
+                               gint _tmp10_ = 0;
+                               const gchar* _tmp11_;
+                               if (!_tmp4_) {
+                                       gint _tmp5_;
+                                       _tmp5_ = i;
+                                       i = _tmp5_ + 1;
+                               }
+                               _tmp4_ = FALSE;
+                               if (str_array_length1 != -1) {
+                                       _tmp7_ = i < str_array_length1;
+                               } else {
+                                       _tmp7_ = FALSE;
+                               }
+                               if (_tmp7_) {
+                                       _tmp6_ = TRUE;
+                               } else {
+                                       gboolean _tmp8_ = FALSE;
+                                       if (str_array_length1 == -1) {
+                                               const gchar* _tmp9_;
+                                               _tmp9_ = str_array[i];
+                                               _tmp8_ = _tmp9_ != NULL;
+                                       } else {
+                                               _tmp8_ = FALSE;
+                                       }
+                                       _tmp6_ = _tmp8_;
+                               }
+                               if (!_tmp6_) {
+                                       break;
+                               }
+                               _tmp11_ = str_array[i];
+                               if (_tmp11_ != NULL) {
+                                       const gchar* _tmp12_;
+                                       gint _tmp13_;
+                                       gint _tmp14_;
+                                       _tmp12_ = str_array[i];
+                                       _tmp13_ = strlen ((const gchar*) _tmp12_);
+                                       _tmp14_ = _tmp13_;
+                                       _tmp10_ = _tmp14_;
+                               } else {
+                                       _tmp10_ = 0;
+                               }
+                               len += (gsize) _tmp10_;
+                       }
+               }
+               if (i == 0) {
+                       gchar* _tmp15_;
+                       _tmp15_ = g_strdup ("");
+                       result = _tmp15_;
+                       return result;
+               }
+               str_array_length1 = i;
+               _tmp16_ = strlen ((const gchar*) separator);
+               _tmp17_ = _tmp16_;
+               len += (gsize) (_tmp17_ * (i - 1));
+               _tmp18_ = g_malloc (len);
+               res = _tmp18_;
+               _tmp19_ = res;
+               _tmp20_ = str_array[0];
+               _tmp21_ = g_stpcpy ((void*) _tmp19_, (const gchar*) _tmp20_);
+               ptr = _tmp21_;
+               {
+                       gboolean _tmp22_ = FALSE;
+                       i = 1;
+                       _tmp22_ = TRUE;
+                       while (TRUE) {
+                               void* _tmp24_;
+                               void* _tmp25_;
+                               const gchar* _tmp26_ = NULL;
+                               const gchar* _tmp27_;
+                               void* _tmp29_;
+                               void* _tmp30_;
+                               if (!_tmp22_) {
+                                       gint _tmp23_;
+                                       _tmp23_ = i;
+                                       i = _tmp23_ + 1;
+                               }
+                               _tmp22_ = FALSE;
+                               if (!(i < str_array_length1)) {
+                                       break;
+                               }
+                               _tmp24_ = ptr;
+                               _tmp25_ = g_stpcpy (_tmp24_, (const gchar*) separator);
+                               ptr = _tmp25_;
+                               _tmp27_ = str_array[i];
+                               if (_tmp27_ != NULL) {
+                                       const gchar* _tmp28_;
+                                       _tmp28_ = str_array[i];
+                                       _tmp26_ = (const gchar*) _tmp28_;
+                               } else {
+                                       _tmp26_ = "";
+                               }
+                               _tmp29_ = ptr;
+                               _tmp30_ = g_stpcpy (_tmp29_, _tmp26_);
+                               ptr = _tmp30_;
+                       }
+               }
+               _tmp31_ = res;
+               res = NULL;
+               result = (gchar*) _tmp31_;
+               return result;
+       } else {
+               gchar* _tmp32_;
+               _tmp32_ = g_strdup ("");
+               result = _tmp32_;
+               return result;
+       }
+}
+
+static void
+_vala_main (void)
+{
+       gchar** a = NULL;
+       gchar* _tmp0_;
+       gchar* _tmp1_;
+       gchar* _tmp2_;
+       gchar** _tmp3_;
+       gint a_length1;
+       gint _a_size_;
+       gchar* _tmp4_;
+       gchar* _tmp5_;
+       gchar* _tmp6_;
+       gchar* _tmp7_;
+       gchar* _tmp8_;
+       gchar* _tmp9_;
+       gchar* _tmp10_;
+       gchar* _tmp11_;
+       gchar* _tmp12_;
+       gchar* _tmp13_;
+       gchar* _tmp14_;
+       gchar* _tmp15_;
+       gchar* _tmp16_;
+       gchar* _tmp17_;
+       _tmp0_ = g_strdup ("foo");
+       _tmp1_ = g_strdup ("bar");
+       _tmp2_ = g_strdup ("baz");
+       _tmp3_ = g_new0 (gchar*, 4 + 1);
+       _tmp3_[0] = _tmp0_;
+       _tmp3_[1] = _tmp1_;
+       _tmp3_[2] = NULL;
+       _tmp3_[3] = _tmp2_;
+       a = _tmp3_;
+       a_length1 = 4;
+       _a_size_ = a_length1;
+       a_length1 = 0;
+       _tmp4_ = _vala_g_strjoinv (":", a, (gint) a_length1);
+       _tmp5_ = _tmp4_;
+       _vala_assert (g_strcmp0 (_tmp5_, "") == 0, "string.joinv (\":\", a) == \"\"");
+       _g_free0 (_tmp5_);
+       a_length1 = 1;
+       _tmp6_ = _vala_g_strjoinv (":", a, (gint) a_length1);
+       _tmp7_ = _tmp6_;
+       _vala_assert (g_strcmp0 (_tmp7_, "foo") == 0, "string.joinv (\":\", a) == \"foo\"");
+       _g_free0 (_tmp7_);
+       a_length1 = 2;
+       _tmp8_ = _vala_g_strjoinv (":", a, (gint) a_length1);
+       _tmp9_ = _tmp8_;
+       _vala_assert (g_strcmp0 (_tmp9_, "foo:bar") == 0, "string.joinv (\":\", a) == \"foo:bar\"");
+       _g_free0 (_tmp9_);
+       a_length1 = 3;
+       _tmp10_ = _vala_g_strjoinv (":", a, (gint) a_length1);
+       _tmp11_ = _tmp10_;
+       _vala_assert (g_strcmp0 (_tmp11_, "foo:bar:") == 0, "string.joinv (\":\", a) == \"foo:bar:\"");
+       _g_free0 (_tmp11_);
+       a_length1 = 4;
+       _tmp12_ = _vala_g_strjoinv (":", a, (gint) a_length1);
+       _tmp13_ = _tmp12_;
+       _vala_assert (g_strcmp0 (_tmp13_, "foo:bar::baz") == 0, "string.joinv (\":\", a) == 
\"foo:bar::baz\"");
+       _g_free0 (_tmp13_);
+       a_length1 = -1;
+       _tmp14_ = _vala_g_strjoinv (":", a, (gint) a_length1);
+       _tmp15_ = _tmp14_;
+       _vala_assert (g_strcmp0 (_tmp15_, "foo:bar") == 0, "string.joinv (\":\", a) == \"foo:bar\"");
+       _g_free0 (_tmp15_);
+       _tmp16_ = _vala_g_strjoinv (":", NULL, (gint) 0);
+       _tmp17_ = _tmp16_;
+       _vala_assert (g_strcmp0 (_tmp17_, "") == 0, "string.joinv (\":\", null) == \"\"");
+       _g_free0 (_tmp17_);
+       a_length1 = 4;
+       a = (_vala_array_free (a, a_length1, (GDestroyNotify) g_free), NULL);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/methods/bug726347.c-expected b/tests/methods/bug726347.c-expected
new file mode 100644
index 000000000..0303b9f1c
--- /dev/null
+++ b/tests/methods/bug726347.c-expected
@@ -0,0 +1,358 @@
+/* methods_bug726347.c generated by valac, the Vala compiler
+ * generated from methods_bug726347.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+#define _g_free0(var) (var = (g_free (var), NULL))
+typedef struct _ParamSpecFoo ParamSpecFoo;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN gint foo_count_strings (Foo* self,
+                        ...);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+gint
+foo_count_strings (Foo* self,
+                   ...)
+{
+       gint i = 0;
+       va_list args = {0};
+       gint result = 0;
+       g_return_val_if_fail (IS_FOO (self), 0);
+       i = 0;
+       va_start (args, self);
+       {
+               gchar* str = NULL;
+               const gchar* _tmp0_;
+               gchar* _tmp1_;
+               _tmp0_ = va_arg (args, gchar*);
+               _tmp1_ = g_strdup (_tmp0_);
+               str = _tmp1_;
+               {
+                       gboolean _tmp2_ = FALSE;
+                       _tmp2_ = TRUE;
+                       while (TRUE) {
+                               const gchar* _tmp5_;
+                               gint _tmp6_;
+                               if (!_tmp2_) {
+                                       const gchar* _tmp3_;
+                                       gchar* _tmp4_;
+                                       _tmp3_ = va_arg (args, gchar*);
+                                       _tmp4_ = g_strdup (_tmp3_);
+                                       _g_free0 (str);
+                                       str = _tmp4_;
+                               }
+                               _tmp2_ = FALSE;
+                               _tmp5_ = str;
+                               if (!(_tmp5_ != NULL)) {
+                                       break;
+                               }
+                               _tmp6_ = i;
+                               i = _tmp6_ + 1;
+                       }
+               }
+               _g_free0 (str);
+       }
+       result = i;
+       va_end (args);
+       return result;
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       gint count = 0;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       count = foo_count_strings (foo, "foo", "bar", "baz", NULL);
+       _vala_assert (count == 3, "count == 3");
+       _foo_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/bug736235.c-expected b/tests/methods/bug736235.c-expected
new file mode 100644
index 000000000..8e322ced0
--- /dev/null
+++ b/tests/methods/bug736235.c-expected
@@ -0,0 +1,217 @@
+/* methods_bug736235.c generated by valac, the Vala compiler
+ * generated from methods_bug736235.vala, do not modify */
+
+#include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_BAR_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_free0(var) (var = (g_free (var), NULL))
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _FooPrivate {
+       gchar* _bar;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+VALA_EXTERN const gchar* foo_get_bar (Foo* self);
+static void foo_set_bar (Foo* self,
+                  const gchar* value);
+static void foo_finalize (GObject * obj);
+static GType foo_get_type_once (void);
+static void _vala_foo_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_foo_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec);
+static void _vala_main (void);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, "bar", (const gchar*) NULL, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+const gchar*
+foo_get_bar (Foo* self)
+{
+       const gchar* result;
+       const gchar* _tmp0_;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = self->priv->_bar;
+       result = _tmp0_;
+       return result;
+}
+
+static void
+foo_set_bar (Foo* self,
+             const gchar* value)
+{
+       gchar* old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_bar (self);
+       if (g_strcmp0 (value, old_value) != 0) {
+               gchar* _tmp0_;
+               _tmp0_ = g_strdup (value);
+               _g_free0 (self->priv->_bar);
+               self->priv->_bar = _tmp0_;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_BAR_PROPERTY]);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_foo_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_foo_set_property;
+       G_OBJECT_CLASS (klass)->finalize = foo_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_BAR_PROPERTY, 
foo_properties[FOO_BAR_PROPERTY] = g_param_spec_string ("bar", "bar", "bar", NULL, G_PARAM_STATIC_STRINGS | 
G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+}
+
+static void
+foo_finalize (GObject * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       _g_free0 (self->priv->_bar);
+       G_OBJECT_CLASS (foo_parent_class)->finalize (obj);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_foo_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_BAR_PROPERTY:
+               g_value_set_string (value, foo_get_bar (self));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_foo_set_property (GObject * object,
+                        guint property_id,
+                        const GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_BAR_PROPERTY:
+               foo_set_bar (self, g_value_get_string (value));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/bug737222.c-expected b/tests/methods/bug737222.c-expected
new file mode 100644
index 000000000..af1a4779f
--- /dev/null
+++ b/tests/methods/bug737222.c-expected
@@ -0,0 +1,133 @@
+/* methods_bug737222.c generated by valac, the Vala compiler
+ * generated from methods_bug737222.vala, do not modify */
+
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN gint* foo (gint* result_length1);
+VALA_EXTERN gchar** bar (void);
+static void _vala_main (void);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+static gssize _vala_array_length (gpointer array);
+
+gint*
+foo (gint* result_length1)
+{
+       gint* _tmp0_;
+       gint* _tmp1_;
+       gint _tmp1__length1;
+       gint* result = NULL;
+       _tmp0_ = g_new0 (gint, 1);
+       _tmp1_ = _tmp0_;
+       _tmp1__length1 = 1;
+       if (result_length1) {
+               *result_length1 = _tmp1__length1;
+       }
+       result = _tmp1_;
+       _vala_warn_if_fail (((*result_length1) == 0) || ((*result_length1) == 1), "result.length == 0 || 
result.length == 1");
+       return result;
+}
+
+gchar**
+bar (void)
+{
+       gchar* _tmp0_;
+       gchar** _tmp1_;
+       const gchar* _tmp2_;
+       gchar** result = NULL;
+       _tmp0_ = g_strdup ("bar");
+       _tmp1_ = g_new0 (gchar*, 1 + 1);
+       _tmp1_[0] = _tmp0_;
+       result = _tmp1_;
+       _tmp2_ = result[0];
+       _vala_warn_if_fail (g_strcmp0 (_tmp2_, "bar") == 0, "result[0] == \"bar\"");
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       gint _tmp0_ = 0;
+       gint* _tmp1_;
+       gint* _tmp2_;
+       gint _tmp2__length1;
+       gchar** _tmp3_;
+       gchar** _tmp4_;
+       gchar** _tmp5_;
+       gint _tmp5__length1;
+       _tmp1_ = foo (&_tmp0_);
+       _tmp2_ = _tmp1_;
+       _tmp2__length1 = _tmp0_;
+       _tmp2_ = (g_free (_tmp2_), NULL);
+       _tmp4_ = _tmp3_ = bar ();
+       _tmp5_ = _tmp4_;
+       _tmp5__length1 = _vala_array_length (_tmp3_);
+       _tmp5_ = (_vala_array_free (_tmp5_, _tmp5__length1, (GDestroyNotify) g_free), NULL);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
+static gssize
+_vala_array_length (gpointer array)
+{
+       gssize length;
+       length = 0;
+       if (array) {
+               while (((gpointer*) array)[length]) {
+                       length++;
+               }
+       }
+       return length;
+}
+
diff --git a/tests/methods/bug743877.c-expected b/tests/methods/bug743877.c-expected
new file mode 100644
index 000000000..b5e893902
--- /dev/null
+++ b/tests/methods/bug743877.c-expected
@@ -0,0 +1,56 @@
+/* methods_bug743877.c generated by valac, the Vala compiler
+ * generated from methods_bug743877.vala, do not modify */
+
+#include <locale.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (void);
+static gssize _vala_array_length (gpointer array);
+
+static void
+_vala_main (void)
+{
+       gchar** charsets = NULL;
+       gint charsets_length1 = 0;
+       gint _charsets_size_ = 0;
+       gboolean is_utf8 = FALSE;
+       gchar** _tmp0_ = NULL;
+       gboolean _tmp1_;
+       setlocale (LC_ALL, "");
+       _tmp1_ = g_get_filename_charsets (&_tmp0_);
+       charsets = _tmp0_;
+       charsets_length1 = -1;
+       _charsets_size_ = charsets_length1;
+       charsets_length1 = _vala_array_length (charsets);
+       is_utf8 = _tmp1_;
+       _vala_assert (charsets_length1 != -1, "charsets.length != -1");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static gssize
+_vala_array_length (gpointer array)
+{
+       gssize length;
+       length = 0;
+       if (array) {
+               while (((gpointer*) array)[length]) {
+                       length++;
+               }
+       }
+       return length;
+}
+
diff --git a/tests/methods/bug771964.c-expected b/tests/methods/bug771964.c-expected
new file mode 100644
index 000000000..c2d07e25d
--- /dev/null
+++ b/tests/methods/bug771964.c-expected
@@ -0,0 +1,253 @@
+/* methods_bug771964.c generated by valac, the Vala compiler
+ * generated from methods_bug771964.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+enum  {
+       BAR_0_PROPERTY,
+       BAR_NUM_PROPERTIES
+};
+static GParamSpec* bar_properties[BAR_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+       void (*test) (Foo* self, GType t_type, GBoxedCopyFunc t_dup_func, GDestroyNotify t_destroy_func, 
gconstpointer parameter);
+};
+
+struct _Bar {
+       Foo parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       FooClass parent_class;
+};
+
+static gpointer foo_parent_class = NULL;
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN void foo_test (Foo* self,
+               GType t_type,
+               GBoxedCopyFunc t_dup_func,
+               GDestroyNotify t_destroy_func,
+               gconstpointer parameter);
+static void foo_real_test (Foo* self,
+                    GType t_type,
+                    GBoxedCopyFunc t_dup_func,
+                    GDestroyNotify t_destroy_func,
+                    gconstpointer parameter);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static GType foo_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
+static void bar_real_test (Foo* base,
+                    GType t_type,
+                    GBoxedCopyFunc t_dup_func,
+                    GDestroyNotify t_destroy_func,
+                    gconstpointer parameter);
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static GType bar_get_type_once (void);
+static gint _vala_main (void);
+
+static void
+foo_real_test (Foo* self,
+               GType t_type,
+               GBoxedCopyFunc t_dup_func,
+               GDestroyNotify t_destroy_func,
+               gconstpointer parameter)
+{
+       g_critical ("Type `%s' does not implement abstract method `foo_test'", g_type_name 
(G_TYPE_FROM_INSTANCE (self)));
+       return;
+}
+
+void
+foo_test (Foo* self,
+          GType t_type,
+          GBoxedCopyFunc t_dup_func,
+          GDestroyNotify t_destroy_func,
+          gconstpointer parameter)
+{
+       FooClass* _klass_;
+       g_return_if_fail (IS_FOO (self));
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->test) {
+               _klass_->test (self, t_type, t_dup_func, t_destroy_func, parameter);
+       }
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->test = (void (*) (Foo*, GType, GBoxedCopyFunc, GDestroyNotify, gconstpointer)) 
foo_real_test;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 
G_TYPE_FLAG_ABSTRACT);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+bar_real_test (Foo* base,
+               GType t_type,
+               GBoxedCopyFunc t_dup_func,
+               GDestroyNotify t_destroy_func,
+               gconstpointer parameter)
+{
+       Bar * self;
+       FILE* _tmp0_;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAR, Bar);
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, "Just a test!\n");
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar * self = NULL;
+       self = (Bar*) foo_construct (object_type);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->test = (void (*) (Foo*, GType, GBoxedCopyFunc, GDestroyNotify, gconstpointer)) 
bar_real_test;
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (TYPE_FOO, "Bar", &g_define_type_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static gint
+_vala_main (void)
+{
+       Bar* obj = NULL;
+       Bar* _tmp0_;
+       gint result = 0;
+       _tmp0_ = bar_new ();
+       obj = _tmp0_;
+       foo_test (G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo), G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, 
(GDestroyNotify) g_free, "test");
+       result = 0;
+       _g_object_unref0 (obj);
+       return result;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       return _vala_main ();
+}
+
diff --git a/tests/methods/bug774060.c-expected b/tests/methods/bug774060.c-expected
new file mode 100644
index 000000000..addb5eabc
--- /dev/null
+++ b/tests/methods/bug774060.c-expected
@@ -0,0 +1,204 @@
+/* methods_bug774060.c generated by valac, the Vala compiler
+ * generated from methods_bug774060.vala, do not modify */
+
+#include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+       const gchar* (*format_virtual) (Foo* self, const gchar* bar, gint baz, const gchar* format) 
G_GNUC_FORMAT(4) ;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN const gchar* foo_format (Foo* self,
+                         const gchar* bar,
+                         gint baz,
+                         const gchar* format) G_GNUC_FORMAT(4) ;
+VALA_EXTERN const gchar* foo_format_pos (const gchar* bar,
+                             gint baz,
+                             const gchar* format,
+                             Foo* self) G_GNUC_FORMAT(3) ;
+static const gchar* foo_real_format_virtual (Foo* self,
+                                      const gchar* bar,
+                                      gint baz,
+                                      const gchar* format) G_GNUC_FORMAT(4) ;
+VALA_EXTERN const gchar* foo_format_static (const gchar* foo,
+                                gint baz,
+                                const gchar* format) G_GNUC_FORMAT(3) ;
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static GType foo_get_type_once (void);
+VALA_EXTERN const gchar* format_wrapper (const gchar* format) G_GNUC_FORMAT(1) ;
+static void _vala_main (void);
+
+const gchar*
+foo_format (Foo* self,
+            const gchar* bar,
+            gint baz,
+            const gchar* format)
+{
+       const gchar* result = NULL;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       g_return_val_if_fail (bar != NULL, NULL);
+       g_return_val_if_fail (format != NULL, NULL);
+       result = format;
+       return result;
+}
+
+const gchar*
+foo_format_pos (const gchar* bar,
+                gint baz,
+                const gchar* format,
+                Foo* self)
+{
+       const gchar* result = NULL;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       g_return_val_if_fail (bar != NULL, NULL);
+       g_return_val_if_fail (format != NULL, NULL);
+       result = format;
+       return result;
+}
+
+static const gchar*
+foo_real_format_virtual (Foo* self,
+                         const gchar* bar,
+                         gint baz,
+                         const gchar* format)
+{
+       const gchar* result = NULL;
+       g_return_val_if_fail (bar != NULL, NULL);
+       g_return_val_if_fail (format != NULL, NULL);
+       result = format;
+       return result;
+}
+
+const gchar*
+foo_format_static (const gchar* foo,
+                   gint baz,
+                   const gchar* format)
+{
+       const gchar* result = NULL;
+       g_return_val_if_fail (foo != NULL, NULL);
+       g_return_val_if_fail (format != NULL, NULL);
+       result = format;
+       return result;
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->format_virtual = (const gchar* (*) (Foo*, const gchar*, gint, const gchar*)) 
foo_real_format_virtual;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+const gchar*
+format_wrapper (const gchar* format)
+{
+       const gchar* result = NULL;
+       g_return_val_if_fail (format != NULL, NULL);
+       result = format;
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       g_print (format_wrapper ("%d"), 42);
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       g_print (foo_format (foo, "", 0, "%d"), 42);
+       g_print (foo_format_pos ("", 0, "%d", foo), 42);
+       g_print (FOO_GET_CLASS (foo)->format_virtual (foo, "", 0, "%d"), 42);
+       g_print (foo_format_static ("", 0, "%d"), 42);
+       _g_object_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/bug781061.c-expected b/tests/methods/bug781061.c-expected
new file mode 100644
index 000000000..91d787d5e
--- /dev/null
+++ b/tests/methods/bug781061.c-expected
@@ -0,0 +1,149 @@
+/* methods_bug781061.c generated by valac, the Vala compiler
+ * generated from methods_bug781061.vala, do not modify */
+
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef enum  {
+       FOO_ERROR_FAILED
+} FooError;
+#define FOO_ERROR foo_error_quark ()
+
+VALA_EXTERN GQuark foo_error_quark (void);
+VALA_EXTERN void print_something_throws (gboolean ok,
+                             const gchar* format,
+                             GError** error,
+                             ...)  G_GNUC_PRINTF(2,4) ;
+VALA_EXTERN void print_something_vargs_throws (gboolean ok,
+                                   const gchar* format,
+                                   va_list vargs,
+                                   GError** error)  G_GNUC_PRINTF(2,0) ;
+VALA_EXTERN void scan_something_throws (gboolean ok,
+                            const gchar* format,
+                            GError** error,
+                            ...) G_GNUC_SCANF(2,4) ;
+VALA_EXTERN void scan_something_vargs_throws (gboolean ok,
+                                  const gchar* format,
+                                  va_list vargs,
+                                  GError** error) G_GNUC_SCANF(2,0) ;
+static void _vala_main (void);
+
+GQuark
+foo_error_quark (void)
+{
+       return g_quark_from_static_string ("foo-error-quark");
+}
+
+void
+print_something_throws (gboolean ok,
+                        const gchar* format,
+                        GError** error,
+                        ...)
+{
+       va_list vargs = {0};
+       GError* _inner_error0_ = NULL;
+       g_return_if_fail (format != NULL);
+       va_start (vargs, error);
+       print_something_vargs_throws (ok, format, vargs, &_inner_error0_);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               if (_inner_error0_->domain == FOO_ERROR) {
+                       g_propagate_error (error, _inner_error0_);
+                       va_end (vargs);
+                       return;
+               } else {
+                       va_end (vargs);
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+       }
+       va_end (vargs);
+}
+
+void
+print_something_vargs_throws (gboolean ok,
+                              const gchar* format,
+                              va_list vargs,
+                              GError** error)
+{
+       g_return_if_fail (format != NULL);
+}
+
+void
+scan_something_throws (gboolean ok,
+                       const gchar* format,
+                       GError** error,
+                       ...)
+{
+       g_return_if_fail (format != NULL);
+}
+
+void
+scan_something_vargs_throws (gboolean ok,
+                             const gchar* format,
+                             va_list vargs,
+                             GError** error)
+{
+       g_return_if_fail (format != NULL);
+}
+
+static void
+_vala_main (void)
+{
+       GError* _inner_error0_ = NULL;
+       {
+               gint i = 0;
+               gint _tmp0_ = 0;
+               print_something_throws (TRUE, "%s", &_inner_error0_, "foo");
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       if (_inner_error0_->domain == FOO_ERROR) {
+                               goto __catch0_foo_error;
+                       }
+                       g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+               scan_something_throws (FALSE, "%d", &_inner_error0_, &_tmp0_);
+               i = _tmp0_;
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       if (_inner_error0_->domain == FOO_ERROR) {
+                               goto __catch0_foo_error;
+                       }
+                       g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+       }
+       goto __finally0;
+       __catch0_foo_error:
+       {
+               g_clear_error (&_inner_error0_);
+       }
+       __finally0:
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/bug784691.c-expected b/tests/methods/bug784691.c-expected
new file mode 100644
index 000000000..dd0bf7502
--- /dev/null
+++ b/tests/methods/bug784691.c-expected
@@ -0,0 +1,50 @@
+/* methods_bug784691.c generated by valac, the Vala compiler
+ * generated from methods_bug784691.vala, do not modify */
+
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN gint* get_foo (void);
+static void _vala_main (void);
+
+const gint FOO[3] = {0, 1, 2};
+
+gint*
+get_foo (void)
+{
+       gint* result = NULL;
+       _vala_assert (G_N_ELEMENTS (FOO) == 3, "FOO.length == 3");
+       result = FOO;
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       gint* _tmp0_;
+       _tmp0_ = get_foo ();
+       _vala_assert (3 == 3, "get_foo ().length == 3");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/bug791215.c-expected b/tests/methods/bug791215.c-expected
new file mode 100644
index 000000000..69066096a
--- /dev/null
+++ b/tests/methods/bug791215.c-expected
@@ -0,0 +1,47 @@
+/* methods_bug791215.c generated by valac, the Vala compiler
+ * generated from methods_bug791215.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN void foo_print (const gchar* fmt,
+                ...)  G_GNUC_PRINTF(1,2) ;
+static void _vala_main (void);
+
+void
+foo_print (const gchar* fmt,
+           ...)
+{
+       _vala_assert (fmt == NULL, "fmt == null");
+}
+
+static void
+_vala_main (void)
+{
+       foo_print (NULL);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/bug791283.c-expected b/tests/methods/bug791283.c-expected
new file mode 100644
index 000000000..a0e1c4387
--- /dev/null
+++ b/tests/methods/bug791283.c-expected
@@ -0,0 +1,366 @@
+/* methods_bug791283.c generated by valac, the Vala compiler
+ * generated from methods_bug791283.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+#define _g_ptr_array_unref0(var) ((var == NULL) ? NULL : (var = (g_ptr_array_unref (var), NULL)))
+typedef struct _ParamSpecFoo ParamSpecFoo;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _FooPrivate {
+       GType t_type;
+       GBoxedCopyFunc t_dup_func;
+       GDestroyNotify t_destroy_func;
+       GPtrArray* bar;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new (GType t_type,
+              GBoxedCopyFunc t_dup_func,
+              GDestroyNotify t_destroy_func);
+VALA_EXTERN Foo* foo_construct (GType object_type,
+                    GType t_type,
+                    GBoxedCopyFunc t_dup_func,
+                    GDestroyNotify t_destroy_func);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN GPtrArray* create_bar (GType g_type,
+                       GBoxedCopyFunc g_dup_func,
+                       GDestroyNotify g_destroy_func);
+static void _vala_main (void);
+static gint* _int_dup (gint* self);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct (GType object_type,
+               GType t_type,
+               GBoxedCopyFunc t_dup_func,
+               GDestroyNotify t_destroy_func)
+{
+       Foo* self = NULL;
+       GPtrArray* _tmp0_;
+       self = (Foo*) g_type_create_instance (object_type);
+       self->priv->t_type = t_type;
+       self->priv->t_dup_func = t_dup_func;
+       self->priv->t_destroy_func = t_destroy_func;
+       _tmp0_ = g_ptr_array_new_full ((guint) 0, t_destroy_func);
+       _g_ptr_array_unref0 (self->priv->bar);
+       self->priv->bar = _tmp0_;
+       return self;
+}
+
+Foo*
+foo_new (GType t_type,
+         GBoxedCopyFunc t_dup_func,
+         GDestroyNotify t_destroy_func)
+{
+       return foo_construct (TYPE_FOO, t_type, t_dup_func, t_destroy_func);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+       _g_ptr_array_unref0 (self->priv->bar);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+GPtrArray*
+create_bar (GType g_type,
+            GBoxedCopyFunc g_dup_func,
+            GDestroyNotify g_destroy_func)
+{
+       GPtrArray* _tmp0_;
+       GPtrArray* result = NULL;
+       _tmp0_ = g_ptr_array_new_full ((guint) 0, g_destroy_func);
+       result = _tmp0_;
+       return result;
+}
+
+static gint*
+_int_dup (gint* self)
+{
+       gint* dup;
+       dup = g_new0 (gint, 1);
+       memcpy (dup, self, sizeof (gint));
+       return dup;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       GPtrArray* bar = NULL;
+       GPtrArray* _tmp1_;
+       _tmp0_ = foo_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free);
+       foo = _tmp0_;
+       _tmp1_ = create_bar (G_TYPE_INT, (GBoxedCopyFunc) _int_dup, (GDestroyNotify) g_free);
+       bar = _tmp1_;
+       _g_ptr_array_unref0 (bar);
+       _foo_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/closures.c-expected b/tests/methods/closures.c-expected
new file mode 100644
index 000000000..22c5f2c97
--- /dev/null
+++ b/tests/methods/closures.c-expected
@@ -0,0 +1,541 @@
+/* methods_closures.c generated by valac, the Vala compiler
+ * generated from methods_closures.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef gint (*Func) (gpointer user_data);
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+typedef struct _Block1Data Block1Data;
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+typedef void (*NoTargetFunc) (void);
+typedef struct _Block2Data Block2Data;
+typedef struct _Block3Data Block3Data;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _Block1Data {
+       int _ref_count_;
+       Foo* self;
+       GObject* o;
+       GMainLoop* loop;
+};
+
+struct _Block2Data {
+       int _ref_count_;
+       Func B;
+       gpointer B_target;
+       GDestroyNotify B_target_destroy_notify;
+       gint k;
+       Func x1;
+       gpointer x1_target;
+       Func x2;
+       gpointer x2_target;
+       Func x3;
+       gpointer x3_target;
+       Func x4;
+       gpointer x4_target;
+};
+
+struct _Block3Data {
+       int _ref_count_;
+       gint* array;
+       NoTargetFunc func;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN void foo_bar (Foo* self,
+              GMainLoop* loop);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static gboolean __lambda4_ (Block1Data* _data1_);
+static gboolean ___lambda4__gsource_func (gpointer self);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static GType foo_get_type_once (void);
+VALA_EXTERN gint A (gint k,
+        Func x1,
+        gpointer x1_target,
+        Func x2,
+        gpointer x2_target,
+        Func x3,
+        gpointer x3_target,
+        Func x4,
+        gpointer x4_target,
+        Func x5,
+        gpointer x5_target);
+static Block2Data* block2_data_ref (Block2Data* _data2_);
+static void block2_data_unref (void * _userdata_);
+static gint __lambda5_ (Block2Data* _data2_);
+static gint ___lambda5__func (gpointer self);
+VALA_EXTERN void B (gint* array,
+        NoTargetFunc func);
+static Block3Data* block3_data_ref (Block3Data* _data3_);
+static void block3_data_unref (void * _userdata_);
+static gint __lambda6_ (Block3Data* _data3_);
+static gint ___lambda6__func (gpointer self);
+static void _vala_main (void);
+static gint __lambda7_ (void);
+static gint ___lambda7__func (gpointer self);
+static gint __lambda8_ (void);
+static gint ___lambda8__func (gpointer self);
+static gint __lambda9_ (void);
+static gint ___lambda9__func (gpointer self);
+static gint __lambda10_ (void);
+static gint ___lambda10__func (gpointer self);
+static gint __lambda11_ (void);
+static gint ___lambda11__func (gpointer self);
+static gssize _vala_array_length (gpointer array);
+
+static gpointer
+_g_main_loop_ref0 (gpointer self)
+{
+       return self ? g_main_loop_ref (self) : NULL;
+}
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               Foo* self;
+               self = _data1_->self;
+               _g_object_unref0 (_data1_->o);
+               _g_main_loop_unref0 (_data1_->loop);
+               _g_object_unref0 (self);
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static gboolean
+__lambda4_ (Block1Data* _data1_)
+{
+       Foo* self;
+       gboolean result = FALSE;
+       self = _data1_->self;
+       _g_object_unref0 (_data1_->o);
+       _data1_->o = NULL;
+       g_main_loop_quit (_data1_->loop);
+       result = FALSE;
+       return result;
+}
+
+static gboolean
+___lambda4__gsource_func (gpointer self)
+{
+       gboolean result;
+       result = __lambda4_ (self);
+       return result;
+}
+
+void
+foo_bar (Foo* self,
+         GMainLoop* loop)
+{
+       Block1Data* _data1_;
+       GMainLoop* _tmp0_;
+       GObject* _tmp1_;
+       GSourceFunc f = NULL;
+       gpointer f_target;
+       GDestroyNotify f_target_destroy_notify;
+       GSourceFunc _tmp2_;
+       gpointer _tmp2__target;
+       GDestroyNotify _tmp2__target_destroy_notify;
+       g_return_if_fail (IS_FOO (self));
+       g_return_if_fail (loop != NULL);
+       _data1_ = g_slice_new0 (Block1Data);
+       _data1_->_ref_count_ = 1;
+       _data1_->self = g_object_ref (self);
+       _tmp0_ = _g_main_loop_ref0 (loop);
+       _g_main_loop_unref0 (_data1_->loop);
+       _data1_->loop = _tmp0_;
+       _tmp1_ = g_object_new (G_TYPE_OBJECT, NULL);
+       _data1_->o = _tmp1_;
+       f = ___lambda4__gsource_func;
+       f_target = block1_data_ref (_data1_);
+       f_target_destroy_notify = block1_data_unref;
+       _tmp2_ = f;
+       _tmp2__target = f_target;
+       _tmp2__target_destroy_notify = f_target_destroy_notify;
+       f = NULL;
+       f_target = NULL;
+       f_target_destroy_notify = NULL;
+       g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _tmp2_, _tmp2__target, _tmp2__target_destroy_notify);
+       (f_target_destroy_notify == NULL) ? NULL : (f_target_destroy_notify (f_target), NULL);
+       f = NULL;
+       f_target = NULL;
+       f_target_destroy_notify = NULL;
+       block1_data_unref (_data1_);
+       _data1_ = NULL;
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static Block2Data*
+block2_data_ref (Block2Data* _data2_)
+{
+       g_atomic_int_inc (&_data2_->_ref_count_);
+       return _data2_;
+}
+
+static void
+block2_data_unref (void * _userdata_)
+{
+       Block2Data* _data2_;
+       _data2_ = (Block2Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data2_->_ref_count_)) {
+               (_data2_->B_target_destroy_notify == NULL) ? NULL : (_data2_->B_target_destroy_notify 
(_data2_->B_target), NULL);
+               _data2_->B = NULL;
+               _data2_->B_target = NULL;
+               _data2_->B_target_destroy_notify = NULL;
+               g_slice_free (Block2Data, _data2_);
+       }
+}
+
+static gint
+__lambda5_ (Block2Data* _data2_)
+{
+       Func _tmp0_;
+       gpointer _tmp0__target;
+       gint result = 0;
+       _data2_->k = _data2_->k - 1;
+       _tmp0_ = _data2_->B;
+       _tmp0__target = _data2_->B_target;
+       result = A (_data2_->k, _tmp0_, _tmp0__target, _data2_->x1, _data2_->x1_target, _data2_->x2, 
_data2_->x2_target, _data2_->x3, _data2_->x3_target, _data2_->x4, _data2_->x4_target);
+       return result;
+}
+
+static gint
+___lambda5__func (gpointer self)
+{
+       gint result;
+       result = __lambda5_ (self);
+       return result;
+}
+
+gint
+A (gint k,
+   Func x1,
+   gpointer x1_target,
+   Func x2,
+   gpointer x2_target,
+   Func x3,
+   gpointer x3_target,
+   Func x4,
+   gpointer x4_target,
+   Func x5,
+   gpointer x5_target)
+{
+       Block2Data* _data2_;
+       gint _tmp0_ = 0;
+       gint result = 0;
+       _data2_ = g_slice_new0 (Block2Data);
+       _data2_->_ref_count_ = 1;
+       _data2_->k = k;
+       _data2_->x1 = x1;
+       _data2_->x1_target = x1_target;
+       _data2_->x2 = x2;
+       _data2_->x2_target = x2_target;
+       _data2_->x3 = x3;
+       _data2_->x3_target = x3_target;
+       _data2_->x4 = x4;
+       _data2_->x4_target = x4_target;
+       _data2_->B = NULL;
+       _data2_->B_target = NULL;
+       _data2_->B_target_destroy_notify = NULL;
+       (_data2_->B_target_destroy_notify == NULL) ? NULL : (_data2_->B_target_destroy_notify 
(_data2_->B_target), NULL);
+       _data2_->B = NULL;
+       _data2_->B_target = NULL;
+       _data2_->B_target_destroy_notify = NULL;
+       _data2_->B = ___lambda5__func;
+       _data2_->B_target = block2_data_ref (_data2_);
+       _data2_->B_target_destroy_notify = block2_data_unref;
+       if (_data2_->k <= 0) {
+               _tmp0_ = _data2_->x4 (_data2_->x4_target) + x5 (x5_target);
+       } else {
+               Func _tmp1_;
+               gpointer _tmp1__target;
+               _tmp1_ = _data2_->B;
+               _tmp1__target = _data2_->B_target;
+               _tmp0_ = _tmp1_ (_tmp1__target);
+       }
+       result = _tmp0_;
+       block2_data_unref (_data2_);
+       _data2_ = NULL;
+       return result;
+}
+
+static Block3Data*
+block3_data_ref (Block3Data* _data3_)
+{
+       g_atomic_int_inc (&_data3_->_ref_count_);
+       return _data3_;
+}
+
+static void
+block3_data_unref (void * _userdata_)
+{
+       Block3Data* _data3_;
+       _data3_ = (Block3Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data3_->_ref_count_)) {
+               g_slice_free (Block3Data, _data3_);
+       }
+}
+
+static gint
+__lambda6_ (Block3Data* _data3_)
+{
+       gint result = 0;
+       _data3_->array = NULL;
+       _data3_->func ();
+       result = 0;
+       return result;
+}
+
+static gint
+___lambda6__func (gpointer self)
+{
+       gint result;
+       result = __lambda6_ (self);
+       return result;
+}
+
+void
+B (gint* array,
+   NoTargetFunc func)
+{
+       Block3Data* _data3_;
+       Func C = NULL;
+       gpointer C_target;
+       GDestroyNotify C_target_destroy_notify;
+       _data3_ = g_slice_new0 (Block3Data);
+       _data3_->_ref_count_ = 1;
+       _data3_->array = array;
+       _data3_->func = func;
+       C = ___lambda6__func;
+       C_target = block3_data_ref (_data3_);
+       C_target_destroy_notify = block3_data_unref;
+       (C_target_destroy_notify == NULL) ? NULL : (C_target_destroy_notify (C_target), NULL);
+       C = NULL;
+       C_target = NULL;
+       C_target_destroy_notify = NULL;
+       block3_data_unref (_data3_);
+       _data3_ = NULL;
+}
+
+static gint
+__lambda7_ (void)
+{
+       gint result = 0;
+       result = 1;
+       return result;
+}
+
+static gint
+___lambda7__func (gpointer self)
+{
+       gint result;
+       result = __lambda7_ ();
+       return result;
+}
+
+static gint
+__lambda8_ (void)
+{
+       gint result = 0;
+       result = -1;
+       return result;
+}
+
+static gint
+___lambda8__func (gpointer self)
+{
+       gint result;
+       result = __lambda8_ ();
+       return result;
+}
+
+static gint
+__lambda9_ (void)
+{
+       gint result = 0;
+       result = -1;
+       return result;
+}
+
+static gint
+___lambda9__func (gpointer self)
+{
+       gint result;
+       result = __lambda9_ ();
+       return result;
+}
+
+static gint
+__lambda10_ (void)
+{
+       gint result = 0;
+       result = 1;
+       return result;
+}
+
+static gint
+___lambda10__func (gpointer self)
+{
+       gint result;
+       result = __lambda10_ ();
+       return result;
+}
+
+static gint
+__lambda11_ (void)
+{
+       gint result = 0;
+       result = 0;
+       return result;
+}
+
+static gint
+___lambda11__func (gpointer self)
+{
+       gint result;
+       result = __lambda11_ ();
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       gint _result_ = 0;
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       GMainLoop* loop = NULL;
+       GMainLoop* _tmp1_;
+       _result_ = A (10, ___lambda7__func, NULL, ___lambda8__func, NULL, ___lambda9__func, NULL, 
___lambda10__func, NULL, ___lambda11__func, NULL);
+       _vala_assert (_result_ == -67, "result == -67");
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       _tmp1_ = g_main_loop_new (NULL, FALSE);
+       loop = _tmp1_;
+       foo_bar (foo, loop);
+       g_main_loop_run (loop);
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"foo.ref_count == 1");
+       _g_main_loop_unref0 (loop);
+       _g_object_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static gssize
+_vala_array_length (gpointer array)
+{
+       gssize length;
+       length = 0;
+       if (array) {
+               while (((gpointer*) array)[length]) {
+                       length++;
+               }
+       }
+       return length;
+}
+
diff --git a/tests/methods/contains.c-expected b/tests/methods/contains.c-expected
new file mode 100644
index 000000000..8d55e8330
--- /dev/null
+++ b/tests/methods/contains.c-expected
@@ -0,0 +1,315 @@
+/* methods_contains.c generated by valac, the Vala compiler
+ * generated from methods_contains.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN gboolean foo_contains (Foo* self,
+                       gint item);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+gboolean
+foo_contains (Foo* self,
+              gint item)
+{
+       gboolean result = FALSE;
+       g_return_val_if_fail (IS_FOO (self), FALSE);
+       result = item == 42;
+       return result;
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       _vala_assert (foo_contains (foo, 42), "42 in foo");
+       _foo_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/delegate-target.c-expected b/tests/methods/delegate-target.c-expected
new file mode 100644
index 000000000..ceaddff03
--- /dev/null
+++ b/tests/methods/delegate-target.c-expected
@@ -0,0 +1,829 @@
+/* methods_delegate_target.c generated by valac, the Vala compiler
+ * generated from methods_delegate_target.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef void (*FooFunc) (gpointer user_data);
+
+#define TYPE_IFOO (ifoo_get_type ())
+#define IFOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IFOO, IFoo))
+#define IS_IFOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IFOO))
+#define IFOO_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_IFOO, IFooIface))
+
+typedef struct _IFoo IFoo;
+typedef struct _IFooIface IFooIface;
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _IFooIface {
+       GTypeInterface parent_iface;
+       FooFunc (*get_foo) (IFoo* self);
+       void (*do_foo) (IFoo* self, FooFunc f);
+};
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+       FooFunc (*get_foo) (Foo* self);
+       void (*do_foo) (Foo* self, FooFunc f);
+       FooFunc (*get_bar) (Foo* self);
+       void (*do_bar) (Foo* self, FooFunc f);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+struct _Bar {
+       Foo parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       FooClass parent_class;
+};
+
+static gpointer foo_parent_class = NULL;
+static IFooIface * foo_ifoo_parent_iface = NULL;
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN GType ifoo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN FooFunc ifoo_get_foo (IFoo* self);
+VALA_EXTERN void ifoo_do_foo (IFoo* self,
+                  FooFunc f);
+static GType ifoo_get_type_once (void);
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN FooFunc foo_get_foo (Foo* self);
+VALA_EXTERN void foo_do_foo (Foo* self,
+                 FooFunc f);
+VALA_EXTERN FooFunc foo_get_bar (Foo* self);
+VALA_EXTERN void foo_do_bar (Foo* self,
+                 FooFunc f);
+static FooFunc foo_real_get_foo (Foo* self);
+static void __lambda4_ (Foo* self);
+static void ___lambda4__foo_func (gpointer self);
+static void foo_real_do_foo (Foo* self,
+                      FooFunc f);
+static FooFunc foo_real_get_bar (Foo* self);
+static void __lambda5_ (Foo* self);
+static void ___lambda5__foo_func (gpointer self);
+static void foo_real_do_bar (Foo* self,
+                      FooFunc f);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void ___lambda6_ (Foo* self);
+static void ____lambda6__foo_func (gpointer self);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, foo_unref)
+static FooFunc bar_real_get_foo (Foo* base);
+static void __lambda7_ (Bar* self);
+static void ___lambda7__foo_func (gpointer self);
+static void bar_real_do_foo (Foo* base,
+                      FooFunc f);
+static FooFunc bar_real_get_bar (Foo* base);
+static void __lambda8_ (Bar* self);
+static void ___lambda8__foo_func (gpointer self);
+static void bar_real_do_bar (Foo* base,
+                      FooFunc f);
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static void ___lambda9_ (Bar* self);
+static void ____lambda9__foo_func (gpointer self);
+static void ___lambda10_ (Bar* self);
+static void ____lambda10__foo_func (gpointer self);
+static GType bar_get_type_once (void);
+VALA_EXTERN FooFunc get_foo (void);
+static void __lambda11_ (void);
+static void ___lambda11__foo_func (gpointer self);
+VALA_EXTERN void do_foo (FooFunc f);
+static void _vala_main (void);
+static void ___lambda12_ (void);
+static void ____lambda12__foo_func (gpointer self);
+
+FooFunc
+ifoo_get_foo (IFoo* self)
+{
+       IFooIface* _iface_;
+       g_return_val_if_fail (IS_IFOO (self), NULL);
+       _iface_ = IFOO_GET_INTERFACE (self);
+       if (_iface_->get_foo) {
+               return _iface_->get_foo (self);
+       }
+       return NULL;
+}
+
+void
+ifoo_do_foo (IFoo* self,
+             FooFunc f)
+{
+       IFooIface* _iface_;
+       g_return_if_fail (IS_IFOO (self));
+       _iface_ = IFOO_GET_INTERFACE (self);
+       if (_iface_->do_foo) {
+               _iface_->do_foo (self, f);
+       }
+}
+
+static void
+ifoo_default_init (IFooIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+ifoo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (IFooIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) ifoo_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType ifoo_type_id;
+       ifoo_type_id = g_type_register_static (G_TYPE_INTERFACE, "IFoo", &g_define_type_info, 0);
+       return ifoo_type_id;
+}
+
+GType
+ifoo_get_type (void)
+{
+       static volatile gsize ifoo_type_id__volatile = 0;
+       if (g_once_init_enter (&ifoo_type_id__volatile)) {
+               GType ifoo_type_id;
+               ifoo_type_id = ifoo_get_type_once ();
+               g_once_init_leave (&ifoo_type_id__volatile, ifoo_type_id);
+       }
+       return ifoo_type_id__volatile;
+}
+
+static void
+__lambda4_ (Foo* self)
+{
+}
+
+static void
+___lambda4__foo_func (gpointer self)
+{
+       __lambda4_ ((Foo*) self);
+}
+
+static FooFunc
+foo_real_get_foo (Foo* self)
+{
+       FooFunc result = NULL;
+       result = ___lambda4__foo_func;
+       return result;
+}
+
+FooFunc
+foo_get_foo (Foo* self)
+{
+       FooClass* _klass_;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->get_foo) {
+               return _klass_->get_foo (self);
+       }
+       return NULL;
+}
+
+static void
+foo_real_do_foo (Foo* self,
+                 FooFunc f)
+{
+       _vala_assert (NULL == NULL, "f.target == null");
+       f (NULL);
+}
+
+void
+foo_do_foo (Foo* self,
+            FooFunc f)
+{
+       FooClass* _klass_;
+       g_return_if_fail (IS_FOO (self));
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->do_foo) {
+               _klass_->do_foo (self, f);
+       }
+}
+
+static void
+__lambda5_ (Foo* self)
+{
+}
+
+static void
+___lambda5__foo_func (gpointer self)
+{
+       __lambda5_ ((Foo*) self);
+}
+
+static FooFunc
+foo_real_get_bar (Foo* self)
+{
+       FooFunc result = NULL;
+       result = ___lambda5__foo_func;
+       return result;
+}
+
+FooFunc
+foo_get_bar (Foo* self)
+{
+       FooClass* _klass_;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->get_bar) {
+               return _klass_->get_bar (self);
+       }
+       return NULL;
+}
+
+static void
+foo_real_do_bar (Foo* self,
+                 FooFunc f)
+{
+       _vala_assert (NULL == NULL, "f.target == null");
+       f (NULL);
+}
+
+void
+foo_do_bar (Foo* self,
+            FooFunc f)
+{
+       FooClass* _klass_;
+       g_return_if_fail (IS_FOO (self));
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->do_bar) {
+               _klass_->do_bar (self, f);
+       }
+}
+
+static void
+___lambda6_ (Foo* self)
+{
+}
+
+static void
+____lambda6__foo_func (gpointer self)
+{
+       ___lambda6_ ((Foo*) self);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       {
+               FooFunc f = NULL;
+               FooFunc _tmp0_;
+               gpointer f_target;
+               GDestroyNotify f_target_destroy_notify;
+               _tmp0_ = foo_get_foo (self);
+               f = _tmp0_;
+               f_target = NULL;
+               f_target_destroy_notify = NULL;
+               _vala_assert (f_target == NULL, "f.target == null");
+               f (f_target);
+               (f_target_destroy_notify == NULL) ? NULL : (f_target_destroy_notify (f_target), NULL);
+               f = NULL;
+               f_target = NULL;
+               f_target_destroy_notify = NULL;
+       }
+       {
+               foo_do_foo (self, ____lambda6__foo_func);
+       }
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       ((FooClass *) klass)->get_foo = (FooFunc (*) (Foo*)) foo_real_get_foo;
+       ((FooClass *) klass)->do_foo = (void (*) (Foo*, FooFunc)) foo_real_do_foo;
+       ((FooClass *) klass)->get_bar = (FooFunc (*) (Foo*)) foo_real_get_bar;
+       ((FooClass *) klass)->do_bar = (void (*) (Foo*, FooFunc)) foo_real_do_bar;
+}
+
+static void
+foo_ifoo_interface_init (IFooIface * iface,
+                         gpointer iface_data)
+{
+       foo_ifoo_parent_iface = g_type_interface_peek_parent (iface);
+       iface->get_foo = (FooFunc (*) (IFoo*)) foo_get_foo;
+       iface->do_foo = (void (*) (IFoo*, FooFunc)) foo_do_foo;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       static const GInterfaceInfo ifoo_info = { (GInterfaceInitFunc) foo_ifoo_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       g_type_add_interface_static (foo_type_id, TYPE_IFOO, &ifoo_info);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+__lambda7_ (Bar* self)
+{
+}
+
+static void
+___lambda7__foo_func (gpointer self)
+{
+       __lambda7_ ((Bar*) self);
+}
+
+static FooFunc
+bar_real_get_foo (Foo* base)
+{
+       Bar * self;
+       FooFunc result = NULL;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAR, Bar);
+       result = ___lambda7__foo_func;
+       return result;
+}
+
+static void
+bar_real_do_foo (Foo* base,
+                 FooFunc f)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAR, Bar);
+       _vala_assert (NULL == NULL, "f.target == null");
+       f (NULL);
+}
+
+static void
+__lambda8_ (Bar* self)
+{
+}
+
+static void
+___lambda8__foo_func (gpointer self)
+{
+       __lambda8_ ((Bar*) self);
+}
+
+static FooFunc
+bar_real_get_bar (Foo* base)
+{
+       Bar * self;
+       FooFunc result = NULL;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAR, Bar);
+       result = ___lambda8__foo_func;
+       return result;
+}
+
+static void
+bar_real_do_bar (Foo* base,
+                 FooFunc f)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAR, Bar);
+       _vala_assert (NULL == NULL, "f.target == null");
+       f (NULL);
+}
+
+static void
+___lambda9_ (Bar* self)
+{
+}
+
+static void
+____lambda9__foo_func (gpointer self)
+{
+       ___lambda9_ ((Bar*) self);
+}
+
+static void
+___lambda10_ (Bar* self)
+{
+}
+
+static void
+____lambda10__foo_func (gpointer self)
+{
+       ___lambda10_ ((Bar*) self);
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar* self = NULL;
+       self = (Bar*) foo_construct (object_type);
+       {
+               FooFunc f = NULL;
+               FooFunc _tmp0_;
+               gpointer f_target;
+               GDestroyNotify f_target_destroy_notify;
+               _tmp0_ = foo_get_foo (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_FOO, Foo));
+               f = _tmp0_;
+               f_target = NULL;
+               f_target_destroy_notify = NULL;
+               _vala_assert (f_target == NULL, "f.target == null");
+               f (f_target);
+               (f_target_destroy_notify == NULL) ? NULL : (f_target_destroy_notify (f_target), NULL);
+               f = NULL;
+               f_target = NULL;
+               f_target_destroy_notify = NULL;
+       }
+       {
+               foo_do_foo (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_FOO, Foo), ____lambda9__foo_func);
+       }
+       {
+               FooFunc f = NULL;
+               FooFunc _tmp1_;
+               gpointer f_target;
+               GDestroyNotify f_target_destroy_notify;
+               _tmp1_ = foo_get_bar (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_FOO, Foo));
+               f = _tmp1_;
+               f_target = NULL;
+               f_target_destroy_notify = NULL;
+               _vala_assert (f_target == NULL, "f.target == null");
+               f (f_target);
+               (f_target_destroy_notify == NULL) ? NULL : (f_target_destroy_notify (f_target), NULL);
+               f = NULL;
+               f_target = NULL;
+               f_target_destroy_notify = NULL;
+       }
+       {
+               foo_do_bar (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_FOO, Foo), ____lambda10__foo_func);
+       }
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->get_foo = (FooFunc (*) (Foo*)) bar_real_get_foo;
+       ((FooClass *) klass)->do_foo = (void (*) (Foo*, FooFunc)) bar_real_do_foo;
+       ((FooClass *) klass)->get_bar = (FooFunc (*) (Foo*)) bar_real_get_bar;
+       ((FooClass *) klass)->do_bar = (void (*) (Foo*, FooFunc)) bar_real_do_bar;
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (TYPE_FOO, "Bar", &g_define_type_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+__lambda11_ (void)
+{
+}
+
+static void
+___lambda11__foo_func (gpointer self)
+{
+       __lambda11_ ();
+}
+
+FooFunc
+get_foo (void)
+{
+       FooFunc result = NULL;
+       result = ___lambda11__foo_func;
+       return result;
+}
+
+void
+do_foo (FooFunc f)
+{
+       _vala_assert (NULL == NULL, "f.target == null");
+       f (NULL);
+}
+
+static void
+___lambda12_ (void)
+{
+}
+
+static void
+____lambda12__foo_func (gpointer self)
+{
+       ___lambda12_ ();
+}
+
+static void
+_vala_main (void)
+{
+       {
+               FooFunc f = NULL;
+               FooFunc _tmp0_;
+               gpointer f_target;
+               GDestroyNotify f_target_destroy_notify;
+               _tmp0_ = get_foo ();
+               f = _tmp0_;
+               f_target = NULL;
+               f_target_destroy_notify = NULL;
+               _vala_assert (f_target == NULL, "f.target == null");
+               f (f_target);
+               (f_target_destroy_notify == NULL) ? NULL : (f_target_destroy_notify (f_target), NULL);
+               f = NULL;
+               f_target = NULL;
+               f_target_destroy_notify = NULL;
+       }
+       {
+               do_foo (____lambda12__foo_func);
+       }
+       {
+               Foo* foo = NULL;
+               Foo* _tmp1_;
+               _tmp1_ = foo_new ();
+               foo = _tmp1_;
+               _foo_unref0 (foo);
+       }
+       {
+               Bar* bar = NULL;
+               Bar* _tmp2_;
+               _tmp2_ = bar_new ();
+               bar = _tmp2_;
+               _foo_unref0 (bar);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/extern.c-expected b/tests/methods/extern.c-expected
new file mode 100644
index 000000000..8ade4324b
--- /dev/null
+++ b/tests/methods/extern.c-expected
@@ -0,0 +1,321 @@
+/* methods_extern.c generated by valac, the Vala compiler
+ * generated from methods_extern.vala, do not modify */
+
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib-object.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+typedef struct _ParamSpecBar ParamSpecBar;
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Bar {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       GTypeClass parent_class;
+       void (*finalize) (Bar *self);
+};
+
+struct _ParamSpecBar {
+       GParamSpec parent_instance;
+};
+
+static gpointer bar_parent_class = NULL;
+
+void vala_some_thing (void);
+VALA_EXTERN gpointer bar_ref (gpointer instance);
+VALA_EXTERN void bar_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_bar (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_bar (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_bar (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_bar (const GValue* value);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, bar_unref)
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static void bar_finalize (Bar * obj);
+static GType bar_get_type_once (void);
+static void _vala_main (void);
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar* self = NULL;
+       self = (Bar*) g_type_create_instance (object_type);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+value_bar_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_bar_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               bar_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_bar_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = bar_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_bar_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_bar_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Bar * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = bar_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_bar_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Bar ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = bar_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_bar (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecBar* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_BAR), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_bar (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_bar (GValue* value,
+               gpointer v_object)
+{
+       Bar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               bar_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_unref (old);
+       }
+}
+
+void
+value_take_bar (GValue* value,
+                gpointer v_object)
+{
+       Bar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_unref (old);
+       }
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       ((BarClass *) klass)->finalize = bar_finalize;
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+bar_finalize (Bar * obj)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_bar_init, value_bar_free_value, 
value_bar_copy_value, value_bar_peek_pointer, "p", value_bar_collect_value, "p", value_bar_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType bar_type_id;
+       bar_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Bar", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+gpointer
+bar_ref (gpointer instance)
+{
+       Bar * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+bar_unref (gpointer instance)
+{
+       Bar * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               BAR_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       gchar* _tmp0_;
+       gchar* _tmp1_;
+       gchar* _tmp2_;
+       gchar* _tmp3_;
+       gchar* _tmp4_;
+       gchar* _tmp5_;
+       _tmp0_ = g_strdup ("foo");
+       _tmp1_ = _tmp0_;
+       _vala_assert (g_strcmp0 ("foo", _tmp1_) == 0, "\"foo\" == strdup (\"foo\")");
+       _g_free0 (_tmp1_);
+       _tmp2_ = g_strdup ("foo");
+       _tmp3_ = _tmp2_;
+       _vala_assert (g_strcmp0 ("foo", _tmp3_) == 0, "\"foo\" == Foo.strdup (\"foo\")");
+       _g_free0 (_tmp3_);
+       _tmp4_ = g_strdup ("foo");
+       _tmp5_ = _tmp4_;
+       _vala_assert (g_strcmp0 ("foo", _tmp5_) == 0, "\"foo\" == Bar.strdup (\"foo\")");
+       _g_free0 (_tmp5_);
+       _vala_assert (((void*) vala_some_thing) != NULL, "(void*) some_thing != null");
+       _vala_assert (((void*) vala_some_thing) != NULL, "(void*) Foo.some_thing != null");
+       _vala_assert (((void*) vala_some_thing) != NULL, "(void*) Bar.some_thing != null");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/generics.c-expected b/tests/methods/generics.c-expected
new file mode 100644
index 000000000..5cf5065b2
--- /dev/null
+++ b/tests/methods/generics.c-expected
@@ -0,0 +1,505 @@
+/* methods_generics.c generated by valac, the Vala compiler
+ * generated from methods_generics.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define FOO_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_FOO, FooIface))
+
+typedef struct _Foo Foo;
+typedef struct _FooIface FooIface;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+typedef struct _ParamSpecBar ParamSpecBar;
+
+#define TYPE_BAZ (baz_get_type ())
+#define BAZ(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAZ, Baz))
+#define BAZ_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAZ, BazClass))
+#define IS_BAZ(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAZ))
+#define IS_BAZ_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAZ))
+#define BAZ_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAZ, BazClass))
+
+typedef struct _Baz Baz;
+typedef struct _BazClass BazClass;
+typedef struct _BazPrivate BazPrivate;
+enum  {
+       BAZ_0_PROPERTY,
+       BAZ_NUM_PROPERTIES
+};
+static GParamSpec* baz_properties[BAZ_NUM_PROPERTIES];
+#define _bar_unref0(var) ((var == NULL) ? NULL : (var = (bar_unref (var), NULL)))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _FooIface {
+       GTypeInterface parent_iface;
+};
+
+struct _Bar {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       GTypeClass parent_class;
+       void (*finalize) (Bar *self);
+};
+
+struct _ParamSpecBar {
+       GParamSpec parent_instance;
+};
+
+struct _Baz {
+       GObject parent_instance;
+       BazPrivate * priv;
+};
+
+struct _BazClass {
+       GObjectClass parent_class;
+};
+
+static gpointer bar_parent_class = NULL;
+static gpointer baz_parent_class = NULL;
+static FooIface * baz_foo_parent_iface = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN void foo_foo (Foo* self,
+              GType t_type,
+              GBoxedCopyFunc t_dup_func,
+              GDestroyNotify t_destroy_func,
+              gpointer bar);
+static GType foo_get_type_once (void);
+VALA_EXTERN gpointer bar_ref (gpointer instance);
+VALA_EXTERN void bar_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_bar (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_bar (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_bar (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_bar (const GValue* value);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, bar_unref)
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static void bar_finalize (Bar * obj);
+static GType bar_get_type_once (void);
+VALA_EXTERN GType baz_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Baz, g_object_unref)
+VALA_EXTERN Baz* baz_new (void);
+VALA_EXTERN Baz* baz_construct (GType object_type);
+static GType baz_get_type_once (void);
+VALA_EXTERN void foo (GType t_type,
+          GBoxedCopyFunc t_dup_func,
+          GDestroyNotify t_destroy_func,
+          gpointer bar);
+VALA_EXTERN gboolean is_check (GType g_type,
+                   GBoxedCopyFunc g_dup_func,
+                   GDestroyNotify g_destroy_func);
+static void _vala_main (void);
+
+void
+foo_foo (Foo* self,
+         GType t_type,
+         GBoxedCopyFunc t_dup_func,
+         GDestroyNotify t_destroy_func,
+         gpointer bar)
+{
+       ((bar == NULL) || (t_destroy_func == NULL)) ? NULL : (bar = (t_destroy_func (bar), NULL));
+       bar = NULL;
+       ((bar == NULL) || (t_destroy_func == NULL)) ? NULL : (bar = (t_destroy_func (bar), NULL));
+}
+
+static void
+foo_default_init (FooIface * iface,
+                  gpointer iface_data)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_INTERFACE, "Foo", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (foo_type_id, G_TYPE_OBJECT);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar* self = NULL;
+       self = (Bar*) g_type_create_instance (object_type);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+value_bar_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_bar_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               bar_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_bar_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = bar_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_bar_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_bar_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Bar * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = bar_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_bar_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Bar ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = bar_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_bar (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecBar* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_BAR), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_bar (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_bar (GValue* value,
+               gpointer v_object)
+{
+       Bar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               bar_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_unref (old);
+       }
+}
+
+void
+value_take_bar (GValue* value,
+                gpointer v_object)
+{
+       Bar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_unref (old);
+       }
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       ((BarClass *) klass)->finalize = bar_finalize;
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+bar_finalize (Bar * obj)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_bar_init, value_bar_free_value, 
value_bar_copy_value, value_bar_peek_pointer, "p", value_bar_collect_value, "p", value_bar_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType bar_type_id;
+       bar_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Bar", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+gpointer
+bar_ref (gpointer instance)
+{
+       Bar * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+bar_unref (gpointer instance)
+{
+       Bar * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               BAR_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+Baz*
+baz_construct (GType object_type)
+{
+       Baz * self = NULL;
+       self = (Baz*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Baz*
+baz_new (void)
+{
+       return baz_construct (TYPE_BAZ);
+}
+
+static void
+baz_class_init (BazClass * klass,
+                gpointer klass_data)
+{
+       baz_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+baz_foo_interface_init (FooIface * iface,
+                        gpointer iface_data)
+{
+       baz_foo_parent_iface = g_type_interface_peek_parent (iface);
+}
+
+static void
+baz_instance_init (Baz * self,
+                   gpointer klass)
+{
+}
+
+static GType
+baz_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BazClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) baz_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Baz), 0, 
(GInstanceInitFunc) baz_instance_init, NULL };
+       static const GInterfaceInfo foo_info = { (GInterfaceInitFunc) baz_foo_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       GType baz_type_id;
+       baz_type_id = g_type_register_static (G_TYPE_OBJECT, "Baz", &g_define_type_info, 0);
+       g_type_add_interface_static (baz_type_id, TYPE_FOO, &foo_info);
+       return baz_type_id;
+}
+
+GType
+baz_get_type (void)
+{
+       static volatile gsize baz_type_id__volatile = 0;
+       if (g_once_init_enter (&baz_type_id__volatile)) {
+               GType baz_type_id;
+               baz_type_id = baz_get_type_once ();
+               g_once_init_leave (&baz_type_id__volatile, baz_type_id);
+       }
+       return baz_type_id__volatile;
+}
+
+void
+foo (GType t_type,
+     GBoxedCopyFunc t_dup_func,
+     GDestroyNotify t_destroy_func,
+     gpointer bar)
+{
+       ((bar == NULL) || (t_destroy_func == NULL)) ? NULL : (bar = (t_destroy_func (bar), NULL));
+       bar = NULL;
+       ((bar == NULL) || (t_destroy_func == NULL)) ? NULL : (bar = (t_destroy_func (bar), NULL));
+}
+
+gboolean
+is_check (GType g_type,
+          GBoxedCopyFunc g_dup_func,
+          GDestroyNotify g_destroy_func)
+{
+       Bar* o = NULL;
+       Bar* _tmp0_;
+       gboolean result = FALSE;
+       _tmp0_ = bar_new ();
+       o = _tmp0_;
+       result = G_TYPE_CHECK_INSTANCE_TYPE (o, g_type);
+       _bar_unref0 (o);
+       return result;
+}
+
+static gpointer
+_g_object_ref0 (gpointer self)
+{
+       return self ? g_object_ref (self) : NULL;
+}
+
+static void
+_vala_main (void)
+{
+       GObject* bar = NULL;
+       GObject* _tmp0_;
+       GObject* _tmp1_;
+       Baz* baz = NULL;
+       Baz* _tmp2_;
+       GObject* _tmp3_;
+       _tmp0_ = g_object_new (G_TYPE_OBJECT, NULL);
+       bar = _tmp0_;
+       _tmp1_ = _g_object_ref0 (bar);
+       foo (G_TYPE_OBJECT, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp1_);
+       _vala_assert (bar->ref_count == ((guint) 1), "bar.ref_count == 1");
+       _tmp2_ = baz_new ();
+       baz = _tmp2_;
+       _tmp3_ = _g_object_ref0 (bar);
+       foo_foo (G_TYPE_CHECK_INSTANCE_CAST (baz, TYPE_FOO, Foo), G_TYPE_OBJECT, (GBoxedCopyFunc) 
g_object_ref, (GDestroyNotify) g_object_unref, _tmp3_);
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (baz, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"baz.ref_count == 1");
+       _vala_assert (is_check (TYPE_BAR, (GBoxedCopyFunc) bar_ref, (GDestroyNotify) bar_unref), 
"is_check<Bar> ()");
+       _vala_assert (!is_check (TYPE_BAZ, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref), 
"!is_check<Baz> ()");
+       _g_object_unref0 (baz);
+       _g_object_unref0 (bar);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/iterator.c-expected b/tests/methods/iterator.c-expected
new file mode 100644
index 000000000..3565c88ff
--- /dev/null
+++ b/tests/methods/iterator.c-expected
@@ -0,0 +1,3014 @@
+/* methods_iterator.c generated by valac, the Vala compiler
+ * generated from methods_iterator.vala, do not modify */
+
+#include <glib-object.h>
+#include <gobject/gvaluecollector.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+#define TYPE_FOO_ITERATOR (foo_iterator_get_type ())
+#define FOO_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO_ITERATOR, FooIterator))
+#define FOO_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO_ITERATOR, FooIteratorClass))
+#define IS_FOO_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO_ITERATOR))
+#define IS_FOO_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO_ITERATOR))
+#define FOO_ITERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO_ITERATOR, FooIteratorClass))
+
+typedef struct _FooIterator FooIterator;
+typedef struct _FooIteratorClass FooIteratorClass;
+typedef struct _FooIteratorPrivate FooIteratorPrivate;
+typedef struct _ParamSpecFooIterator ParamSpecFooIterator;
+
+#define TYPE_FOO_COLLECTION (foo_collection_get_type ())
+#define FOO_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO_COLLECTION, FooCollection))
+#define FOO_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO_COLLECTION, 
FooCollectionClass))
+#define IS_FOO_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO_COLLECTION))
+#define IS_FOO_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO_COLLECTION))
+#define FOO_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO_COLLECTION, 
FooCollectionClass))
+
+typedef struct _FooCollection FooCollection;
+typedef struct _FooCollectionClass FooCollectionClass;
+typedef struct _FooCollectionPrivate FooCollectionPrivate;
+typedef struct _ParamSpecFooCollection ParamSpecFooCollection;
+
+#define TYPE_FOO_ITERATOR2 (foo_iterator2_get_type ())
+#define FOO_ITERATOR2(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO_ITERATOR2, FooIterator2))
+#define FOO_ITERATOR2_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO_ITERATOR2, FooIterator2Class))
+#define IS_FOO_ITERATOR2(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO_ITERATOR2))
+#define IS_FOO_ITERATOR2_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO_ITERATOR2))
+#define FOO_ITERATOR2_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO_ITERATOR2, 
FooIterator2Class))
+
+typedef struct _FooIterator2 FooIterator2;
+typedef struct _FooIterator2Class FooIterator2Class;
+typedef struct _FooIterator2Private FooIterator2Private;
+typedef struct _ParamSpecFooIterator2 ParamSpecFooIterator2;
+
+#define TYPE_FOO_COLLECTION2 (foo_collection2_get_type ())
+#define FOO_COLLECTION2(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO_COLLECTION2, FooCollection2))
+#define FOO_COLLECTION2_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO_COLLECTION2, 
FooCollection2Class))
+#define IS_FOO_COLLECTION2(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO_COLLECTION2))
+#define IS_FOO_COLLECTION2_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO_COLLECTION2))
+#define FOO_COLLECTION2_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO_COLLECTION2, 
FooCollection2Class))
+
+typedef struct _FooCollection2 FooCollection2;
+typedef struct _FooCollection2Class FooCollection2Class;
+typedef struct _FooCollection2Private FooCollection2Private;
+typedef struct _ParamSpecFooCollection2 ParamSpecFooCollection2;
+
+#define TYPE_FOO_COLLECTION3 (foo_collection3_get_type ())
+#define FOO_COLLECTION3(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO_COLLECTION3, FooCollection3))
+#define FOO_COLLECTION3_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO_COLLECTION3, 
FooCollection3Class))
+#define IS_FOO_COLLECTION3(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO_COLLECTION3))
+#define IS_FOO_COLLECTION3_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO_COLLECTION3))
+#define FOO_COLLECTION3_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO_COLLECTION3, 
FooCollection3Class))
+
+typedef struct _FooCollection3 FooCollection3;
+typedef struct _FooCollection3Class FooCollection3Class;
+typedef struct _FooCollection3Private FooCollection3Private;
+typedef struct _ParamSpecFooCollection3 ParamSpecFooCollection3;
+
+#define TYPE_FOO_ENTRY4 (foo_entry4_get_type ())
+#define FOO_ENTRY4(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO_ENTRY4, FooEntry4))
+#define FOO_ENTRY4_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO_ENTRY4, FooEntry4Class))
+#define IS_FOO_ENTRY4(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO_ENTRY4))
+#define IS_FOO_ENTRY4_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO_ENTRY4))
+#define FOO_ENTRY4_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO_ENTRY4, FooEntry4Class))
+
+typedef struct _FooEntry4 FooEntry4;
+typedef struct _FooEntry4Class FooEntry4Class;
+typedef struct _FooEntry4Private FooEntry4Private;
+typedef struct _ParamSpecFooEntry4 ParamSpecFooEntry4;
+
+#define TYPE_FOO_ITERATOR4 (foo_iterator4_get_type ())
+#define FOO_ITERATOR4(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO_ITERATOR4, FooIterator4))
+#define FOO_ITERATOR4_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO_ITERATOR4, FooIterator4Class))
+#define IS_FOO_ITERATOR4(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO_ITERATOR4))
+#define IS_FOO_ITERATOR4_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO_ITERATOR4))
+#define FOO_ITERATOR4_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO_ITERATOR4, 
FooIterator4Class))
+
+typedef struct _FooIterator4 FooIterator4;
+typedef struct _FooIterator4Class FooIterator4Class;
+typedef struct _FooIterator4Private FooIterator4Private;
+typedef struct _ParamSpecFooIterator4 ParamSpecFooIterator4;
+
+#define TYPE_FOO_COLLECTION4 (foo_collection4_get_type ())
+#define FOO_COLLECTION4(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO_COLLECTION4, FooCollection4))
+#define FOO_COLLECTION4_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO_COLLECTION4, 
FooCollection4Class))
+#define IS_FOO_COLLECTION4(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO_COLLECTION4))
+#define IS_FOO_COLLECTION4_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO_COLLECTION4))
+#define FOO_COLLECTION4_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO_COLLECTION4, 
FooCollection4Class))
+
+typedef struct _FooCollection4 FooCollection4;
+typedef struct _FooCollection4Class FooCollection4Class;
+typedef struct _FooCollection4Private FooCollection4Private;
+typedef struct _ParamSpecFooCollection4 ParamSpecFooCollection4;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _foo_iterator_unref0(var) ((var == NULL) ? NULL : (var = (foo_iterator_unref (var), NULL)))
+#define _foo_iterator2_unref0(var) ((var == NULL) ? NULL : (var = (foo_iterator2_unref (var), NULL)))
+#define _foo_entry4_unref0(var) ((var == NULL) ? NULL : (var = (foo_entry4_unref (var), NULL)))
+#define _foo_iterator4_unref0(var) ((var == NULL) ? NULL : (var = (foo_iterator4_unref (var), NULL)))
+#define _foo_collection4_unref0(var) ((var == NULL) ? NULL : (var = (foo_collection4_unref (var), NULL)))
+#define _foo_collection3_unref0(var) ((var == NULL) ? NULL : (var = (foo_collection3_unref (var), NULL)))
+#define _foo_collection2_unref0(var) ((var == NULL) ? NULL : (var = (foo_collection2_unref (var), NULL)))
+#define _foo_collection_unref0(var) ((var == NULL) ? NULL : (var = (foo_collection_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+struct _FooIterator {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooIteratorPrivate * priv;
+};
+
+struct _FooIteratorClass {
+       GTypeClass parent_class;
+       void (*finalize) (FooIterator *self);
+};
+
+struct _FooIteratorPrivate {
+       gboolean called;
+};
+
+struct _ParamSpecFooIterator {
+       GParamSpec parent_instance;
+};
+
+struct _FooCollection {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooCollectionPrivate * priv;
+};
+
+struct _FooCollectionClass {
+       GTypeClass parent_class;
+       void (*finalize) (FooCollection *self);
+};
+
+struct _ParamSpecFooCollection {
+       GParamSpec parent_instance;
+};
+
+struct _FooIterator2 {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooIterator2Private * priv;
+};
+
+struct _FooIterator2Class {
+       GTypeClass parent_class;
+       void (*finalize) (FooIterator2 *self);
+};
+
+struct _FooIterator2Private {
+       gboolean called;
+};
+
+struct _ParamSpecFooIterator2 {
+       GParamSpec parent_instance;
+};
+
+struct _FooCollection2 {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooCollection2Private * priv;
+};
+
+struct _FooCollection2Class {
+       GTypeClass parent_class;
+       void (*finalize) (FooCollection2 *self);
+};
+
+struct _ParamSpecFooCollection2 {
+       GParamSpec parent_instance;
+};
+
+struct _FooCollection3 {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooCollection3Private * priv;
+};
+
+struct _FooCollection3Class {
+       GTypeClass parent_class;
+       void (*finalize) (FooCollection3 *self);
+};
+
+struct _ParamSpecFooCollection3 {
+       GParamSpec parent_instance;
+};
+
+struct _FooEntry4 {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooEntry4Private * priv;
+};
+
+struct _FooEntry4Class {
+       GTypeClass parent_class;
+       void (*finalize) (FooEntry4 *self);
+};
+
+struct _FooEntry4Private {
+       GType k_type;
+       GBoxedCopyFunc k_dup_func;
+       GDestroyNotify k_destroy_func;
+       GType v_type;
+       GBoxedCopyFunc v_dup_func;
+       GDestroyNotify v_destroy_func;
+       gpointer _key;
+       gpointer _value;
+};
+
+struct _ParamSpecFooEntry4 {
+       GParamSpec parent_instance;
+};
+
+struct _FooIterator4 {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooIterator4Private * priv;
+};
+
+struct _FooIterator4Class {
+       GTypeClass parent_class;
+       void (*finalize) (FooIterator4 *self);
+};
+
+struct _FooIterator4Private {
+       GType g_type;
+       GBoxedCopyFunc g_dup_func;
+       GDestroyNotify g_destroy_func;
+       gboolean called;
+};
+
+struct _ParamSpecFooIterator4 {
+       GParamSpec parent_instance;
+};
+
+struct _FooCollection4 {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooCollection4Private * priv;
+};
+
+struct _FooCollection4Class {
+       GTypeClass parent_class;
+       void (*finalize) (FooCollection4 *self);
+};
+
+struct _FooCollection4Private {
+       GType k_type;
+       GBoxedCopyFunc k_dup_func;
+       GDestroyNotify k_destroy_func;
+       GType v_type;
+       GBoxedCopyFunc v_dup_func;
+       GDestroyNotify v_destroy_func;
+};
+
+struct _ParamSpecFooCollection4 {
+       GParamSpec parent_instance;
+};
+
+static gpointer foo_parent_class = NULL;
+static gint FooIterator_private_offset;
+static gpointer foo_iterator_parent_class = NULL;
+VALA_EXTERN Foo* foo_instance;
+static gpointer foo_collection_parent_class = NULL;
+static gint FooIterator2_private_offset;
+static gpointer foo_iterator2_parent_class = NULL;
+static gpointer foo_collection2_parent_class = NULL;
+static gpointer foo_collection3_parent_class = NULL;
+static gint FooEntry4_private_offset;
+static gpointer foo_entry4_parent_class = NULL;
+static gint FooIterator4_private_offset;
+static gpointer foo_iterator4_parent_class = NULL;
+static gint FooCollection4_private_offset;
+static gpointer foo_collection4_parent_class = NULL;
+Foo* foo_instance = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN gpointer foo_iterator_ref (gpointer instance);
+VALA_EXTERN void foo_iterator_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo_iterator (const gchar* name,
+                                     const gchar* nick,
+                                     const gchar* blurb,
+                                     GType object_type,
+                                     GParamFlags flags);
+VALA_EXTERN void value_set_foo_iterator (GValue* value,
+                             gpointer v_object);
+VALA_EXTERN void value_take_foo_iterator (GValue* value,
+                              gpointer v_object);
+VALA_EXTERN gpointer value_get_foo_iterator (const GValue* value);
+VALA_EXTERN GType foo_iterator_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (FooIterator, foo_iterator_unref)
+VALA_EXTERN gboolean foo_iterator_next (FooIterator* self);
+VALA_EXTERN Foo* foo_iterator_get (FooIterator* self);
+VALA_EXTERN FooIterator* foo_iterator_new (void);
+VALA_EXTERN FooIterator* foo_iterator_construct (GType object_type);
+static void foo_iterator_finalize (FooIterator * obj);
+static GType foo_iterator_get_type_once (void);
+VALA_EXTERN gpointer foo_collection_ref (gpointer instance);
+VALA_EXTERN void foo_collection_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo_collection (const gchar* name,
+                                       const gchar* nick,
+                                       const gchar* blurb,
+                                       GType object_type,
+                                       GParamFlags flags);
+VALA_EXTERN void value_set_foo_collection (GValue* value,
+                               gpointer v_object);
+VALA_EXTERN void value_take_foo_collection (GValue* value,
+                                gpointer v_object);
+VALA_EXTERN gpointer value_get_foo_collection (const GValue* value);
+VALA_EXTERN GType foo_collection_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (FooCollection, foo_collection_unref)
+VALA_EXTERN FooIterator* foo_collection_iterator (FooCollection* self);
+VALA_EXTERN FooCollection* foo_collection_new (void);
+VALA_EXTERN FooCollection* foo_collection_construct (GType object_type);
+static void foo_collection_finalize (FooCollection * obj);
+static GType foo_collection_get_type_once (void);
+VALA_EXTERN gpointer foo_iterator2_ref (gpointer instance);
+VALA_EXTERN void foo_iterator2_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo_iterator2 (const gchar* name,
+                                      const gchar* nick,
+                                      const gchar* blurb,
+                                      GType object_type,
+                                      GParamFlags flags);
+VALA_EXTERN void value_set_foo_iterator2 (GValue* value,
+                              gpointer v_object);
+VALA_EXTERN void value_take_foo_iterator2 (GValue* value,
+                               gpointer v_object);
+VALA_EXTERN gpointer value_get_foo_iterator2 (const GValue* value);
+VALA_EXTERN GType foo_iterator2_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (FooIterator2, foo_iterator2_unref)
+VALA_EXTERN Foo* foo_iterator2_next_value (FooIterator2* self);
+VALA_EXTERN FooIterator2* foo_iterator2_new (void);
+VALA_EXTERN FooIterator2* foo_iterator2_construct (GType object_type);
+static void foo_iterator2_finalize (FooIterator2 * obj);
+static GType foo_iterator2_get_type_once (void);
+VALA_EXTERN gpointer foo_collection2_ref (gpointer instance);
+VALA_EXTERN void foo_collection2_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo_collection2 (const gchar* name,
+                                        const gchar* nick,
+                                        const gchar* blurb,
+                                        GType object_type,
+                                        GParamFlags flags);
+VALA_EXTERN void value_set_foo_collection2 (GValue* value,
+                                gpointer v_object);
+VALA_EXTERN void value_take_foo_collection2 (GValue* value,
+                                 gpointer v_object);
+VALA_EXTERN gpointer value_get_foo_collection2 (const GValue* value);
+VALA_EXTERN GType foo_collection2_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (FooCollection2, foo_collection2_unref)
+VALA_EXTERN FooIterator2* foo_collection2_iterator (FooCollection2* self);
+VALA_EXTERN FooCollection2* foo_collection2_new (void);
+VALA_EXTERN FooCollection2* foo_collection2_construct (GType object_type);
+static void foo_collection2_finalize (FooCollection2 * obj);
+static GType foo_collection2_get_type_once (void);
+VALA_EXTERN gpointer foo_collection3_ref (gpointer instance);
+VALA_EXTERN void foo_collection3_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo_collection3 (const gchar* name,
+                                        const gchar* nick,
+                                        const gchar* blurb,
+                                        GType object_type,
+                                        GParamFlags flags);
+VALA_EXTERN void value_set_foo_collection3 (GValue* value,
+                                gpointer v_object);
+VALA_EXTERN void value_take_foo_collection3 (GValue* value,
+                                 gpointer v_object);
+VALA_EXTERN gpointer value_get_foo_collection3 (const GValue* value);
+VALA_EXTERN GType foo_collection3_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (FooCollection3, foo_collection3_unref)
+VALA_EXTERN Foo* foo_collection3_get (FooCollection3* self,
+                          gint index);
+VALA_EXTERN FooCollection3* foo_collection3_new (void);
+VALA_EXTERN FooCollection3* foo_collection3_construct (GType object_type);
+VALA_EXTERN gint foo_collection3_get_size (FooCollection3* self);
+static void foo_collection3_finalize (FooCollection3 * obj);
+static GType foo_collection3_get_type_once (void);
+VALA_EXTERN gpointer foo_entry4_ref (gpointer instance);
+VALA_EXTERN void foo_entry4_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo_entry4 (const gchar* name,
+                                   const gchar* nick,
+                                   const gchar* blurb,
+                                   GType object_type,
+                                   GParamFlags flags);
+VALA_EXTERN void value_set_foo_entry4 (GValue* value,
+                           gpointer v_object);
+VALA_EXTERN void value_take_foo_entry4 (GValue* value,
+                            gpointer v_object);
+VALA_EXTERN gpointer value_get_foo_entry4 (const GValue* value);
+VALA_EXTERN GType foo_entry4_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (FooEntry4, foo_entry4_unref)
+VALA_EXTERN FooEntry4* foo_entry4_new (GType k_type,
+                           GBoxedCopyFunc k_dup_func,
+                           GDestroyNotify k_destroy_func,
+                           GType v_type,
+                           GBoxedCopyFunc v_dup_func,
+                           GDestroyNotify v_destroy_func,
+                           gconstpointer _key,
+                           gconstpointer _value);
+VALA_EXTERN FooEntry4* foo_entry4_construct (GType object_type,
+                                 GType k_type,
+                                 GBoxedCopyFunc k_dup_func,
+                                 GDestroyNotify k_destroy_func,
+                                 GType v_type,
+                                 GBoxedCopyFunc v_dup_func,
+                                 GDestroyNotify v_destroy_func,
+                                 gconstpointer _key,
+                                 gconstpointer _value);
+static void foo_entry4_set_key (FooEntry4* self,
+                         gconstpointer value);
+static void foo_entry4_set_value (FooEntry4* self,
+                           gconstpointer value);
+VALA_EXTERN gconstpointer foo_entry4_get_key (FooEntry4* self);
+VALA_EXTERN gconstpointer foo_entry4_get_value (FooEntry4* self);
+static void foo_entry4_finalize (FooEntry4 * obj);
+static GType foo_entry4_get_type_once (void);
+VALA_EXTERN gpointer foo_iterator4_ref (gpointer instance);
+VALA_EXTERN void foo_iterator4_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo_iterator4 (const gchar* name,
+                                      const gchar* nick,
+                                      const gchar* blurb,
+                                      GType object_type,
+                                      GParamFlags flags);
+VALA_EXTERN void value_set_foo_iterator4 (GValue* value,
+                              gpointer v_object);
+VALA_EXTERN void value_take_foo_iterator4 (GValue* value,
+                               gpointer v_object);
+VALA_EXTERN gpointer value_get_foo_iterator4 (const GValue* value);
+VALA_EXTERN GType foo_iterator4_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (FooIterator4, foo_iterator4_unref)
+VALA_EXTERN gboolean foo_iterator4_next (FooIterator4* self);
+VALA_EXTERN gpointer foo_iterator4_get (FooIterator4* self);
+VALA_EXTERN FooIterator4* foo_iterator4_new (GType g_type,
+                                 GBoxedCopyFunc g_dup_func,
+                                 GDestroyNotify g_destroy_func);
+VALA_EXTERN FooIterator4* foo_iterator4_construct (GType object_type,
+                                       GType g_type,
+                                       GBoxedCopyFunc g_dup_func,
+                                       GDestroyNotify g_destroy_func);
+static void foo_iterator4_finalize (FooIterator4 * obj);
+static GType foo_iterator4_get_type_once (void);
+VALA_EXTERN gpointer foo_collection4_ref (gpointer instance);
+VALA_EXTERN void foo_collection4_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo_collection4 (const gchar* name,
+                                        const gchar* nick,
+                                        const gchar* blurb,
+                                        GType object_type,
+                                        GParamFlags flags);
+VALA_EXTERN void value_set_foo_collection4 (GValue* value,
+                                gpointer v_object);
+VALA_EXTERN void value_take_foo_collection4 (GValue* value,
+                                 gpointer v_object);
+VALA_EXTERN gpointer value_get_foo_collection4 (const GValue* value);
+VALA_EXTERN GType foo_collection4_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (FooCollection4, foo_collection4_unref)
+VALA_EXTERN gpointer foo_collection4_get (FooCollection4* self,
+                              gconstpointer key);
+VALA_EXTERN FooIterator4* foo_collection4_iterator (FooCollection4* self);
+VALA_EXTERN FooCollection4* foo_collection4_new (GType k_type,
+                                     GBoxedCopyFunc k_dup_func,
+                                     GDestroyNotify k_destroy_func,
+                                     GType v_type,
+                                     GBoxedCopyFunc v_dup_func,
+                                     GDestroyNotify v_destroy_func);
+VALA_EXTERN FooCollection4* foo_collection4_construct (GType object_type,
+                                           GType k_type,
+                                           GBoxedCopyFunc k_dup_func,
+                                           GDestroyNotify k_destroy_func,
+                                           GType v_type,
+                                           GBoxedCopyFunc v_dup_func,
+                                           GDestroyNotify v_destroy_func);
+VALA_EXTERN gint foo_collection4_get_size (FooCollection4* self);
+static void foo_collection4_finalize (FooCollection4 * obj);
+static GType foo_collection4_get_type_once (void);
+static void _vala_main (void);
+static void _foo_unref0_ (gpointer var);
+static inline void _g_slist_free__foo_unref0_ (GSList* self);
+static inline void _g_list_free__foo_unref0_ (GList* self);
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static inline gpointer
+foo_iterator_get_instance_private (FooIterator* self)
+{
+       return G_STRUCT_MEMBER_P (self, FooIterator_private_offset);
+}
+
+gboolean
+foo_iterator_next (FooIterator* self)
+{
+       gboolean result = FALSE;
+       g_return_val_if_fail (IS_FOO_ITERATOR (self), FALSE);
+       result = !self->priv->called;
+       return result;
+}
+
+static gpointer
+_foo_ref0 (gpointer self)
+{
+       return self ? foo_ref (self) : NULL;
+}
+
+Foo*
+foo_iterator_get (FooIterator* self)
+{
+       Foo* _tmp0_;
+       Foo* _tmp1_;
+       Foo* result = NULL;
+       g_return_val_if_fail (IS_FOO_ITERATOR (self), NULL);
+       _vala_assert (!self->priv->called, "!called");
+       self->priv->called = TRUE;
+       _tmp0_ = foo_instance;
+       _tmp1_ = _foo_ref0 (_tmp0_);
+       result = _tmp1_;
+       return result;
+}
+
+FooIterator*
+foo_iterator_construct (GType object_type)
+{
+       FooIterator* self = NULL;
+       self = (FooIterator*) g_type_create_instance (object_type);
+       return self;
+}
+
+FooIterator*
+foo_iterator_new (void)
+{
+       return foo_iterator_construct (TYPE_FOO_ITERATOR);
+}
+
+static void
+value_foo_iterator_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_iterator_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_iterator_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_iterator_copy_value (const GValue* src_value,
+                               GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_iterator_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_iterator_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_iterator_collect_value (GValue* value,
+                                  guint n_collect_values,
+                                  GTypeCValue* collect_values,
+                                  guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               FooIterator * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_iterator_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_iterator_lcopy_value (const GValue* value,
+                                guint n_collect_values,
+                                GTypeCValue* collect_values,
+                                guint collect_flags)
+{
+       FooIterator ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_iterator_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo_iterator (const gchar* name,
+                         const gchar* nick,
+                         const gchar* blurb,
+                         GType object_type,
+                         GParamFlags flags)
+{
+       ParamSpecFooIterator* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO_ITERATOR), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo_iterator (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO_ITERATOR), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo_iterator (GValue* value,
+                        gpointer v_object)
+{
+       FooIterator * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO_ITERATOR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO_ITERATOR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_iterator_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_iterator_unref (old);
+       }
+}
+
+void
+value_take_foo_iterator (GValue* value,
+                         gpointer v_object)
+{
+       FooIterator * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO_ITERATOR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO_ITERATOR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_iterator_unref (old);
+       }
+}
+
+static void
+foo_iterator_class_init (FooIteratorClass * klass,
+                         gpointer klass_data)
+{
+       foo_iterator_parent_class = g_type_class_peek_parent (klass);
+       ((FooIteratorClass *) klass)->finalize = foo_iterator_finalize;
+       g_type_class_adjust_private_offset (klass, &FooIterator_private_offset);
+}
+
+static void
+foo_iterator_instance_init (FooIterator * self,
+                            gpointer klass)
+{
+       self->priv = foo_iterator_get_instance_private (self);
+       self->priv->called = FALSE;
+       self->ref_count = 1;
+}
+
+static void
+foo_iterator_finalize (FooIterator * obj)
+{
+       FooIterator * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO_ITERATOR, FooIterator);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_iterator_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_iterator_init, 
value_foo_iterator_free_value, value_foo_iterator_copy_value, value_foo_iterator_peek_pointer, "p", 
value_foo_iterator_collect_value, "p", value_foo_iterator_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooIteratorClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_iterator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(FooIterator), 0, (GInstanceInitFunc) foo_iterator_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_iterator_type_id;
+       foo_iterator_type_id = g_type_register_fundamental (g_type_fundamental_next (), "FooIterator", 
&g_define_type_info, &g_define_type_fundamental_info, 0);
+       FooIterator_private_offset = g_type_add_instance_private (foo_iterator_type_id, sizeof 
(FooIteratorPrivate));
+       return foo_iterator_type_id;
+}
+
+GType
+foo_iterator_get_type (void)
+{
+       static volatile gsize foo_iterator_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_iterator_type_id__volatile)) {
+               GType foo_iterator_type_id;
+               foo_iterator_type_id = foo_iterator_get_type_once ();
+               g_once_init_leave (&foo_iterator_type_id__volatile, foo_iterator_type_id);
+       }
+       return foo_iterator_type_id__volatile;
+}
+
+gpointer
+foo_iterator_ref (gpointer instance)
+{
+       FooIterator * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_iterator_unref (gpointer instance)
+{
+       FooIterator * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_ITERATOR_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+FooIterator*
+foo_collection_iterator (FooCollection* self)
+{
+       FooIterator* _tmp0_;
+       FooIterator* result = NULL;
+       g_return_val_if_fail (IS_FOO_COLLECTION (self), NULL);
+       _tmp0_ = foo_iterator_new ();
+       result = _tmp0_;
+       return result;
+}
+
+FooCollection*
+foo_collection_construct (GType object_type)
+{
+       FooCollection* self = NULL;
+       self = (FooCollection*) g_type_create_instance (object_type);
+       return self;
+}
+
+FooCollection*
+foo_collection_new (void)
+{
+       return foo_collection_construct (TYPE_FOO_COLLECTION);
+}
+
+static void
+value_foo_collection_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_collection_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_collection_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_collection_copy_value (const GValue* src_value,
+                                 GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_collection_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_collection_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collection_collect_value (GValue* value,
+                                    guint n_collect_values,
+                                    GTypeCValue* collect_values,
+                                    guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               FooCollection * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_collection_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_collection_lcopy_value (const GValue* value,
+                                  guint n_collect_values,
+                                  GTypeCValue* collect_values,
+                                  guint collect_flags)
+{
+       FooCollection ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_collection_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo_collection (const gchar* name,
+                           const gchar* nick,
+                           const gchar* blurb,
+                           GType object_type,
+                           GParamFlags flags)
+{
+       ParamSpecFooCollection* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO_COLLECTION), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo_collection (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO_COLLECTION), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo_collection (GValue* value,
+                          gpointer v_object)
+{
+       FooCollection * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO_COLLECTION));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO_COLLECTION));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_collection_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_collection_unref (old);
+       }
+}
+
+void
+value_take_foo_collection (GValue* value,
+                           gpointer v_object)
+{
+       FooCollection * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO_COLLECTION));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO_COLLECTION));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_collection_unref (old);
+       }
+}
+
+static void
+foo_collection_class_init (FooCollectionClass * klass,
+                           gpointer klass_data)
+{
+       foo_collection_parent_class = g_type_class_peek_parent (klass);
+       ((FooCollectionClass *) klass)->finalize = foo_collection_finalize;
+}
+
+static void
+foo_collection_instance_init (FooCollection * self,
+                              gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_collection_finalize (FooCollection * obj)
+{
+       FooCollection * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO_COLLECTION, FooCollection);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_collection_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_collection_init, 
value_foo_collection_free_value, value_foo_collection_copy_value, value_foo_collection_peek_pointer, "p", 
value_foo_collection_collect_value, "p", value_foo_collection_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooCollectionClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_collection_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(FooCollection), 0, (GInstanceInitFunc) foo_collection_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_collection_type_id;
+       foo_collection_type_id = g_type_register_fundamental (g_type_fundamental_next (), "FooCollection", 
&g_define_type_info, &g_define_type_fundamental_info, 0);
+       return foo_collection_type_id;
+}
+
+GType
+foo_collection_get_type (void)
+{
+       static volatile gsize foo_collection_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_collection_type_id__volatile)) {
+               GType foo_collection_type_id;
+               foo_collection_type_id = foo_collection_get_type_once ();
+               g_once_init_leave (&foo_collection_type_id__volatile, foo_collection_type_id);
+       }
+       return foo_collection_type_id__volatile;
+}
+
+gpointer
+foo_collection_ref (gpointer instance)
+{
+       FooCollection * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_collection_unref (gpointer instance)
+{
+       FooCollection * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_COLLECTION_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static inline gpointer
+foo_iterator2_get_instance_private (FooIterator2* self)
+{
+       return G_STRUCT_MEMBER_P (self, FooIterator2_private_offset);
+}
+
+Foo*
+foo_iterator2_next_value (FooIterator2* self)
+{
+       Foo* _tmp0_;
+       Foo* _tmp1_;
+       Foo* result = NULL;
+       g_return_val_if_fail (IS_FOO_ITERATOR2 (self), NULL);
+       if (self->priv->called) {
+               result = NULL;
+               return result;
+       }
+       self->priv->called = TRUE;
+       _tmp0_ = foo_instance;
+       _tmp1_ = _foo_ref0 (_tmp0_);
+       result = _tmp1_;
+       return result;
+}
+
+FooIterator2*
+foo_iterator2_construct (GType object_type)
+{
+       FooIterator2* self = NULL;
+       self = (FooIterator2*) g_type_create_instance (object_type);
+       return self;
+}
+
+FooIterator2*
+foo_iterator2_new (void)
+{
+       return foo_iterator2_construct (TYPE_FOO_ITERATOR2);
+}
+
+static void
+value_foo_iterator2_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_iterator2_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_iterator2_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_iterator2_copy_value (const GValue* src_value,
+                                GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_iterator2_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_iterator2_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_iterator2_collect_value (GValue* value,
+                                   guint n_collect_values,
+                                   GTypeCValue* collect_values,
+                                   guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               FooIterator2 * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_iterator2_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_iterator2_lcopy_value (const GValue* value,
+                                 guint n_collect_values,
+                                 GTypeCValue* collect_values,
+                                 guint collect_flags)
+{
+       FooIterator2 ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_iterator2_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo_iterator2 (const gchar* name,
+                          const gchar* nick,
+                          const gchar* blurb,
+                          GType object_type,
+                          GParamFlags flags)
+{
+       ParamSpecFooIterator2* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO_ITERATOR2), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo_iterator2 (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO_ITERATOR2), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo_iterator2 (GValue* value,
+                         gpointer v_object)
+{
+       FooIterator2 * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO_ITERATOR2));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO_ITERATOR2));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_iterator2_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_iterator2_unref (old);
+       }
+}
+
+void
+value_take_foo_iterator2 (GValue* value,
+                          gpointer v_object)
+{
+       FooIterator2 * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO_ITERATOR2));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO_ITERATOR2));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_iterator2_unref (old);
+       }
+}
+
+static void
+foo_iterator2_class_init (FooIterator2Class * klass,
+                          gpointer klass_data)
+{
+       foo_iterator2_parent_class = g_type_class_peek_parent (klass);
+       ((FooIterator2Class *) klass)->finalize = foo_iterator2_finalize;
+       g_type_class_adjust_private_offset (klass, &FooIterator2_private_offset);
+}
+
+static void
+foo_iterator2_instance_init (FooIterator2 * self,
+                             gpointer klass)
+{
+       self->priv = foo_iterator2_get_instance_private (self);
+       self->priv->called = FALSE;
+       self->ref_count = 1;
+}
+
+static void
+foo_iterator2_finalize (FooIterator2 * obj)
+{
+       FooIterator2 * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO_ITERATOR2, FooIterator2);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_iterator2_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_iterator2_init, 
value_foo_iterator2_free_value, value_foo_iterator2_copy_value, value_foo_iterator2_peek_pointer, "p", 
value_foo_iterator2_collect_value, "p", value_foo_iterator2_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooIterator2Class), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_iterator2_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(FooIterator2), 0, (GInstanceInitFunc) foo_iterator2_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_iterator2_type_id;
+       foo_iterator2_type_id = g_type_register_fundamental (g_type_fundamental_next (), "FooIterator2", 
&g_define_type_info, &g_define_type_fundamental_info, 0);
+       FooIterator2_private_offset = g_type_add_instance_private (foo_iterator2_type_id, sizeof 
(FooIterator2Private));
+       return foo_iterator2_type_id;
+}
+
+GType
+foo_iterator2_get_type (void)
+{
+       static volatile gsize foo_iterator2_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_iterator2_type_id__volatile)) {
+               GType foo_iterator2_type_id;
+               foo_iterator2_type_id = foo_iterator2_get_type_once ();
+               g_once_init_leave (&foo_iterator2_type_id__volatile, foo_iterator2_type_id);
+       }
+       return foo_iterator2_type_id__volatile;
+}
+
+gpointer
+foo_iterator2_ref (gpointer instance)
+{
+       FooIterator2 * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_iterator2_unref (gpointer instance)
+{
+       FooIterator2 * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_ITERATOR2_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+FooIterator2*
+foo_collection2_iterator (FooCollection2* self)
+{
+       FooIterator2* _tmp0_;
+       FooIterator2* result = NULL;
+       g_return_val_if_fail (IS_FOO_COLLECTION2 (self), NULL);
+       _tmp0_ = foo_iterator2_new ();
+       result = _tmp0_;
+       return result;
+}
+
+FooCollection2*
+foo_collection2_construct (GType object_type)
+{
+       FooCollection2* self = NULL;
+       self = (FooCollection2*) g_type_create_instance (object_type);
+       return self;
+}
+
+FooCollection2*
+foo_collection2_new (void)
+{
+       return foo_collection2_construct (TYPE_FOO_COLLECTION2);
+}
+
+static void
+value_foo_collection2_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_collection2_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_collection2_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_collection2_copy_value (const GValue* src_value,
+                                  GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_collection2_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_collection2_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collection2_collect_value (GValue* value,
+                                     guint n_collect_values,
+                                     GTypeCValue* collect_values,
+                                     guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               FooCollection2 * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_collection2_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_collection2_lcopy_value (const GValue* value,
+                                   guint n_collect_values,
+                                   GTypeCValue* collect_values,
+                                   guint collect_flags)
+{
+       FooCollection2 ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_collection2_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo_collection2 (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags)
+{
+       ParamSpecFooCollection2* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO_COLLECTION2), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo_collection2 (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO_COLLECTION2), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo_collection2 (GValue* value,
+                           gpointer v_object)
+{
+       FooCollection2 * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO_COLLECTION2));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO_COLLECTION2));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_collection2_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_collection2_unref (old);
+       }
+}
+
+void
+value_take_foo_collection2 (GValue* value,
+                            gpointer v_object)
+{
+       FooCollection2 * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO_COLLECTION2));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO_COLLECTION2));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_collection2_unref (old);
+       }
+}
+
+static void
+foo_collection2_class_init (FooCollection2Class * klass,
+                            gpointer klass_data)
+{
+       foo_collection2_parent_class = g_type_class_peek_parent (klass);
+       ((FooCollection2Class *) klass)->finalize = foo_collection2_finalize;
+}
+
+static void
+foo_collection2_instance_init (FooCollection2 * self,
+                               gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_collection2_finalize (FooCollection2 * obj)
+{
+       FooCollection2 * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO_COLLECTION2, FooCollection2);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_collection2_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_collection2_init, 
value_foo_collection2_free_value, value_foo_collection2_copy_value, value_foo_collection2_peek_pointer, "p", 
value_foo_collection2_collect_value, "p", value_foo_collection2_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooCollection2Class), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_collection2_class_init, (GClassFinalizeFunc) NULL, NULL, 
sizeof (FooCollection2), 0, (GInstanceInitFunc) foo_collection2_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_collection2_type_id;
+       foo_collection2_type_id = g_type_register_fundamental (g_type_fundamental_next (), "FooCollection2", 
&g_define_type_info, &g_define_type_fundamental_info, 0);
+       return foo_collection2_type_id;
+}
+
+GType
+foo_collection2_get_type (void)
+{
+       static volatile gsize foo_collection2_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_collection2_type_id__volatile)) {
+               GType foo_collection2_type_id;
+               foo_collection2_type_id = foo_collection2_get_type_once ();
+               g_once_init_leave (&foo_collection2_type_id__volatile, foo_collection2_type_id);
+       }
+       return foo_collection2_type_id__volatile;
+}
+
+gpointer
+foo_collection2_ref (gpointer instance)
+{
+       FooCollection2 * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_collection2_unref (gpointer instance)
+{
+       FooCollection2 * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_COLLECTION2_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+Foo*
+foo_collection3_get (FooCollection3* self,
+                     gint index)
+{
+       Foo* _tmp0_;
+       Foo* _tmp1_;
+       Foo* result = NULL;
+       g_return_val_if_fail (IS_FOO_COLLECTION3 (self), NULL);
+       _vala_assert (index == 0, "index == 0");
+       _tmp0_ = foo_instance;
+       _tmp1_ = _foo_ref0 (_tmp0_);
+       result = _tmp1_;
+       return result;
+}
+
+FooCollection3*
+foo_collection3_construct (GType object_type)
+{
+       FooCollection3* self = NULL;
+       self = (FooCollection3*) g_type_create_instance (object_type);
+       return self;
+}
+
+FooCollection3*
+foo_collection3_new (void)
+{
+       return foo_collection3_construct (TYPE_FOO_COLLECTION3);
+}
+
+gint
+foo_collection3_get_size (FooCollection3* self)
+{
+       gint result;
+       g_return_val_if_fail (IS_FOO_COLLECTION3 (self), 0);
+       result = 1;
+       return result;
+}
+
+static void
+value_foo_collection3_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_collection3_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_collection3_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_collection3_copy_value (const GValue* src_value,
+                                  GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_collection3_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_collection3_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collection3_collect_value (GValue* value,
+                                     guint n_collect_values,
+                                     GTypeCValue* collect_values,
+                                     guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               FooCollection3 * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_collection3_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_collection3_lcopy_value (const GValue* value,
+                                   guint n_collect_values,
+                                   GTypeCValue* collect_values,
+                                   guint collect_flags)
+{
+       FooCollection3 ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_collection3_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo_collection3 (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags)
+{
+       ParamSpecFooCollection3* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO_COLLECTION3), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo_collection3 (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO_COLLECTION3), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo_collection3 (GValue* value,
+                           gpointer v_object)
+{
+       FooCollection3 * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO_COLLECTION3));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO_COLLECTION3));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_collection3_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_collection3_unref (old);
+       }
+}
+
+void
+value_take_foo_collection3 (GValue* value,
+                            gpointer v_object)
+{
+       FooCollection3 * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO_COLLECTION3));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO_COLLECTION3));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_collection3_unref (old);
+       }
+}
+
+static void
+foo_collection3_class_init (FooCollection3Class * klass,
+                            gpointer klass_data)
+{
+       foo_collection3_parent_class = g_type_class_peek_parent (klass);
+       ((FooCollection3Class *) klass)->finalize = foo_collection3_finalize;
+}
+
+static void
+foo_collection3_instance_init (FooCollection3 * self,
+                               gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_collection3_finalize (FooCollection3 * obj)
+{
+       FooCollection3 * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO_COLLECTION3, FooCollection3);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_collection3_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_collection3_init, 
value_foo_collection3_free_value, value_foo_collection3_copy_value, value_foo_collection3_peek_pointer, "p", 
value_foo_collection3_collect_value, "p", value_foo_collection3_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooCollection3Class), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_collection3_class_init, (GClassFinalizeFunc) NULL, NULL, 
sizeof (FooCollection3), 0, (GInstanceInitFunc) foo_collection3_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_collection3_type_id;
+       foo_collection3_type_id = g_type_register_fundamental (g_type_fundamental_next (), "FooCollection3", 
&g_define_type_info, &g_define_type_fundamental_info, 0);
+       return foo_collection3_type_id;
+}
+
+GType
+foo_collection3_get_type (void)
+{
+       static volatile gsize foo_collection3_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_collection3_type_id__volatile)) {
+               GType foo_collection3_type_id;
+               foo_collection3_type_id = foo_collection3_get_type_once ();
+               g_once_init_leave (&foo_collection3_type_id__volatile, foo_collection3_type_id);
+       }
+       return foo_collection3_type_id__volatile;
+}
+
+gpointer
+foo_collection3_ref (gpointer instance)
+{
+       FooCollection3 * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_collection3_unref (gpointer instance)
+{
+       FooCollection3 * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_COLLECTION3_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static inline gpointer
+foo_entry4_get_instance_private (FooEntry4* self)
+{
+       return G_STRUCT_MEMBER_P (self, FooEntry4_private_offset);
+}
+
+FooEntry4*
+foo_entry4_construct (GType object_type,
+                      GType k_type,
+                      GBoxedCopyFunc k_dup_func,
+                      GDestroyNotify k_destroy_func,
+                      GType v_type,
+                      GBoxedCopyFunc v_dup_func,
+                      GDestroyNotify v_destroy_func,
+                      gconstpointer _key,
+                      gconstpointer _value)
+{
+       FooEntry4* self = NULL;
+       self = (FooEntry4*) g_type_create_instance (object_type);
+       self->priv->k_type = k_type;
+       self->priv->k_dup_func = k_dup_func;
+       self->priv->k_destroy_func = k_destroy_func;
+       self->priv->v_type = v_type;
+       self->priv->v_dup_func = v_dup_func;
+       self->priv->v_destroy_func = v_destroy_func;
+       foo_entry4_set_key (self, _key);
+       foo_entry4_set_value (self, _value);
+       return self;
+}
+
+FooEntry4*
+foo_entry4_new (GType k_type,
+                GBoxedCopyFunc k_dup_func,
+                GDestroyNotify k_destroy_func,
+                GType v_type,
+                GBoxedCopyFunc v_dup_func,
+                GDestroyNotify v_destroy_func,
+                gconstpointer _key,
+                gconstpointer _value)
+{
+       return foo_entry4_construct (TYPE_FOO_ENTRY4, k_type, k_dup_func, k_destroy_func, v_type, v_dup_func, 
v_destroy_func, _key, _value);
+}
+
+gconstpointer
+foo_entry4_get_key (FooEntry4* self)
+{
+       gconstpointer result;
+       gconstpointer _tmp0_;
+       g_return_val_if_fail (IS_FOO_ENTRY4 (self), NULL);
+       _tmp0_ = self->priv->_key;
+       result = _tmp0_;
+       return result;
+}
+
+static void
+foo_entry4_set_key (FooEntry4* self,
+                    gconstpointer value)
+{
+       gpointer _tmp0_;
+       g_return_if_fail (IS_FOO_ENTRY4 (self));
+       _tmp0_ = ((value != NULL) && (self->priv->k_dup_func != NULL)) ? self->priv->k_dup_func ((gpointer) 
value) : ((gpointer) value);
+       ((self->priv->_key == NULL) || (self->priv->k_destroy_func == NULL)) ? NULL : (self->priv->_key = 
(self->priv->k_destroy_func (self->priv->_key), NULL));
+       self->priv->_key = _tmp0_;
+}
+
+gconstpointer
+foo_entry4_get_value (FooEntry4* self)
+{
+       gconstpointer result;
+       gconstpointer _tmp0_;
+       g_return_val_if_fail (IS_FOO_ENTRY4 (self), NULL);
+       _tmp0_ = self->priv->_value;
+       result = _tmp0_;
+       return result;
+}
+
+static void
+foo_entry4_set_value (FooEntry4* self,
+                      gconstpointer value)
+{
+       gpointer _tmp0_;
+       g_return_if_fail (IS_FOO_ENTRY4 (self));
+       _tmp0_ = ((value != NULL) && (self->priv->v_dup_func != NULL)) ? self->priv->v_dup_func ((gpointer) 
value) : ((gpointer) value);
+       ((self->priv->_value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (self->priv->_value = 
(self->priv->v_destroy_func (self->priv->_value), NULL));
+       self->priv->_value = _tmp0_;
+}
+
+static void
+value_foo_entry4_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_entry4_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_entry4_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_entry4_copy_value (const GValue* src_value,
+                             GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_entry4_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_entry4_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_entry4_collect_value (GValue* value,
+                                guint n_collect_values,
+                                GTypeCValue* collect_values,
+                                guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               FooEntry4 * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_entry4_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_entry4_lcopy_value (const GValue* value,
+                              guint n_collect_values,
+                              GTypeCValue* collect_values,
+                              guint collect_flags)
+{
+       FooEntry4 ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_entry4_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo_entry4 (const gchar* name,
+                       const gchar* nick,
+                       const gchar* blurb,
+                       GType object_type,
+                       GParamFlags flags)
+{
+       ParamSpecFooEntry4* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO_ENTRY4), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo_entry4 (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO_ENTRY4), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo_entry4 (GValue* value,
+                      gpointer v_object)
+{
+       FooEntry4 * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO_ENTRY4));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO_ENTRY4));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_entry4_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_entry4_unref (old);
+       }
+}
+
+void
+value_take_foo_entry4 (GValue* value,
+                       gpointer v_object)
+{
+       FooEntry4 * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO_ENTRY4));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO_ENTRY4));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_entry4_unref (old);
+       }
+}
+
+static void
+foo_entry4_class_init (FooEntry4Class * klass,
+                       gpointer klass_data)
+{
+       foo_entry4_parent_class = g_type_class_peek_parent (klass);
+       ((FooEntry4Class *) klass)->finalize = foo_entry4_finalize;
+       g_type_class_adjust_private_offset (klass, &FooEntry4_private_offset);
+}
+
+static void
+foo_entry4_instance_init (FooEntry4 * self,
+                          gpointer klass)
+{
+       self->priv = foo_entry4_get_instance_private (self);
+       self->ref_count = 1;
+}
+
+static void
+foo_entry4_finalize (FooEntry4 * obj)
+{
+       FooEntry4 * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO_ENTRY4, FooEntry4);
+       g_signal_handlers_destroy (self);
+       ((self->priv->_key == NULL) || (self->priv->k_destroy_func == NULL)) ? NULL : (self->priv->_key = 
(self->priv->k_destroy_func (self->priv->_key), NULL));
+       ((self->priv->_value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (self->priv->_value = 
(self->priv->v_destroy_func (self->priv->_value), NULL));
+}
+
+static GType
+foo_entry4_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_entry4_init, 
value_foo_entry4_free_value, value_foo_entry4_copy_value, value_foo_entry4_peek_pointer, "p", 
value_foo_entry4_collect_value, "p", value_foo_entry4_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooEntry4Class), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_entry4_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(FooEntry4), 0, (GInstanceInitFunc) foo_entry4_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_entry4_type_id;
+       foo_entry4_type_id = g_type_register_fundamental (g_type_fundamental_next (), "FooEntry4", 
&g_define_type_info, &g_define_type_fundamental_info, 0);
+       FooEntry4_private_offset = g_type_add_instance_private (foo_entry4_type_id, sizeof 
(FooEntry4Private));
+       return foo_entry4_type_id;
+}
+
+GType
+foo_entry4_get_type (void)
+{
+       static volatile gsize foo_entry4_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_entry4_type_id__volatile)) {
+               GType foo_entry4_type_id;
+               foo_entry4_type_id = foo_entry4_get_type_once ();
+               g_once_init_leave (&foo_entry4_type_id__volatile, foo_entry4_type_id);
+       }
+       return foo_entry4_type_id__volatile;
+}
+
+gpointer
+foo_entry4_ref (gpointer instance)
+{
+       FooEntry4 * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_entry4_unref (gpointer instance)
+{
+       FooEntry4 * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_ENTRY4_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static inline gpointer
+foo_iterator4_get_instance_private (FooIterator4* self)
+{
+       return G_STRUCT_MEMBER_P (self, FooIterator4_private_offset);
+}
+
+gboolean
+foo_iterator4_next (FooIterator4* self)
+{
+       gboolean result = FALSE;
+       g_return_val_if_fail (IS_FOO_ITERATOR4 (self), FALSE);
+       result = !self->priv->called;
+       return result;
+}
+
+gpointer
+foo_iterator4_get (FooIterator4* self)
+{
+       Foo* _tmp0_;
+       FooEntry4* _tmp1_;
+       gpointer result = NULL;
+       g_return_val_if_fail (IS_FOO_ITERATOR4 (self), NULL);
+       _vala_assert (!self->priv->called, "!called");
+       self->priv->called = TRUE;
+       _tmp0_ = foo_instance;
+       _tmp1_ = foo_entry4_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, TYPE_FOO, 
(GBoxedCopyFunc) foo_ref, (GDestroyNotify) foo_unref, "foo", _tmp0_);
+       result = _tmp1_;
+       return result;
+}
+
+FooIterator4*
+foo_iterator4_construct (GType object_type,
+                         GType g_type,
+                         GBoxedCopyFunc g_dup_func,
+                         GDestroyNotify g_destroy_func)
+{
+       FooIterator4* self = NULL;
+       self = (FooIterator4*) g_type_create_instance (object_type);
+       self->priv->g_type = g_type;
+       self->priv->g_dup_func = g_dup_func;
+       self->priv->g_destroy_func = g_destroy_func;
+       return self;
+}
+
+FooIterator4*
+foo_iterator4_new (GType g_type,
+                   GBoxedCopyFunc g_dup_func,
+                   GDestroyNotify g_destroy_func)
+{
+       return foo_iterator4_construct (TYPE_FOO_ITERATOR4, g_type, g_dup_func, g_destroy_func);
+}
+
+static void
+value_foo_iterator4_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_iterator4_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_iterator4_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_iterator4_copy_value (const GValue* src_value,
+                                GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_iterator4_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_iterator4_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_iterator4_collect_value (GValue* value,
+                                   guint n_collect_values,
+                                   GTypeCValue* collect_values,
+                                   guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               FooIterator4 * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_iterator4_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_iterator4_lcopy_value (const GValue* value,
+                                 guint n_collect_values,
+                                 GTypeCValue* collect_values,
+                                 guint collect_flags)
+{
+       FooIterator4 ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_iterator4_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo_iterator4 (const gchar* name,
+                          const gchar* nick,
+                          const gchar* blurb,
+                          GType object_type,
+                          GParamFlags flags)
+{
+       ParamSpecFooIterator4* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO_ITERATOR4), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo_iterator4 (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO_ITERATOR4), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo_iterator4 (GValue* value,
+                         gpointer v_object)
+{
+       FooIterator4 * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO_ITERATOR4));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO_ITERATOR4));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_iterator4_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_iterator4_unref (old);
+       }
+}
+
+void
+value_take_foo_iterator4 (GValue* value,
+                          gpointer v_object)
+{
+       FooIterator4 * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO_ITERATOR4));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO_ITERATOR4));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_iterator4_unref (old);
+       }
+}
+
+static void
+foo_iterator4_class_init (FooIterator4Class * klass,
+                          gpointer klass_data)
+{
+       foo_iterator4_parent_class = g_type_class_peek_parent (klass);
+       ((FooIterator4Class *) klass)->finalize = foo_iterator4_finalize;
+       g_type_class_adjust_private_offset (klass, &FooIterator4_private_offset);
+}
+
+static void
+foo_iterator4_instance_init (FooIterator4 * self,
+                             gpointer klass)
+{
+       self->priv = foo_iterator4_get_instance_private (self);
+       self->priv->called = FALSE;
+       self->ref_count = 1;
+}
+
+static void
+foo_iterator4_finalize (FooIterator4 * obj)
+{
+       FooIterator4 * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO_ITERATOR4, FooIterator4);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_iterator4_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_iterator4_init, 
value_foo_iterator4_free_value, value_foo_iterator4_copy_value, value_foo_iterator4_peek_pointer, "p", 
value_foo_iterator4_collect_value, "p", value_foo_iterator4_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooIterator4Class), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_iterator4_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(FooIterator4), 0, (GInstanceInitFunc) foo_iterator4_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_iterator4_type_id;
+       foo_iterator4_type_id = g_type_register_fundamental (g_type_fundamental_next (), "FooIterator4", 
&g_define_type_info, &g_define_type_fundamental_info, 0);
+       FooIterator4_private_offset = g_type_add_instance_private (foo_iterator4_type_id, sizeof 
(FooIterator4Private));
+       return foo_iterator4_type_id;
+}
+
+GType
+foo_iterator4_get_type (void)
+{
+       static volatile gsize foo_iterator4_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_iterator4_type_id__volatile)) {
+               GType foo_iterator4_type_id;
+               foo_iterator4_type_id = foo_iterator4_get_type_once ();
+               g_once_init_leave (&foo_iterator4_type_id__volatile, foo_iterator4_type_id);
+       }
+       return foo_iterator4_type_id__volatile;
+}
+
+gpointer
+foo_iterator4_ref (gpointer instance)
+{
+       FooIterator4 * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_iterator4_unref (gpointer instance)
+{
+       FooIterator4 * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_ITERATOR4_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static inline gpointer
+foo_collection4_get_instance_private (FooCollection4* self)
+{
+       return G_STRUCT_MEMBER_P (self, FooCollection4_private_offset);
+}
+
+gpointer
+foo_collection4_get (FooCollection4* self,
+                     gconstpointer key)
+{
+       Foo* _tmp0_;
+       gpointer _tmp1_;
+       gpointer result = NULL;
+       g_return_val_if_fail (IS_FOO_COLLECTION4 (self), NULL);
+       _vala_assert (g_strcmp0 (key, "foo") == 0, "key == \"foo\"");
+       _tmp0_ = foo_instance;
+       _tmp1_ = ((_tmp0_ != NULL) && (self->priv->v_dup_func != NULL)) ? self->priv->v_dup_func ((gpointer) 
_tmp0_) : ((gpointer) _tmp0_);
+       result = _tmp1_;
+       return result;
+}
+
+FooIterator4*
+foo_collection4_iterator (FooCollection4* self)
+{
+       FooIterator4* _tmp0_;
+       FooIterator4* result = NULL;
+       g_return_val_if_fail (IS_FOO_COLLECTION4 (self), NULL);
+       _tmp0_ = foo_iterator4_new (TYPE_FOO_ENTRY4, (GBoxedCopyFunc) foo_entry4_ref, (GDestroyNotify) 
foo_entry4_unref);
+       result = _tmp0_;
+       return result;
+}
+
+FooCollection4*
+foo_collection4_construct (GType object_type,
+                           GType k_type,
+                           GBoxedCopyFunc k_dup_func,
+                           GDestroyNotify k_destroy_func,
+                           GType v_type,
+                           GBoxedCopyFunc v_dup_func,
+                           GDestroyNotify v_destroy_func)
+{
+       FooCollection4* self = NULL;
+       self = (FooCollection4*) g_type_create_instance (object_type);
+       self->priv->k_type = k_type;
+       self->priv->k_dup_func = k_dup_func;
+       self->priv->k_destroy_func = k_destroy_func;
+       self->priv->v_type = v_type;
+       self->priv->v_dup_func = v_dup_func;
+       self->priv->v_destroy_func = v_destroy_func;
+       return self;
+}
+
+FooCollection4*
+foo_collection4_new (GType k_type,
+                     GBoxedCopyFunc k_dup_func,
+                     GDestroyNotify k_destroy_func,
+                     GType v_type,
+                     GBoxedCopyFunc v_dup_func,
+                     GDestroyNotify v_destroy_func)
+{
+       return foo_collection4_construct (TYPE_FOO_COLLECTION4, k_type, k_dup_func, k_destroy_func, v_type, 
v_dup_func, v_destroy_func);
+}
+
+gint
+foo_collection4_get_size (FooCollection4* self)
+{
+       gint result;
+       g_return_val_if_fail (IS_FOO_COLLECTION4 (self), 0);
+       result = 1;
+       return result;
+}
+
+static void
+value_foo_collection4_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_collection4_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_collection4_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_collection4_copy_value (const GValue* src_value,
+                                  GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_collection4_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_collection4_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collection4_collect_value (GValue* value,
+                                     guint n_collect_values,
+                                     GTypeCValue* collect_values,
+                                     guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               FooCollection4 * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_collection4_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_collection4_lcopy_value (const GValue* value,
+                                   guint n_collect_values,
+                                   GTypeCValue* collect_values,
+                                   guint collect_flags)
+{
+       FooCollection4 ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_collection4_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo_collection4 (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags)
+{
+       ParamSpecFooCollection4* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO_COLLECTION4), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo_collection4 (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO_COLLECTION4), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo_collection4 (GValue* value,
+                           gpointer v_object)
+{
+       FooCollection4 * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO_COLLECTION4));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO_COLLECTION4));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_collection4_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_collection4_unref (old);
+       }
+}
+
+void
+value_take_foo_collection4 (GValue* value,
+                            gpointer v_object)
+{
+       FooCollection4 * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO_COLLECTION4));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO_COLLECTION4));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_collection4_unref (old);
+       }
+}
+
+static void
+foo_collection4_class_init (FooCollection4Class * klass,
+                            gpointer klass_data)
+{
+       foo_collection4_parent_class = g_type_class_peek_parent (klass);
+       ((FooCollection4Class *) klass)->finalize = foo_collection4_finalize;
+       g_type_class_adjust_private_offset (klass, &FooCollection4_private_offset);
+}
+
+static void
+foo_collection4_instance_init (FooCollection4 * self,
+                               gpointer klass)
+{
+       self->priv = foo_collection4_get_instance_private (self);
+       self->ref_count = 1;
+}
+
+static void
+foo_collection4_finalize (FooCollection4 * obj)
+{
+       FooCollection4 * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO_COLLECTION4, FooCollection4);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_collection4_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_collection4_init, 
value_foo_collection4_free_value, value_foo_collection4_copy_value, value_foo_collection4_peek_pointer, "p", 
value_foo_collection4_collect_value, "p", value_foo_collection4_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooCollection4Class), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_collection4_class_init, (GClassFinalizeFunc) NULL, NULL, 
sizeof (FooCollection4), 0, (GInstanceInitFunc) foo_collection4_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_collection4_type_id;
+       foo_collection4_type_id = g_type_register_fundamental (g_type_fundamental_next (), "FooCollection4", 
&g_define_type_info, &g_define_type_fundamental_info, 0);
+       FooCollection4_private_offset = g_type_add_instance_private (foo_collection4_type_id, sizeof 
(FooCollection4Private));
+       return foo_collection4_type_id;
+}
+
+GType
+foo_collection4_get_type (void)
+{
+       static volatile gsize foo_collection4_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_collection4_type_id__volatile)) {
+               GType foo_collection4_type_id;
+               foo_collection4_type_id = foo_collection4_get_type_once ();
+               g_once_init_leave (&foo_collection4_type_id__volatile, foo_collection4_type_id);
+       }
+       return foo_collection4_type_id__volatile;
+}
+
+gpointer
+foo_collection4_ref (gpointer instance)
+{
+       FooCollection4 * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_collection4_unref (gpointer instance)
+{
+       FooCollection4 * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_COLLECTION4_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_foo_unref0_ (gpointer var)
+{
+       (var == NULL) ? NULL : (var = (foo_unref (var), NULL));
+}
+
+static inline void
+_g_slist_free__foo_unref0_ (GSList* self)
+{
+       g_slist_free_full (self, (GDestroyNotify) _foo_unref0_);
+}
+
+static inline void
+_g_list_free__foo_unref0_ (GList* self)
+{
+       g_list_free_full (self, (GDestroyNotify) _foo_unref0_);
+}
+
+static void
+_vala_main (void)
+{
+       Foo* _tmp0_;
+       FooCollection* collection = NULL;
+       FooCollection* _tmp1_;
+       FooCollection2* collection2 = NULL;
+       FooCollection2* _tmp9_;
+       FooCollection3* collection3 = NULL;
+       FooCollection3* _tmp17_;
+       FooCollection4* collection4 = NULL;
+       FooCollection4* _tmp28_;
+       FooCollection4* _tmp41_;
+       gpointer _tmp42_;
+       Foo* _tmp43_;
+       Foo* _tmp44_;
+       GList* list = NULL;
+       Foo* _tmp45_;
+       Foo* _tmp46_;
+       GList* _tmp47_;
+       GSList* slist = NULL;
+       Foo* _tmp51_;
+       Foo* _tmp52_;
+       GSList* _tmp53_;
+       _tmp0_ = foo_new ();
+       _foo_unref0 (foo_instance);
+       foo_instance = _tmp0_;
+       _tmp1_ = foo_collection_new ();
+       collection = _tmp1_;
+       {
+               FooIterator* _foo_it = NULL;
+               FooCollection* _tmp2_;
+               FooIterator* _tmp3_;
+               _tmp2_ = collection;
+               _tmp3_ = foo_collection_iterator (_tmp2_);
+               _foo_it = _tmp3_;
+               while (TRUE) {
+                       FooIterator* _tmp4_;
+                       Foo* foo = NULL;
+                       FooIterator* _tmp5_;
+                       Foo* _tmp6_;
+                       Foo* _tmp7_;
+                       Foo* _tmp8_;
+                       _tmp4_ = _foo_it;
+                       if (!foo_iterator_next (_tmp4_)) {
+                               break;
+                       }
+                       _tmp5_ = _foo_it;
+                       _tmp6_ = foo_iterator_get (_tmp5_);
+                       foo = _tmp6_;
+                       _tmp7_ = foo;
+                       _tmp8_ = foo_instance;
+                       _vala_assert (_tmp7_ == _tmp8_, "foo == foo_instance");
+                       _foo_unref0 (foo);
+               }
+               _foo_iterator_unref0 (_foo_it);
+       }
+       _tmp9_ = foo_collection2_new ();
+       collection2 = _tmp9_;
+       {
+               FooIterator2* _foo2_it = NULL;
+               FooCollection2* _tmp10_;
+               FooIterator2* _tmp11_;
+               Foo* foo2 = NULL;
+               _tmp10_ = collection2;
+               _tmp11_ = foo_collection2_iterator (_tmp10_);
+               _foo2_it = _tmp11_;
+               while (TRUE) {
+                       FooIterator2* _tmp12_;
+                       Foo* _tmp13_;
+                       Foo* _tmp14_;
+                       Foo* _tmp15_;
+                       Foo* _tmp16_;
+                       _tmp12_ = _foo2_it;
+                       _tmp13_ = foo_iterator2_next_value (_tmp12_);
+                       _foo_unref0 (foo2);
+                       foo2 = _tmp13_;
+                       _tmp14_ = foo2;
+                       if (!(_tmp14_ != NULL)) {
+                               break;
+                       }
+                       _tmp15_ = foo2;
+                       _tmp16_ = foo_instance;
+                       _vala_assert (_tmp15_ == _tmp16_, "foo2 == foo_instance");
+               }
+               _foo_unref0 (foo2);
+               _foo_iterator2_unref0 (_foo2_it);
+       }
+       _tmp17_ = foo_collection3_new ();
+       collection3 = _tmp17_;
+       {
+               FooCollection3* _foo3_list = NULL;
+               FooCollection3* _tmp18_;
+               gint _foo3_size = 0;
+               FooCollection3* _tmp19_;
+               gint _tmp20_;
+               gint _tmp21_;
+               gint _foo3_index = 0;
+               _tmp18_ = collection3;
+               _foo3_list = _tmp18_;
+               _tmp19_ = _foo3_list;
+               _tmp20_ = foo_collection3_get_size (_tmp19_);
+               _tmp21_ = _tmp20_;
+               _foo3_size = _tmp21_;
+               _foo3_index = -1;
+               while (TRUE) {
+                       gint _tmp22_;
+                       gint _tmp23_;
+                       Foo* foo3 = NULL;
+                       FooCollection3* _tmp24_;
+                       Foo* _tmp25_;
+                       Foo* _tmp26_;
+                       Foo* _tmp27_;
+                       _foo3_index = _foo3_index + 1;
+                       _tmp22_ = _foo3_index;
+                       _tmp23_ = _foo3_size;
+                       if (!(_tmp22_ < _tmp23_)) {
+                               break;
+                       }
+                       _tmp24_ = _foo3_list;
+                       _tmp25_ = foo_collection3_get (_tmp24_, _foo3_index);
+                       foo3 = _tmp25_;
+                       _tmp26_ = foo3;
+                       _tmp27_ = foo_instance;
+                       _vala_assert (_tmp26_ == _tmp27_, "foo3 == foo_instance");
+                       _foo_unref0 (foo3);
+               }
+       }
+       _tmp28_ = foo_collection4_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, 
TYPE_FOO, (GBoxedCopyFunc) foo_ref, (GDestroyNotify) foo_unref);
+       collection4 = _tmp28_;
+       {
+               FooIterator4* _fooentry4_it = NULL;
+               FooCollection4* _tmp29_;
+               FooIterator4* _tmp30_;
+               _tmp29_ = collection4;
+               _tmp30_ = foo_collection4_iterator (_tmp29_);
+               _fooentry4_it = _tmp30_;
+               while (TRUE) {
+                       FooIterator4* _tmp31_;
+                       FooEntry4* fooentry4 = NULL;
+                       FooIterator4* _tmp32_;
+                       gpointer _tmp33_;
+                       FooEntry4* _tmp34_;
+                       gconstpointer _tmp35_;
+                       gconstpointer _tmp36_;
+                       FooEntry4* _tmp37_;
+                       gconstpointer _tmp38_;
+                       gconstpointer _tmp39_;
+                       Foo* _tmp40_;
+                       _tmp31_ = _fooentry4_it;
+                       if (!foo_iterator4_next (_tmp31_)) {
+                               break;
+                       }
+                       _tmp32_ = _fooentry4_it;
+                       _tmp33_ = foo_iterator4_get (_tmp32_);
+                       fooentry4 = (FooEntry4*) _tmp33_;
+                       _tmp34_ = fooentry4;
+                       _tmp35_ = foo_entry4_get_key (_tmp34_);
+                       _tmp36_ = _tmp35_;
+                       _vala_assert (g_strcmp0 ((const gchar*) _tmp36_, "foo") == 0, "fooentry4.key == 
\"foo\"");
+                       _tmp37_ = fooentry4;
+                       _tmp38_ = foo_entry4_get_value (_tmp37_);
+                       _tmp39_ = _tmp38_;
+                       _tmp40_ = foo_instance;
+                       _vala_assert (((Foo*) _tmp39_) == _tmp40_, "fooentry4.value == foo_instance");
+                       _foo_entry4_unref0 (fooentry4);
+               }
+               _foo_iterator4_unref0 (_fooentry4_it);
+       }
+       _tmp41_ = collection4;
+       _tmp42_ = foo_collection4_get (_tmp41_, "foo");
+       _tmp43_ = (Foo*) _tmp42_;
+       _tmp44_ = foo_instance;
+       _vala_assert (_tmp43_ == _tmp44_, "collection4[\"foo\"] == foo_instance");
+       _foo_unref0 (_tmp43_);
+       list = NULL;
+       _tmp45_ = foo_instance;
+       _tmp46_ = _foo_ref0 (_tmp45_);
+       list = g_list_append (list, _tmp46_);
+       _tmp47_ = list;
+       {
+               GList* e_collection = NULL;
+               GList* e_it = NULL;
+               e_collection = _tmp47_;
+               for (e_it = e_collection; e_it != NULL; e_it = e_it->next) {
+                       Foo* _tmp48_;
+                       Foo* e = NULL;
+                       _tmp48_ = _foo_ref0 ((Foo*) e_it->data);
+                       e = _tmp48_;
+                       {
+                               Foo* _tmp49_;
+                               Foo* _tmp50_;
+                               _tmp49_ = e;
+                               _tmp50_ = foo_instance;
+                               _vala_assert (_tmp49_ == _tmp50_, "e == foo_instance");
+                               _foo_unref0 (e);
+                       }
+               }
+       }
+       slist = NULL;
+       _tmp51_ = foo_instance;
+       _tmp52_ = _foo_ref0 (_tmp51_);
+       slist = g_slist_append (slist, _tmp52_);
+       _tmp53_ = slist;
+       {
+               GSList* e_collection = NULL;
+               GSList* e_it = NULL;
+               e_collection = _tmp53_;
+               for (e_it = e_collection; e_it != NULL; e_it = e_it->next) {
+                       Foo* _tmp54_;
+                       Foo* e = NULL;
+                       _tmp54_ = _foo_ref0 ((Foo*) e_it->data);
+                       e = _tmp54_;
+                       {
+                               Foo* _tmp55_;
+                               Foo* _tmp56_;
+                               _tmp55_ = e;
+                               _tmp56_ = foo_instance;
+                               _vala_assert (_tmp55_ == _tmp56_, "e == foo_instance");
+                               _foo_unref0 (e);
+                       }
+               }
+       }
+       (slist == NULL) ? NULL : (slist = (_g_slist_free__foo_unref0_ (slist), NULL));
+       (list == NULL) ? NULL : (list = (_g_list_free__foo_unref0_ (list), NULL));
+       _foo_collection4_unref0 (collection4);
+       _foo_collection3_unref0 (collection3);
+       _foo_collection2_unref0 (collection2);
+       _foo_collection_unref0 (collection);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/lambda.c-expected b/tests/methods/lambda.c-expected
new file mode 100644
index 000000000..fad928709
--- /dev/null
+++ b/tests/methods/lambda.c-expected
@@ -0,0 +1,227 @@
+/* methods_lambda.c generated by valac, the Vala compiler
+ * generated from methods_lambda.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef gint (*MamanActionCallback) (gint i);
+typedef void (*MamanActionOutCallback) (gint* i);
+typedef void (*MamanActionRefCallback) (gint* i);
+
+#define MAMAN_TYPE_BAR (maman_bar_get_type ())
+#define MAMAN_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_BAR, MamanBar))
+#define MAMAN_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAMAN_TYPE_BAR, MamanBarClass))
+#define MAMAN_IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_BAR))
+#define MAMAN_IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAMAN_TYPE_BAR))
+#define MAMAN_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAMAN_TYPE_BAR, MamanBarClass))
+
+typedef struct _MamanBar MamanBar;
+typedef struct _MamanBarClass MamanBarClass;
+typedef struct _MamanBarPrivate MamanBarPrivate;
+enum  {
+       MAMAN_BAR_0_PROPERTY,
+       MAMAN_BAR_NUM_PROPERTIES
+};
+static GParamSpec* maman_bar_properties[MAMAN_BAR_NUM_PROPERTIES];
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _MamanBar {
+       GObject parent_instance;
+       MamanBarPrivate * priv;
+};
+
+struct _MamanBarClass {
+       GObjectClass parent_class;
+};
+
+static gpointer maman_bar_parent_class = NULL;
+
+VALA_EXTERN GType maman_bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MamanBar, g_object_unref)
+static gint maman_bar_do_action (MamanActionCallback cb);
+static gint maman_bar_do_out_action (MamanActionOutCallback cb);
+static gint maman_bar_do_ref_action (MamanActionRefCallback cb);
+static gint maman_bar_main (void);
+static gint __lambda4_ (gint i);
+static gint ___lambda4__maman_action_callback (gint i);
+static gint __lambda5_ (gint i);
+static gint ___lambda5__maman_action_callback (gint i);
+static void __lambda6_ (gint* i);
+static void ___lambda6__maman_action_out_callback (gint* i);
+static void __lambda7_ (gint* i);
+static void ___lambda7__maman_action_ref_callback (gint* i);
+VALA_EXTERN MamanBar* maman_bar_new (void);
+VALA_EXTERN MamanBar* maman_bar_construct (GType object_type);
+static GType maman_bar_get_type_once (void);
+
+static gint
+maman_bar_do_action (MamanActionCallback cb)
+{
+       gint result = 0;
+       result = cb (1);
+       return result;
+}
+
+static gint
+maman_bar_do_out_action (MamanActionOutCallback cb)
+{
+       gint i = 0;
+       gint _tmp0_ = 0;
+       gint result = 0;
+       cb (&_tmp0_);
+       i = _tmp0_;
+       result = i;
+       return result;
+}
+
+static gint
+maman_bar_do_ref_action (MamanActionRefCallback cb)
+{
+       gint i = 0;
+       gint result = 0;
+       i = 1;
+       cb (&i);
+       result = i;
+       return result;
+}
+
+static gint
+__lambda4_ (gint i)
+{
+       gint result = 0;
+       result = i * 2;
+       return result;
+}
+
+static gint
+___lambda4__maman_action_callback (gint i)
+{
+       gint result;
+       result = __lambda4_ (i);
+       return result;
+}
+
+static gint
+__lambda5_ (gint i)
+{
+       gint result = 0;
+       result = i * 3;
+       return result;
+}
+
+static gint
+___lambda5__maman_action_callback (gint i)
+{
+       gint result;
+       result = __lambda5_ (i);
+       return result;
+}
+
+static void
+__lambda6_ (gint* i)
+{
+       gint _vala_i = 0;
+       _vala_i = 4;
+       if (i) {
+               *i = _vala_i;
+       }
+}
+
+static void
+___lambda6__maman_action_out_callback (gint* i)
+{
+       __lambda6_ (i);
+}
+
+static void
+__lambda7_ (gint* i)
+{
+       *i = (*i) + 4;
+}
+
+static void
+___lambda7__maman_action_ref_callback (gint* i)
+{
+       __lambda7_ (i);
+}
+
+static gint
+maman_bar_main (void)
+{
+       gint result = 0;
+       _vala_assert (maman_bar_do_action (___lambda4__maman_action_callback) == 2, "do_action (i => i * 2) 
== 2");
+       _vala_assert (maman_bar_do_action (___lambda5__maman_action_callback) == 3, "do_action (i => { return 
i * 3; }) == 3");
+       _vala_assert (maman_bar_do_out_action (___lambda6__maman_action_out_callback) == 4, "do_out_action 
((out i) => { i = 4; }) == 4");
+       _vala_assert (maman_bar_do_ref_action (___lambda7__maman_action_ref_callback) == 5, "do_ref_action 
((ref i) => { i += 4; }) == 5");
+       result = 0;
+       return result;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       return maman_bar_main ();
+}
+
+MamanBar*
+maman_bar_construct (GType object_type)
+{
+       MamanBar * self = NULL;
+       self = (MamanBar*) g_object_new (object_type, NULL);
+       return self;
+}
+
+MamanBar*
+maman_bar_new (void)
+{
+       return maman_bar_construct (MAMAN_TYPE_BAR);
+}
+
+static void
+maman_bar_class_init (MamanBarClass * klass,
+                      gpointer klass_data)
+{
+       maman_bar_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+maman_bar_instance_init (MamanBar * self,
+                         gpointer klass)
+{
+}
+
+static GType
+maman_bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (MamanBarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(MamanBar), 0, (GInstanceInitFunc) maman_bar_instance_init, NULL };
+       GType maman_bar_type_id;
+       maman_bar_type_id = g_type_register_static (G_TYPE_OBJECT, "MamanBar", &g_define_type_info, 0);
+       return maman_bar_type_id;
+}
+
+GType
+maman_bar_get_type (void)
+{
+       static volatile gsize maman_bar_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_bar_type_id__volatile)) {
+               GType maman_bar_type_id;
+               maman_bar_type_id = maman_bar_get_type_once ();
+               g_once_init_leave (&maman_bar_type_id__volatile, maman_bar_type_id);
+       }
+       return maman_bar_type_id__volatile;
+}
+
diff --git a/tests/methods/nowrapper-interface.c-expected b/tests/methods/nowrapper-interface.c-expected
new file mode 100644
index 000000000..a3ba046f3
--- /dev/null
+++ b/tests/methods/nowrapper-interface.c-expected
@@ -0,0 +1,187 @@
+/* methods_nowrapper_interface.c generated by valac, the Vala compiler
+ * generated from methods_nowrapper_interface.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_IFOO (ifoo_get_type ())
+#define IFOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IFOO, IFoo))
+#define IS_IFOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IFOO))
+#define IFOO_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_IFOO, IFooIface))
+
+typedef struct _IFoo IFoo;
+typedef struct _IFooIface IFooIface;
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _IFooIface {
+       GTypeInterface parent_iface;
+       gint (*bar) (IFoo* self);
+};
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+static gpointer foo_parent_class = NULL;
+static IFooIface * foo_ifoo_parent_iface = NULL;
+
+VALA_EXTERN GType ifoo_get_type (void) G_GNUC_CONST ;
+static GType ifoo_get_type_once (void);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+static gint foo_real_bar (IFoo* base);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+static void
+ifoo_default_init (IFooIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+ifoo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (IFooIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) ifoo_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType ifoo_type_id;
+       ifoo_type_id = g_type_register_static (G_TYPE_INTERFACE, "IFoo", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (ifoo_type_id, G_TYPE_OBJECT);
+       return ifoo_type_id;
+}
+
+GType
+ifoo_get_type (void)
+{
+       static volatile gsize ifoo_type_id__volatile = 0;
+       if (g_once_init_enter (&ifoo_type_id__volatile)) {
+               GType ifoo_type_id;
+               ifoo_type_id = ifoo_get_type_once ();
+               g_once_init_leave (&ifoo_type_id__volatile, ifoo_type_id);
+       }
+       return ifoo_type_id__volatile;
+}
+
+static gint
+foo_real_bar (IFoo* base)
+{
+       Foo * self;
+       gint result = 0;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_FOO, Foo);
+       result = 42;
+       return result;
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+foo_ifoo_interface_init (IFooIface * iface,
+                         gpointer iface_data)
+{
+       foo_ifoo_parent_iface = g_type_interface_peek_parent (iface);
+       iface->bar = (gint (*) (IFoo*)) foo_real_bar;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       static const GInterfaceInfo ifoo_info = { (GInterfaceInitFunc) foo_ifoo_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       g_type_add_interface_static (foo_type_id, TYPE_IFOO, &ifoo_info);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       _vala_assert (IFOO_GET_INTERFACE (G_TYPE_CHECK_INSTANCE_CAST (foo, TYPE_IFOO, IFoo))->bar 
(G_TYPE_CHECK_INSTANCE_CAST (foo, TYPE_IFOO, IFoo)) == 42, "foo.bar () == 42");
+       _g_object_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/parameter-fixed-array-initializer.c-expected 
b/tests/methods/parameter-fixed-array-initializer.c-expected
new file mode 100644
index 000000000..8e36be8dc
--- /dev/null
+++ b/tests/methods/parameter-fixed-array-initializer.c-expected
@@ -0,0 +1,126 @@
+/* methods_parameter_fixed_array_initializer.c generated by valac, the Vala compiler
+ * generated from methods_parameter_fixed_array_initializer.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <float.h>
+#include <math.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_BAR (bar_get_type ())
+typedef struct _Bar Bar;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Bar {
+       gint i;
+       gdouble d;
+};
+
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Bar* bar_dup (const Bar* self);
+VALA_EXTERN void bar_free (Bar* self);
+VALA_EXTERN void foo (gint* a);
+VALA_EXTERN void bar (Bar* b);
+static void _vala_main (void);
+
+Bar*
+bar_dup (const Bar* self)
+{
+       Bar* dup;
+       dup = g_new0 (Bar, 1);
+       memcpy (dup, self, sizeof (Bar));
+       return dup;
+}
+
+void
+bar_free (Bar* self)
+{
+       g_free (self);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       GType bar_type_id;
+       bar_type_id = g_boxed_type_register_static ("Bar", (GBoxedCopyFunc) bar_dup, (GBoxedFreeFunc) 
bar_free);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+void
+foo (gint* a)
+{
+       gint _tmp0_;
+       _tmp0_ = a[2];
+       _vala_assert (_tmp0_ == 4711, "a[2] == 4711");
+}
+
+void
+bar (Bar* b)
+{
+       Bar _tmp0_;
+       Bar _tmp1_;
+       _tmp0_ = b[2];
+       _vala_assert (_tmp0_.i == 23, "b[2].i == 23");
+       _tmp1_ = b[2];
+       _vala_assert (_tmp1_.d == 47.11, "b[2].d == 47.11");
+}
+
+static void
+_vala_main (void)
+{
+       gint _tmp0_[3] = {0};
+       Bar b = {0};
+       Bar _tmp1_ = {0};
+       Bar _tmp2_;
+       Bar _tmp3_;
+       Bar _tmp4_;
+       Bar _tmp5_[3] = {0};
+       _tmp0_[0] = 23;
+       _tmp0_[1] = 42;
+       _tmp0_[2] = 4711;
+       foo (_tmp0_);
+       _tmp1_.i = 23;
+       _tmp1_.d = 47.11;
+       b = _tmp1_;
+       _tmp2_ = b;
+       _tmp3_ = b;
+       _tmp4_ = b;
+       _tmp5_[0] = _tmp2_;
+       _tmp5_[1] = _tmp3_;
+       _tmp5_[2] = _tmp4_;
+       bar (_tmp5_);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/parameter-out-free-on-error.c-expected 
b/tests/methods/parameter-out-free-on-error.c-expected
new file mode 100644
index 000000000..d4b813bbd
--- /dev/null
+++ b/tests/methods/parameter-out-free-on-error.c-expected
@@ -0,0 +1,264 @@
+/* methods_parameter_out_free_on_error.c generated by valac, the Vala compiler
+ * generated from methods_parameter_out_free_on_error.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_MANAM (manam_get_type ())
+#define MANAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MANAM, Manam))
+#define MANAM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MANAM, ManamClass))
+#define IS_MANAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MANAM))
+#define IS_MANAM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MANAM))
+#define MANAM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MANAM, ManamClass))
+
+typedef struct _Manam Manam;
+typedef struct _ManamClass ManamClass;
+typedef struct _ManamPrivate ManamPrivate;
+enum  {
+       MANAM_0_PROPERTY,
+       MANAM_NUM_PROPERTIES
+};
+static GParamSpec* manam_properties[MANAM_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+typedef enum  {
+       FOO_ERROR_FAIL
+} FooError;
+#define FOO_ERROR foo_error_quark ()
+struct _Manam {
+       GObject parent_instance;
+       ManamPrivate * priv;
+};
+
+struct _ManamClass {
+       GObjectClass parent_class;
+};
+
+static gpointer manam_parent_class = NULL;
+
+VALA_EXTERN GQuark foo_error_quark (void);
+VALA_EXTERN GType manam_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Manam, g_object_unref)
+VALA_EXTERN Manam* manam_new (void);
+VALA_EXTERN Manam* manam_construct (GType object_type);
+static GType manam_get_type_once (void);
+VALA_EXTERN void foo (Manam* i,
+          Manam* * o,
+          GError** error);
+VALA_EXTERN void bar (Manam* i,
+          Manam* * o,
+          GError** error);
+static void _vala_main (void);
+
+GQuark
+foo_error_quark (void)
+{
+       return g_quark_from_static_string ("foo-error-quark");
+}
+
+Manam*
+manam_construct (GType object_type)
+{
+       Manam * self = NULL;
+       self = (Manam*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Manam*
+manam_new (void)
+{
+       return manam_construct (TYPE_MANAM);
+}
+
+static void
+manam_class_init (ManamClass * klass,
+                  gpointer klass_data)
+{
+       manam_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+manam_instance_init (Manam * self,
+                     gpointer klass)
+{
+}
+
+static GType
+manam_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (ManamClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) manam_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Manam), 
0, (GInstanceInitFunc) manam_instance_init, NULL };
+       GType manam_type_id;
+       manam_type_id = g_type_register_static (G_TYPE_OBJECT, "Manam", &g_define_type_info, 0);
+       return manam_type_id;
+}
+
+GType
+manam_get_type (void)
+{
+       static volatile gsize manam_type_id__volatile = 0;
+       if (g_once_init_enter (&manam_type_id__volatile)) {
+               GType manam_type_id;
+               manam_type_id = manam_get_type_once ();
+               g_once_init_leave (&manam_type_id__volatile, manam_type_id);
+       }
+       return manam_type_id__volatile;
+}
+
+static gpointer
+_g_object_ref0 (gpointer self)
+{
+       return self ? g_object_ref (self) : NULL;
+}
+
+void
+foo (Manam* i,
+     Manam* * o,
+     GError** error)
+{
+       Manam* _vala_o = NULL;
+       Manam* _tmp0_;
+       GError* _tmp1_;
+       GError* _inner_error0_ = NULL;
+       g_return_if_fail (IS_MANAM (i));
+       _tmp0_ = _g_object_ref0 (i);
+       _g_object_unref0 (_vala_o);
+       _vala_o = _tmp0_;
+       _tmp1_ = g_error_new_literal (FOO_ERROR, FOO_ERROR_FAIL, "foo");
+       _inner_error0_ = _tmp1_;
+       if (_inner_error0_->domain == FOO_ERROR) {
+               g_propagate_error (error, _inner_error0_);
+               _g_object_unref0 (_vala_o);
+               return;
+       } else {
+               _g_object_unref0 (_vala_o);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+}
+
+void
+bar (Manam* i,
+     Manam* * o,
+     GError** error)
+{
+       Manam* _vala_o = NULL;
+       GError* _tmp0_;
+       GError* _inner_error0_ = NULL;
+       g_return_if_fail (IS_MANAM (i));
+       _vala_o = i;
+       _tmp0_ = g_error_new_literal (FOO_ERROR, FOO_ERROR_FAIL, "bar");
+       _inner_error0_ = _tmp0_;
+       if (_inner_error0_->domain == FOO_ERROR) {
+               g_propagate_error (error, _inner_error0_);
+               return;
+       } else {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+}
+
+static void
+_vala_main (void)
+{
+       GError* _inner_error0_ = NULL;
+       {
+               Manam* manam = NULL;
+               Manam* _tmp0_;
+               _tmp0_ = manam_new ();
+               manam = _tmp0_;
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (manam, G_TYPE_OBJECT, GObject)->ref_count == 
((guint) 1), "manam.ref_count == 1");
+               {
+                       Manam* minim = NULL;
+                       Manam* _tmp1_ = NULL;
+                       foo (manam, &_tmp1_, &_inner_error0_);
+                       _g_object_unref0 (minim);
+                       minim = _tmp1_;
+                       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                               _g_object_unref0 (minim);
+                               if (_inner_error0_->domain == FOO_ERROR) {
+                                       goto __catch0_foo_error;
+                               }
+                               _g_object_unref0 (manam);
+                               g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, 
__LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                               g_clear_error (&_inner_error0_);
+                               return;
+                       }
+                       _g_object_unref0 (minim);
+               }
+               goto __finally0;
+               __catch0_foo_error:
+               {
+                       g_clear_error (&_inner_error0_);
+               }
+               __finally0:
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       _g_object_unref0 (manam);
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (manam, G_TYPE_OBJECT, GObject)->ref_count == 
((guint) 1), "manam.ref_count == 1");
+               _g_object_unref0 (manam);
+       }
+       {
+               Manam* manam = NULL;
+               Manam* _tmp2_;
+               _tmp2_ = manam_new ();
+               manam = _tmp2_;
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (manam, G_TYPE_OBJECT, GObject)->ref_count == 
((guint) 1), "manam.ref_count == 1");
+               {
+                       Manam* minim = NULL;
+                       Manam* _tmp3_ = NULL;
+                       bar (manam, &_tmp3_, &_inner_error0_);
+                       minim = _tmp3_;
+                       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                               if (_inner_error0_->domain == FOO_ERROR) {
+                                       goto __catch1_foo_error;
+                               }
+                               _g_object_unref0 (manam);
+                               g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, 
__LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                               g_clear_error (&_inner_error0_);
+                               return;
+                       }
+               }
+               goto __finally1;
+               __catch1_foo_error:
+               {
+                       g_clear_error (&_inner_error0_);
+               }
+               __finally1:
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       _g_object_unref0 (manam);
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (manam, G_TYPE_OBJECT, GObject)->ref_count == 
((guint) 1), "manam.ref_count == 1");
+               _g_object_unref0 (manam);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/parameter-ref-array-resize-captured.c-expected 
b/tests/methods/parameter-ref-array-resize-captured.c-expected
new file mode 100644
index 000000000..2b06a3a23
--- /dev/null
+++ b/tests/methods/parameter-ref-array-resize-captured.c-expected
@@ -0,0 +1,150 @@
+/* methods_parameter_ref_array_resize_captured.c generated by valac, the Vala compiler
+ * generated from methods_parameter_ref_array_resize_captured.vala, do not modify */
+
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef void (*FooFunc) (gpointer user_data);
+typedef struct _Block1Data Block1Data;
+
+struct _Block1Data {
+       int _ref_count_;
+       gint* a;
+       gint a_length1;
+       gint _a_size_;
+};
+
+VALA_EXTERN void foo (gint** a,
+          gint* a_length1);
+static void _vala_main (void);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static void __lambda4_ (Block1Data* _data1_);
+static void ___lambda4__foo_func (gpointer self);
+static void _vala_array_add1 (gint* * array,
+                       gint* length,
+                       gint* size,
+                       gint value);
+
+void
+foo (gint** a,
+     gint* a_length1)
+{
+       gint* _tmp0_;
+       _tmp0_ = g_new0 (gint, 1);
+       *a = (g_free (*a), NULL);
+       *a = _tmp0_;
+       *a_length1 = 1;
+}
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               _data1_->a = (g_free (_data1_->a), NULL);
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static void
+__lambda4_ (Block1Data* _data1_)
+{
+       foo (&_data1_->a, (gint*) (&_data1_->a_length1));
+       _data1_->_a_size_ = _data1_->a_length1;
+}
+
+static void
+___lambda4__foo_func (gpointer self)
+{
+       __lambda4_ (self);
+}
+
+static void
+_vala_array_add1 (gint* * array,
+                  gint* length,
+                  gint* size,
+                  gint value)
+{
+       if ((*length) == (*size)) {
+               *size = (*size) ? (2 * (*size)) : 4;
+               *array = g_renew (gint, *array, *size);
+       }
+       (*array)[(*length)++] = value;
+}
+
+static void
+_vala_main (void)
+{
+       Block1Data* _data1_;
+       gint* _tmp0_;
+       FooFunc func = NULL;
+       gpointer func_target;
+       GDestroyNotify func_target_destroy_notify;
+       FooFunc _tmp1_;
+       gpointer _tmp1__target;
+       _data1_ = g_slice_new0 (Block1Data);
+       _data1_->_ref_count_ = 1;
+       _tmp0_ = g_new0 (gint, (10 * 1024) * 1024);
+       _data1_->a = _tmp0_;
+       _data1_->a_length1 = (10 * 1024) * 1024;
+       _data1_->_a_size_ = _data1_->a_length1;
+       func = ___lambda4__foo_func;
+       func_target = block1_data_ref (_data1_);
+       func_target_destroy_notify = block1_data_unref;
+       _tmp1_ = func;
+       _tmp1__target = func_target;
+       _tmp1_ (_tmp1__target);
+       {
+               gint i = 0;
+               i = 1;
+               {
+                       gboolean _tmp2_ = FALSE;
+                       _tmp2_ = TRUE;
+                       while (TRUE) {
+                               if (!_tmp2_) {
+                                       gint _tmp3_;
+                                       _tmp3_ = i;
+                                       i = _tmp3_ + 1;
+                               }
+                               _tmp2_ = FALSE;
+                               if (!(i < ((10 * 1024) * 1024))) {
+                                       break;
+                               }
+                               _vala_array_add1 (&_data1_->a, &_data1_->a_length1, &_data1_->_a_size_, 4711);
+                       }
+               }
+       }
+       (func_target_destroy_notify == NULL) ? NULL : (func_target_destroy_notify (func_target), NULL);
+       func = NULL;
+       func_target = NULL;
+       func_target_destroy_notify = NULL;
+       block1_data_unref (_data1_);
+       _data1_ = NULL;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/parameter-ref-array-resize.c-expected 
b/tests/methods/parameter-ref-array-resize.c-expected
new file mode 100644
index 000000000..ece83e988
--- /dev/null
+++ b/tests/methods/parameter-ref-array-resize.c-expected
@@ -0,0 +1,91 @@
+/* methods_parameter_ref_array_resize.c generated by valac, the Vala compiler
+ * generated from methods_parameter_ref_array_resize.vala, do not modify */
+
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+VALA_EXTERN void foo (gint** a,
+          gint* a_length1);
+static void _vala_main (void);
+static void _vala_array_add1 (gint* * array,
+                       gint* length,
+                       gint* size,
+                       gint value);
+
+void
+foo (gint** a,
+     gint* a_length1)
+{
+       gint* _tmp0_;
+       _tmp0_ = g_new0 (gint, 1);
+       *a = (g_free (*a), NULL);
+       *a = _tmp0_;
+       *a_length1 = 1;
+}
+
+static void
+_vala_array_add1 (gint* * array,
+                  gint* length,
+                  gint* size,
+                  gint value)
+{
+       if ((*length) == (*size)) {
+               *size = (*size) ? (2 * (*size)) : 4;
+               *array = g_renew (gint, *array, *size);
+       }
+       (*array)[(*length)++] = value;
+}
+
+static void
+_vala_main (void)
+{
+       gint* a = NULL;
+       gint* _tmp0_;
+       gint a_length1;
+       gint _a_size_;
+       _tmp0_ = g_new0 (gint, (10 * 1024) * 1024);
+       a = _tmp0_;
+       a_length1 = (10 * 1024) * 1024;
+       _a_size_ = a_length1;
+       foo (&a, (gint*) (&a_length1));
+       _a_size_ = a_length1;
+       {
+               gint i = 0;
+               i = 1;
+               {
+                       gboolean _tmp1_ = FALSE;
+                       _tmp1_ = TRUE;
+                       while (TRUE) {
+                               if (!_tmp1_) {
+                                       gint _tmp2_;
+                                       _tmp2_ = i;
+                                       i = _tmp2_ + 1;
+                               }
+                               _tmp1_ = FALSE;
+                               if (!(i < ((10 * 1024) * 1024))) {
+                                       break;
+                               }
+                               _vala_array_add1 (&a, &a_length1, &_a_size_, 4711);
+                       }
+               }
+       }
+       a = (g_free (a), NULL);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/parameter-ref-delegate.c-expected b/tests/methods/parameter-ref-delegate.c-expected
new file mode 100644
index 000000000..dab6bf147
--- /dev/null
+++ b/tests/methods/parameter-ref-delegate.c-expected
@@ -0,0 +1,187 @@
+/* methods_parameter_ref_delegate.c generated by valac, the Vala compiler
+ * generated from methods_parameter_ref_delegate.vala, do not modify */
+
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef gint (*FooFunc) (gpointer user_data);
+typedef struct _Block1Data Block1Data;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Block1Data {
+       int _ref_count_;
+       gint i;
+};
+
+VALA_EXTERN void foo (gint i,
+          FooFunc* func,
+          gpointer* func_target,
+          GDestroyNotify* func_target_destroy_notify);
+static gint __lambda4_ (void);
+static gint ___lambda4__foo_func (gpointer self);
+VALA_EXTERN gint bar (void);
+static void _vala_main (void);
+static gint _bar_foo_func (gpointer self);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static gint ___lambda5_ (Block1Data* _data1_);
+static gint ____lambda5__foo_func (gpointer self);
+
+static gint
+__lambda4_ (void)
+{
+       gint result = 0;
+       result = 4711;
+       return result;
+}
+
+static gint
+___lambda4__foo_func (gpointer self)
+{
+       gint result;
+       result = __lambda4_ ();
+       return result;
+}
+
+void
+foo (gint i,
+     FooFunc* func,
+     gpointer* func_target,
+     GDestroyNotify* func_target_destroy_notify)
+{
+       _vala_assert ((*func) (*func_target) == i, "func () == i");
+       ((*func_target_destroy_notify) == NULL) ? NULL : ((*func_target_destroy_notify) (*func_target), NULL);
+       *func = NULL;
+       *func_target = NULL;
+       *func_target_destroy_notify = NULL;
+       *func = ___lambda4__foo_func;
+       *func_target = NULL;
+       *func_target_destroy_notify = NULL;
+}
+
+gint
+bar (void)
+{
+       gint result = 0;
+       result = 23;
+       return result;
+}
+
+static gint
+_bar_foo_func (gpointer self)
+{
+       gint result;
+       result = bar ();
+       return result;
+}
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static gint
+___lambda5_ (Block1Data* _data1_)
+{
+       gint result = 0;
+       result = _data1_->i;
+       return result;
+}
+
+static gint
+____lambda5__foo_func (gpointer self)
+{
+       gint result;
+       result = ___lambda5_ (self);
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       {
+               FooFunc func = NULL;
+               gpointer func_target;
+               GDestroyNotify func_target_destroy_notify;
+               FooFunc _tmp0_;
+               gpointer _tmp0__target;
+               FooFunc _tmp1_;
+               gpointer _tmp1__target;
+               func = _bar_foo_func;
+               func_target = NULL;
+               func_target_destroy_notify = NULL;
+               _tmp0_ = func;
+               _tmp0__target = func_target;
+               _vala_assert (_tmp0_ (_tmp0__target) == 23, "func () == 23");
+               foo (23, &func, &func_target, &func_target_destroy_notify);
+               _tmp1_ = func;
+               _tmp1__target = func_target;
+               _vala_assert (_tmp1_ (_tmp1__target) == 4711, "func () == 4711");
+               (func_target_destroy_notify == NULL) ? NULL : (func_target_destroy_notify (func_target), 
NULL);
+               func = NULL;
+               func_target = NULL;
+               func_target_destroy_notify = NULL;
+       }
+       {
+               Block1Data* _data1_;
+               FooFunc func = NULL;
+               gpointer func_target;
+               GDestroyNotify func_target_destroy_notify;
+               FooFunc _tmp2_;
+               gpointer _tmp2__target;
+               FooFunc _tmp3_;
+               gpointer _tmp3__target;
+               _data1_ = g_slice_new0 (Block1Data);
+               _data1_->_ref_count_ = 1;
+               _data1_->i = 42;
+               func = ____lambda5__foo_func;
+               func_target = block1_data_ref (_data1_);
+               func_target_destroy_notify = block1_data_unref;
+               _tmp2_ = func;
+               _tmp2__target = func_target;
+               _vala_assert (_tmp2_ (_tmp2__target) == 42, "func () == 42");
+               foo (42, &func, &func_target, &func_target_destroy_notify);
+               _tmp3_ = func;
+               _tmp3__target = func_target;
+               _vala_assert (_tmp3_ (_tmp3__target) == 4711, "func () == 4711");
+               (func_target_destroy_notify == NULL) ? NULL : (func_target_destroy_notify (func_target), 
NULL);
+               func = NULL;
+               func_target = NULL;
+               func_target_destroy_notify = NULL;
+               block1_data_unref (_data1_);
+               _data1_ = NULL;
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/parameter-ref-element-access.c-expected 
b/tests/methods/parameter-ref-element-access.c-expected
new file mode 100644
index 000000000..4e23b1bd2
--- /dev/null
+++ b/tests/methods/parameter-ref-element-access.c-expected
@@ -0,0 +1,99 @@
+/* methods_parameter_ref_element_access.c generated by valac, the Vala compiler
+ * generated from methods_parameter_ref_element_access.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN void foo (gchar* * s);
+static void _vala_main (void);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+void
+foo (gchar* * s)
+{
+       gchar* _tmp0_;
+       g_return_if_fail (*s != NULL);
+       _vala_assert (g_strcmp0 (*s, "foo") == 0, "s == \"foo\"");
+       _tmp0_ = g_strdup ("bar");
+       _g_free0 (*s);
+       *s = _tmp0_;
+}
+
+static void
+_vala_main (void)
+{
+       gchar** bar = NULL;
+       gchar* _tmp0_;
+       gchar* _tmp1_;
+       gchar** _tmp2_;
+       gint bar_length1;
+       gint _bar_size_;
+       const gchar* _tmp3_;
+       _tmp0_ = g_strdup ("manam");
+       _tmp1_ = g_strdup ("foo");
+       _tmp2_ = g_new0 (gchar*, 2 + 1);
+       _tmp2_[0] = _tmp0_;
+       _tmp2_[1] = _tmp1_;
+       bar = _tmp2_;
+       bar_length1 = 2;
+       _bar_size_ = bar_length1;
+       foo (&bar[1]);
+       _tmp3_ = bar[1];
+       _vala_assert (g_strcmp0 (_tmp3_, "bar") == 0, "bar[1] == \"bar\"");
+       bar = (_vala_array_free (bar, bar_length1, (GDestroyNotify) g_free), NULL);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/methods/params-array-with-throws.c-expected 
b/tests/methods/params-array-with-throws.c-expected
new file mode 100644
index 000000000..ab3e1ffd7
--- /dev/null
+++ b/tests/methods/params-array-with-throws.c-expected
@@ -0,0 +1,622 @@
+/* methods_params_array_with_throws.c generated by valac, the Vala compiler
+ * generated from methods_params_array_with_throws.vala, do not modify */
+
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib-object.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+typedef enum  {
+       FOO_ERROR_BAD,
+       FOO_ERROR_WORSE
+} FooError;
+#define FOO_ERROR foo_error_quark ()
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GQuark foo_error_quark (void);
+VALA_EXTERN void foo (GError** error,
+          const gchar* _first_array,
+          ...);
+static void _vala_array_add1 (const gchar** * array,
+                       gint* length,
+                       gint* size,
+                       const gchar* value);
+VALA_EXTERN void bar (GError** error,
+          const gchar* _first_array,
+          ...);
+static void _vala_array_add2 (const gchar** * array,
+                       gint* length,
+                       gint* size,
+                       const gchar* value);
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN void foo_foo (Foo* self,
+              GError** error,
+              const gchar* _first_array,
+              ...);
+static void _vala_array_add3 (const gchar** * array,
+                       gint* length,
+                       gint* size,
+                       const gchar* value);
+VALA_EXTERN void foo_bar (Foo* self,
+              GError** error,
+              const gchar* _first_array,
+              ...);
+static void _vala_array_add4 (const gchar** * array,
+                       gint* length,
+                       gint* size,
+                       const gchar* value);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+GQuark
+foo_error_quark (void)
+{
+       return g_quark_from_static_string ("foo-error-quark");
+}
+
+static void
+_vala_array_add1 (const gchar** * array,
+                  gint* length,
+                  gint* size,
+                  const gchar* value)
+{
+       if ((*length) == (*size)) {
+               *size = (*size) ? (2 * (*size)) : 4;
+               *array = g_renew (const gchar*, *array, (*size) + 1);
+       }
+       (*array)[(*length)++] = value;
+       (*array)[*length] = NULL;
+}
+
+void
+foo (GError** error,
+     const gchar* _first_array,
+     ...)
+{
+       const gchar* _array_element;
+       va_list _va_list_array;
+       const gchar** array = NULL;
+       gint array_length1 = 0;
+       gint _array_size_ = 0;
+       const gchar* _tmp0_;
+       const gchar* _tmp1_;
+       const gchar* _tmp2_;
+       array = g_new0 (const gchar*, array_length1 + 1);
+       va_start (_va_list_array, _first_array);
+       _array_element = _first_array;
+       while (_array_element != NULL) {
+               _vala_array_add1 (&array, &array_length1, &_array_size_, _array_element);
+               _array_element = va_arg (_va_list_array, const gchar*);
+       }
+       va_end (_va_list_array);
+       _vala_assert (array_length1 == 3, "array.length == 3");
+       _tmp0_ = array[0];
+       _vala_assert (g_strcmp0 (_tmp0_, "foo") == 0, "array[0] == \"foo\"");
+       _tmp1_ = array[1];
+       _vala_assert (g_strcmp0 (_tmp1_, "bar") == 0, "array[1] == \"bar\"");
+       _tmp2_ = array[2];
+       _vala_assert (g_strcmp0 (_tmp2_, "manam") == 0, "array[2] == \"manam\"");
+       array = (g_free (array), NULL);
+}
+
+static void
+_vala_array_add2 (const gchar** * array,
+                  gint* length,
+                  gint* size,
+                  const gchar* value)
+{
+       if ((*length) == (*size)) {
+               *size = (*size) ? (2 * (*size)) : 4;
+               *array = g_renew (const gchar*, *array, (*size) + 1);
+       }
+       (*array)[(*length)++] = value;
+       (*array)[*length] = NULL;
+}
+
+void
+bar (GError** error,
+     const gchar* _first_array,
+     ...)
+{
+       const gchar* _array_element;
+       va_list _va_list_array;
+       const gchar** array = NULL;
+       gint array_length1 = 0;
+       gint _array_size_ = 0;
+       GError* _tmp0_;
+       GError* _inner_error0_ = NULL;
+       array = g_new0 (const gchar*, array_length1 + 1);
+       va_start (_va_list_array, _first_array);
+       _array_element = _first_array;
+       while (_array_element != NULL) {
+               _vala_array_add2 (&array, &array_length1, &_array_size_, _array_element);
+               _array_element = va_arg (_va_list_array, const gchar*);
+       }
+       va_end (_va_list_array);
+       _tmp0_ = g_error_new_literal (FOO_ERROR, FOO_ERROR_BAD, "bad");
+       _inner_error0_ = _tmp0_;
+       if (_inner_error0_->domain == FOO_ERROR) {
+               g_propagate_error (error, _inner_error0_);
+               array = (g_free (array), NULL);
+               return;
+       } else {
+               array = (g_free (array), NULL);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+}
+
+static void
+_vala_array_add3 (const gchar** * array,
+                  gint* length,
+                  gint* size,
+                  const gchar* value)
+{
+       if ((*length) == (*size)) {
+               *size = (*size) ? (2 * (*size)) : 4;
+               *array = g_renew (const gchar*, *array, (*size) + 1);
+       }
+       (*array)[(*length)++] = value;
+       (*array)[*length] = NULL;
+}
+
+void
+foo_foo (Foo* self,
+         GError** error,
+         const gchar* _first_array,
+         ...)
+{
+       const gchar* _array_element;
+       va_list _va_list_array;
+       const gchar** array = NULL;
+       gint array_length1 = 0;
+       gint _array_size_ = 0;
+       const gchar* _tmp0_;
+       const gchar* _tmp1_;
+       const gchar* _tmp2_;
+       g_return_if_fail (IS_FOO (self));
+       array = g_new0 (const gchar*, array_length1 + 1);
+       va_start (_va_list_array, _first_array);
+       _array_element = _first_array;
+       while (_array_element != NULL) {
+               _vala_array_add3 (&array, &array_length1, &_array_size_, _array_element);
+               _array_element = va_arg (_va_list_array, const gchar*);
+       }
+       va_end (_va_list_array);
+       _vala_assert (array_length1 == 3, "array.length == 3");
+       _tmp0_ = array[0];
+       _vala_assert (g_strcmp0 (_tmp0_, "foo") == 0, "array[0] == \"foo\"");
+       _tmp1_ = array[1];
+       _vala_assert (g_strcmp0 (_tmp1_, "bar") == 0, "array[1] == \"bar\"");
+       _tmp2_ = array[2];
+       _vala_assert (g_strcmp0 (_tmp2_, "manam") == 0, "array[2] == \"manam\"");
+       array = (g_free (array), NULL);
+}
+
+static void
+_vala_array_add4 (const gchar** * array,
+                  gint* length,
+                  gint* size,
+                  const gchar* value)
+{
+       if ((*length) == (*size)) {
+               *size = (*size) ? (2 * (*size)) : 4;
+               *array = g_renew (const gchar*, *array, (*size) + 1);
+       }
+       (*array)[(*length)++] = value;
+       (*array)[*length] = NULL;
+}
+
+void
+foo_bar (Foo* self,
+         GError** error,
+         const gchar* _first_array,
+         ...)
+{
+       const gchar* _array_element;
+       va_list _va_list_array;
+       const gchar** array = NULL;
+       gint array_length1 = 0;
+       gint _array_size_ = 0;
+       GError* _tmp0_;
+       GError* _inner_error0_ = NULL;
+       g_return_if_fail (IS_FOO (self));
+       array = g_new0 (const gchar*, array_length1 + 1);
+       va_start (_va_list_array, _first_array);
+       _array_element = _first_array;
+       while (_array_element != NULL) {
+               _vala_array_add4 (&array, &array_length1, &_array_size_, _array_element);
+               _array_element = va_arg (_va_list_array, const gchar*);
+       }
+       va_end (_va_list_array);
+       _tmp0_ = g_error_new_literal (FOO_ERROR, FOO_ERROR_BAD, "bad");
+       _inner_error0_ = _tmp0_;
+       if (_inner_error0_->domain == FOO_ERROR) {
+               g_propagate_error (error, _inner_error0_);
+               array = (g_free (array), NULL);
+               return;
+       } else {
+               array = (g_free (array), NULL);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       GError* _inner_error0_ = NULL;
+       {
+               foo (&_inner_error0_, "foo", "bar", "manam", NULL);
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+       }
+       {
+               {
+                       bar (&_inner_error0_, "foo", "bar", "manam", NULL);
+                       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                               if (g_error_matches (_inner_error0_, FOO_ERROR, FOO_ERROR_BAD)) {
+                                       goto __catch0_foo_error_bad;
+                               }
+                               goto __catch0_g_error;
+                       }
+                       g_assert_not_reached ();
+               }
+               goto __finally0;
+               __catch0_foo_error_bad:
+               {
+                       g_clear_error (&_inner_error0_);
+               }
+               goto __finally0;
+               __catch0_g_error:
+               {
+                       g_clear_error (&_inner_error0_);
+                       g_assert_not_reached ();
+               }
+               __finally0:
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+       }
+       {
+               Foo* foo = NULL;
+               Foo* _tmp0_;
+               Foo* _tmp1_;
+               _tmp0_ = foo_new ();
+               foo = _tmp0_;
+               _tmp1_ = foo;
+               foo_foo (_tmp1_, &_inner_error0_, "foo", "bar", "manam", NULL);
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       _foo_unref0 (foo);
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+               _foo_unref0 (foo);
+       }
+       {
+               {
+                       Foo* foo = NULL;
+                       Foo* _tmp2_;
+                       Foo* _tmp3_;
+                       _tmp2_ = foo_new ();
+                       foo = _tmp2_;
+                       _tmp3_ = foo;
+                       foo_bar (_tmp3_, &_inner_error0_, "foo", "bar", "manam", NULL);
+                       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                               _foo_unref0 (foo);
+                               if (g_error_matches (_inner_error0_, FOO_ERROR, FOO_ERROR_BAD)) {
+                                       goto __catch1_foo_error_bad;
+                               }
+                               goto __catch1_g_error;
+                       }
+                       g_assert_not_reached ();
+                       _foo_unref0 (foo);
+               }
+               goto __finally1;
+               __catch1_foo_error_bad:
+               {
+                       g_clear_error (&_inner_error0_);
+               }
+               goto __finally1;
+               __catch1_g_error:
+               {
+                       g_clear_error (&_inner_error0_);
+                       g_assert_not_reached ();
+               }
+               __finally1:
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/params-array.c-expected b/tests/methods/params-array.c-expected
new file mode 100644
index 000000000..4ee39af47
--- /dev/null
+++ b/tests/methods/params-array.c-expected
@@ -0,0 +1,1155 @@
+/* methods_params_array.c generated by valac, the Vala compiler
+ * generated from methods_params_array.vala, do not modify */
+
+#include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+#include <float.h>
+#include <math.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+#define _g_free0(var) (var = (g_free (var), NULL))
+typedef struct _ParamSpecFoo ParamSpecFoo;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define __vala_GValue_free0(var) ((var == NULL) ? NULL : (var = (_vala_GValue_free (var), NULL)))
+#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new (const gchar* _first_strv,
+              ...);
+VALA_EXTERN Foo* foo_construct (GType object_type,
+                    const gchar* _first_strv,
+                    ...);
+VALA_EXTERN Foo* foo_constructv (GType object_type,
+                     const gchar* _first_strv,
+                     va_list _va_list_strv);
+static void _vala_array_add1 (const gchar** * array,
+                       gint* length,
+                       gint* size,
+                       const gchar* value);
+VALA_EXTERN Foo* foo_new_bar (gint _first_intv,
+                  ...);
+VALA_EXTERN Foo* foo_construct_bar (GType object_type,
+                        gint _first_intv,
+                        ...);
+VALA_EXTERN Foo* foo_constructv_bar (GType object_type,
+                         gint _first_intv,
+                         va_list _va_list_intv);
+static void _vala_array_add2 (gint* * array,
+                       gint* length,
+                       gint* size,
+                       gint value);
+VALA_EXTERN Foo* foo_new_manam (GValue* _first_valuev,
+                    ...);
+VALA_EXTERN Foo* foo_construct_manam (GType object_type,
+                          GValue* _first_valuev,
+                          ...);
+VALA_EXTERN Foo* foo_constructv_manam (GType object_type,
+                           GValue* _first_valuev,
+                           va_list _va_list_valuev);
+static void _vala_array_add3 (GValue** * array,
+                       gint* length,
+                       gint* size,
+                       const GValue* value);
+VALA_EXTERN Foo* foo_new_manam_owned (GValue* _first_valuev,
+                          ...);
+VALA_EXTERN Foo* foo_construct_manam_owned (GType object_type,
+                                GValue* _first_valuev,
+                                ...);
+VALA_EXTERN Foo* foo_constructv_manam_owned (GType object_type,
+                                 GValue* _first_valuev,
+                                 va_list _va_list_valuev);
+static void _vala_array_add4 (GValue** * array,
+                       gint* length,
+                       gint* size,
+                       GValue* value);
+static void _vala_GValue_free (GValue* self);
+VALA_EXTERN Foo* foo_new_minim (GVariant* _first_variantv,
+                    ...);
+VALA_EXTERN Foo* foo_construct_minim (GType object_type,
+                          GVariant* _first_variantv,
+                          ...);
+VALA_EXTERN Foo* foo_constructv_minim (GType object_type,
+                           GVariant* _first_variantv,
+                           va_list _va_list_variantv);
+static void _vala_array_add5 (GVariant** * array,
+                       gint* length,
+                       gint* size,
+                       GVariant* value);
+static gchar* _variant_get1 (GVariant* value);
+static gint _variant_get2 (GVariant* value);
+static gdouble _variant_get3 (GVariant* value);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN void foo (const gchar* _first_strv,
+          ...);
+static void _vala_array_add6 (const gchar** * array,
+                       gint* length,
+                       gint* size,
+                       const gchar* value);
+VALA_EXTERN void bar (gint _first_intv,
+          ...);
+static void _vala_array_add7 (gint* * array,
+                       gint* length,
+                       gint* size,
+                       gint value);
+VALA_EXTERN void manam (GValue* _first_valuev,
+            ...);
+static void _vala_array_add8 (GValue** * array,
+                       gint* length,
+                       gint* size,
+                       const GValue* value);
+VALA_EXTERN void manam_owned (GValue* _first_valuev,
+                  ...);
+static void _vala_array_add9 (GValue** * array,
+                       gint* length,
+                       gint* size,
+                       GValue* value);
+VALA_EXTERN void minim (GVariant* _first_variantv,
+            ...);
+static void _vala_array_add10 (GVariant** * array,
+                        gint* length,
+                        gint* size,
+                        GVariant* value);
+static gchar* _variant_get4 (GVariant* value);
+static gint _variant_get5 (GVariant* value);
+static gdouble _variant_get6 (GVariant* value);
+static void _vala_main (void);
+static GVariant* _variant_new1 (const gchar* value);
+static GVariant* _variant_new2 (gint value);
+static GVariant* _variant_new3 (gdouble value);
+static GVariant* _variant_new4 (const gchar* value);
+static GVariant* _variant_new5 (gint value);
+static GVariant* _variant_new6 (gdouble value);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static void
+_vala_array_add1 (const gchar** * array,
+                  gint* length,
+                  gint* size,
+                  const gchar* value)
+{
+       if ((*length) == (*size)) {
+               *size = (*size) ? (2 * (*size)) : 4;
+               *array = g_renew (const gchar*, *array, (*size) + 1);
+       }
+       (*array)[(*length)++] = value;
+       (*array)[*length] = NULL;
+}
+
+Foo*
+foo_constructv (GType object_type,
+                const gchar* _first_strv,
+                va_list _va_list_strv)
+{
+       const gchar* _strv_element;
+       Foo* self = NULL;
+       const gchar** strv = NULL;
+       gint strv_length1 = 0;
+       gint _strv_size_ = 0;
+       const gchar* _tmp0_;
+       const gchar* _tmp1_;
+       const gchar* _tmp2_;
+       strv = g_new0 (const gchar*, strv_length1 + 1);
+       _strv_element = _first_strv;
+       while (_strv_element != NULL) {
+               _vala_array_add1 (&strv, &strv_length1, &_strv_size_, _strv_element);
+               _strv_element = va_arg (_va_list_strv, const gchar*);
+       }
+       va_end (_va_list_strv);
+       self = (Foo*) g_type_create_instance (object_type);
+       _vala_assert (strv_length1 == 3, "strv.length == 3");
+       _tmp0_ = strv[0];
+       _vala_assert (g_strcmp0 (_tmp0_, "foo") == 0, "strv[0] == \"foo\"");
+       _tmp1_ = strv[1];
+       _vala_assert (g_strcmp0 (_tmp1_, "bar") == 0, "strv[1] == \"bar\"");
+       _tmp2_ = strv[2];
+       _vala_assert (g_strcmp0 (_tmp2_, "manam") == 0, "strv[2] == \"manam\"");
+       strv = (g_free (strv), NULL);
+       return self;
+}
+
+Foo*
+foo_new (const gchar* _first_strv,
+         ...)
+{
+       va_list _vala_va_list_obj;
+       va_start (_vala_va_list_obj, _first_strv);
+       return foo_constructv (TYPE_FOO, _first_strv, _vala_va_list_obj);
+}
+
+Foo*
+foo_construct (GType object_type,
+               const gchar* _first_strv,
+               ...)
+{
+       va_list _vala_va_list_obj;
+       va_start (_vala_va_list_obj, _first_strv);
+       return foo_constructv (object_type, _first_strv, _vala_va_list_obj);
+}
+
+static void
+_vala_array_add2 (gint* * array,
+                  gint* length,
+                  gint* size,
+                  gint value)
+{
+       if ((*length) == (*size)) {
+               *size = (*size) ? (2 * (*size)) : 4;
+               *array = g_renew (gint, *array, *size);
+       }
+       (*array)[(*length)++] = value;
+}
+
+Foo*
+foo_constructv_bar (GType object_type,
+                    gint _first_intv,
+                    va_list _va_list_intv)
+{
+       gint _intv_element;
+       Foo* self = NULL;
+       gint* intv = NULL;
+       gint intv_length1 = 0;
+       gint _intv_size_ = 0;
+       gint _tmp0_;
+       gint _tmp1_;
+       gint _tmp2_;
+       intv = g_new0 (gint, intv_length1);
+       _intv_element = _first_intv;
+       while (_intv_element != NULL) {
+               _vala_array_add2 (&intv, &intv_length1, &_intv_size_, _intv_element);
+               _intv_element = va_arg (_va_list_intv, gint);
+       }
+       va_end (_va_list_intv);
+       self = (Foo*) g_type_create_instance (object_type);
+       _vala_assert (intv_length1 == 3, "intv.length == 3");
+       _tmp0_ = intv[0];
+       _vala_assert (_tmp0_ == 23, "intv[0] == 23");
+       _tmp1_ = intv[1];
+       _vala_assert (_tmp1_ == 42, "intv[1] == 42");
+       _tmp2_ = intv[2];
+       _vala_assert (_tmp2_ == 4711, "intv[2] == 4711");
+       intv = (g_free (intv), NULL);
+       return self;
+}
+
+Foo*
+foo_new_bar (gint _first_intv,
+             ...)
+{
+       va_list _vala_va_list_obj;
+       va_start (_vala_va_list_obj, _first_intv);
+       return foo_constructv_bar (TYPE_FOO, _first_intv, _vala_va_list_obj);
+}
+
+Foo*
+foo_construct_bar (GType object_type,
+                   gint _first_intv,
+                   ...)
+{
+       va_list _vala_va_list_obj;
+       va_start (_vala_va_list_obj, _first_intv);
+       return foo_constructv_bar (object_type, _first_intv, _vala_va_list_obj);
+}
+
+static void
+_vala_array_add3 (GValue** * array,
+                  gint* length,
+                  gint* size,
+                  const GValue* value)
+{
+       if ((*length) == (*size)) {
+               *size = (*size) ? (2 * (*size)) : 4;
+               *array = g_renew (GValue*, *array, *size);
+       }
+       (*array)[(*length)++] = value;
+}
+
+Foo*
+foo_constructv_manam (GType object_type,
+                      GValue* _first_valuev,
+                      va_list _va_list_valuev)
+{
+       GValue* _valuev_element;
+       Foo* self = NULL;
+       GValue** valuev = NULL;
+       gint valuev_length1 = 0;
+       gint _valuev_size_ = 0;
+       GValue* _tmp0_;
+       GValue* _tmp1_;
+       GValue* _tmp2_;
+       valuev = g_new0 (GValue*, valuev_length1);
+       _valuev_element = _first_valuev;
+       while (_valuev_element != NULL) {
+               _vala_array_add3 (&valuev, &valuev_length1, &_valuev_size_, _valuev_element);
+               _valuev_element = va_arg (_va_list_valuev, GValue*);
+       }
+       va_end (_va_list_valuev);
+       self = (Foo*) g_type_create_instance (object_type);
+       _vala_assert (valuev_length1 == 3, "valuev.length == 3");
+       _tmp0_ = valuev[0];
+       _vala_assert (g_strcmp0 (g_value_get_string (_tmp0_), "foo") == 0, "valuev[0] == \"foo\"");
+       _tmp1_ = valuev[1];
+       _vala_assert (g_value_get_int (_tmp1_) == 4711, "valuev[1] == 4711");
+       _tmp2_ = valuev[2];
+       _vala_assert (g_value_get_double (_tmp2_) == 3.1415, "valuev[2] == 3.1415");
+       valuev = (g_free (valuev), NULL);
+       return self;
+}
+
+Foo*
+foo_new_manam (GValue* _first_valuev,
+               ...)
+{
+       va_list _vala_va_list_obj;
+       va_start (_vala_va_list_obj, _first_valuev);
+       return foo_constructv_manam (TYPE_FOO, _first_valuev, _vala_va_list_obj);
+}
+
+Foo*
+foo_construct_manam (GType object_type,
+                     GValue* _first_valuev,
+                     ...)
+{
+       va_list _vala_va_list_obj;
+       va_start (_vala_va_list_obj, _first_valuev);
+       return foo_constructv_manam (object_type, _first_valuev, _vala_va_list_obj);
+}
+
+static void
+_vala_array_add4 (GValue** * array,
+                  gint* length,
+                  gint* size,
+                  GValue* value)
+{
+       if ((*length) == (*size)) {
+               *size = (*size) ? (2 * (*size)) : 4;
+               *array = g_renew (GValue*, *array, *size);
+       }
+       (*array)[(*length)++] = value;
+}
+
+static void
+_vala_GValue_free (GValue* self)
+{
+       g_boxed_free (G_TYPE_VALUE, self);
+}
+
+Foo*
+foo_constructv_manam_owned (GType object_type,
+                            GValue* _first_valuev,
+                            va_list _va_list_valuev)
+{
+       GValue* _valuev_element;
+       Foo* self = NULL;
+       GValue** valuev = NULL;
+       gint valuev_length1 = 0;
+       gint _valuev_size_ = 0;
+       GValue* _tmp0_;
+       GValue* _tmp1_;
+       GValue* _tmp2_;
+       valuev = g_new0 (GValue*, valuev_length1);
+       _valuev_element = _first_valuev;
+       while (_valuev_element != NULL) {
+               _vala_array_add4 (&valuev, &valuev_length1, &_valuev_size_, _valuev_element);
+               _valuev_element = va_arg (_va_list_valuev, GValue*);
+       }
+       va_end (_va_list_valuev);
+       self = (Foo*) g_type_create_instance (object_type);
+       _vala_assert (valuev_length1 == 3, "valuev.length == 3");
+       _tmp0_ = valuev[0];
+       _vala_assert (g_strcmp0 (g_value_get_string (_tmp0_), "foo") == 0, "valuev[0] == \"foo\"");
+       _tmp1_ = valuev[1];
+       _vala_assert (g_value_get_int (_tmp1_) == 4711, "valuev[1] == 4711");
+       _tmp2_ = valuev[2];
+       _vala_assert (g_value_get_double (_tmp2_) == 3.1415, "valuev[2] == 3.1415");
+       valuev = (_vala_array_free (valuev, valuev_length1, (GDestroyNotify) _vala_GValue_free), NULL);
+       return self;
+}
+
+Foo*
+foo_new_manam_owned (GValue* _first_valuev,
+                     ...)
+{
+       va_list _vala_va_list_obj;
+       va_start (_vala_va_list_obj, _first_valuev);
+       return foo_constructv_manam_owned (TYPE_FOO, _first_valuev, _vala_va_list_obj);
+}
+
+Foo*
+foo_construct_manam_owned (GType object_type,
+                           GValue* _first_valuev,
+                           ...)
+{
+       va_list _vala_va_list_obj;
+       va_start (_vala_va_list_obj, _first_valuev);
+       return foo_constructv_manam_owned (object_type, _first_valuev, _vala_va_list_obj);
+}
+
+static void
+_vala_array_add5 (GVariant** * array,
+                  gint* length,
+                  gint* size,
+                  GVariant* value)
+{
+       if ((*length) == (*size)) {
+               *size = (*size) ? (2 * (*size)) : 4;
+               *array = g_renew (GVariant*, *array, (*size) + 1);
+       }
+       (*array)[(*length)++] = value;
+       (*array)[*length] = NULL;
+}
+
+static gchar*
+_variant_get1 (GVariant* value)
+{
+       return g_variant_dup_string (value, NULL);
+}
+
+static gint
+_variant_get2 (GVariant* value)
+{
+       return g_variant_get_int32 (value);
+}
+
+static gdouble
+_variant_get3 (GVariant* value)
+{
+       return g_variant_get_double (value);
+}
+
+Foo*
+foo_constructv_minim (GType object_type,
+                      GVariant* _first_variantv,
+                      va_list _va_list_variantv)
+{
+       GVariant* _variantv_element;
+       Foo* self = NULL;
+       GVariant** variantv = NULL;
+       gint variantv_length1 = 0;
+       gint _variantv_size_ = 0;
+       GVariant* _tmp0_;
+       gchar* _tmp1_;
+       gchar* _tmp2_;
+       GVariant* _tmp3_;
+       gint _tmp4_;
+       GVariant* _tmp5_;
+       gdouble _tmp6_;
+       variantv = g_new0 (GVariant*, variantv_length1 + 1);
+       _variantv_element = _first_variantv;
+       while (_variantv_element != NULL) {
+               _vala_array_add5 (&variantv, &variantv_length1, &_variantv_size_, _variantv_element);
+               _variantv_element = va_arg (_va_list_variantv, GVariant*);
+       }
+       va_end (_va_list_variantv);
+       self = (Foo*) g_type_create_instance (object_type);
+       _vala_assert (variantv_length1 == 3, "variantv.length == 3");
+       _tmp0_ = variantv[0];
+       _tmp1_ = _variant_get1 (_tmp0_);
+       _tmp2_ = _tmp1_;
+       _vala_assert (g_strcmp0 (_tmp2_, "foo") == 0, "(string) variantv[0] == \"foo\"");
+       _g_free0 (_tmp2_);
+       _tmp3_ = variantv[1];
+       _tmp4_ = _variant_get2 (_tmp3_);
+       _vala_assert (_tmp4_ == 4711, "(int) variantv[1] == 4711");
+       _tmp5_ = variantv[2];
+       _tmp6_ = _variant_get3 (_tmp5_);
+       _vala_assert (_tmp6_ == 3.1415, "(double) variantv[2] == 3.1415");
+       variantv = (g_free (variantv), NULL);
+       return self;
+}
+
+Foo*
+foo_new_minim (GVariant* _first_variantv,
+               ...)
+{
+       va_list _vala_va_list_obj;
+       va_start (_vala_va_list_obj, _first_variantv);
+       return foo_constructv_minim (TYPE_FOO, _first_variantv, _vala_va_list_obj);
+}
+
+Foo*
+foo_construct_minim (GType object_type,
+                     GVariant* _first_variantv,
+                     ...)
+{
+       va_list _vala_va_list_obj;
+       va_start (_vala_va_list_obj, _first_variantv);
+       return foo_constructv_minim (object_type, _first_variantv, _vala_va_list_obj);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_array_add6 (const gchar** * array,
+                  gint* length,
+                  gint* size,
+                  const gchar* value)
+{
+       if ((*length) == (*size)) {
+               *size = (*size) ? (2 * (*size)) : 4;
+               *array = g_renew (const gchar*, *array, (*size) + 1);
+       }
+       (*array)[(*length)++] = value;
+       (*array)[*length] = NULL;
+}
+
+void
+foo (const gchar* _first_strv,
+     ...)
+{
+       const gchar* _strv_element;
+       va_list _va_list_strv;
+       const gchar** strv = NULL;
+       gint strv_length1 = 0;
+       gint _strv_size_ = 0;
+       const gchar* _tmp0_;
+       const gchar* _tmp1_;
+       const gchar* _tmp2_;
+       strv = g_new0 (const gchar*, strv_length1 + 1);
+       va_start (_va_list_strv, _first_strv);
+       _strv_element = _first_strv;
+       while (_strv_element != NULL) {
+               _vala_array_add6 (&strv, &strv_length1, &_strv_size_, _strv_element);
+               _strv_element = va_arg (_va_list_strv, const gchar*);
+       }
+       va_end (_va_list_strv);
+       _vala_assert (strv_length1 == 3, "strv.length == 3");
+       _tmp0_ = strv[0];
+       _vala_assert (g_strcmp0 (_tmp0_, "foo") == 0, "strv[0] == \"foo\"");
+       _tmp1_ = strv[1];
+       _vala_assert (g_strcmp0 (_tmp1_, "bar") == 0, "strv[1] == \"bar\"");
+       _tmp2_ = strv[2];
+       _vala_assert (g_strcmp0 (_tmp2_, "manam") == 0, "strv[2] == \"manam\"");
+       strv = (g_free (strv), NULL);
+}
+
+static void
+_vala_array_add7 (gint* * array,
+                  gint* length,
+                  gint* size,
+                  gint value)
+{
+       if ((*length) == (*size)) {
+               *size = (*size) ? (2 * (*size)) : 4;
+               *array = g_renew (gint, *array, *size);
+       }
+       (*array)[(*length)++] = value;
+}
+
+void
+bar (gint _first_intv,
+     ...)
+{
+       gint _intv_element;
+       va_list _va_list_intv;
+       gint* intv = NULL;
+       gint intv_length1 = 0;
+       gint _intv_size_ = 0;
+       gint _tmp0_;
+       gint _tmp1_;
+       gint _tmp2_;
+       intv = g_new0 (gint, intv_length1);
+       va_start (_va_list_intv, _first_intv);
+       _intv_element = _first_intv;
+       while (_intv_element != NULL) {
+               _vala_array_add7 (&intv, &intv_length1, &_intv_size_, _intv_element);
+               _intv_element = va_arg (_va_list_intv, gint);
+       }
+       va_end (_va_list_intv);
+       _vala_assert (intv_length1 == 3, "intv.length == 3");
+       _tmp0_ = intv[0];
+       _vala_assert (_tmp0_ == 23, "intv[0] == 23");
+       _tmp1_ = intv[1];
+       _vala_assert (_tmp1_ == 42, "intv[1] == 42");
+       _tmp2_ = intv[2];
+       _vala_assert (_tmp2_ == 4711, "intv[2] == 4711");
+       intv = (g_free (intv), NULL);
+}
+
+static void
+_vala_array_add8 (GValue** * array,
+                  gint* length,
+                  gint* size,
+                  const GValue* value)
+{
+       if ((*length) == (*size)) {
+               *size = (*size) ? (2 * (*size)) : 4;
+               *array = g_renew (GValue*, *array, *size);
+       }
+       (*array)[(*length)++] = value;
+}
+
+void
+manam (GValue* _first_valuev,
+       ...)
+{
+       GValue* _valuev_element;
+       va_list _va_list_valuev;
+       GValue** valuev = NULL;
+       gint valuev_length1 = 0;
+       gint _valuev_size_ = 0;
+       GValue* _tmp0_;
+       GValue* _tmp1_;
+       GValue* _tmp2_;
+       valuev = g_new0 (GValue*, valuev_length1);
+       va_start (_va_list_valuev, _first_valuev);
+       _valuev_element = _first_valuev;
+       while (_valuev_element != NULL) {
+               _vala_array_add8 (&valuev, &valuev_length1, &_valuev_size_, _valuev_element);
+               _valuev_element = va_arg (_va_list_valuev, GValue*);
+       }
+       va_end (_va_list_valuev);
+       _vala_assert (valuev_length1 == 3, "valuev.length == 3");
+       _tmp0_ = valuev[0];
+       _vala_assert (g_strcmp0 (g_value_get_string (_tmp0_), "foo") == 0, "valuev[0] == \"foo\"");
+       _tmp1_ = valuev[1];
+       _vala_assert (g_value_get_int (_tmp1_) == 4711, "valuev[1] == 4711");
+       _tmp2_ = valuev[2];
+       _vala_assert (g_value_get_double (_tmp2_) == 3.1415, "valuev[2] == 3.1415");
+       valuev = (g_free (valuev), NULL);
+}
+
+static void
+_vala_array_add9 (GValue** * array,
+                  gint* length,
+                  gint* size,
+                  GValue* value)
+{
+       if ((*length) == (*size)) {
+               *size = (*size) ? (2 * (*size)) : 4;
+               *array = g_renew (GValue*, *array, *size);
+       }
+       (*array)[(*length)++] = value;
+}
+
+void
+manam_owned (GValue* _first_valuev,
+             ...)
+{
+       GValue* _valuev_element;
+       va_list _va_list_valuev;
+       GValue** valuev = NULL;
+       gint valuev_length1 = 0;
+       gint _valuev_size_ = 0;
+       GValue* _tmp0_;
+       GValue* _tmp1_;
+       GValue* _tmp2_;
+       valuev = g_new0 (GValue*, valuev_length1);
+       va_start (_va_list_valuev, _first_valuev);
+       _valuev_element = _first_valuev;
+       while (_valuev_element != NULL) {
+               _vala_array_add9 (&valuev, &valuev_length1, &_valuev_size_, _valuev_element);
+               _valuev_element = va_arg (_va_list_valuev, GValue*);
+       }
+       va_end (_va_list_valuev);
+       _vala_assert (valuev_length1 == 3, "valuev.length == 3");
+       _tmp0_ = valuev[0];
+       _vala_assert (g_strcmp0 (g_value_get_string (_tmp0_), "foo") == 0, "valuev[0] == \"foo\"");
+       _tmp1_ = valuev[1];
+       _vala_assert (g_value_get_int (_tmp1_) == 4711, "valuev[1] == 4711");
+       _tmp2_ = valuev[2];
+       _vala_assert (g_value_get_double (_tmp2_) == 3.1415, "valuev[2] == 3.1415");
+       valuev = (_vala_array_free (valuev, valuev_length1, (GDestroyNotify) _vala_GValue_free), NULL);
+}
+
+static void
+_vala_array_add10 (GVariant** * array,
+                   gint* length,
+                   gint* size,
+                   GVariant* value)
+{
+       if ((*length) == (*size)) {
+               *size = (*size) ? (2 * (*size)) : 4;
+               *array = g_renew (GVariant*, *array, (*size) + 1);
+       }
+       (*array)[(*length)++] = value;
+       (*array)[*length] = NULL;
+}
+
+static gchar*
+_variant_get4 (GVariant* value)
+{
+       return g_variant_dup_string (value, NULL);
+}
+
+static gint
+_variant_get5 (GVariant* value)
+{
+       return g_variant_get_int32 (value);
+}
+
+static gdouble
+_variant_get6 (GVariant* value)
+{
+       return g_variant_get_double (value);
+}
+
+void
+minim (GVariant* _first_variantv,
+       ...)
+{
+       GVariant* _variantv_element;
+       va_list _va_list_variantv;
+       GVariant** variantv = NULL;
+       gint variantv_length1 = 0;
+       gint _variantv_size_ = 0;
+       GVariant* _tmp0_;
+       gchar* _tmp1_;
+       gchar* _tmp2_;
+       GVariant* _tmp3_;
+       gint _tmp4_;
+       GVariant* _tmp5_;
+       gdouble _tmp6_;
+       variantv = g_new0 (GVariant*, variantv_length1 + 1);
+       va_start (_va_list_variantv, _first_variantv);
+       _variantv_element = _first_variantv;
+       while (_variantv_element != NULL) {
+               _vala_array_add10 (&variantv, &variantv_length1, &_variantv_size_, _variantv_element);
+               _variantv_element = va_arg (_va_list_variantv, GVariant*);
+       }
+       va_end (_va_list_variantv);
+       _vala_assert (variantv_length1 == 3, "variantv.length == 3");
+       _tmp0_ = variantv[0];
+       _tmp1_ = _variant_get4 (_tmp0_);
+       _tmp2_ = _tmp1_;
+       _vala_assert (g_strcmp0 (_tmp2_, "foo") == 0, "(string) variantv[0] == \"foo\"");
+       _g_free0 (_tmp2_);
+       _tmp3_ = variantv[1];
+       _tmp4_ = _variant_get5 (_tmp3_);
+       _vala_assert (_tmp4_ == 4711, "(int) variantv[1] == 4711");
+       _tmp5_ = variantv[2];
+       _tmp6_ = _variant_get6 (_tmp5_);
+       _vala_assert (_tmp6_ == 3.1415, "(double) variantv[2] == 3.1415");
+       variantv = (g_free (variantv), NULL);
+}
+
+static GVariant*
+_variant_new1 (const gchar* value)
+{
+       return g_variant_ref_sink (g_variant_new_string (value));
+}
+
+static GVariant*
+_variant_new2 (gint value)
+{
+       return g_variant_ref_sink (g_variant_new_int32 (value));
+}
+
+static GVariant*
+_variant_new3 (gdouble value)
+{
+       return g_variant_ref_sink (g_variant_new_double (value));
+}
+
+static GVariant*
+_variant_new4 (const gchar* value)
+{
+       return g_variant_ref_sink (g_variant_new_string (value));
+}
+
+static GVariant*
+_variant_new5 (gint value)
+{
+       return g_variant_ref_sink (g_variant_new_int32 (value));
+}
+
+static GVariant*
+_variant_new6 (gdouble value)
+{
+       return g_variant_ref_sink (g_variant_new_double (value));
+}
+
+static void
+_vala_main (void)
+{
+       Foo* f = NULL;
+       Foo* _tmp0_;
+       Foo* _tmp1_;
+       GValue* _tmp2_ = NULL;
+       GValue* _tmp3_ = NULL;
+       GValue* _tmp4_ = NULL;
+       Foo* _tmp5_;
+       GValue* _tmp6_ = NULL;
+       GValue* _tmp7_ = NULL;
+       GValue* _tmp8_ = NULL;
+       Foo* _tmp9_;
+       GVariant* _tmp10_;
+       GVariant* _tmp11_;
+       GVariant* _tmp12_;
+       Foo* _tmp13_;
+       GValue* _tmp14_ = NULL;
+       GValue* _tmp15_ = NULL;
+       GValue* _tmp16_ = NULL;
+       GValue* _tmp17_ = NULL;
+       GValue* _tmp18_ = NULL;
+       GValue* _tmp19_ = NULL;
+       GVariant* _tmp20_;
+       GVariant* _tmp21_;
+       GVariant* _tmp22_;
+       _tmp0_ = foo_new ("foo", "bar", "manam", NULL);
+       _foo_unref0 (f);
+       f = _tmp0_;
+       _tmp1_ = foo_new_bar (23, 42, 4711, NULL);
+       _foo_unref0 (f);
+       f = _tmp1_;
+       _tmp2_ = g_new0 (GValue, 1);
+       g_value_init (_tmp2_, G_TYPE_STRING);
+       g_value_set_string (_tmp2_, "foo");
+       _tmp3_ = g_new0 (GValue, 1);
+       g_value_init (_tmp3_, G_TYPE_INT);
+       g_value_set_int (_tmp3_, 4711);
+       _tmp4_ = g_new0 (GValue, 1);
+       g_value_init (_tmp4_, G_TYPE_DOUBLE);
+       g_value_set_double (_tmp4_, 3.1415);
+       _tmp5_ = foo_new_manam (_tmp2_, _tmp3_, _tmp4_, NULL);
+       _foo_unref0 (f);
+       f = _tmp5_;
+       __vala_GValue_free0 (_tmp4_);
+       __vala_GValue_free0 (_tmp3_);
+       __vala_GValue_free0 (_tmp2_);
+       _tmp6_ = g_new0 (GValue, 1);
+       g_value_init (_tmp6_, G_TYPE_STRING);
+       g_value_set_string (_tmp6_, "foo");
+       _tmp7_ = g_new0 (GValue, 1);
+       g_value_init (_tmp7_, G_TYPE_INT);
+       g_value_set_int (_tmp7_, 4711);
+       _tmp8_ = g_new0 (GValue, 1);
+       g_value_init (_tmp8_, G_TYPE_DOUBLE);
+       g_value_set_double (_tmp8_, 3.1415);
+       _tmp9_ = foo_new_manam_owned (_tmp6_, _tmp7_, _tmp8_, NULL);
+       _foo_unref0 (f);
+       f = _tmp9_;
+       _tmp10_ = _variant_new1 ("foo");
+       _tmp11_ = _variant_new2 (4711);
+       _tmp12_ = _variant_new3 (3.1415);
+       _tmp13_ = foo_new_minim (_tmp10_, _tmp11_, _tmp12_, NULL);
+       _foo_unref0 (f);
+       f = _tmp13_;
+       _g_variant_unref0 (_tmp12_);
+       _g_variant_unref0 (_tmp11_);
+       _g_variant_unref0 (_tmp10_);
+       foo ("foo", "bar", "manam", NULL);
+       bar (23, 42, 4711, NULL);
+       _tmp14_ = g_new0 (GValue, 1);
+       g_value_init (_tmp14_, G_TYPE_STRING);
+       g_value_set_string (_tmp14_, "foo");
+       _tmp15_ = g_new0 (GValue, 1);
+       g_value_init (_tmp15_, G_TYPE_INT);
+       g_value_set_int (_tmp15_, 4711);
+       _tmp16_ = g_new0 (GValue, 1);
+       g_value_init (_tmp16_, G_TYPE_DOUBLE);
+       g_value_set_double (_tmp16_, 3.1415);
+       manam (_tmp14_, _tmp15_, _tmp16_, NULL);
+       __vala_GValue_free0 (_tmp16_);
+       __vala_GValue_free0 (_tmp15_);
+       __vala_GValue_free0 (_tmp14_);
+       _tmp17_ = g_new0 (GValue, 1);
+       g_value_init (_tmp17_, G_TYPE_STRING);
+       g_value_set_string (_tmp17_, "foo");
+       _tmp18_ = g_new0 (GValue, 1);
+       g_value_init (_tmp18_, G_TYPE_INT);
+       g_value_set_int (_tmp18_, 4711);
+       _tmp19_ = g_new0 (GValue, 1);
+       g_value_init (_tmp19_, G_TYPE_DOUBLE);
+       g_value_set_double (_tmp19_, 3.1415);
+       manam_owned (_tmp17_, _tmp18_, _tmp19_, NULL);
+       _tmp20_ = _variant_new4 ("foo");
+       _tmp21_ = _variant_new5 (4711);
+       _tmp22_ = _variant_new6 (3.1415);
+       minim (_tmp20_, _tmp21_, _tmp22_, NULL);
+       _g_variant_unref0 (_tmp22_);
+       _g_variant_unref0 (_tmp21_);
+       _g_variant_unref0 (_tmp20_);
+       _foo_unref0 (f);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/methods/postconditions-temp-variables.c-expected 
b/tests/methods/postconditions-temp-variables.c-expected
new file mode 100644
index 000000000..2609bcf30
--- /dev/null
+++ b/tests/methods/postconditions-temp-variables.c-expected
@@ -0,0 +1,107 @@
+/* methods_postconditions_temp_variables.c generated by valac, the Vala compiler
+ * generated from methods_postconditions_temp_variables.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN gchar* foo (void);
+VALA_EXTERN gchar* bar (gboolean b);
+static void _vala_main (void);
+
+static const gchar*
+string_to_string (const gchar* self)
+{
+       const gchar* result = NULL;
+       g_return_val_if_fail (self != NULL, NULL);
+       result = self;
+       return result;
+}
+
+gchar*
+foo (void)
+{
+       gchar* _tmp0_;
+       const gchar* _tmp1_;
+       gchar* result = NULL;
+       _tmp0_ = g_strdup_printf ("%i", 4711);
+       result = _tmp0_;
+       _tmp1_ = string_to_string (result);
+       _vala_warn_if_fail (g_strcmp0 (_tmp1_, "23") != 0, "result.to_string () != \"23\"");
+       return result;
+}
+
+gchar*
+bar (gboolean b)
+{
+       gchar* result = NULL;
+       if (b) {
+               gchar* _tmp0_;
+               const gchar* _tmp1_;
+               const gchar* _tmp2_;
+               _tmp0_ = g_strdup_printf ("%i", 23);
+               result = _tmp0_;
+               _tmp1_ = result;
+               _tmp2_ = string_to_string (_tmp1_);
+               _vala_warn_if_fail (g_strcmp0 (_tmp2_, "4711") != 0, "result.to_string () != \"4711\"");
+               return result;
+       } else {
+               gchar* _tmp3_;
+               const gchar* _tmp4_;
+               const gchar* _tmp5_;
+               _tmp3_ = g_strdup_printf ("%i", 42);
+               result = _tmp3_;
+               _tmp4_ = result;
+               _tmp5_ = string_to_string (_tmp4_);
+               _vala_warn_if_fail (g_strcmp0 (_tmp5_, "4711") != 0, "result.to_string () != \"4711\"");
+               return result;
+       }
+}
+
+static void
+_vala_main (void)
+{
+       gchar* _tmp0_;
+       gchar* _tmp1_;
+       gchar* _tmp2_;
+       gchar* _tmp3_;
+       gchar* _tmp4_;
+       gchar* _tmp5_;
+       _tmp0_ = foo ();
+       _tmp1_ = _tmp0_;
+       _vala_assert (g_strcmp0 (_tmp1_, "4711") == 0, "foo () == \"4711\"");
+       _g_free0 (_tmp1_);
+       _tmp2_ = bar (TRUE);
+       _tmp3_ = _tmp2_;
+       _vala_assert (g_strcmp0 (_tmp3_, "23") == 0, "bar (true) == \"23\"");
+       _g_free0 (_tmp3_);
+       _tmp4_ = bar (FALSE);
+       _tmp5_ = _tmp4_;
+       _vala_assert (g_strcmp0 (_tmp5_, "42") == 0, "bar (false) == \"42\"");
+       _g_free0 (_tmp5_);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/postconditions.c-expected b/tests/methods/postconditions.c-expected
new file mode 100644
index 000000000..0dc918850
--- /dev/null
+++ b/tests/methods/postconditions.c-expected
@@ -0,0 +1,370 @@
+/* methods_postconditions.c generated by valac, the Vala compiler
+ * generated from methods_postconditions.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN void foo (gchar** a,
+          gint a_length1);
+VALA_EXTERN void foz (gchar*** a,
+          gint* a_length1);
+VALA_EXTERN void fom (gchar*** a,
+          gint* a_length1);
+VALA_EXTERN gchar** bar (gchar** a,
+             gint a_length1,
+             gint* result_length1);
+VALA_EXTERN gchar** baz (gchar*** a,
+             gint* a_length1,
+             gint* result_length1);
+VALA_EXTERN gchar** bam (gchar*** a,
+             gint* a_length1,
+             gint* result_length1);
+static void _vala_main (void);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+void
+foo (gchar** a,
+     gint a_length1)
+{
+       const gchar* _tmp0_;
+       _tmp0_ = a[1];
+       _vala_warn_if_fail (g_strcmp0 (_tmp0_, "bar") == 0, "a[1] == \"bar\"");
+       a = (_vala_array_free (a, a_length1, (GDestroyNotify) g_free), NULL);
+}
+
+void
+foz (gchar*** a,
+     gint* a_length1)
+{
+       gchar* _tmp0_;
+       gchar* _tmp1_;
+       gchar** _tmp2_;
+       const gchar* _tmp3_;
+       _tmp0_ = g_strdup ("foo");
+       _tmp1_ = g_strdup ("bar");
+       _tmp2_ = g_new0 (gchar*, 2 + 1);
+       _tmp2_[0] = _tmp0_;
+       _tmp2_[1] = _tmp1_;
+       *a = (_vala_array_free (*a, *a_length1, (GDestroyNotify) g_free), NULL);
+       *a = _tmp2_;
+       *a_length1 = 2;
+       _tmp3_ = (*a)[1];
+       _vala_warn_if_fail (g_strcmp0 (_tmp3_, "bar") == 0, "a[1] == \"bar\"");
+}
+
+void
+fom (gchar*** a,
+     gint* a_length1)
+{
+       gchar** _vala_a = NULL;
+       gint _vala_a_length1 = 0;
+       gchar* _tmp0_;
+       gchar* _tmp1_;
+       gchar** _tmp2_;
+       const gchar* _tmp3_;
+       _tmp0_ = g_strdup ("foo");
+       _tmp1_ = g_strdup ("bar");
+       _tmp2_ = g_new0 (gchar*, 2 + 1);
+       _tmp2_[0] = _tmp0_;
+       _tmp2_[1] = _tmp1_;
+       _vala_a = (_vala_array_free (_vala_a, _vala_a_length1, (GDestroyNotify) g_free), NULL);
+       _vala_a = _tmp2_;
+       _vala_a_length1 = 2;
+       _tmp3_ = _vala_a[1];
+       _vala_warn_if_fail (g_strcmp0 (_tmp3_, "bar") == 0, "a[1] == \"bar\"");
+       if (a) {
+               *a = _vala_a;
+       } else {
+               _vala_a = (_vala_array_free (_vala_a, _vala_a_length1, (GDestroyNotify) g_free), NULL);
+       }
+       if (a_length1) {
+               *a_length1 = _vala_a_length1;
+       }
+}
+
+gchar**
+bar (gchar** a,
+     gint a_length1,
+     gint* result_length1)
+{
+       gchar* _tmp0_;
+       gchar** _tmp1_;
+       gchar** _tmp2_;
+       gint _tmp2__length1;
+       const gchar* _tmp3_;
+       const gchar* _tmp4_;
+       gchar** result = NULL;
+       _tmp0_ = g_strdup ("manam");
+       _tmp1_ = g_new0 (gchar*, 1 + 1);
+       _tmp1_[0] = _tmp0_;
+       _tmp2_ = _tmp1_;
+       _tmp2__length1 = 1;
+       if (result_length1) {
+               *result_length1 = _tmp2__length1;
+       }
+       result = _tmp2_;
+       _tmp3_ = result[0];
+       _tmp4_ = a[1];
+       _vala_warn_if_fail ((g_strcmp0 (_tmp3_, "manam") == 0) && (g_strcmp0 (_tmp4_, "foo") == 0), 
"result[0] == \"manam\" && a[1] == \"foo\"");
+       a = (_vala_array_free (a, a_length1, (GDestroyNotify) g_free), NULL);
+       return result;
+}
+
+gchar**
+baz (gchar*** a,
+     gint* a_length1,
+     gint* result_length1)
+{
+       gchar* _tmp0_;
+       gchar* _tmp1_;
+       gchar** _tmp2_;
+       gchar* _tmp3_;
+       gchar** _tmp4_;
+       gchar** _tmp5_;
+       gint _tmp5__length1;
+       const gchar* _tmp6_;
+       const gchar* _tmp7_;
+       gchar** result = NULL;
+       _tmp0_ = g_strdup ("bar");
+       _tmp1_ = g_strdup ("foo");
+       _tmp2_ = g_new0 (gchar*, 2 + 1);
+       _tmp2_[0] = _tmp0_;
+       _tmp2_[1] = _tmp1_;
+       *a = (_vala_array_free (*a, *a_length1, (GDestroyNotify) g_free), NULL);
+       *a = _tmp2_;
+       *a_length1 = 2;
+       _tmp3_ = g_strdup ("manam");
+       _tmp4_ = g_new0 (gchar*, 1 + 1);
+       _tmp4_[0] = _tmp3_;
+       _tmp5_ = _tmp4_;
+       _tmp5__length1 = 1;
+       if (result_length1) {
+               *result_length1 = _tmp5__length1;
+       }
+       result = _tmp5_;
+       _tmp6_ = result[0];
+       _tmp7_ = (*a)[1];
+       _vala_warn_if_fail ((g_strcmp0 (_tmp6_, "manam") == 0) && (g_strcmp0 (_tmp7_, "foo") == 0), 
"result[0] == \"manam\" && a[1] == \"foo\"");
+       return result;
+}
+
+gchar**
+bam (gchar*** a,
+     gint* a_length1,
+     gint* result_length1)
+{
+       gchar** _vala_a = NULL;
+       gint _vala_a_length1 = 0;
+       gchar* _tmp0_;
+       gchar* _tmp1_;
+       gchar** _tmp2_;
+       gchar* _tmp3_;
+       gchar** _tmp4_;
+       gchar** _tmp5_;
+       gint _tmp5__length1;
+       const gchar* _tmp6_;
+       const gchar* _tmp7_;
+       gchar** result = NULL;
+       _tmp0_ = g_strdup ("bar");
+       _tmp1_ = g_strdup ("foo");
+       _tmp2_ = g_new0 (gchar*, 2 + 1);
+       _tmp2_[0] = _tmp0_;
+       _tmp2_[1] = _tmp1_;
+       _vala_a = (_vala_array_free (_vala_a, _vala_a_length1, (GDestroyNotify) g_free), NULL);
+       _vala_a = _tmp2_;
+       _vala_a_length1 = 2;
+       _tmp3_ = g_strdup ("manam");
+       _tmp4_ = g_new0 (gchar*, 1 + 1);
+       _tmp4_[0] = _tmp3_;
+       _tmp5_ = _tmp4_;
+       _tmp5__length1 = 1;
+       if (result_length1) {
+               *result_length1 = _tmp5__length1;
+       }
+       result = _tmp5_;
+       _tmp6_ = result[0];
+       _tmp7_ = _vala_a[1];
+       _vala_warn_if_fail ((g_strcmp0 (_tmp6_, "manam") == 0) && (g_strcmp0 (_tmp7_, "foo") == 0), 
"result[0] == \"manam\" && a[1] == \"foo\"");
+       if (a) {
+               *a = _vala_a;
+       } else {
+               _vala_a = (_vala_array_free (_vala_a, _vala_a_length1, (GDestroyNotify) g_free), NULL);
+       }
+       if (a_length1) {
+               *a_length1 = _vala_a_length1;
+       }
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       {
+               gchar* _tmp0_;
+               gchar* _tmp1_;
+               gchar** _tmp2_;
+               _tmp0_ = g_strdup ("foo");
+               _tmp1_ = g_strdup ("bar");
+               _tmp2_ = g_new0 (gchar*, 2 + 1);
+               _tmp2_[0] = _tmp0_;
+               _tmp2_[1] = _tmp1_;
+               foo (_tmp2_, (gint) 2);
+       }
+       {
+               gchar** a = NULL;
+               gchar** _tmp3_;
+               gint a_length1;
+               gint _a_size_;
+               gchar** _tmp4_;
+               gint _tmp4__length1;
+               const gchar* _tmp5_;
+               _tmp3_ = g_new0 (gchar*, 0 + 1);
+               a = _tmp3_;
+               a_length1 = 0;
+               _a_size_ = a_length1;
+               foz (&a, (gint*) (&a_length1));
+               _a_size_ = a_length1;
+               _tmp4_ = a;
+               _tmp4__length1 = a_length1;
+               _tmp5_ = _tmp4_[0];
+               _vala_assert (g_strcmp0 (_tmp5_, "foo") == 0, "a[0] == \"foo\"");
+               a = (_vala_array_free (a, a_length1, (GDestroyNotify) g_free), NULL);
+       }
+       {
+               gchar** a = NULL;
+               gint a_length1 = 0;
+               gint _a_size_ = 0;
+               gchar** _tmp6_ = NULL;
+               gint _tmp7_ = 0;
+               const gchar* _tmp8_;
+               fom (&_tmp6_, &_tmp7_);
+               a = (_vala_array_free (a, a_length1, (GDestroyNotify) g_free), NULL);
+               a = _tmp6_;
+               a_length1 = _tmp7_;
+               _a_size_ = a_length1;
+               _tmp8_ = a[0];
+               _vala_assert (g_strcmp0 (_tmp8_, "foo") == 0, "a[0] == \"foo\"");
+               a = (_vala_array_free (a, a_length1, (GDestroyNotify) g_free), NULL);
+       }
+       {
+               gchar* _tmp9_;
+               gchar* _tmp10_;
+               gchar** _tmp11_;
+               gint _tmp12_ = 0;
+               gchar** _tmp13_;
+               gchar** _tmp14_;
+               gint _tmp14__length1;
+               const gchar* _tmp15_;
+               _tmp9_ = g_strdup ("bar");
+               _tmp10_ = g_strdup ("foo");
+               _tmp11_ = g_new0 (gchar*, 2 + 1);
+               _tmp11_[0] = _tmp9_;
+               _tmp11_[1] = _tmp10_;
+               _tmp13_ = bar (_tmp11_, (gint) 2, &_tmp12_);
+               _tmp14_ = _tmp13_;
+               _tmp14__length1 = _tmp12_;
+               _tmp15_ = _tmp14_[0];
+               _vala_assert (g_strcmp0 (_tmp15_, "manam") == 0, "bar ({ \"bar\", \"foo\" })[0] == 
\"manam\"");
+               _tmp14_ = (_vala_array_free (_tmp14_, _tmp14__length1, (GDestroyNotify) g_free), NULL);
+       }
+       {
+               gchar** a = NULL;
+               gchar** _tmp16_;
+               gint a_length1;
+               gint _a_size_;
+               gint _tmp17_ = 0;
+               gchar** _tmp18_;
+               gchar** _tmp19_;
+               gint _tmp19__length1;
+               const gchar* _tmp20_;
+               _tmp16_ = g_new0 (gchar*, 0 + 1);
+               a = _tmp16_;
+               a_length1 = 0;
+               _a_size_ = a_length1;
+               _tmp18_ = baz (&a, (gint*) (&a_length1), &_tmp17_);
+               _a_size_ = a_length1;
+               _tmp19_ = _tmp18_;
+               _tmp19__length1 = _tmp17_;
+               _tmp20_ = _tmp19_[0];
+               _vala_assert (g_strcmp0 (_tmp20_, "manam") == 0, "baz (ref a)[0] == \"manam\"");
+               _tmp19_ = (_vala_array_free (_tmp19_, _tmp19__length1, (GDestroyNotify) g_free), NULL);
+               a = (_vala_array_free (a, a_length1, (GDestroyNotify) g_free), NULL);
+       }
+       {
+               gchar** a = NULL;
+               gint a_length1 = 0;
+               gint _a_size_ = 0;
+               gchar** _tmp21_ = NULL;
+               gint _tmp22_ = 0;
+               gint _tmp23_ = 0;
+               gchar** _tmp24_;
+               gchar** _tmp25_;
+               gint _tmp25__length1;
+               const gchar* _tmp26_;
+               _tmp24_ = bam (&_tmp21_, &_tmp22_, &_tmp23_);
+               a = (_vala_array_free (a, a_length1, (GDestroyNotify) g_free), NULL);
+               a = _tmp21_;
+               a_length1 = _tmp22_;
+               _a_size_ = a_length1;
+               _tmp25_ = _tmp24_;
+               _tmp25__length1 = _tmp23_;
+               _tmp26_ = _tmp25_[0];
+               _vala_assert (g_strcmp0 (_tmp26_, "manam") == 0, "bam (out a)[0] == \"manam\"");
+               _tmp25_ = (_vala_array_free (_tmp25_, _tmp25__length1, (GDestroyNotify) g_free), NULL);
+               a = (_vala_array_free (a, a_length1, (GDestroyNotify) g_free), NULL);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/methods/preconditions-temp-variables.c-expected 
b/tests/methods/preconditions-temp-variables.c-expected
new file mode 100644
index 000000000..f8436bb26
--- /dev/null
+++ b/tests/methods/preconditions-temp-variables.c-expected
@@ -0,0 +1,74 @@
+/* methods_preconditions_temp_variables.c generated by valac, the Vala compiler
+ * generated from methods_preconditions_temp_variables.vala, do not modify */
+
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN gchar* foo (gint i);
+static void _vala_main (void);
+
+gchar*
+foo (gint i)
+{
+       gchar* _tmp0_;
+       gchar* _tmp1_;
+       gchar* _tmp2_;
+       gchar* _tmp3_;
+       gchar* _tmp4_;
+       gchar* _tmp5_;
+       gchar* result = NULL;
+       _tmp0_ = g_strdup_printf ("%i", i);
+       _tmp1_ = _tmp0_;
+       _tmp2_ = g_strdup_printf ("%i", i);
+       _tmp3_ = _tmp2_;
+       _vala_return_val_if_fail ((g_strcmp0 (_tmp1_, "23") == 0) || (g_strcmp0 (_tmp3_, "42") == 0), 
"i.to_string () == \"23\" || i.to_string () == \"42\"", NULL);
+       _tmp4_ = g_strdup_printf ("%i", i);
+       _tmp5_ = _tmp4_;
+       _g_free0 (_tmp3_);
+       _g_free0 (_tmp1_);
+       result = _tmp5_;
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       gchar* _tmp0_;
+       gchar* _tmp1_;
+       gchar* _tmp2_;
+       gchar* _tmp3_;
+       _tmp0_ = foo (23);
+       _tmp1_ = _tmp0_;
+       _vala_assert (g_strcmp0 (_tmp1_, "23") == 0, "foo (23) == \"23\"");
+       _g_free0 (_tmp1_);
+       _tmp2_ = foo (42);
+       _tmp3_ = _tmp2_;
+       _vala_assert (g_strcmp0 (_tmp3_, "42") == 0, "foo (42) == \"42\"");
+       _g_free0 (_tmp3_);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/prepostconditions-captured.c-expected 
b/tests/methods/prepostconditions-captured.c-expected
new file mode 100644
index 000000000..829c31743
--- /dev/null
+++ b/tests/methods/prepostconditions-captured.c-expected
@@ -0,0 +1,302 @@
+/* methods_prepostconditions_captured.c generated by valac, the Vala compiler
+ * generated from methods_prepostconditions_captured.vala, do not modify */
+
+#include <glib.h>
+#include <gio/gio.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef void (*Func) (gpointer user_data);
+typedef struct _Block1Data Block1Data;
+typedef struct _Block2Data Block2Data;
+typedef struct _Block3Data Block3Data;
+typedef struct _FooData FooData;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Block1Data {
+       int _ref_count_;
+       gint i;
+};
+
+struct _Block2Data {
+       int _ref_count_;
+       gint i;
+};
+
+struct _Block3Data {
+       int _ref_count_;
+       gint i;
+       gpointer _async_data_;
+};
+
+struct _FooData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       gint i;
+       gint result;
+       Block3Data* _data3_;
+       Func f;
+       gpointer f_target;
+       GDestroyNotify f_target_destroy_notify;
+};
+
+VALA_EXTERN gint bar (gint i);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static void __lambda4_ (Block1Data* _data1_);
+static void ___lambda4__func (gpointer self);
+VALA_EXTERN void baz (gint i);
+static Block2Data* block2_data_ref (Block2Data* _data2_);
+static void block2_data_unref (void * _userdata_);
+static void __lambda5_ (Block2Data* _data2_);
+static void ___lambda5__func (gpointer self);
+static void foo_data_free (gpointer _data);
+VALA_EXTERN void foo (gint i,
+          GAsyncReadyCallback _callback_,
+          gpointer _user_data_);
+VALA_EXTERN gint foo_finish (GAsyncResult* _res_);
+static gboolean foo_co (FooData* _data_);
+static Block3Data* block3_data_ref (Block3Data* _data3_);
+static void block3_data_unref (void * _userdata_);
+static void __lambda6_ (Block3Data* _data3_);
+static void ___lambda6__func (gpointer self);
+static void _vala_main (void);
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static void
+__lambda4_ (Block1Data* _data1_)
+{
+       _vala_assert (_data1_->i == 23, "i == 23");
+       _data1_->i = 42;
+}
+
+static void
+___lambda4__func (gpointer self)
+{
+       __lambda4_ (self);
+}
+
+gint
+bar (gint i)
+{
+       Block1Data* _data1_;
+       Func f = NULL;
+       gpointer f_target;
+       GDestroyNotify f_target_destroy_notify;
+       gint result = 0;
+       _vala_return_val_if_fail (i == 23, "i == 23", 0);
+       _data1_ = g_slice_new0 (Block1Data);
+       _data1_->_ref_count_ = 1;
+       _data1_->i = i;
+       f = ___lambda4__func;
+       f_target = block1_data_ref (_data1_);
+       f_target_destroy_notify = block1_data_unref;
+       f (f_target);
+       result = _data1_->i;
+       _vala_warn_if_fail (_data1_->i == 42, "i == 42");
+       (f_target_destroy_notify == NULL) ? NULL : (f_target_destroy_notify (f_target), NULL);
+       f = NULL;
+       f_target = NULL;
+       f_target_destroy_notify = NULL;
+       block1_data_unref (_data1_);
+       _data1_ = NULL;
+       return result;
+}
+
+static Block2Data*
+block2_data_ref (Block2Data* _data2_)
+{
+       g_atomic_int_inc (&_data2_->_ref_count_);
+       return _data2_;
+}
+
+static void
+block2_data_unref (void * _userdata_)
+{
+       Block2Data* _data2_;
+       _data2_ = (Block2Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data2_->_ref_count_)) {
+               g_slice_free (Block2Data, _data2_);
+       }
+}
+
+static void
+__lambda5_ (Block2Data* _data2_)
+{
+       _vala_assert (_data2_->i == 42, "i == 42");
+       _data2_->i = 23;
+}
+
+static void
+___lambda5__func (gpointer self)
+{
+       __lambda5_ (self);
+}
+
+void
+baz (gint i)
+{
+       Block2Data* _data2_;
+       Func f = NULL;
+       gpointer f_target;
+       GDestroyNotify f_target_destroy_notify;
+       _vala_return_if_fail (i == 42, "i == 42");
+       _data2_ = g_slice_new0 (Block2Data);
+       _data2_->_ref_count_ = 1;
+       _data2_->i = i;
+       f = ___lambda5__func;
+       f_target = block2_data_ref (_data2_);
+       f_target_destroy_notify = block2_data_unref;
+       f (f_target);
+       _vala_warn_if_fail (_data2_->i == 23, "i == 23");
+       (f_target_destroy_notify == NULL) ? NULL : (f_target_destroy_notify (f_target), NULL);
+       f = NULL;
+       f_target = NULL;
+       f_target_destroy_notify = NULL;
+       block2_data_unref (_data2_);
+       _data2_ = NULL;
+}
+
+static void
+foo_data_free (gpointer _data)
+{
+       FooData* _data_;
+       _data_ = _data;
+       g_slice_free (FooData, _data_);
+}
+
+void
+foo (gint i,
+     GAsyncReadyCallback _callback_,
+     gpointer _user_data_)
+{
+       FooData* _data_;
+       _data_ = g_slice_new0 (FooData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, foo_data_free);
+       _data_->i = i;
+       foo_co (_data_);
+}
+
+gint
+foo_finish (GAsyncResult* _res_)
+{
+       gint result;
+       FooData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+       result = _data_->result;
+       return result;
+}
+
+static Block3Data*
+block3_data_ref (Block3Data* _data3_)
+{
+       g_atomic_int_inc (&_data3_->_ref_count_);
+       return _data3_;
+}
+
+static void
+block3_data_unref (void * _userdata_)
+{
+       Block3Data* _data3_;
+       _data3_ = (Block3Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data3_->_ref_count_)) {
+               g_slice_free (Block3Data, _data3_);
+       }
+}
+
+static void
+__lambda6_ (Block3Data* _data3_)
+{
+       _vala_assert (_data3_->i == 23, "i == 23");
+       _data3_->i = 42;
+}
+
+static void
+___lambda6__func (gpointer self)
+{
+       __lambda6_ (self);
+}
+
+static gboolean
+foo_co (FooData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _vala_return_val_if_fail (_data_->i == 23, "i == 23", FALSE);
+       _data_->_data3_ = g_slice_new0 (Block3Data);
+       _data_->_data3_->_ref_count_ = 1;
+       _data_->_data3_->i = _data_->i;
+       _data_->_data3_->_async_data_ = _data_;
+       _data_->f = ___lambda6__func;
+       _data_->f_target = block3_data_ref (_data_->_data3_);
+       _data_->f_target_destroy_notify = block3_data_unref;
+       _data_->f (_data_->f_target);
+       _data_->result = _data_->_data3_->i;
+       _vala_warn_if_fail (_data_->_data3_->i == 42, "i == 42");
+       (_data_->f_target_destroy_notify == NULL) ? NULL : (_data_->f_target_destroy_notify 
(_data_->f_target), NULL);
+       _data_->f = NULL;
+       _data_->f_target = NULL;
+       _data_->f_target_destroy_notify = NULL;
+       block3_data_unref (_data_->_data3_);
+       _data_->_data3_ = NULL;
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+_vala_main (void)
+{
+       _vala_assert (bar (23) == 42, "bar (23) == 42");
+       baz (42);
+       foo (23, NULL, NULL);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/prepostconditions.c-expected b/tests/methods/prepostconditions.c-expected
new file mode 100644
index 000000000..a0c565293
--- /dev/null
+++ b/tests/methods/prepostconditions.c-expected
@@ -0,0 +1,633 @@
+/* methods_prepostconditions.c generated by valac, the Vala compiler
+ * generated from methods_prepostconditions.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+#define TYPE_BAR (bar_get_type ())
+typedef struct _Bar Bar;
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+       gboolean ensured;
+       gboolean required;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+       gint (*manam) (Foo* self, gint i);
+       gint (*manam_pre) (Foo* self, gint i);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+struct _Bar {
+       gboolean ensured;
+       gboolean required;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN gint foo_manam (Foo* self,
+                gint i);
+VALA_EXTERN gint foo_manam_pre (Foo* self,
+                    gint i);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+VALA_EXTERN Foo* foo_new_post (void);
+VALA_EXTERN Foo* foo_construct_post (GType object_type);
+VALA_EXTERN void foo_foo (Foo* self);
+VALA_EXTERN gchar* foo_bar (Foo* self);
+VALA_EXTERN void foo_foo_pre (Foo* self,
+                  gint i);
+VALA_EXTERN gint foo_bar_pre (Foo* self,
+                  gint i);
+VALA_EXTERN gint foo_faz (Foo* self,
+              gint i);
+VALA_EXTERN gint foo_faz_pre (Foo* self,
+                  gint i);
+static gint foo_real_manam (Foo* self,
+                     gint i);
+static gint foo_real_manam_pre (Foo* self,
+                         gint i);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Bar* bar_dup (const Bar* self);
+VALA_EXTERN void bar_free (Bar* self);
+VALA_EXTERN void bar_init (Bar *self);
+VALA_EXTERN void bar_init_post (Bar *self);
+VALA_EXTERN void bar_bar (Bar *self);
+VALA_EXTERN gchar* bar_foo (Bar *self);
+static void _vala_main (void);
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       self->required = TRUE;
+       _vala_return_val_if_fail (self->required, "required = true", NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+Foo*
+foo_construct_post (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       self->ensured = TRUE;
+       _vala_warn_if_fail (self->ensured, "ensured = true");
+       return self;
+}
+
+Foo*
+foo_new_post (void)
+{
+       return foo_construct_post (TYPE_FOO);
+}
+
+void
+foo_foo (Foo* self)
+{
+       g_return_if_fail (IS_FOO (self));
+       self->ensured = TRUE;
+       _vala_warn_if_fail (self->ensured, "ensured = true");
+}
+
+gchar*
+foo_bar (Foo* self)
+{
+       gchar* _tmp0_;
+       gint _tmp1_;
+       gint _tmp2_;
+       gchar* result = NULL;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = g_strdup ("bar");
+       result = _tmp0_;
+       _tmp1_ = strlen (result);
+       _tmp2_ = _tmp1_;
+       _vala_warn_if_fail (_tmp2_ >= 3, "result.length >= 3");
+       return result;
+}
+
+void
+foo_foo_pre (Foo* self,
+             gint i)
+{
+       g_return_if_fail (IS_FOO (self));
+       _vala_return_if_fail (i > 23, "i > 23");
+       _vala_assert (i == 42, "i == 42");
+}
+
+gint
+foo_bar_pre (Foo* self,
+             gint i)
+{
+       gint result = 0;
+       g_return_val_if_fail (IS_FOO (self), 0);
+       _vala_return_val_if_fail (i > 42, "i > 42", 0);
+       _vala_assert (i == 4711, "i == 4711");
+       result = i;
+       return result;
+}
+
+gint
+foo_faz (Foo* self,
+         gint i)
+{
+       gint result = 0;
+       g_return_val_if_fail (IS_FOO (self), 0);
+       switch (i) {
+               case 42:
+               {
+                       result = i;
+                       _vala_warn_if_fail (result > 23, "result > 23");
+                       return result;
+               }
+               default:
+               {
+                       g_assert_not_reached ();
+               }
+       }
+}
+
+gint
+foo_faz_pre (Foo* self,
+             gint i)
+{
+       gint result = 0;
+       g_return_val_if_fail (IS_FOO (self), 0);
+       _vala_return_val_if_fail (i > 23, "i > 23", 0);
+       switch (i) {
+               case 4711:
+               {
+                       result = i;
+                       return result;
+               }
+               default:
+               {
+                       g_assert_not_reached ();
+               }
+       }
+}
+
+static gint
+foo_real_manam (Foo* self,
+                gint i)
+{
+       gint result = 0;
+       switch (i) {
+               case 67:
+               {
+                       result = i;
+                       _vala_warn_if_fail (result > 23, "result > 23");
+                       return result;
+               }
+               default:
+               {
+                       g_assert_not_reached ();
+               }
+       }
+}
+
+gint
+foo_manam (Foo* self,
+           gint i)
+{
+       FooClass* _klass_;
+       g_return_val_if_fail (IS_FOO (self), 0);
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->manam) {
+               gint result;
+               result = _klass_->manam (self, i);
+               _vala_warn_if_fail (result > 23, "result > 23");
+               return result;
+       }
+       return -1;
+}
+
+static gint
+foo_real_manam_pre (Foo* self,
+                    gint i)
+{
+       gint result = 0;
+       _vala_return_val_if_fail (i > 23, "i > 23", 0);
+       switch (i) {
+               case 231:
+               {
+                       result = i;
+                       return result;
+               }
+               default:
+               {
+                       g_assert_not_reached ();
+               }
+       }
+}
+
+gint
+foo_manam_pre (Foo* self,
+               gint i)
+{
+       FooClass* _klass_;
+       g_return_val_if_fail (IS_FOO (self), 0);
+       _vala_return_val_if_fail (i > 23, "i > 23", 0);
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->manam_pre) {
+               return _klass_->manam_pre (self, i);
+       }
+       return -1;
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       ((FooClass *) klass)->manam = (gint (*) (Foo*, gint)) foo_real_manam;
+       ((FooClass *) klass)->manam_pre = (gint (*) (Foo*, gint)) foo_real_manam_pre;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ensured = FALSE;
+       self->required = FALSE;
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+void
+bar_init (Bar *self)
+{
+       memset (self, 0, sizeof (Bar));
+       (*self).required = TRUE;
+       _vala_return_if_fail ((*self).required, "required = true");
+}
+
+void
+bar_init_post (Bar *self)
+{
+       memset (self, 0, sizeof (Bar));
+       (*self).ensured = TRUE;
+       _vala_warn_if_fail ((*self).ensured, "ensured = true");
+}
+
+void
+bar_bar (Bar *self)
+{
+       (*self).ensured = TRUE;
+       _vala_warn_if_fail ((*self).ensured, "ensured = true");
+}
+
+gchar*
+bar_foo (Bar *self)
+{
+       gchar* _tmp0_;
+       gint _tmp1_;
+       gint _tmp2_;
+       gchar* result = NULL;
+       _tmp0_ = g_strdup ("foo");
+       result = _tmp0_;
+       _tmp1_ = strlen (result);
+       _tmp2_ = _tmp1_;
+       _vala_warn_if_fail (_tmp2_ >= 3, "result.length >= 3");
+       return result;
+}
+
+Bar*
+bar_dup (const Bar* self)
+{
+       Bar* dup;
+       dup = g_new0 (Bar, 1);
+       memcpy (dup, self, sizeof (Bar));
+       return dup;
+}
+
+void
+bar_free (Bar* self)
+{
+       g_free (self);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       GType bar_type_id;
+       bar_type_id = g_boxed_type_register_static ("Bar", (GBoxedCopyFunc) bar_dup, (GBoxedFreeFunc) 
bar_free);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       gchar* _tmp1_;
+       gchar* _tmp2_;
+       Foo* foo2 = NULL;
+       Foo* _tmp3_;
+       Bar bar = {0};
+       Bar _tmp4_;
+       Bar _tmp5_;
+       gchar* _tmp6_;
+       gchar* _tmp7_;
+       Bar bar2 = {0};
+       Bar _tmp8_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       _vala_assert (foo->required, "foo.required");
+       foo_foo (foo);
+       _vala_assert (foo->ensured, "foo.ensured");
+       _tmp1_ = foo_bar (foo);
+       _tmp2_ = _tmp1_;
+       _vala_assert (g_strcmp0 (_tmp2_, "bar") == 0, "foo.bar () == \"bar\"");
+       _g_free0 (_tmp2_);
+       foo_foo_pre (foo, 42);
+       _vala_assert (foo_bar_pre (foo, 4711) == 4711, "foo.bar_pre (4711) == 4711");
+       _vala_assert (foo_faz (foo, 42) == 42, "foo.faz (42) == 42");
+       _vala_assert (foo_faz_pre (foo, 4711) == 4711, "foo.faz_pre (4711) == 4711");
+       _vala_assert (foo_manam (foo, 67) == 67, "foo.manam (67) == 67");
+       _vala_assert (foo_manam_pre (foo, 231) == 231, "foo.manam_pre (231) == 231");
+       _tmp3_ = foo_new_post ();
+       foo2 = _tmp3_;
+       _vala_assert (foo2->ensured, "foo2.ensured");
+       bar_init (&bar);
+       _tmp4_ = bar;
+       _vala_assert (_tmp4_.required, "bar.required");
+       bar_bar (&bar);
+       _tmp5_ = bar;
+       _vala_assert (_tmp5_.ensured, "bar.ensured");
+       _tmp6_ = bar_foo (&bar);
+       _tmp7_ = _tmp6_;
+       _vala_assert (g_strcmp0 (_tmp7_, "foo") == 0, "bar.foo () == \"foo\"");
+       _g_free0 (_tmp7_);
+       bar_init_post (&bar2);
+       _tmp8_ = bar2;
+       _vala_assert (_tmp8_.ensured, "bar2.ensured");
+       _foo_unref0 (foo2);
+       _foo_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/print-attribute.c-expected b/tests/methods/print-attribute.c-expected
new file mode 100644
index 000000000..55f40f943
--- /dev/null
+++ b/tests/methods/print-attribute.c-expected
@@ -0,0 +1,461 @@
+/* methods_print_attribute.c generated by valac, the Vala compiler
+ * generated from methods_print_attribute.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+typedef enum  {
+       FOO_ERROR_FAIL
+} FooError;
+#define FOO_ERROR foo_error_quark ()
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GQuark foo_error_quark (void);
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN void foo_foo (Foo* self,
+              const gchar* s);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN void foo (const gchar* s);
+VALA_EXTERN void bar (const gchar* s,
+          GError** error);
+static void _vala_main (void);
+
+GQuark
+foo_error_quark (void)
+{
+       return g_quark_from_static_string ("foo-error-quark");
+}
+
+void
+foo_foo (Foo* self,
+         const gchar* s)
+{
+       g_return_if_fail (IS_FOO (self));
+       g_return_if_fail (s != NULL);
+       _vala_assert (self != NULL, "this != null");
+       _vala_assert (g_strcmp0 (s, "4711Footrue") == 0, "s == \"4711Footrue\"");
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+void
+foo (const gchar* s)
+{
+       g_return_if_fail (s != NULL);
+       _vala_assert (g_strcmp0 (s, "232.7182footrue") == 0, "s == \"232.7182footrue\"");
+}
+
+void
+bar (const gchar* s,
+     GError** error)
+{
+       GError* _tmp0_;
+       GError* _inner_error0_ = NULL;
+       g_return_if_fail (s != NULL);
+       _vala_assert (g_strcmp0 (s, "423.1415barfalse") == 0, "s == \"423.1415barfalse\"");
+       _tmp0_ = g_error_new_literal (FOO_ERROR, FOO_ERROR_FAIL, "bar");
+       _inner_error0_ = _tmp0_;
+       g_propagate_error (error, _inner_error0_);
+       return;
+}
+
+static gchar*
+bool_to_string (gboolean self)
+{
+       gchar* result = NULL;
+       if (self) {
+               gchar* _tmp0_;
+               _tmp0_ = g_strdup ("true");
+               result = _tmp0_;
+               return result;
+       } else {
+               gchar* _tmp1_;
+               _tmp1_ = g_strdup ("false");
+               result = _tmp1_;
+               return result;
+       }
+}
+
+static void
+_vala_main (void)
+{
+       gboolean reached = FALSE;
+       GError* _inner_error0_ = NULL;
+       {
+               gchar* _tmp0_;
+               gchar* _tmp1_;
+               gchar* _tmp2_;
+               gchar* _tmp3_;
+               gchar* _tmp4_;
+               gchar* _tmp5_;
+               gchar* _tmp6_;
+               gchar* _tmp7_;
+               _tmp0_ = g_strdup_printf ("%i", 23);
+               _tmp1_ = _tmp0_;
+               _tmp2_ = g_strdup_printf ("%g", 2.7182f);
+               _tmp3_ = _tmp2_;
+               _tmp4_ = bool_to_string (TRUE);
+               _tmp5_ = _tmp4_;
+               _tmp6_ = g_strconcat (_tmp1_, _tmp3_, "foo", _tmp5_, NULL);
+               _tmp7_ = _tmp6_;
+               foo (_tmp7_);
+               _g_free0 (_tmp7_);
+               _g_free0 (_tmp5_);
+               _g_free0 (_tmp3_);
+               _g_free0 (_tmp1_);
+       }
+       reached = FALSE;
+       {
+               gchar* _tmp8_;
+               gchar* _tmp9_;
+               gchar* _tmp10_;
+               gchar* _tmp11_;
+               gchar* _tmp12_;
+               gchar* _tmp13_;
+               gchar* _tmp14_;
+               gchar* _tmp15_;
+               _tmp8_ = g_strdup_printf ("%i", 42);
+               _tmp9_ = _tmp8_;
+               _tmp10_ = g_strdup_printf ("%g", 3.1415f);
+               _tmp11_ = _tmp10_;
+               _tmp12_ = bool_to_string (FALSE);
+               _tmp13_ = _tmp12_;
+               _tmp14_ = g_strconcat (_tmp9_, _tmp11_, "bar", _tmp13_, NULL);
+               _tmp15_ = _tmp14_;
+               bar (_tmp15_, &_inner_error0_);
+               _g_free0 (_tmp15_);
+               _g_free0 (_tmp13_);
+               _g_free0 (_tmp11_);
+               _g_free0 (_tmp9_);
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       if (g_error_matches (_inner_error0_, FOO_ERROR, FOO_ERROR_FAIL)) {
+                               goto __catch0_foo_error_fail;
+                       }
+                       goto __catch0_g_error;
+               }
+       }
+       goto __finally0;
+       __catch0_foo_error_fail:
+       {
+               g_clear_error (&_inner_error0_);
+               reached = TRUE;
+       }
+       goto __finally0;
+       __catch0_g_error:
+       {
+               g_clear_error (&_inner_error0_);
+               g_assert_not_reached ();
+       }
+       __finally0:
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _vala_assert (reached, "reached");
+       {
+               Foo* f = NULL;
+               Foo* _tmp16_;
+               gchar* _tmp17_;
+               gchar* _tmp18_;
+               gchar* _tmp19_;
+               gchar* _tmp20_;
+               gchar* _tmp21_;
+               gchar* _tmp22_;
+               _tmp16_ = foo_new ();
+               f = _tmp16_;
+               _tmp17_ = g_strdup_printf ("%i", 4711);
+               _tmp18_ = _tmp17_;
+               _tmp19_ = bool_to_string (TRUE);
+               _tmp20_ = _tmp19_;
+               _tmp21_ = g_strconcat (_tmp18_, "Foo", _tmp20_, NULL);
+               _tmp22_ = _tmp21_;
+               foo_foo (f, _tmp22_);
+               _g_free0 (_tmp22_);
+               _g_free0 (_tmp20_);
+               _g_free0 (_tmp18_);
+               _foo_unref0 (f);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/printf-constructor.c-expected b/tests/methods/printf-constructor.c-expected
new file mode 100644
index 000000000..6f465f495
--- /dev/null
+++ b/tests/methods/printf-constructor.c-expected
@@ -0,0 +1,27 @@
+/* methods_printf_constructor.c generated by valac, the Vala compiler
+ * generated from methods_printf_constructor.vala, do not modify */
+
+#include <glib.h>
+
+#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+       GError* err = NULL;
+       GError* _tmp0_;
+       _tmp0_ = g_error_new (g_quark_from_string ("g-io-error-quark"), 0, "%d", 4);
+       err = _tmp0_;
+       _g_error_free0 (err);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/return-unowned-delegate.c-expected 
b/tests/methods/return-unowned-delegate.c-expected
new file mode 100644
index 000000000..cb8d2fa83
--- /dev/null
+++ b/tests/methods/return-unowned-delegate.c-expected
@@ -0,0 +1,134 @@
+/* methods_return_unowned_delegate.c generated by valac, the Vala compiler
+ * generated from methods_return_unowned_delegate.vala, do not modify */
+
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef gint (*FooFunc) (gpointer user_data);
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN FooFunc foo (gpointer* result_target);
+VALA_EXTERN gint manam (void);
+VALA_EXTERN FooFunc bar (gpointer* result_target);
+static gint __lambda4_ (void);
+static gint ___lambda4__foo_func (gpointer self);
+static void _vala_main (void);
+
+FooFunc
+foo (gpointer* result_target)
+{
+       FooFunc _tmp0_;
+       gpointer _tmp0__target;
+       FooFunc result = NULL;
+       _tmp0_ = (FooFunc) manam;
+       _tmp0__target = NULL;
+       *result_target = _tmp0__target;
+       result = _tmp0_;
+       return result;
+}
+
+static gint
+__lambda4_ (void)
+{
+       gint result = 0;
+       result = 4711;
+       return result;
+}
+
+static gint
+___lambda4__foo_func (gpointer self)
+{
+       gint result;
+       result = __lambda4_ ();
+       return result;
+}
+
+FooFunc
+bar (gpointer* result_target)
+{
+       FooFunc _tmp0_;
+       gpointer _tmp0__target;
+       FooFunc result = NULL;
+       _tmp0_ = ___lambda4__foo_func;
+       _tmp0__target = NULL;
+       *result_target = _tmp0__target;
+       result = _tmp0_;
+       return result;
+}
+
+gint
+manam (void)
+{
+       gint result = 0;
+       result = 42;
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       {
+               FooFunc func = NULL;
+               gpointer _tmp0_ = NULL;
+               FooFunc _tmp1_;
+               gpointer func_target;
+               GDestroyNotify func_target_destroy_notify;
+               FooFunc _tmp2_;
+               gpointer _tmp2__target;
+               GDestroyNotify _tmp2__target_destroy_notify;
+               _tmp1_ = foo (&_tmp0_);
+               func = _tmp1_;
+               func_target = _tmp0_;
+               func_target_destroy_notify = NULL;
+               _tmp2_ = (FooFunc) manam;
+               _tmp2__target = NULL;
+               _tmp2__target_destroy_notify = NULL;
+               _vala_assert (func == _tmp2_, "func == (FooFunc) manam");
+               (_tmp2__target_destroy_notify == NULL) ? NULL : (_tmp2__target_destroy_notify 
(_tmp2__target), NULL);
+               _tmp2_ = NULL;
+               _tmp2__target = NULL;
+               _tmp2__target_destroy_notify = NULL;
+               _vala_assert (func (func_target) == 42, "func () == 42");
+               (func_target_destroy_notify == NULL) ? NULL : (func_target_destroy_notify (func_target), 
NULL);
+               func = NULL;
+               func_target = NULL;
+               func_target_destroy_notify = NULL;
+       }
+       {
+               FooFunc func = NULL;
+               gpointer _tmp3_ = NULL;
+               FooFunc _tmp4_;
+               gpointer func_target;
+               GDestroyNotify func_target_destroy_notify;
+               _tmp4_ = bar (&_tmp3_);
+               func = _tmp4_;
+               func_target = _tmp3_;
+               func_target_destroy_notify = NULL;
+               _vala_assert (func (func_target) == 4711, "func () == 4711");
+               (func_target_destroy_notify == NULL) ? NULL : (func_target_destroy_notify (func_target), 
NULL);
+               func = NULL;
+               func_target = NULL;
+               func_target_destroy_notify = NULL;
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/same-name.c-expected b/tests/methods/same-name.c-expected
new file mode 100644
index 000000000..17167174a
--- /dev/null
+++ b/tests/methods/same-name.c-expected
@@ -0,0 +1,391 @@
+/* methods_same_name.c generated by valac, the Vala compiler
+ * generated from methods_same_name.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_IFOO (ifoo_get_type ())
+#define IFOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IFOO, IFoo))
+#define IS_IFOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IFOO))
+#define IFOO_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_IFOO, IFooIface))
+
+typedef struct _IFoo IFoo;
+typedef struct _IFooIface IFooIface;
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _IFooIface {
+       GTypeInterface parent_iface;
+       gboolean (*foo) (IFoo* self);
+};
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gpointer foo_parent_class = NULL;
+static IFooIface * foo_ifoo_parent_iface = NULL;
+
+VALA_EXTERN GType ifoo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN gboolean ifoo_foo (IFoo* self);
+static GType ifoo_get_type_once (void);
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+static gboolean foo_real_ifoo_foo (IFoo* base);
+VALA_EXTERN gint foo_foo (Foo* self);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+gboolean
+ifoo_foo (IFoo* self)
+{
+       IFooIface* _iface_;
+       g_return_val_if_fail (IS_IFOO (self), FALSE);
+       _iface_ = IFOO_GET_INTERFACE (self);
+       if (_iface_->foo) {
+               return _iface_->foo (self);
+       }
+       return FALSE;
+}
+
+static void
+ifoo_default_init (IFooIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+ifoo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (IFooIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) ifoo_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType ifoo_type_id;
+       ifoo_type_id = g_type_register_static (G_TYPE_INTERFACE, "IFoo", &g_define_type_info, 0);
+       return ifoo_type_id;
+}
+
+GType
+ifoo_get_type (void)
+{
+       static volatile gsize ifoo_type_id__volatile = 0;
+       if (g_once_init_enter (&ifoo_type_id__volatile)) {
+               GType ifoo_type_id;
+               ifoo_type_id = ifoo_get_type_once ();
+               g_once_init_leave (&ifoo_type_id__volatile, ifoo_type_id);
+       }
+       return ifoo_type_id__volatile;
+}
+
+static gboolean
+foo_real_ifoo_foo (IFoo* base)
+{
+       Foo * self;
+       gboolean result = FALSE;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_FOO, Foo);
+       result = TRUE;
+       return result;
+}
+
+gint
+foo_foo (Foo* self)
+{
+       gint result = 0;
+       g_return_val_if_fail (IS_FOO (self), 0);
+       result = 42;
+       return result;
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_ifoo_interface_init (IFooIface * iface,
+                         gpointer iface_data)
+{
+       foo_ifoo_parent_iface = g_type_interface_peek_parent (iface);
+       iface->foo = (gboolean (*) (IFoo*)) foo_real_ifoo_foo;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       static const GInterfaceInfo ifoo_info = { (GInterfaceInitFunc) foo_ifoo_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       g_type_add_interface_static (foo_type_id, TYPE_IFOO, &ifoo_info);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       _vala_assert (ifoo_foo (G_TYPE_CHECK_INSTANCE_CAST (foo, TYPE_IFOO, IFoo)), "((IFoo) foo).foo ()");
+       _vala_assert (foo_foo (foo) == 42, "foo.foo () == 42");
+       _foo_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/symbolresolution.c-expected b/tests/methods/symbolresolution.c-expected
new file mode 100644
index 000000000..8e2f205d5
--- /dev/null
+++ b/tests/methods/symbolresolution.c-expected
@@ -0,0 +1,462 @@
+/* methods_symbolresolution.c generated by valac, the Vala compiler
+ * generated from methods_symbolresolution.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_CLASS (class_get_type ())
+#define CLASS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_CLASS, Class))
+#define CLASS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_CLASS, ClassClass))
+#define IS_CLASS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_CLASS))
+#define IS_CLASS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_CLASS))
+#define CLASS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_CLASS, ClassClass))
+
+typedef struct _Class Class;
+typedef struct _ClassClass ClassClass;
+typedef struct _ClassPrivate ClassPrivate;
+typedef void (*ClassFoo) (gpointer user_data);
+typedef struct _Block1Data Block1Data;
+#define _class_unref0(var) ((var == NULL) ? NULL : (var = (class_unref (var), NULL)))
+#define _g_free0(var) (var = (g_free (var), NULL))
+typedef struct _ParamSpecClass ParamSpecClass;
+
+struct _Class {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       ClassPrivate * priv;
+};
+
+struct _ClassClass {
+       GTypeClass parent_class;
+       void (*finalize) (Class *self);
+};
+
+struct _Block1Data {
+       int _ref_count_;
+       Class* self;
+       ClassFoo foo;
+       gpointer foo_target;
+};
+
+struct _ParamSpecClass {
+       GParamSpec parent_instance;
+};
+
+static gpointer class_parent_class = NULL;
+
+VALA_EXTERN gpointer class_ref (gpointer instance);
+VALA_EXTERN void class_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_class (const gchar* name,
+                              const gchar* nick,
+                              const gchar* blurb,
+                              GType object_type,
+                              GParamFlags flags);
+VALA_EXTERN void value_set_class (GValue* value,
+                      gpointer v_object);
+VALA_EXTERN void value_take_class (GValue* value,
+                       gpointer v_object);
+VALA_EXTERN gpointer value_get_class (const GValue* value);
+VALA_EXTERN GType class_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Class, class_unref)
+VALA_EXTERN void class_foo (Class* self);
+VALA_EXTERN void class_test (Class* self,
+                 ClassFoo foo,
+                 gpointer foo_target);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static void __lambda4_ (Block1Data* _data1_);
+static void ___lambda4__class_foo (gpointer self);
+static void class_active_scope (Class* self);
+VALA_EXTERN Class* class_new (void);
+VALA_EXTERN Class* class_construct (GType object_type);
+static void class_finalize (Class * obj);
+static GType class_get_type_once (void);
+static void _vala_main (void);
+static void __lambda5_ (void);
+static void ___lambda5__class_foo (gpointer self);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+void
+class_foo (Class* self)
+{
+       g_return_if_fail (IS_CLASS (self));
+       g_assert_not_reached ();
+}
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               Class* self;
+               self = _data1_->self;
+               _class_unref0 (self);
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static void
+__lambda4_ (Block1Data* _data1_)
+{
+       Class* self;
+       self = _data1_->self;
+       _data1_->foo (_data1_->foo_target);
+}
+
+static void
+___lambda4__class_foo (gpointer self)
+{
+       __lambda4_ (self);
+}
+
+void
+class_test (Class* self,
+            ClassFoo foo,
+            gpointer foo_target)
+{
+       Block1Data* _data1_;
+       ClassFoo func = NULL;
+       gpointer func_target;
+       GDestroyNotify func_target_destroy_notify;
+       g_return_if_fail (IS_CLASS (self));
+       _data1_ = g_slice_new0 (Block1Data);
+       _data1_->_ref_count_ = 1;
+       _data1_->self = class_ref (self);
+       _data1_->foo = foo;
+       _data1_->foo_target = foo_target;
+       func = ___lambda4__class_foo;
+       func_target = block1_data_ref (_data1_);
+       func_target_destroy_notify = block1_data_unref;
+       func (func_target);
+       (func_target_destroy_notify == NULL) ? NULL : (func_target_destroy_notify (func_target), NULL);
+       func = NULL;
+       func_target = NULL;
+       func_target_destroy_notify = NULL;
+       block1_data_unref (_data1_);
+       _data1_ = NULL;
+}
+
+static void
+class_active_scope (Class* self)
+{
+       gchar** _tmp0_;
+       gchar* bar = NULL;
+       gchar* _tmp2_;
+       g_return_if_fail (IS_CLASS (self));
+       _tmp0_ = g_new0 (gchar*, 0 + 1);
+       {
+               gchar** bar_collection = NULL;
+               gint bar_collection_length1 = 0;
+               gint _bar_collection_size_ = 0;
+               gint bar_it = 0;
+               bar_collection = _tmp0_;
+               bar_collection_length1 = 0;
+               for (bar_it = 0; bar_it < bar_collection_length1; bar_it = bar_it + 1) {
+                       gchar* _tmp1_;
+                       gchar* bar = NULL;
+                       _tmp1_ = g_strdup (bar_collection[bar_it]);
+                       bar = _tmp1_;
+                       {
+                               _g_free0 (bar);
+                       }
+               }
+               bar_collection = (_vala_array_free (bar_collection, bar_collection_length1, (GDestroyNotify) 
g_free), NULL);
+       }
+       _tmp2_ = g_strdup ("bar");
+       bar = _tmp2_;
+       _g_free0 (bar);
+}
+
+Class*
+class_construct (GType object_type)
+{
+       Class* self = NULL;
+       self = (Class*) g_type_create_instance (object_type);
+       return self;
+}
+
+Class*
+class_new (void)
+{
+       return class_construct (TYPE_CLASS);
+}
+
+static void
+value_class_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_class_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               class_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_class_copy_value (const GValue* src_value,
+                        GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = class_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_class_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_class_collect_value (GValue* value,
+                           guint n_collect_values,
+                           GTypeCValue* collect_values,
+                           guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Class * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = class_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_class_lcopy_value (const GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       Class ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = class_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_class (const gchar* name,
+                  const gchar* nick,
+                  const gchar* blurb,
+                  GType object_type,
+                  GParamFlags flags)
+{
+       ParamSpecClass* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_CLASS), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_class (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_CLASS), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_class (GValue* value,
+                 gpointer v_object)
+{
+       Class * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_CLASS));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_CLASS));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               class_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               class_unref (old);
+       }
+}
+
+void
+value_take_class (GValue* value,
+                  gpointer v_object)
+{
+       Class * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_CLASS));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_CLASS));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               class_unref (old);
+       }
+}
+
+static void
+class_class_init (ClassClass * klass,
+                  gpointer klass_data)
+{
+       class_parent_class = g_type_class_peek_parent (klass);
+       ((ClassClass *) klass)->finalize = class_finalize;
+}
+
+static void
+class_instance_init (Class * self,
+                     gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+class_finalize (Class * obj)
+{
+       Class * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_CLASS, Class);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+class_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_class_init, value_class_free_value, 
value_class_copy_value, value_class_peek_pointer, "p", value_class_collect_value, "p", 
value_class_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (ClassClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) class_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Class), 
0, (GInstanceInitFunc) class_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType class_type_id;
+       class_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Class", 
&g_define_type_info, &g_define_type_fundamental_info, 0);
+       return class_type_id;
+}
+
+GType
+class_get_type (void)
+{
+       static volatile gsize class_type_id__volatile = 0;
+       if (g_once_init_enter (&class_type_id__volatile)) {
+               GType class_type_id;
+               class_type_id = class_get_type_once ();
+               g_once_init_leave (&class_type_id__volatile, class_type_id);
+       }
+       return class_type_id__volatile;
+}
+
+gpointer
+class_ref (gpointer instance)
+{
+       Class * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+class_unref (gpointer instance)
+{
+       Class * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               CLASS_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+__lambda5_ (void)
+{
+}
+
+static void
+___lambda5__class_foo (gpointer self)
+{
+       __lambda5_ ();
+}
+
+static void
+_vala_main (void)
+{
+       Class* cl = NULL;
+       Class* _tmp0_;
+       _tmp0_ = class_new ();
+       cl = _tmp0_;
+       class_test (cl, ___lambda5__class_foo, NULL);
+       _class_unref0 (cl);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/methods/varargs-delegate-without-target.c-expected 
b/tests/methods/varargs-delegate-without-target.c-expected
new file mode 100644
index 000000000..1a3e6e639
--- /dev/null
+++ b/tests/methods/varargs-delegate-without-target.c-expected
@@ -0,0 +1,105 @@
+/* methods_varargs_delegate_without_target.c generated by valac, the Vala compiler
+ * generated from methods_varargs_delegate_without_target.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+#include <stdarg.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef gchar* (*Foo) (void);
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN gchar* foo (void* data);
+VALA_EXTERN void bar (gint first,
+          ...);
+VALA_EXTERN void baz (gint first,
+          ...);
+static void _vala_main (void);
+
+gchar*
+foo (void* data)
+{
+       gchar* _tmp0_;
+       gchar* result = NULL;
+       _tmp0_ = g_strdup ("foo");
+       result = _tmp0_;
+       return result;
+}
+
+void
+bar (gint first,
+     ...)
+{
+       va_list args = {0};
+       Foo** out_func = NULL;
+       Foo** _tmp0_;
+       _vala_assert (first == 23, "first == 23");
+       va_start (args, first);
+       _tmp0_ = va_arg (args, Foo**);
+       out_func = _tmp0_;
+       *out_func = (Foo) foo;
+       va_end (args);
+}
+
+void
+baz (gint first,
+     ...)
+{
+       va_list args = {0};
+       Foo func = NULL;
+       Foo _tmp0_;
+       gchar* _tmp1_;
+       gchar* _tmp2_;
+       _vala_assert (first == 42, "first == 42");
+       va_start (args, first);
+       _tmp0_ = va_arg (args, Foo);
+       func = _tmp0_;
+       _tmp1_ = func ();
+       _tmp2_ = _tmp1_;
+       _vala_assert (g_strcmp0 (_tmp2_, "foo") == 0, "func () == \"foo\"");
+       _g_free0 (_tmp2_);
+       va_end (args);
+}
+
+static void
+_vala_main (void)
+{
+       {
+               Foo func = NULL;
+               Foo _tmp0_ = NULL;
+               gchar* _tmp1_;
+               gchar* _tmp2_;
+               bar (23, &_tmp0_, NULL);
+               func = _tmp0_;
+               _tmp1_ = func ();
+               _tmp2_ = _tmp1_;
+               _vala_assert (g_strcmp0 (_tmp2_, "foo") == 0, "func () == \"foo\"");
+               _g_free0 (_tmp2_);
+       }
+       {
+               baz (42, foo, NULL);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/varargs-delegate.c-expected b/tests/methods/varargs-delegate.c-expected
new file mode 100644
index 000000000..a30390565
--- /dev/null
+++ b/tests/methods/varargs-delegate.c-expected
@@ -0,0 +1,125 @@
+/* methods_varargs_delegate.c generated by valac, the Vala compiler
+ * generated from methods_varargs_delegate.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+#include <stdarg.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef gchar* (*Foo) (gpointer user_data);
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN gchar* foo (void* data);
+VALA_EXTERN void bar (gint first,
+          ...);
+VALA_EXTERN void baz (gint first,
+          ...);
+static void _vala_main (void);
+
+gchar*
+foo (void* data)
+{
+       gchar* _tmp0_;
+       gchar* result = NULL;
+       _tmp0_ = g_strdup ("foo");
+       result = _tmp0_;
+       return result;
+}
+
+void
+bar (gint first,
+     ...)
+{
+       va_list args = {0};
+       Foo** out_func = NULL;
+       Foo** _tmp0_;
+       _vala_assert (first == 23, "first == 23");
+       va_start (args, first);
+       _tmp0_ = va_arg (args, Foo**);
+       out_func = _tmp0_;
+       *out_func = (Foo*) foo;
+       va_end (args);
+}
+
+void
+baz (gint first,
+     ...)
+{
+       va_list args = {0};
+       Foo func = NULL;
+       Foo _tmp0_;
+       gpointer func_target;
+       GDestroyNotify func_target_destroy_notify;
+       gchar* _tmp1_;
+       gchar* _tmp2_;
+       _vala_assert (first == 42, "first == 42");
+       va_start (args, first);
+       _tmp0_ = va_arg (args, Foo);
+       func = _tmp0_;
+       func_target = NULL;
+       func_target_destroy_notify = NULL;
+       _tmp1_ = func (func_target);
+       _tmp2_ = _tmp1_;
+       _vala_assert (g_strcmp0 (_tmp2_, "foo") == 0, "func () == \"foo\"");
+       _g_free0 (_tmp2_);
+       (func_target_destroy_notify == NULL) ? NULL : (func_target_destroy_notify (func_target), NULL);
+       func = NULL;
+       func_target = NULL;
+       func_target_destroy_notify = NULL;
+       va_end (args);
+}
+
+static void
+_vala_main (void)
+{
+       {
+               Foo func = NULL;
+               gpointer func_target = NULL;
+               GDestroyNotify func_target_destroy_notify = NULL;
+               Foo _tmp0_ = NULL;
+               gchar* _tmp1_;
+               gchar* _tmp2_;
+               bar (23, &_tmp0_, NULL);
+               (func_target_destroy_notify == NULL) ? NULL : (func_target_destroy_notify (func_target), 
NULL);
+               func = NULL;
+               func_target = NULL;
+               func_target_destroy_notify = NULL;
+               func = _tmp0_;
+               func_target = NULL;
+               func_target_destroy_notify = NULL;
+               _tmp1_ = func (func_target);
+               _tmp2_ = _tmp1_;
+               _vala_assert (g_strcmp0 (_tmp2_, "foo") == 0, "func () == \"foo\"");
+               _g_free0 (_tmp2_);
+               (func_target_destroy_notify == NULL) ? NULL : (func_target_destroy_notify (func_target), 
NULL);
+               func = NULL;
+               func_target = NULL;
+               func_target_destroy_notify = NULL;
+       }
+       {
+               baz (42, foo, NULL);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/varargs-gvalue.c-expected b/tests/methods/varargs-gvalue.c-expected
new file mode 100644
index 000000000..5c5d26a69
--- /dev/null
+++ b/tests/methods/varargs-gvalue.c-expected
@@ -0,0 +1,99 @@
+/* methods_varargs_gvalue.c generated by valac, the Vala compiler
+ * generated from methods_varargs_gvalue.vala, do not modify */
+
+#include <glib.h>
+#include <stdarg.h>
+#include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN void foo (gint first_arg,
+          ...);
+VALA_EXTERN void faz (gint first_arg,
+          ...);
+static void _vala_main (void);
+
+void
+foo (gint first_arg,
+     ...)
+{
+       va_list args = {0};
+       GValue val = {0};
+       GValue _tmp0_;
+       GValue _tmp1_ = {0};
+       const gchar* _tmp2_;
+       va_start (args, first_arg);
+       _tmp0_ = *(va_arg (args, GValue*));
+       if (G_IS_VALUE (&_tmp0_)) {
+               g_value_init (&_tmp1_, G_VALUE_TYPE (&_tmp0_));
+               g_value_copy (&_tmp0_, &_tmp1_);
+       } else {
+               _tmp1_ = _tmp0_;
+       }
+       val = _tmp1_;
+       _vala_assert (first_arg == 42, "first_arg == 42");
+       _vala_assert (G_VALUE_HOLDS (&val, G_TYPE_STRING), "val.holds (typeof (string))");
+       _tmp2_ = g_value_get_string (&val);
+       _vala_assert (g_strcmp0 (_tmp2_, "foo") == 0, "val.get_string () == \"foo\"");
+       G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL;
+       va_end (args);
+}
+
+void
+faz (gint first_arg,
+     ...)
+{
+       va_list args = {0};
+       GValue* val = NULL;
+       GValue* _tmp0_;
+       const gchar* _tmp1_;
+       va_start (args, first_arg);
+       _tmp0_ = va_arg (args, GValue*);
+       val = _tmp0_;
+       _vala_assert (first_arg == 23, "first_arg == 23");
+       _vala_assert (G_VALUE_HOLDS (val, G_TYPE_STRING), "val.holds (typeof (string))");
+       _tmp1_ = g_value_get_string (val);
+       _vala_assert (g_strcmp0 (_tmp1_, "foo") == 0, "val.get_string () == \"foo\"");
+       va_end (args);
+}
+
+static void
+_vala_main (void)
+{
+       GValue val = {0};
+       GValue _tmp0_ = {0};
+       GValue _tmp1_;
+       GValue _tmp2_;
+       g_value_init (&_tmp0_, G_TYPE_STRING);
+       val = _tmp0_;
+       g_value_set_string (&val, "foo");
+       _tmp1_ = val;
+       foo (42, &_tmp1_, NULL);
+       _tmp2_ = val;
+       faz (23, &_tmp2_, NULL);
+       G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/varargs-out.c-expected b/tests/methods/varargs-out.c-expected
new file mode 100644
index 000000000..adf27b865
--- /dev/null
+++ b/tests/methods/varargs-out.c-expected
@@ -0,0 +1,337 @@
+/* methods_varargs_out.c generated by valac, the Vala compiler
+ * generated from methods_varargs_out.vala, do not modify */
+
+#include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+#include <stdarg.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NAME_PROPERTY,
+       FOO_ID_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _FooPrivate {
+       gchar* _name;
+       gint _id;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+VALA_EXTERN Foo* foo_static;
+Foo* foo_static = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+VALA_EXTERN const gchar* foo_get_name (Foo* self);
+VALA_EXTERN void foo_set_name (Foo* self,
+                   const gchar* value);
+VALA_EXTERN gint foo_get_id (Foo* self);
+VALA_EXTERN void foo_set_id (Foo* self,
+                 gint value);
+static void foo_finalize (GObject * obj);
+static GType foo_get_type_once (void);
+static void _vala_foo_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_foo_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec);
+VALA_EXTERN gboolean get_foo_varg (const gchar* s,
+                       ...);
+static void _vala_main (void);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+const gchar*
+foo_get_name (Foo* self)
+{
+       const gchar* result;
+       const gchar* _tmp0_;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = self->priv->_name;
+       result = _tmp0_;
+       return result;
+}
+
+void
+foo_set_name (Foo* self,
+              const gchar* value)
+{
+       gchar* old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_name (self);
+       if (g_strcmp0 (value, old_value) != 0) {
+               gchar* _tmp0_;
+               _tmp0_ = g_strdup (value);
+               _g_free0 (self->priv->_name);
+               self->priv->_name = _tmp0_;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_NAME_PROPERTY]);
+       }
+}
+
+gint
+foo_get_id (Foo* self)
+{
+       gint result;
+       g_return_val_if_fail (IS_FOO (self), 0);
+       result = self->priv->_id;
+       return result;
+}
+
+void
+foo_set_id (Foo* self,
+            gint value)
+{
+       gint old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_id (self);
+       if (old_value != value) {
+               self->priv->_id = value;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_ID_PROPERTY]);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_foo_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_foo_set_property;
+       G_OBJECT_CLASS (klass)->finalize = foo_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_NAME_PROPERTY, 
foo_properties[FOO_NAME_PROPERTY] = g_param_spec_string ("name", "name", "name", NULL, G_PARAM_STATIC_STRINGS 
| G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_ID_PROPERTY, 
foo_properties[FOO_ID_PROPERTY] = g_param_spec_int ("id", "id", "id", G_MININT, G_MAXINT, 0, 
G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+}
+
+static void
+foo_finalize (GObject * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       _g_free0 (self->priv->_name);
+       G_OBJECT_CLASS (foo_parent_class)->finalize (obj);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_foo_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_NAME_PROPERTY:
+               g_value_set_string (value, foo_get_name (self));
+               break;
+               case FOO_ID_PROPERTY:
+               g_value_set_int (value, foo_get_id (self));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_foo_set_property (GObject * object,
+                        guint property_id,
+                        const GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_NAME_PROPERTY:
+               foo_set_name (self, g_value_get_string (value));
+               break;
+               case FOO_ID_PROPERTY:
+               foo_set_id (self, g_value_get_int (value));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+gboolean
+get_foo_varg (const gchar* s,
+              ...)
+{
+       va_list args = {0};
+       Foo** out_foo = NULL;
+       Foo** _tmp0_;
+       Foo* _tmp1_;
+       GObject* _tmp2_;
+       gboolean result = FALSE;
+       g_return_val_if_fail (s != NULL, FALSE);
+       va_start (args, s);
+       _tmp0_ = va_arg (args, Foo**);
+       out_foo = _tmp0_;
+       _tmp1_ = foo_static;
+       _tmp2_ = g_object_ref (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, G_TYPE_OBJECT, GObject));
+       *out_foo = _tmp2_;
+       result = TRUE;
+       va_end (args);
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* _tmp1_;
+       Foo* _tmp8_;
+       {
+               Foo* _tmp0_;
+               _tmp0_ = foo_new ();
+               _g_object_unref0 (foo_static);
+               foo_static = _tmp0_;
+       }
+       _tmp1_ = foo_static;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"foo_static.ref_count == 1");
+       {
+               Foo* foo = NULL;
+               Foo* _tmp2_ = NULL;
+               Foo* _tmp3_;
+               Foo* _tmp4_ = NULL;
+               gboolean _tmp5_;
+               Foo* _tmp7_;
+               get_foo_varg ("foo", &_tmp2_, NULL);
+               _g_object_unref0 (foo);
+               foo = _tmp2_;
+               _tmp3_ = foo;
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, G_TYPE_OBJECT, GObject)->ref_count == 
((guint) 2), "foo.ref_count == 2");
+               _tmp5_ = get_foo_varg ("foo", &_tmp4_, NULL);
+               _g_object_unref0 (foo);
+               foo = _tmp4_;
+               if (_tmp5_) {
+                       Foo* _tmp6_;
+                       _tmp6_ = foo;
+                       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp6_, G_TYPE_OBJECT, GObject)->ref_count 
== ((guint) 2), "foo.ref_count == 2");
+               }
+               _tmp7_ = foo;
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp7_, G_TYPE_OBJECT, GObject)->ref_count == 
((guint) 2), "foo.ref_count == 2");
+               _g_object_unref0 (foo);
+       }
+       _tmp8_ = foo_static;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp8_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"foo_static.ref_count == 1");
+       {
+               Foo* _tmp9_;
+               gchar* name = NULL;
+               gint id = 0;
+               Foo* _tmp10_;
+               gchar* _tmp11_ = NULL;
+               gint _tmp12_ = 0;
+               _tmp9_ = foo_static;
+               g_object_set (G_TYPE_CHECK_INSTANCE_CAST (_tmp9_, G_TYPE_OBJECT, GObject), "name", "foo", 
"id", 42, NULL);
+               _tmp10_ = foo_static;
+               g_object_get (G_TYPE_CHECK_INSTANCE_CAST (_tmp10_, G_TYPE_OBJECT, GObject), "name", &_tmp11_, 
"id", &_tmp12_, NULL);
+               _g_free0 (name);
+               name = _tmp11_;
+               id = _tmp12_;
+               _vala_assert (g_strcmp0 (name, "foo") == 0, "name == \"foo\"");
+               _vala_assert (id == 42, "id == 42");
+               _g_free0 (name);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/varargs-ref.c-expected b/tests/methods/varargs-ref.c-expected
new file mode 100644
index 000000000..cc68f4ab7
--- /dev/null
+++ b/tests/methods/varargs-ref.c-expected
@@ -0,0 +1,71 @@
+/* methods_varargs_ref.c generated by valac, the Vala compiler
+ * generated from methods_varargs_ref.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+#include <stdarg.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN void set_foo_varg (const gchar* s,
+                   ...);
+static void _vala_main (void);
+
+void
+set_foo_varg (const gchar* s,
+              ...)
+{
+       va_list args = {0};
+       const gchar** ref_s1 = NULL;
+       const gchar** _tmp0_;
+       const gchar** ref_s2 = NULL;
+       const gchar** _tmp1_;
+       g_return_if_fail (s != NULL);
+       va_start (args, s);
+       _tmp0_ = va_arg (args, const gchar**);
+       ref_s1 = _tmp0_;
+       *ref_s1 = "bar";
+       _tmp1_ = va_arg (args, const gchar**);
+       ref_s2 = _tmp1_;
+       *ref_s2 = "manam";
+       va_end (args);
+}
+
+static void
+_vala_main (void)
+{
+       const gchar* bar = NULL;
+       const gchar* manam = NULL;
+       const gchar* _tmp0_;
+       const gchar* _tmp1_;
+       bar = "";
+       manam = "";
+       set_foo_varg ("foo", &bar, &manam, NULL);
+       _tmp0_ = bar;
+       _vala_assert (g_strcmp0 (_tmp0_, "bar") == 0, "bar == \"bar\"");
+       _tmp1_ = manam;
+       _vala_assert (g_strcmp0 (_tmp1_, "manam") == 0, "manam == \"manam\"");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/methods/varargs-struct.c-expected b/tests/methods/varargs-struct.c-expected
new file mode 100644
index 000000000..5b6e85af9
--- /dev/null
+++ b/tests/methods/varargs-struct.c-expected
@@ -0,0 +1,138 @@
+/* methods_varargs_struct.c generated by valac, the Vala compiler
+ * generated from methods_varargs_struct.vala, do not modify */
+
+#include <glib.h>
+#include <string.h>
+#include <stdarg.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef struct _Bar Bar;
+#define _bar_free0(var) ((var == NULL) ? NULL : (var = (bar_free (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Bar {
+       gint i;
+       gint j;
+};
+
+VALA_EXTERN Bar* bar_dup (const Bar* self);
+VALA_EXTERN void bar_free (Bar* self);
+VALA_EXTERN void foo (gint first_arg,
+          ...);
+VALA_EXTERN void faz (gint first_arg,
+          ...);
+VALA_EXTERN void fab (gint first_arg,
+          ...);
+static void _vala_main (void);
+
+Bar*
+bar_dup (const Bar* self)
+{
+       Bar* dup;
+       dup = g_new0 (Bar, 1);
+       memcpy (dup, self, sizeof (Bar));
+       return dup;
+}
+
+void
+bar_free (Bar* self)
+{
+       g_free (self);
+}
+
+void
+foo (gint first_arg,
+     ...)
+{
+       va_list args = {0};
+       Bar bar = {0};
+       Bar _tmp0_;
+       Bar _tmp1_;
+       va_start (args, first_arg);
+       bar = *(va_arg (args, Bar*));
+       _vala_assert (first_arg == 42, "first_arg == 42");
+       _tmp0_ = bar;
+       _vala_assert (_tmp0_.i == 23, "bar.i == 23");
+       _tmp1_ = bar;
+       _vala_assert (_tmp1_.j == 4711, "bar.j == 4711");
+       va_end (args);
+}
+
+void
+faz (gint first_arg,
+     ...)
+{
+       va_list args = {0};
+       Bar* bar = NULL;
+       Bar* _tmp0_;
+       va_start (args, first_arg);
+       _tmp0_ = va_arg (args, Bar*);
+       bar = _tmp0_;
+       _vala_assert (first_arg == 23, "first_arg == 23");
+       _vala_assert ((*bar).i == 23, "bar.i == 23");
+       _vala_assert ((*bar).j == 4711, "bar.j == 4711");
+       va_end (args);
+}
+
+static gpointer
+_bar_dup0 (gpointer self)
+{
+       return self ? bar_dup (self) : NULL;
+}
+
+void
+fab (gint first_arg,
+     ...)
+{
+       va_list args = {0};
+       Bar* bar = NULL;
+       Bar* _tmp0_;
+       va_start (args, first_arg);
+       _tmp0_ = _bar_dup0 (va_arg (args, Bar*));
+       bar = _tmp0_;
+       _vala_assert (first_arg == 65, "first_arg == 65");
+       _vala_assert ((*bar).i == 23, "bar.i == 23");
+       _vala_assert ((*bar).j == 4711, "bar.j == 4711");
+       _bar_free0 (bar);
+       va_end (args);
+}
+
+static void
+_vala_main (void)
+{
+       Bar bar = {0};
+       Bar _tmp0_ = {0};
+       Bar _tmp1_;
+       Bar _tmp2_;
+       Bar _tmp3_;
+       _tmp0_.i = 23;
+       _tmp0_.j = 4711;
+       bar = _tmp0_;
+       _tmp1_ = bar;
+       foo (42, &_tmp1_, NULL);
+       _tmp2_ = bar;
+       faz (23, &_tmp2_, NULL);
+       _tmp3_ = bar;
+       fab (65, &_tmp3_, NULL);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/namespace/unique.c-expected b/tests/namespace/unique.c-expected
new file mode 100644
index 000000000..10dd574b4
--- /dev/null
+++ b/tests/namespace/unique.c-expected
@@ -0,0 +1,309 @@
+/* namespace_unique.c generated by valac, the Vala compiler
+ * generated from namespace_unique.vala, do not modify */
+
+#include <glib-object.h>
+#include <gobject/gvaluecollector.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define G_TYPE_VALA_FOO (g_vala_foo_get_type ())
+#define G_VALA_FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_VALA_FOO, GValaFoo))
+#define G_VALA_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), G_TYPE_VALA_FOO, GValaFooClass))
+#define G_IS_VALA_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_VALA_FOO))
+#define G_IS_VALA_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), G_TYPE_VALA_FOO))
+#define G_VALA_FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G_TYPE_VALA_FOO, GValaFooClass))
+
+typedef struct _GValaFoo GValaFoo;
+typedef struct _GValaFooClass GValaFooClass;
+typedef struct _GValaFooPrivate GValaFooPrivate;
+typedef struct _GParamSpecValaFoo GParamSpecValaFoo;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _GValaFoo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       GValaFooPrivate * priv;
+};
+
+struct _GValaFooClass {
+       GTypeClass parent_class;
+       void (*finalize) (GValaFoo *self);
+};
+
+struct _GParamSpecValaFoo {
+       GParamSpec parent_instance;
+};
+
+static gpointer g_vala_foo_parent_class = NULL;
+
+VALA_EXTERN gpointer g_vala_foo_ref (gpointer instance);
+VALA_EXTERN void g_vala_foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* g_param_spec_vala_foo (const gchar* name,
+                                   const gchar* nick,
+                                   const gchar* blurb,
+                                   GType object_type,
+                                   GParamFlags flags);
+VALA_EXTERN void g_value_set_vala_foo (GValue* value,
+                           gpointer v_object);
+VALA_EXTERN void g_value_take_vala_foo (GValue* value,
+                            gpointer v_object);
+VALA_EXTERN gpointer g_value_get_vala_foo (const GValue* value);
+VALA_EXTERN GType g_vala_foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (GValaFoo, g_vala_foo_unref)
+VALA_EXTERN GValaFoo* g_vala_foo_new (void);
+VALA_EXTERN GValaFoo* g_vala_foo_construct (GType object_type);
+static void g_vala_foo_finalize (GValaFoo * obj);
+static GType g_vala_foo_get_type_once (void);
+VALA_EXTERN gint g_vala_foo (void);
+static void _vala_main (void);
+
+GValaFoo*
+g_vala_foo_construct (GType object_type)
+{
+       GValaFoo* self = NULL;
+       self = (GValaFoo*) g_type_create_instance (object_type);
+       return self;
+}
+
+GValaFoo*
+g_vala_foo_new (void)
+{
+       return g_vala_foo_construct (G_TYPE_VALA_FOO);
+}
+
+static void
+g_value_vala_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+g_value_vala_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               g_vala_foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+g_value_vala_foo_copy_value (const GValue* src_value,
+                             GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = g_vala_foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+g_value_vala_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+g_value_vala_foo_collect_value (GValue* value,
+                                guint n_collect_values,
+                                GTypeCValue* collect_values,
+                                guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               GValaFoo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = g_vala_foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+g_value_vala_foo_lcopy_value (const GValue* value,
+                              guint n_collect_values,
+                              GTypeCValue* collect_values,
+                              guint collect_flags)
+{
+       GValaFoo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = g_vala_foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+g_param_spec_vala_foo (const gchar* name,
+                       const gchar* nick,
+                       const gchar* blurb,
+                       GType object_type,
+                       GParamFlags flags)
+{
+       GParamSpecValaFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, G_TYPE_VALA_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+g_value_get_vala_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, G_TYPE_VALA_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+g_value_set_vala_foo (GValue* value,
+                      gpointer v_object)
+{
+       GValaFoo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, G_TYPE_VALA_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, G_TYPE_VALA_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               g_vala_foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               g_vala_foo_unref (old);
+       }
+}
+
+void
+g_value_take_vala_foo (GValue* value,
+                       gpointer v_object)
+{
+       GValaFoo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, G_TYPE_VALA_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, G_TYPE_VALA_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               g_vala_foo_unref (old);
+       }
+}
+
+static void
+g_vala_foo_class_init (GValaFooClass * klass,
+                       gpointer klass_data)
+{
+       g_vala_foo_parent_class = g_type_class_peek_parent (klass);
+       ((GValaFooClass *) klass)->finalize = g_vala_foo_finalize;
+}
+
+static void
+g_vala_foo_instance_init (GValaFoo * self,
+                          gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+g_vala_foo_finalize (GValaFoo * obj)
+{
+       GValaFoo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, G_TYPE_VALA_FOO, GValaFoo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+g_vala_foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { g_value_vala_foo_init, 
g_value_vala_foo_free_value, g_value_vala_foo_copy_value, g_value_vala_foo_peek_pointer, "p", 
g_value_vala_foo_collect_value, "p", g_value_vala_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (GValaFooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) g_vala_foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(GValaFoo), 0, (GInstanceInitFunc) g_vala_foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType g_vala_foo_type_id;
+       g_vala_foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "GValaFoo", 
&g_define_type_info, &g_define_type_fundamental_info, 0);
+       return g_vala_foo_type_id;
+}
+
+GType
+g_vala_foo_get_type (void)
+{
+       static volatile gsize g_vala_foo_type_id__volatile = 0;
+       if (g_once_init_enter (&g_vala_foo_type_id__volatile)) {
+               GType g_vala_foo_type_id;
+               g_vala_foo_type_id = g_vala_foo_get_type_once ();
+               g_once_init_leave (&g_vala_foo_type_id__volatile, g_vala_foo_type_id);
+       }
+       return g_vala_foo_type_id__volatile;
+}
+
+gpointer
+g_vala_foo_ref (gpointer instance)
+{
+       GValaFoo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+g_vala_foo_unref (gpointer instance)
+{
+       GValaFoo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               G_VALA_FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+gint
+g_vala_foo (void)
+{
+       gint result = 0;
+       result = 42;
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       const gchar* _tmp0_;
+       _vala_assert (g_vala_foo () == 42, "vala_foo () == 42");
+       _tmp0_ = g_type_name (G_TYPE_VALA_FOO);
+       _vala_assert (g_strcmp0 (_tmp0_, "GValaFoo") == 0, "typeof (ValaFoo).name () == \"GValaFoo\"");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/nullability/bug611223.c-expected b/tests/nullability/bug611223.c-expected
new file mode 100644
index 000000000..e79eb9690
--- /dev/null
+++ b/tests/nullability/bug611223.c-expected
@@ -0,0 +1,77 @@
+/* nullability_bug611223.c generated by valac, the Vala compiler
+ * generated from nullability_bug611223.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+       gchar* nullable = NULL;
+       const gchar* _tmp0_ = NULL;
+       const gchar* _tmp1_;
+       gchar* non_null = NULL;
+       gchar* _tmp2_;
+       const gchar* _tmp3_ = NULL;
+       const gchar* _tmp4_;
+       gchar* some_null = NULL;
+       gchar* _tmp5_;
+       const gchar* _tmp6_ = NULL;
+       gchar* also_non_null = NULL;
+       gchar* _tmp8_;
+       const gchar* _tmp9_ = NULL;
+       const gchar* _tmp10_;
+       gchar* really_non_null = NULL;
+       gchar* _tmp12_;
+       nullable = NULL;
+       _tmp1_ = nullable;
+       _tmp0_ = _tmp1_;
+       if (_tmp0_ == NULL) {
+               _tmp0_ = "";
+       }
+       _tmp2_ = g_strdup ((const gchar*) _tmp0_);
+       non_null = _tmp2_;
+       _tmp4_ = nullable;
+       _tmp3_ = _tmp4_;
+       if (_tmp3_ == NULL) {
+               _tmp3_ = NULL;
+       }
+       _tmp5_ = g_strdup (_tmp3_);
+       some_null = _tmp5_;
+       _tmp6_ = NULL;
+       if (_tmp6_ == NULL) {
+               const gchar* _tmp7_;
+               _tmp7_ = non_null;
+               _tmp6_ = _tmp7_;
+       }
+       _tmp8_ = g_strdup ((const gchar*) _tmp6_);
+       also_non_null = _tmp8_;
+       _tmp10_ = non_null;
+       _tmp9_ = _tmp10_;
+       if (_tmp9_ == NULL) {
+               const gchar* _tmp11_;
+               _tmp11_ = nullable;
+               _tmp9_ = _tmp11_;
+       }
+       _tmp12_ = g_strdup ((const gchar*) _tmp9_);
+       really_non_null = _tmp12_;
+       _g_free0 (really_non_null);
+       _g_free0 (also_non_null);
+       _g_free0 (some_null);
+       _g_free0 (non_null);
+       _g_free0 (nullable);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/nullability/member-access-narrowed-instance.c-expected 
b/tests/nullability/member-access-narrowed-instance.c-expected
new file mode 100644
index 000000000..7f89e63f7
--- /dev/null
+++ b/tests/nullability/member-access-narrowed-instance.c-expected
@@ -0,0 +1,309 @@
+/* nullability_member_access_narrowed_instance.c generated by valac, the Vala compiler
+ * generated from nullability_member_access_narrowed_instance.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+       gint i;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       if (IS_FOO (foo)) {
+               foo->i = 42;
+               _vala_assert (foo->i == 42, "foo.i == 42");
+       } else {
+               g_assert_not_reached ();
+       }
+       _foo_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/nullability/var-type.c-expected b/tests/nullability/var-type.c-expected
new file mode 100644
index 000000000..9d0f55e35
--- /dev/null
+++ b/tests/nullability/var-type.c-expected
@@ -0,0 +1,92 @@
+/* nullability_var_type.c generated by valac, the Vala compiler
+ * generated from nullability_var_type.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (void);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static void
+_vala_main (void)
+{
+       {
+               const gchar* foo = NULL;
+               const gchar* _tmp0_;
+               foo = "foo";
+               _tmp0_ = foo;
+               _vala_assert (_tmp0_ != NULL, "foo != null");
+       }
+       {
+               gchar* _tmp1_;
+               gchar* _tmp2_;
+               gchar** _tmp3_;
+               _tmp1_ = g_strdup ("foo");
+               _tmp2_ = g_strdup ("bar");
+               _tmp3_ = g_new0 (gchar*, 2 + 1);
+               _tmp3_[0] = _tmp1_;
+               _tmp3_[1] = _tmp2_;
+               {
+                       gchar** foo_collection = NULL;
+                       gint foo_collection_length1 = 0;
+                       gint _foo_collection_size_ = 0;
+                       gint foo_it = 0;
+                       foo_collection = _tmp3_;
+                       foo_collection_length1 = 2;
+                       for (foo_it = 0; foo_it < foo_collection_length1; foo_it = foo_it + 1) {
+                               const gchar* foo = NULL;
+                               foo = foo_collection[foo_it];
+                               {
+                                       const gchar* _tmp4_;
+                                       _tmp4_ = foo;
+                                       _vala_assert (_tmp4_ != NULL, "foo != null");
+                               }
+                       }
+                       foo_collection = (_vala_array_free (foo_collection, foo_collection_length1, 
(GDestroyNotify) g_free), NULL);
+               }
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/objects/bug566909.c-expected b/tests/objects/bug566909.c-expected
new file mode 100644
index 000000000..6a7918347
--- /dev/null
+++ b/tests/objects/bug566909.c-expected
@@ -0,0 +1,268 @@
+/* objects_bug566909.c generated by valac, the Vala compiler
+ * generated from objects_bug566909.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define MAMAN_TYPE_FOO (maman_foo_get_type ())
+#define MAMAN_FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_FOO, MamanFoo))
+#define MAMAN_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAMAN_TYPE_FOO, MamanFooClass))
+#define MAMAN_IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_FOO))
+#define MAMAN_IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAMAN_TYPE_FOO))
+#define MAMAN_FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAMAN_TYPE_FOO, MamanFooClass))
+
+typedef struct _MamanFoo MamanFoo;
+typedef struct _MamanFooClass MamanFooClass;
+typedef struct _MamanFooPrivate MamanFooPrivate;
+enum  {
+       MAMAN_FOO_0_PROPERTY,
+       MAMAN_FOO_NUM_PROPERTIES
+};
+static GParamSpec* maman_foo_properties[MAMAN_FOO_NUM_PROPERTIES];
+enum  {
+       MAMAN_FOO_BAR_SIGNAL,
+       MAMAN_FOO_NUM_SIGNALS
+};
+static guint maman_foo_signals[MAMAN_FOO_NUM_SIGNALS] = {0};
+typedef struct _Block1Data Block1Data;
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _MamanFoo {
+       GObject parent_instance;
+       MamanFooPrivate * priv;
+};
+
+struct _MamanFooClass {
+       GObjectClass parent_class;
+};
+
+struct _Block1Data {
+       int _ref_count_;
+       gboolean detailed1;
+       gboolean detailed2;
+       gboolean detailed3;
+};
+
+static gpointer maman_foo_parent_class = NULL;
+
+VALA_EXTERN GType maman_foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MamanFoo, g_object_unref)
+VALA_EXTERN MamanFoo* maman_foo_new (void);
+VALA_EXTERN MamanFoo* maman_foo_construct (GType object_type);
+static GType maman_foo_get_type_once (void);
+static void _vala_main (void);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static void __lambda4_ (Block1Data* _data1_);
+static void ___lambda4__maman_foo_bar (MamanFoo* _sender,
+                                gpointer self);
+static void __lambda5_ (Block1Data* _data1_);
+static void ___lambda5__maman_foo_bar (MamanFoo* _sender,
+                                gpointer self);
+static void __lambda6_ (Block1Data* _data1_);
+static void ___lambda6__maman_foo_bar (MamanFoo* _sender,
+                                gpointer self);
+
+MamanFoo*
+maman_foo_construct (GType object_type)
+{
+       MamanFoo * self = NULL;
+       self = (MamanFoo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+MamanFoo*
+maman_foo_new (void)
+{
+       return maman_foo_construct (MAMAN_TYPE_FOO);
+}
+
+static void
+maman_foo_class_init (MamanFooClass * klass,
+                      gpointer klass_data)
+{
+       maman_foo_parent_class = g_type_class_peek_parent (klass);
+       maman_foo_signals[MAMAN_FOO_BAR_SIGNAL] = g_signal_new ("bar", MAMAN_TYPE_FOO, G_SIGNAL_RUN_LAST | 
G_SIGNAL_DETAILED, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+}
+
+static void
+maman_foo_instance_init (MamanFoo * self,
+                         gpointer klass)
+{
+}
+
+static GType
+maman_foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (MamanFooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(MamanFoo), 0, (GInstanceInitFunc) maman_foo_instance_init, NULL };
+       GType maman_foo_type_id;
+       maman_foo_type_id = g_type_register_static (G_TYPE_OBJECT, "MamanFoo", &g_define_type_info, 0);
+       return maman_foo_type_id;
+}
+
+GType
+maman_foo_get_type (void)
+{
+       static volatile gsize maman_foo_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_foo_type_id__volatile)) {
+               GType maman_foo_type_id;
+               maman_foo_type_id = maman_foo_get_type_once ();
+               g_once_init_leave (&maman_foo_type_id__volatile, maman_foo_type_id);
+       }
+       return maman_foo_type_id__volatile;
+}
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static void
+__lambda4_ (Block1Data* _data1_)
+{
+       _data1_->detailed1 = TRUE;
+}
+
+static void
+___lambda4__maman_foo_bar (MamanFoo* _sender,
+                           gpointer self)
+{
+       __lambda4_ (self);
+}
+
+static void
+__lambda5_ (Block1Data* _data1_)
+{
+       _data1_->detailed2 = TRUE;
+}
+
+static void
+___lambda5__maman_foo_bar (MamanFoo* _sender,
+                           gpointer self)
+{
+       __lambda5_ (self);
+}
+
+static void
+__lambda6_ (Block1Data* _data1_)
+{
+       _data1_->detailed3 = TRUE;
+}
+
+static void
+___lambda6__maman_foo_bar (MamanFoo* _sender,
+                           gpointer self)
+{
+       __lambda6_ (self);
+}
+
+static void
+_vala_main (void)
+{
+       Block1Data* _data1_;
+       gchar* detail1 = NULL;
+       gchar* _tmp0_;
+       gchar* detail2 = NULL;
+       gchar* _tmp1_;
+       MamanFoo* foo = NULL;
+       MamanFoo* _tmp2_;
+       MamanFoo* _tmp3_;
+       const gchar* _tmp4_;
+       gchar* _tmp5_;
+       MamanFoo* _tmp6_;
+       const gchar* _tmp7_;
+       gchar* _tmp8_;
+       MamanFoo* _tmp9_;
+       MamanFoo* _tmp10_;
+       const gchar* _tmp11_;
+       MamanFoo* _tmp12_;
+       const gchar* _tmp13_;
+       MamanFoo* _tmp14_;
+       gboolean _tmp15_ = FALSE;
+       gboolean _tmp16_ = FALSE;
+       _data1_ = g_slice_new0 (Block1Data);
+       _data1_->_ref_count_ = 1;
+       _data1_->detailed1 = FALSE;
+       _data1_->detailed2 = FALSE;
+       _data1_->detailed3 = FALSE;
+       _tmp0_ = g_strdup ("detail1");
+       detail1 = _tmp0_;
+       _tmp1_ = g_strdup ("detail2");
+       detail2 = _tmp1_;
+       _tmp2_ = maman_foo_new ();
+       foo = _tmp2_;
+       _tmp3_ = foo;
+       _tmp4_ = detail1;
+       _tmp5_ = g_strconcat ("bar::", _tmp4_, NULL);
+       g_signal_connect_data (_tmp3_, _tmp5_, (GCallback) ___lambda4__maman_foo_bar, block1_data_ref 
(_data1_), (GClosureNotify) block1_data_unref, 0);
+       _g_free0 (_tmp5_);
+       _tmp6_ = foo;
+       _tmp7_ = detail2;
+       _tmp8_ = g_strconcat ("bar::", _tmp7_, NULL);
+       g_signal_connect_data (_tmp6_, _tmp8_, (GCallback) ___lambda5__maman_foo_bar, block1_data_ref 
(_data1_), (GClosureNotify) block1_data_unref, 0);
+       _g_free0 (_tmp8_);
+       _tmp9_ = foo;
+       g_signal_connect_data (_tmp9_, "bar::detail3", (GCallback) ___lambda6__maman_foo_bar, block1_data_ref 
(_data1_), (GClosureNotify) block1_data_unref, 0);
+       _tmp10_ = foo;
+       _tmp11_ = detail1;
+       g_signal_emit (_tmp10_, maman_foo_signals[MAMAN_FOO_BAR_SIGNAL], g_quark_from_string (_tmp11_));
+       _tmp12_ = foo;
+       _tmp13_ = detail2;
+       g_signal_emit (_tmp12_, maman_foo_signals[MAMAN_FOO_BAR_SIGNAL], g_quark_from_string (_tmp13_));
+       _tmp14_ = foo;
+       g_signal_emit (_tmp14_, maman_foo_signals[MAMAN_FOO_BAR_SIGNAL], g_quark_from_static_string 
("detail3"));
+       if (_data1_->detailed1) {
+               _tmp16_ = _data1_->detailed2;
+       } else {
+               _tmp16_ = FALSE;
+       }
+       if (_tmp16_) {
+               _tmp15_ = _data1_->detailed3;
+       } else {
+               _tmp15_ = FALSE;
+       }
+       _vala_assert (_tmp15_, "detailed1 && detailed2 && detailed3");
+       _g_object_unref0 (foo);
+       _g_free0 (detail2);
+       _g_free0 (detail1);
+       block1_data_unref (_data1_);
+       _data1_ = NULL;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/bug588203.c-expected b/tests/objects/bug588203.c-expected
new file mode 100644
index 000000000..aaef8da9b
--- /dev/null
+++ b/tests/objects/bug588203.c-expected
@@ -0,0 +1,306 @@
+/* objects_bug588203.c generated by valac, the Vala compiler
+ * generated from objects_bug588203.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+       gint* bar;
+       gint length;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+       self->bar = (g_free (self->bar), NULL);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       gint* _tmp1_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       _tmp1_ = g_new0 (gint, 10);
+       foo->bar = (g_free (foo->bar), NULL);
+       foo->bar = _tmp1_;
+       foo->length = 10;
+       _foo_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/bug589928.c-expected b/tests/objects/bug589928.c-expected
new file mode 100644
index 000000000..1b488379f
--- /dev/null
+++ b/tests/objects/bug589928.c-expected
@@ -0,0 +1,375 @@
+/* objects_bug589928.c generated by valac, the Vala compiler
+ * generated from objects_bug589928.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _FooPrivate {
+       GList* _bar;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+static void _g_free0_ (gpointer var);
+static inline void _g_list_free__g_free0_ (GList* self);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+VALA_EXTERN GList* foo_get_bar (Foo* self);
+VALA_EXTERN void foo_set_bar (Foo* self,
+                  GList* value);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+static void
+_g_free0_ (gpointer var)
+{
+       var = (g_free (var), NULL);
+}
+
+static inline void
+_g_list_free__g_free0_ (GList* self)
+{
+       g_list_free_full (self, (GDestroyNotify) _g_free0_);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+GList*
+foo_get_bar (Foo* self)
+{
+       GList* result;
+       GList* _tmp0_;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = self->priv->_bar;
+       result = _tmp0_;
+       return result;
+}
+
+void
+foo_set_bar (Foo* self,
+             GList* value)
+{
+       GList* _tmp0_;
+       g_return_if_fail (IS_FOO (self));
+       _tmp0_ = value;
+       value = NULL;
+       (self->priv->_bar == NULL) ? NULL : (self->priv->_bar = (_g_list_free__g_free0_ (self->priv->_bar), 
NULL));
+       self->priv->_bar = _tmp0_;
+       (value == NULL) ? NULL : (value = (_g_list_free__g_free0_ (value), NULL));
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+       self->priv->_bar = NULL;
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+       (self->priv->_bar == NULL) ? NULL : (self->priv->_bar = (_g_list_free__g_free0_ (self->priv->_bar), 
NULL));
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       GList* _tmp1_;
+       GList* _tmp2_;
+       gchar* _tmp3_;
+       GList* _tmp4_;
+       GList* _tmp5_;
+       gconstpointer _tmp6_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       _tmp1_ = foo_get_bar (foo);
+       _tmp2_ = _tmp1_;
+       _tmp3_ = g_strdup ("1");
+       foo_set_bar (foo, g_list_append (_tmp2_, _tmp3_));
+       _tmp4_ = foo_get_bar (foo);
+       _tmp5_ = _tmp4_;
+       _tmp6_ = g_list_nth_data (_tmp5_, (guint) 0);
+       _vala_assert (g_strcmp0 ((const gchar*) _tmp6_, "1") == 0, "foo.bar.nth_data (0) == \"1\"");
+       _foo_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/bug593137.c-expected b/tests/objects/bug593137.c-expected
new file mode 100644
index 000000000..612dc0c31
--- /dev/null
+++ b/tests/objects/bug593137.c-expected
@@ -0,0 +1,298 @@
+/* objects_bug593137.c generated by valac, the Vala compiler
+ * generated from objects_bug593137.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+enum  {
+       BAR_0_PROPERTY,
+       BAR_NUM_PROPERTIES
+};
+static GParamSpec* bar_properties[BAR_NUM_PROPERTIES];
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_G_TYPE,
+       FOO_G_DUP_FUNC,
+       FOO_G_DESTROY_FUNC,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Bar {
+       GObject parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       GObjectClass parent_class;
+};
+
+struct _Foo {
+       Bar parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       BarClass parent_class;
+};
+
+struct _FooPrivate {
+       GType g_type;
+       GBoxedCopyFunc g_dup_func;
+       GDestroyNotify g_destroy_func;
+};
+
+static gpointer bar_parent_class = NULL;
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
+VALA_EXTERN Bar* bar_new (GType type);
+VALA_EXTERN Bar* bar_construct (GType object_type,
+                    GType type);
+static GType bar_get_type_once (void);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (GType g_type,
+              GBoxedCopyFunc g_dup_func,
+              GDestroyNotify g_destroy_func);
+VALA_EXTERN Foo* foo_construct (GType object_type,
+                    GType g_type,
+                    GBoxedCopyFunc g_dup_func,
+                    GDestroyNotify g_destroy_func);
+static GType foo_get_type_once (void);
+static void _vala_foo_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_foo_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec);
+static void _vala_main (void);
+
+Bar*
+bar_construct (GType object_type,
+               GType type)
+{
+       Bar * self = NULL;
+       self = (Bar*) g_object_new (object_type, NULL);
+       _vala_assert (type == G_TYPE_STRING, "type == typeof (string)");
+       return self;
+}
+
+Bar*
+bar_new (GType type)
+{
+       return bar_construct (TYPE_BAR, type);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (G_TYPE_OBJECT, "Bar", &g_define_type_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct (GType object_type,
+               GType g_type,
+               GBoxedCopyFunc g_dup_func,
+               GDestroyNotify g_destroy_func)
+{
+       Foo * self = NULL;
+       self = (Foo*) bar_construct (object_type, g_type);
+       self->priv->g_type = g_type;
+       self->priv->g_dup_func = g_dup_func;
+       self->priv->g_destroy_func = g_destroy_func;
+       return self;
+}
+
+Foo*
+foo_new (GType g_type,
+         GBoxedCopyFunc g_dup_func,
+         GDestroyNotify g_destroy_func)
+{
+       return foo_construct (TYPE_FOO, g_type, g_dup_func, g_destroy_func);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_foo_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_foo_set_property;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_G_TYPE, g_param_spec_gtype ("g-type", 
"type", "type", G_TYPE_NONE, G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_G_DUP_FUNC, g_param_spec_pointer 
("g-dup-func", "dup func", "dup func", G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_G_DESTROY_FUNC, g_param_spec_pointer 
("g-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | 
G_PARAM_CONSTRUCT_ONLY));
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (TYPE_BAR, "Foo", &g_define_type_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_foo_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_G_TYPE:
+               g_value_set_gtype (value, self->priv->g_type);
+               break;
+               case FOO_G_DUP_FUNC:
+               g_value_set_pointer (value, self->priv->g_dup_func);
+               break;
+               case FOO_G_DESTROY_FUNC:
+               g_value_set_pointer (value, self->priv->g_destroy_func);
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_foo_set_property (GObject * object,
+                        guint property_id,
+                        const GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_G_TYPE:
+               self->priv->g_type = g_value_get_gtype (value);
+               break;
+               case FOO_G_DUP_FUNC:
+               self->priv->g_dup_func = g_value_get_pointer (value);
+               break;
+               case FOO_G_DESTROY_FUNC:
+               self->priv->g_destroy_func = g_value_get_pointer (value);
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       _tmp0_ = foo_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free);
+       foo = _tmp0_;
+       _g_object_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/bug593260.c-expected b/tests/objects/bug593260.c-expected
new file mode 100644
index 000000000..9abe5e5fd
--- /dev/null
+++ b/tests/objects/bug593260.c-expected
@@ -0,0 +1,317 @@
+/* objects_bug593260.c generated by valac, the Vala compiler
+ * generated from objects_bug593260.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN void foo_do_foo (Foo* self,
+                 GType t_type,
+                 GBoxedCopyFunc t_dup_func,
+                 GDestroyNotify t_destroy_func);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+void
+foo_do_foo (Foo* self,
+            GType t_type,
+            GBoxedCopyFunc t_dup_func,
+            GDestroyNotify t_destroy_func)
+{
+       g_return_if_fail (IS_FOO (self));
+       _vala_assert (IS_FOO (self), "this is Foo");
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       foo_do_foo (foo, G_TYPE_INT, NULL, NULL);
+       _foo_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/bug596621.c-expected b/tests/objects/bug596621.c-expected
new file mode 100644
index 000000000..298bdfa63
--- /dev/null
+++ b/tests/objects/bug596621.c-expected
@@ -0,0 +1,199 @@
+/* objects_bug596621.c generated by valac, the Vala compiler
+ * generated from objects_bug596621.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef void (*Func) (gpointer user_data);
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+enum  {
+       BAR_0_PROPERTY,
+       BAR_NUM_PROPERTIES
+};
+static GParamSpec* bar_properties[BAR_NUM_PROPERTIES];
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _Bar {
+       Foo parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       FooClass parent_class;
+};
+
+static gpointer foo_parent_class = NULL;
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static GType foo_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static GType bar_get_type_once (void);
+static void _vala_main (void);
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar * self = NULL;
+       Func baz = NULL;
+       gpointer baz_target = NULL;
+       GDestroyNotify baz_target_destroy_notify = NULL;
+       self = (Bar*) g_object_new (object_type, NULL);
+       (baz_target_destroy_notify == NULL) ? NULL : (baz_target_destroy_notify (baz_target), NULL);
+       baz = NULL;
+       baz_target = NULL;
+       baz_target_destroy_notify = NULL;
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (TYPE_FOO, "Bar", &g_define_type_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/bug597155.c-expected b/tests/objects/bug597155.c-expected
new file mode 100644
index 000000000..e0f8c5a77
--- /dev/null
+++ b/tests/objects/bug597155.c-expected
@@ -0,0 +1,196 @@
+/* objects_bug597155.c generated by valac, the Vala compiler
+ * generated from objects_bug597155.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+enum  {
+       FOO_BAR_SIGNAL,
+       FOO_NUM_SIGNALS
+};
+static guint foo_signals[FOO_NUM_SIGNALS] = {0};
+typedef struct _Block1Data Block1Data;
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _Block1Data {
+       int _ref_count_;
+       Foo* foo;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static GType foo_get_type_once (void);
+VALA_EXTERN Foo* do_foo (void);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static void __lambda4_ (Block1Data* _data1_);
+static void ___lambda4__foo_bar (Foo* _sender,
+                          gpointer self);
+static void _vala_main (void);
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       foo_signals[FOO_BAR_SIGNAL] = g_signal_new ("bar", TYPE_FOO, G_SIGNAL_RUN_LAST, 0, NULL, NULL, 
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               _g_object_unref0 (_data1_->foo);
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static void
+__lambda4_ (Block1Data* _data1_)
+{
+       _vala_assert (IS_FOO (_data1_->foo), "foo is Foo");
+}
+
+static void
+___lambda4__foo_bar (Foo* _sender,
+                     gpointer self)
+{
+       __lambda4_ (self);
+}
+
+static gpointer
+_g_object_ref0 (gpointer self)
+{
+       return self ? g_object_ref (self) : NULL;
+}
+
+Foo*
+do_foo (void)
+{
+       Block1Data* _data1_;
+       Foo* _tmp0_;
+       Foo* _tmp1_;
+       Foo* result = NULL;
+       _data1_ = g_slice_new0 (Block1Data);
+       _data1_->_ref_count_ = 1;
+       _tmp0_ = foo_new ();
+       _data1_->foo = _tmp0_;
+       g_signal_connect_data (_data1_->foo, "bar", (GCallback) ___lambda4__foo_bar, block1_data_ref 
(_data1_), (GClosureNotify) block1_data_unref, 0);
+       _tmp1_ = _g_object_ref0 (_data1_->foo);
+       result = _tmp1_;
+       block1_data_unref (_data1_);
+       _data1_ = NULL;
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       _tmp0_ = do_foo ();
+       foo = _tmp0_;
+       g_signal_emit (foo, foo_signals[FOO_BAR_SIGNAL], 0);
+       _g_object_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/bug597161.c-expected b/tests/objects/bug597161.c-expected
new file mode 100644
index 000000000..a7913b7b6
--- /dev/null
+++ b/tests/objects/bug597161.c-expected
@@ -0,0 +1,123 @@
+/* objects_bug597161.c generated by valac, the Vala compiler
+ * generated from objects_bug597161.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* _tmp0_;
+       Foo* _tmp1_;
+       _tmp0_ = foo_new ();
+       _tmp1_ = _tmp0_;
+       _vala_assert (IS_FOO (_tmp1_), "new Foo () is Foo");
+       _g_object_unref0 (_tmp1_);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/bug613486.c-expected b/tests/objects/bug613486.c-expected
new file mode 100644
index 000000000..4f8c44a85
--- /dev/null
+++ b/tests/objects/bug613486.c-expected
@@ -0,0 +1,411 @@
+/* objects_bug613486.c generated by valac, the Vala compiler
+ * generated from objects_bug613486.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _FooPrivate {
+       GType t_type;
+       GBoxedCopyFunc t_dup_func;
+       GDestroyNotify t_destroy_func;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+struct _Bar {
+       Foo parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       FooClass parent_class;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN void foo_do_foo (Foo* self,
+                 gconstpointer t);
+VALA_EXTERN Foo* foo_new (GType t_type,
+              GBoxedCopyFunc t_dup_func,
+              GDestroyNotify t_destroy_func);
+VALA_EXTERN Foo* foo_construct (GType object_type,
+                    GType t_type,
+                    GBoxedCopyFunc t_dup_func,
+                    GDestroyNotify t_destroy_func);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, foo_unref)
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static GType bar_get_type_once (void);
+static void _vala_main (void);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+void
+foo_do_foo (Foo* self,
+            gconstpointer t)
+{
+       g_return_if_fail (IS_FOO (self));
+}
+
+Foo*
+foo_construct (GType object_type,
+               GType t_type,
+               GBoxedCopyFunc t_dup_func,
+               GDestroyNotify t_destroy_func)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       self->priv->t_type = t_type;
+       self->priv->t_dup_func = t_dup_func;
+       self->priv->t_destroy_func = t_destroy_func;
+       return self;
+}
+
+Foo*
+foo_new (GType t_type,
+         GBoxedCopyFunc t_dup_func,
+         GDestroyNotify t_destroy_func)
+{
+       return foo_construct (TYPE_FOO, t_type, t_dup_func, t_destroy_func);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar* self = NULL;
+       self = (Bar*) foo_construct (object_type, G_TYPE_INT, NULL, NULL);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (TYPE_FOO, "Bar", &g_define_type_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Bar* b = NULL;
+       Bar* _tmp0_;
+       _tmp0_ = bar_new ();
+       b = _tmp0_;
+       foo_do_foo (G_TYPE_CHECK_INSTANCE_CAST (b, TYPE_FOO, Foo), (gpointer) ((gintptr) 42));
+       _foo_unref0 (b);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/bug613840.c-expected b/tests/objects/bug613840.c-expected
new file mode 100644
index 000000000..3acd5e764
--- /dev/null
+++ b/tests/objects/bug613840.c-expected
@@ -0,0 +1,95 @@
+/* objects_bug613840.c generated by valac, the Vala compiler
+ * generated from objects_bug613840.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (void);
+static void _vala_array_copy1 (GObject* * self,
+                        GObject* * dest);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static gpointer
+_g_object_ref0 (gpointer self)
+{
+       return self ? g_object_ref (self) : NULL;
+}
+
+static void
+_vala_array_copy1 (GObject* * self,
+                   GObject* * dest)
+{
+       gint i;
+       for (i = 0; i < 1; i++) {
+               GObject* _tmp0_;
+               _tmp0_ = _g_object_ref0 (self[i]);
+               dest[i] = _tmp0_;
+       }
+}
+
+static void
+_vala_main (void)
+{
+       GObject* a[1] = {0};
+       GObject* _tmp0_;
+       GObject* _tmp1_[1] = {0};
+       GObject* b[1] = {0};
+       GObject* _tmp2_[1];
+       gint _tmp2__length1;
+       GObject* _tmp3_;
+       GObject* _tmp4_;
+       _tmp0_ = g_object_new (G_TYPE_OBJECT, NULL);
+       _tmp1_[0] = _tmp0_;
+       memcpy (a, _tmp1_, 1 * sizeof (GObject*));
+       _vala_array_copy1 (a, _tmp2_);
+       memcpy (b, _tmp2_, 1 * sizeof (GObject*));
+       _tmp3_ = a[0];
+       _tmp4_ = b[0];
+       _vala_assert (_tmp3_ == _tmp4_, "a[0] == b[0]");
+       _vala_array_destroy (b, 1, (GDestroyNotify) g_object_unref);
+       _vala_array_destroy (a, 1, (GDestroyNotify) g_object_unref);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/objects/bug620675.c-expected b/tests/objects/bug620675.c-expected
new file mode 100644
index 000000000..599994759
--- /dev/null
+++ b/tests/objects/bug620675.c-expected
@@ -0,0 +1,693 @@
+/* objects_bug620675.c generated by valac, the Vala compiler
+ * generated from objects_bug620675.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+#define _g_ptr_array_unref0(var) ((var == NULL) ? NULL : (var = (g_ptr_array_unref (var), NULL)))
+#define _g_free0(var) (var = (g_free (var), NULL))
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+       GPtrArray* paramlist;
+       gboolean used_test;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+struct _Bar {
+       Foo parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       FooClass parent_class;
+};
+
+static gpointer foo_parent_class = NULL;
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new (const gchar* msg,
+              GError** error,
+              ...);
+VALA_EXTERN Foo* foo_construct (GType object_type,
+                    const gchar* msg,
+                    GError** error,
+                    ...);
+VALA_EXTERN Foo* foo_constructv (GType object_type,
+                     const gchar* msg,
+                     GError** error,
+                     va_list _vala_va_list);
+static void _g_free0_ (gpointer var);
+VALA_EXTERN Foo* foo_new_test (const gchar* msg);
+VALA_EXTERN Foo* foo_construct_test (GType object_type,
+                         const gchar* msg);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, foo_unref)
+VALA_EXTERN Bar* bar_new (const gchar* text,
+              GError** error);
+VALA_EXTERN Bar* bar_construct (GType object_type,
+                    const gchar* text,
+                    GError** error);
+VALA_EXTERN Bar* bar_new_other (gint num,
+                    ...);
+VALA_EXTERN Bar* bar_construct_other (GType object_type,
+                          gint num,
+                          ...);
+VALA_EXTERN Bar* bar_constructv_other (GType object_type,
+                           gint num,
+                           va_list _vala_va_list);
+static GType bar_get_type_once (void);
+static void _vala_main (void);
+
+static void
+_g_free0_ (gpointer var)
+{
+       var = (g_free (var), NULL);
+}
+
+Foo*
+foo_constructv (GType object_type,
+                const gchar* msg,
+                GError** error,
+                va_list _vala_va_list)
+{
+       Foo* self = NULL;
+       gchar* arg = NULL;
+       gchar* _tmp0_;
+       va_list args = {0};
+       GPtrArray* _tmp1_;
+       g_return_val_if_fail (msg != NULL, NULL);
+       self = (Foo*) g_type_create_instance (object_type);
+       _tmp0_ = g_strdup (msg);
+       arg = _tmp0_;
+       va_copy (args, _vala_va_list);
+       _tmp1_ = g_ptr_array_new_full ((guint) 0, _g_free0_);
+       _g_ptr_array_unref0 (self->paramlist);
+       self->paramlist = _tmp1_;
+       while (TRUE) {
+               const gchar* _tmp2_;
+               GPtrArray* _tmp3_;
+               const gchar* _tmp4_;
+               gchar* _tmp5_;
+               const gchar* _tmp6_;
+               gchar* _tmp7_;
+               _tmp2_ = arg;
+               if (!(_tmp2_ != NULL)) {
+                       break;
+               }
+               _tmp3_ = self->paramlist;
+               _tmp4_ = arg;
+               _tmp5_ = g_strdup (_tmp4_);
+               g_ptr_array_add (_tmp3_, _tmp5_);
+               _tmp6_ = va_arg (args, gchar*);
+               _tmp7_ = g_strdup (_tmp6_);
+               _g_free0 (arg);
+               arg = _tmp7_;
+       }
+       self->used_test = FALSE;
+       va_end (args);
+       _g_free0 (arg);
+       return self;
+}
+
+Foo*
+foo_new (const gchar* msg,
+         GError** error,
+         ...)
+{
+       va_list _vala_va_list_obj;
+       va_start (_vala_va_list_obj, error);
+       return foo_constructv (TYPE_FOO, msg, error, _vala_va_list_obj);
+}
+
+Foo*
+foo_construct (GType object_type,
+               const gchar* msg,
+               GError** error,
+               ...)
+{
+       va_list _vala_va_list_obj;
+       va_start (_vala_va_list_obj, error);
+       return foo_constructv (object_type, msg, error, _vala_va_list_obj);
+}
+
+Foo*
+foo_construct_test (GType object_type,
+                    const gchar* msg)
+{
+       Foo* self = NULL;
+       GPtrArray* _tmp0_;
+       GPtrArray* _tmp1_;
+       gchar* _tmp2_;
+       g_return_val_if_fail (msg != NULL, NULL);
+       self = (Foo*) g_type_create_instance (object_type);
+       _tmp0_ = g_ptr_array_new_full ((guint) 0, _g_free0_);
+       _g_ptr_array_unref0 (self->paramlist);
+       self->paramlist = _tmp0_;
+       _tmp1_ = self->paramlist;
+       _tmp2_ = g_strdup (msg);
+       g_ptr_array_add (_tmp1_, _tmp2_);
+       self->used_test = TRUE;
+       return self;
+}
+
+Foo*
+foo_new_test (const gchar* msg)
+{
+       return foo_construct_test (TYPE_FOO, msg);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+       _g_ptr_array_unref0 (self->paramlist);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+Bar*
+bar_construct (GType object_type,
+               const gchar* text,
+               GError** error)
+{
+       Bar* self = NULL;
+       GError* _inner_error0_ = NULL;
+       g_return_val_if_fail (text != NULL, NULL);
+       self = (Bar*) foo_construct (object_type, text, &_inner_error0_, "bye", NULL);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_propagate_error (error, _inner_error0_);
+               _foo_unref0 (self);
+               return NULL;
+       }
+       return self;
+}
+
+Bar*
+bar_new (const gchar* text,
+         GError** error)
+{
+       return bar_construct (TYPE_BAR, text, error);
+}
+
+Bar*
+bar_constructv_other (GType object_type,
+                      gint num,
+                      va_list _vala_va_list)
+{
+       Bar* self = NULL;
+       GError* _inner_error0_ = NULL;
+       {
+               self = (Bar*) foo_construct (object_type, "hey", &_inner_error0_, NULL);
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       goto __catch0_g_error;
+               }
+       }
+       goto __finally0;
+       __catch0_g_error:
+       {
+               g_clear_error (&_inner_error0_);
+       }
+       __finally0:
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return NULL;
+       }
+       return self;
+}
+
+Bar*
+bar_new_other (gint num,
+               ...)
+{
+       va_list _vala_va_list_obj;
+       va_start (_vala_va_list_obj, num);
+       return bar_constructv_other (TYPE_BAR, num, _vala_va_list_obj);
+}
+
+Bar*
+bar_construct_other (GType object_type,
+                     gint num,
+                     ...)
+{
+       va_list _vala_va_list_obj;
+       va_start (_vala_va_list_obj, num);
+       return bar_constructv_other (object_type, num, _vala_va_list_obj);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (TYPE_FOO, "Bar", &g_define_type_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static gint
+vala_g_ptr_array_get_length (GPtrArray* self)
+{
+       gint result;
+       g_return_val_if_fail (self != NULL, 0);
+       result = (gint) self->len;
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_ = NULL;
+       Foo* _tmp1_;
+       Foo* _tmp2_;
+       Foo* _tmp3_;
+       Foo* _tmp4_;
+       GPtrArray* _tmp5_;
+       gint _tmp6_;
+       gint _tmp7_;
+       Foo* _tmp8_;
+       GPtrArray* _tmp9_;
+       gconstpointer _tmp10_;
+       Foo* _tmp11_;
+       GPtrArray* _tmp12_;
+       gconstpointer _tmp13_;
+       Foo* _tmp14_;
+       GPtrArray* _tmp15_;
+       gconstpointer _tmp16_;
+       Foo* _tmp17_;
+       Foo* _tmp18_;
+       Foo* _tmp19_;
+       GPtrArray* _tmp20_;
+       gint _tmp21_;
+       gint _tmp22_;
+       Foo* _tmp23_;
+       GPtrArray* _tmp24_;
+       gconstpointer _tmp25_;
+       Bar* _tmp26_ = NULL;
+       Bar* _tmp27_;
+       Bar* _tmp28_;
+       Foo* _tmp29_;
+       Foo* _tmp30_;
+       GPtrArray* _tmp31_;
+       gint _tmp32_;
+       gint _tmp33_;
+       Foo* _tmp34_;
+       GPtrArray* _tmp35_;
+       gconstpointer _tmp36_;
+       Foo* _tmp37_;
+       GPtrArray* _tmp38_;
+       gconstpointer _tmp39_;
+       Bar* _tmp40_;
+       Foo* _tmp41_;
+       Foo* _tmp42_;
+       GPtrArray* _tmp43_;
+       gint _tmp44_;
+       gint _tmp45_;
+       Foo* _tmp46_;
+       GPtrArray* _tmp47_;
+       gconstpointer _tmp48_;
+       GError* _inner_error0_ = NULL;
+       _tmp1_ = foo_new ("one", &_inner_error0_, "two", "three", NULL);
+       _tmp0_ = _tmp1_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _foo_unref0 (foo);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp2_ = _tmp0_;
+       _tmp0_ = NULL;
+       _foo_unref0 (foo);
+       foo = _tmp2_;
+       _tmp3_ = foo;
+       _vala_assert (!_tmp3_->used_test, "!foo.used_test");
+       _tmp4_ = foo;
+       _tmp5_ = _tmp4_->paramlist;
+       _tmp6_ = vala_g_ptr_array_get_length (_tmp5_);
+       _tmp7_ = _tmp6_;
+       _vala_assert (_tmp7_ == 3, "foo.paramlist.length == 3");
+       _tmp8_ = foo;
+       _tmp9_ = _tmp8_->paramlist;
+       _tmp10_ = g_ptr_array_index (_tmp9_, (guint) 0);
+       _vala_assert (g_strcmp0 ((const gchar*) _tmp10_, "one") == 0, "foo.paramlist[0] == \"one\"");
+       _tmp11_ = foo;
+       _tmp12_ = _tmp11_->paramlist;
+       _tmp13_ = g_ptr_array_index (_tmp12_, (guint) 1);
+       _vala_assert (g_strcmp0 ((const gchar*) _tmp13_, "two") == 0, "foo.paramlist[1] == \"two\"");
+       _tmp14_ = foo;
+       _tmp15_ = _tmp14_->paramlist;
+       _tmp16_ = g_ptr_array_index (_tmp15_, (guint) 2);
+       _vala_assert (g_strcmp0 ((const gchar*) _tmp16_, "three") == 0, "foo.paramlist[2] == \"three\"");
+       _tmp17_ = foo_new_test ("meh");
+       _foo_unref0 (foo);
+       foo = _tmp17_;
+       _tmp18_ = foo;
+       _vala_assert (_tmp18_->used_test, "foo.used_test");
+       _tmp19_ = foo;
+       _tmp20_ = _tmp19_->paramlist;
+       _tmp21_ = vala_g_ptr_array_get_length (_tmp20_);
+       _tmp22_ = _tmp21_;
+       _vala_assert (_tmp22_ == 1, "foo.paramlist.length == 1");
+       _tmp23_ = foo;
+       _tmp24_ = _tmp23_->paramlist;
+       _tmp25_ = g_ptr_array_index (_tmp24_, (guint) 0);
+       _vala_assert (g_strcmp0 ((const gchar*) _tmp25_, "meh") == 0, "foo.paramlist[0] == \"meh\"");
+       _tmp27_ = bar_new ("hello", &_inner_error0_);
+       _tmp26_ = _tmp27_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _foo_unref0 (_tmp0_);
+               _foo_unref0 (foo);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp28_ = _tmp26_;
+       _tmp26_ = NULL;
+       _foo_unref0 (foo);
+       foo = G_TYPE_CHECK_INSTANCE_CAST (_tmp28_, TYPE_FOO, Foo);
+       _tmp29_ = foo;
+       _vala_assert (!_tmp29_->used_test, "!foo.used_test");
+       _tmp30_ = foo;
+       _tmp31_ = _tmp30_->paramlist;
+       _tmp32_ = vala_g_ptr_array_get_length (_tmp31_);
+       _tmp33_ = _tmp32_;
+       _vala_assert (_tmp33_ == 2, "foo.paramlist.length == 2");
+       _tmp34_ = foo;
+       _tmp35_ = _tmp34_->paramlist;
+       _tmp36_ = g_ptr_array_index (_tmp35_, (guint) 0);
+       _vala_assert (g_strcmp0 ((const gchar*) _tmp36_, "hello") == 0, "foo.paramlist[0] == \"hello\"");
+       _tmp37_ = foo;
+       _tmp38_ = _tmp37_->paramlist;
+       _tmp39_ = g_ptr_array_index (_tmp38_, (guint) 1);
+       _vala_assert (g_strcmp0 ((const gchar*) _tmp39_, "bye") == 0, "foo.paramlist[1] == \"bye\"");
+       _tmp40_ = bar_new_other (1, 2, 3, NULL);
+       _foo_unref0 (foo);
+       foo = G_TYPE_CHECK_INSTANCE_CAST (_tmp40_, TYPE_FOO, Foo);
+       _tmp41_ = foo;
+       _vala_assert (!_tmp41_->used_test, "!foo.used_test");
+       _tmp42_ = foo;
+       _tmp43_ = _tmp42_->paramlist;
+       _tmp44_ = vala_g_ptr_array_get_length (_tmp43_);
+       _tmp45_ = _tmp44_;
+       _vala_assert (_tmp45_ == 1, "foo.paramlist.length == 1");
+       _tmp46_ = foo;
+       _tmp47_ = _tmp46_->paramlist;
+       _tmp48_ = g_ptr_array_index (_tmp47_, (guint) 0);
+       _vala_assert (g_strcmp0 ((const gchar*) _tmp48_, "hey") == 0, "foo.paramlist[0] == \"hey\"");
+       _foo_unref0 (_tmp26_);
+       _foo_unref0 (_tmp0_);
+       _foo_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/bug620706.c-expected b/tests/objects/bug620706.c-expected
new file mode 100644
index 000000000..a446fad98
--- /dev/null
+++ b/tests/objects/bug620706.c-expected
@@ -0,0 +1,307 @@
+/* objects_bug620706.c generated by valac, the Vala compiler
+ * generated from objects_bug620706.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_VAL_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+
+#define TYPE_BAR (bar_get_type ())
+typedef struct _Bar Bar;
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _FooPrivate {
+       GValue _val;
+};
+
+struct _Bar {
+       gint dummy;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+VALA_EXTERN void foo_get_val (Foo* self,
+                  GValue * result);
+VALA_EXTERN void foo_set_val (Foo* self,
+                  GValue * value);
+static gboolean _g_value_equal (const GValue * s1,
+                         const GValue * s2);
+static void foo_finalize (GObject * obj);
+static GType foo_get_type_once (void);
+static void _vala_foo_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_foo_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Bar* bar_dup (const Bar* self);
+VALA_EXTERN void bar_free (Bar* self);
+static void _vala_main (void);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+void
+foo_get_val (Foo* self,
+             GValue * result)
+{
+       GValue _tmp0_;
+       g_return_if_fail (IS_FOO (self));
+       _tmp0_ = self->priv->_val;
+       *result = _tmp0_;
+       return;
+}
+
+static gboolean
+_g_value_equal (const GValue * s1,
+                const GValue * s2)
+{
+       if (s1 == s2) {
+               return TRUE;
+       }
+       if (s1 == NULL) {
+               return FALSE;
+       }
+       if (s2 == NULL) {
+               return FALSE;
+       }
+       return FALSE;
+}
+
+void
+foo_set_val (Foo* self,
+             GValue * value)
+{
+       GValue old_value;
+       g_return_if_fail (IS_FOO (self));
+       foo_get_val (self, &old_value);
+       if (_g_value_equal (value, &old_value) != TRUE) {
+               GValue _tmp0_;
+               GValue _tmp1_;
+               GValue _tmp2_ = {0};
+               _tmp0_ = *value;
+               _tmp1_ = _tmp0_;
+               if (G_IS_VALUE (&_tmp1_)) {
+                       g_value_init (&_tmp2_, G_VALUE_TYPE (&_tmp1_));
+                       g_value_copy (&_tmp1_, &_tmp2_);
+               } else {
+                       _tmp2_ = _tmp1_;
+               }
+               G_IS_VALUE (&self->priv->_val) ? (g_value_unset (&self->priv->_val), NULL) : NULL;
+               self->priv->_val = _tmp2_;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_VAL_PROPERTY]);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_foo_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_foo_set_property;
+       G_OBJECT_CLASS (klass)->finalize = foo_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_VAL_PROPERTY, 
foo_properties[FOO_VAL_PROPERTY] = g_param_spec_boxed ("val", "val", "val", G_TYPE_VALUE, 
G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+}
+
+static void
+foo_finalize (GObject * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       G_IS_VALUE (&self->priv->_val) ? (g_value_unset (&self->priv->_val), NULL) : NULL;
+       G_OBJECT_CLASS (foo_parent_class)->finalize (obj);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_foo_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_VAL_PROPERTY:
+               {
+                       GValue boxed;
+                       foo_get_val (self, &boxed);
+                       g_value_set_boxed (value, &boxed);
+               }
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_foo_set_property (GObject * object,
+                        guint property_id,
+                        const GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_VAL_PROPERTY:
+               foo_set_val (self, g_value_get_boxed (value));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+Bar*
+bar_dup (const Bar* self)
+{
+       Bar* dup;
+       dup = g_new0 (Bar, 1);
+       memcpy (dup, self, sizeof (Bar));
+       return dup;
+}
+
+void
+bar_free (Bar* self)
+{
+       g_free (self);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       GType bar_type_id;
+       bar_type_id = g_boxed_type_register_static ("Bar", (GBoxedCopyFunc) bar_dup, (GBoxedFreeFunc) 
bar_free);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* f = NULL;
+       Foo* _tmp0_;
+       Bar b = {0};
+       Bar _tmp1_;
+       GValue _tmp2_ = {0};
+       _tmp0_ = foo_new ();
+       f = _tmp0_;
+       memset (&b, 0, sizeof (Bar));
+       _tmp1_ = b;
+       g_value_init (&_tmp2_, TYPE_BAR);
+       g_value_set_boxed (&_tmp2_, &_tmp1_);
+       foo_set_val (f, &_tmp2_);
+       G_IS_VALUE (&_tmp2_) ? (g_value_unset (&_tmp2_), NULL) : NULL;
+       _g_object_unref0 (f);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/bug624594.c-expected b/tests/objects/bug624594.c-expected
new file mode 100644
index 000000000..a30b8ce97
--- /dev/null
+++ b/tests/objects/bug624594.c-expected
@@ -0,0 +1,208 @@
+/* objects_bug624594.c generated by valac, the Vala compiler
+ * generated from objects_bug624594.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_PROPERTY_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _FooPrivate {
+       gint _property;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+VALA_EXTERN gint foo_get_property (Foo* self);
+VALA_EXTERN void foo_set_property (Foo* self,
+                       gint value);
+static void foo_finalize (GObject * obj);
+static GType foo_get_type_once (void);
+static void _vala_foo_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_foo_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec);
+static void _vala_main (void);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+gint
+foo_get_property (Foo* self)
+{
+       gint result;
+       g_return_val_if_fail (IS_FOO (self), 0);
+       result = self->priv->_property;
+       return result;
+}
+
+void
+foo_set_property (Foo* self,
+                  gint value)
+{
+       gint old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_property (self);
+       if (old_value != value) {
+               self->priv->_property = value;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_PROPERTY_PROPERTY]);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_foo_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_foo_set_property;
+       G_OBJECT_CLASS (klass)->finalize = foo_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_PROPERTY_PROPERTY, 
foo_properties[FOO_PROPERTY_PROPERTY] = g_param_spec_int ("property", "property", "property", G_MININT, 
G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+}
+
+static void
+foo_finalize (GObject * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       G_OBJECT_CLASS (foo_parent_class)->finalize (obj);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_foo_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_PROPERTY_PROPERTY:
+               g_value_set_int (value, foo_get_property (self));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_foo_set_property (GObject * object,
+                        guint property_id,
+                        const GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_PROPERTY_PROPERTY:
+               foo_set_property (self, g_value_get_int (value));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/bug626038-2.c-expected b/tests/objects/bug626038-2.c-expected
new file mode 100644
index 000000000..b44656d39
--- /dev/null
+++ b/tests/objects/bug626038-2.c-expected
@@ -0,0 +1,744 @@
+/* objects_bug626038_2.c generated by valac, the Vala compiler
+ * generated from objects_bug626038_2.vala, do not modify */
+
+#include <glib-object.h>
+#include <gobject/gvaluecollector.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+typedef struct _ParamSpecBar ParamSpecBar;
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+enum  {
+       FOO_BAR_SIGNAL,
+       FOO_NUM_SIGNALS
+};
+static guint foo_signals[FOO_NUM_SIGNALS] = {0};
+#define _bar_unref0(var) ((var == NULL) ? NULL : (var = (bar_unref (var), NULL)))
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Bar {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       BarPrivate * priv;
+       gpointer k;
+       gpointer v;
+};
+
+struct _BarClass {
+       GTypeClass parent_class;
+       void (*finalize) (Bar *self);
+};
+
+struct _BarPrivate {
+       GType k_type;
+       GBoxedCopyFunc k_dup_func;
+       GDestroyNotify k_destroy_func;
+       GType v_type;
+       GBoxedCopyFunc v_dup_func;
+       GDestroyNotify v_destroy_func;
+};
+
+struct _ParamSpecBar {
+       GParamSpec parent_instance;
+};
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _FooPrivate {
+       GType g_type;
+       GBoxedCopyFunc g_dup_func;
+       GDestroyNotify g_destroy_func;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gint Bar_private_offset;
+static gpointer bar_parent_class = NULL;
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+VALA_EXTERN gboolean fired;
+gboolean fired = FALSE;
+
+VALA_EXTERN gpointer bar_ref (gpointer instance);
+VALA_EXTERN void bar_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_bar (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_bar (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_bar (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_bar (const GValue* value);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, bar_unref)
+VALA_EXTERN Bar* bar_new (GType k_type,
+              GBoxedCopyFunc k_dup_func,
+              GDestroyNotify k_destroy_func,
+              GType v_type,
+              GBoxedCopyFunc v_dup_func,
+              GDestroyNotify v_destroy_func,
+              gconstpointer k,
+              gconstpointer v);
+VALA_EXTERN Bar* bar_construct (GType object_type,
+                    GType k_type,
+                    GBoxedCopyFunc k_dup_func,
+                    GDestroyNotify k_destroy_func,
+                    GType v_type,
+                    GBoxedCopyFunc v_dup_func,
+                    GDestroyNotify v_destroy_func,
+                    gconstpointer k,
+                    gconstpointer v);
+static void bar_finalize (Bar * obj);
+static GType bar_get_type_once (void);
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN void foo_fire (Foo* self,
+               Bar* item);
+VALA_EXTERN Foo* foo_new (GType g_type,
+              GBoxedCopyFunc g_dup_func,
+              GDestroyNotify g_destroy_func);
+VALA_EXTERN Foo* foo_construct (GType object_type,
+                    GType g_type,
+                    GBoxedCopyFunc g_dup_func,
+                    GDestroyNotify g_destroy_func);
+static void g_cclosure_user_marshal_VOID__BAR (GClosure * closure,
+                                        GValue * return_value,
+                                        guint n_param_values,
+                                        const GValue * param_values,
+                                        gpointer invocation_hint,
+                                        gpointer marshal_data);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN void on_bar (Bar* item);
+static void _vala_main (void);
+static void _on_bar_foo_bar (Foo* _sender,
+                      Bar* item,
+                      gpointer self);
+
+static inline gpointer
+bar_get_instance_private (Bar* self)
+{
+       return G_STRUCT_MEMBER_P (self, Bar_private_offset);
+}
+
+Bar*
+bar_construct (GType object_type,
+               GType k_type,
+               GBoxedCopyFunc k_dup_func,
+               GDestroyNotify k_destroy_func,
+               GType v_type,
+               GBoxedCopyFunc v_dup_func,
+               GDestroyNotify v_destroy_func,
+               gconstpointer k,
+               gconstpointer v)
+{
+       Bar* self = NULL;
+       gpointer _tmp0_;
+       gpointer _tmp1_;
+       self = (Bar*) g_type_create_instance (object_type);
+       self->priv->k_type = k_type;
+       self->priv->k_dup_func = k_dup_func;
+       self->priv->k_destroy_func = k_destroy_func;
+       self->priv->v_type = v_type;
+       self->priv->v_dup_func = v_dup_func;
+       self->priv->v_destroy_func = v_destroy_func;
+       _tmp0_ = ((k != NULL) && (k_dup_func != NULL)) ? k_dup_func ((gpointer) k) : ((gpointer) k);
+       ((self->k == NULL) || (k_destroy_func == NULL)) ? NULL : (self->k = (k_destroy_func (self->k), NULL));
+       self->k = _tmp0_;
+       _tmp1_ = ((v != NULL) && (v_dup_func != NULL)) ? v_dup_func ((gpointer) v) : ((gpointer) v);
+       ((self->v == NULL) || (v_destroy_func == NULL)) ? NULL : (self->v = (v_destroy_func (self->v), NULL));
+       self->v = _tmp1_;
+       return self;
+}
+
+Bar*
+bar_new (GType k_type,
+         GBoxedCopyFunc k_dup_func,
+         GDestroyNotify k_destroy_func,
+         GType v_type,
+         GBoxedCopyFunc v_dup_func,
+         GDestroyNotify v_destroy_func,
+         gconstpointer k,
+         gconstpointer v)
+{
+       return bar_construct (TYPE_BAR, k_type, k_dup_func, k_destroy_func, v_type, v_dup_func, 
v_destroy_func, k, v);
+}
+
+static void
+value_bar_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_bar_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               bar_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_bar_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = bar_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_bar_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_bar_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Bar * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = bar_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_bar_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Bar ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = bar_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_bar (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecBar* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_BAR), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_bar (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_bar (GValue* value,
+               gpointer v_object)
+{
+       Bar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               bar_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_unref (old);
+       }
+}
+
+void
+value_take_bar (GValue* value,
+                gpointer v_object)
+{
+       Bar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_unref (old);
+       }
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       ((BarClass *) klass)->finalize = bar_finalize;
+       g_type_class_adjust_private_offset (klass, &Bar_private_offset);
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+       self->priv = bar_get_instance_private (self);
+       self->ref_count = 1;
+}
+
+static void
+bar_finalize (Bar * obj)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       g_signal_handlers_destroy (self);
+       ((self->k == NULL) || (self->priv->k_destroy_func == NULL)) ? NULL : (self->k = 
(self->priv->k_destroy_func (self->k), NULL));
+       ((self->v == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (self->v = 
(self->priv->v_destroy_func (self->v), NULL));
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_bar_init, value_bar_free_value, 
value_bar_copy_value, value_bar_peek_pointer, "p", value_bar_collect_value, "p", value_bar_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType bar_type_id;
+       bar_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Bar", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       Bar_private_offset = g_type_add_instance_private (bar_type_id, sizeof (BarPrivate));
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+gpointer
+bar_ref (gpointer instance)
+{
+       Bar * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+bar_unref (gpointer instance)
+{
+       Bar * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               BAR_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+void
+foo_fire (Foo* self,
+          Bar* item)
+{
+       g_return_if_fail (IS_FOO (self));
+       g_return_if_fail (IS_BAR (item));
+       g_signal_emit (self, foo_signals[FOO_BAR_SIGNAL], 0, item);
+}
+
+Foo*
+foo_construct (GType object_type,
+               GType g_type,
+               GBoxedCopyFunc g_dup_func,
+               GDestroyNotify g_destroy_func)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       self->priv->g_type = g_type;
+       self->priv->g_dup_func = g_dup_func;
+       self->priv->g_destroy_func = g_destroy_func;
+       return self;
+}
+
+Foo*
+foo_new (GType g_type,
+         GBoxedCopyFunc g_dup_func,
+         GDestroyNotify g_destroy_func)
+{
+       return foo_construct (TYPE_FOO, g_type, g_dup_func, g_destroy_func);
+}
+
+static void
+g_cclosure_user_marshal_VOID__BAR (GClosure * closure,
+                                   GValue * return_value,
+                                   guint n_param_values,
+                                   const GValue * param_values,
+                                   gpointer invocation_hint,
+                                   gpointer marshal_data)
+{
+       typedef void (*GMarshalFunc_VOID__BAR) (gpointer data1, gpointer arg_1, gpointer data2);
+       register GMarshalFunc_VOID__BAR callback;
+       register GCClosure * cc;
+       register gpointer data1;
+       register gpointer data2;
+       cc = (GCClosure *) closure;
+       g_return_if_fail (n_param_values == 2);
+       if (G_CCLOSURE_SWAP_DATA (closure)) {
+               data1 = closure->data;
+               data2 = param_values->data[0].v_pointer;
+       } else {
+               data1 = param_values->data[0].v_pointer;
+               data2 = closure->data;
+       }
+       callback = (GMarshalFunc_VOID__BAR) (marshal_data ? marshal_data : cc->callback);
+       callback (data1, value_get_bar (param_values + 1), data2);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+       foo_signals[FOO_BAR_SIGNAL] = g_signal_new ("bar", TYPE_FOO, G_SIGNAL_RUN_LAST, 0, NULL, NULL, 
g_cclosure_user_marshal_VOID__BAR, G_TYPE_NONE, 1, TYPE_BAR);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+void
+on_bar (Bar* item)
+{
+       gconstpointer _tmp0_;
+       gconstpointer _tmp1_;
+       g_return_if_fail (IS_BAR (item));
+       _tmp0_ = item->k;
+       _vala_assert (((gint) ((gintptr) _tmp0_)) == 42, "item.k == 42");
+       _tmp1_ = item->v;
+       _vala_assert (g_strcmp0 ((const gchar*) _tmp1_, "bar") == 0, "item.v == \"bar\"");
+       fired = TRUE;
+}
+
+static void
+_on_bar_foo_bar (Foo* _sender,
+                 Bar* item,
+                 gpointer self)
+{
+       on_bar (item);
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       Bar* bar = NULL;
+       Bar* _tmp1_;
+       _tmp0_ = foo_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free);
+       foo = _tmp0_;
+       g_signal_connect (foo, "bar", (GCallback) _on_bar_foo_bar, NULL);
+       _tmp1_ = bar_new (G_TYPE_INT, NULL, NULL, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) 
g_free, (gpointer) ((gintptr) 42), "bar");
+       bar = _tmp1_;
+       foo_fire (foo, bar);
+       _vala_assert (fired, "fired");
+       _bar_unref0 (bar);
+       _foo_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/bug626038.c-expected b/tests/objects/bug626038.c-expected
new file mode 100644
index 000000000..5e2835bf4
--- /dev/null
+++ b/tests/objects/bug626038.c-expected
@@ -0,0 +1,306 @@
+/* objects_bug626038.c generated by valac, the Vala compiler
+ * generated from objects_bug626038.vala, do not modify */
+
+#include <glib-object.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+       Foo* foo;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+       _foo_unref0 (self->foo);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       Foo* _tmp1_;
+       Foo* _tmp2_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       _tmp1_ = foo;
+       _tmp2_ = foo;
+       foo = NULL;
+       _foo_unref0 (_tmp1_->foo);
+       _tmp1_->foo = _tmp2_;
+       _foo_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/bug628639.c-expected b/tests/objects/bug628639.c-expected
new file mode 100644
index 000000000..a7ffe5239
--- /dev/null
+++ b/tests/objects/bug628639.c-expected
@@ -0,0 +1,371 @@
+/* objects_bug628639.c generated by valac, the Vala compiler
+ * generated from objects_bug628639.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+enum  {
+       FOO_BAR_SIGNAL,
+       FOO_NUM_SIGNALS
+};
+static guint foo_signals[FOO_NUM_SIGNALS] = {0};
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _FooPrivate {
+       GType g_type;
+       GBoxedCopyFunc g_dup_func;
+       GDestroyNotify g_destroy_func;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+VALA_EXTERN gboolean fired;
+gboolean fired = FALSE;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN void foo_fire (Foo* self,
+               gconstpointer item);
+VALA_EXTERN Foo* foo_new (GType g_type,
+              GBoxedCopyFunc g_dup_func,
+              GDestroyNotify g_destroy_func);
+VALA_EXTERN Foo* foo_construct (GType object_type,
+                    GType g_type,
+                    GBoxedCopyFunc g_dup_func,
+                    GDestroyNotify g_destroy_func);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN void on_bar (gint item);
+static void _vala_main (void);
+static void _on_bar_foo_bar (Foo* _sender,
+                      gconstpointer item,
+                      gpointer self);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+void
+foo_fire (Foo* self,
+          gconstpointer item)
+{
+       g_return_if_fail (IS_FOO (self));
+       g_signal_emit (self, foo_signals[FOO_BAR_SIGNAL], 0, item);
+}
+
+Foo*
+foo_construct (GType object_type,
+               GType g_type,
+               GBoxedCopyFunc g_dup_func,
+               GDestroyNotify g_destroy_func)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       self->priv->g_type = g_type;
+       self->priv->g_dup_func = g_dup_func;
+       self->priv->g_destroy_func = g_destroy_func;
+       return self;
+}
+
+Foo*
+foo_new (GType g_type,
+         GBoxedCopyFunc g_dup_func,
+         GDestroyNotify g_destroy_func)
+{
+       return foo_construct (TYPE_FOO, g_type, g_dup_func, g_destroy_func);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+       foo_signals[FOO_BAR_SIGNAL] = g_signal_new ("bar", TYPE_FOO, G_SIGNAL_RUN_LAST, 0, NULL, NULL, 
g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+void
+on_bar (gint item)
+{
+       _vala_assert (item == 42, "item == 42");
+       fired = TRUE;
+}
+
+static void
+_on_bar_foo_bar (Foo* _sender,
+                 gconstpointer item,
+                 gpointer self)
+{
+       on_bar ((gint) ((gintptr) item));
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       _tmp0_ = foo_new (G_TYPE_INT, NULL, NULL);
+       foo = _tmp0_;
+       g_signal_connect (foo, "bar", (GCallback) _on_bar_foo_bar, NULL);
+       foo_fire (foo, (gpointer) ((gintptr) 42));
+       _vala_assert (fired, "fired");
+       _foo_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/bug629593.c-expected b/tests/objects/bug629593.c-expected
new file mode 100644
index 000000000..6fb1e4eca
--- /dev/null
+++ b/tests/objects/bug629593.c-expected
@@ -0,0 +1,626 @@
+/* objects_bug629593.c generated by valac, the Vala compiler
+ * generated from objects_bug629593.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+typedef struct _BarClassPrivate BarClassPrivate;
+typedef struct _ParamSpecBar ParamSpecBar;
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+       gint thing_to_lock_on;
+       gint other_variable;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _FooPrivate {
+       GRecMutex __lock_thing_to_lock_on;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+struct _Bar {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       BarPrivate * priv;
+       gint other_variable;
+};
+
+struct _BarClass {
+       GTypeClass parent_class;
+       void (*finalize) (Bar *self);
+       gint thing_to_lock_on;
+};
+
+struct _BarClassPrivate {
+       GRecMutex __lock_thing_to_lock_on;
+};
+
+struct _ParamSpecBar {
+       GParamSpec parent_instance;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+VALA_EXTERN void foo_run (Foo* self);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN gpointer bar_ref (gpointer instance);
+VALA_EXTERN void bar_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_bar (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_bar (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_bar (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_bar (const GValue* value);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, bar_unref)
+#define BAR_GET_CLASS_PRIVATE(klass) (G_TYPE_CLASS_GET_PRIVATE (klass, TYPE_BAR, BarClassPrivate))
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+VALA_EXTERN void bar_run (Bar* self);
+static void bar_finalize (Bar * obj);
+static GType bar_get_type_once (void);
+static void _vala_main (void);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       self->other_variable = 0;
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+void
+foo_run (Foo* self)
+{
+       GError* _inner_error0_ = NULL;
+       g_return_if_fail (IS_FOO (self));
+       {
+               g_rec_mutex_lock (&self->priv->__lock_thing_to_lock_on);
+               {
+                       self->other_variable = 1;
+               }
+               __finally0:
+               {
+                       g_rec_mutex_unlock (&self->priv->__lock_thing_to_lock_on);
+               }
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+       }
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+       g_rec_mutex_init (&self->priv->__lock_thing_to_lock_on);
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+       g_rec_mutex_clear (&self->priv->__lock_thing_to_lock_on);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar* self = NULL;
+       self = (Bar*) g_type_create_instance (object_type);
+       self->other_variable = 0;
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+void
+bar_run (Bar* self)
+{
+       GError* _inner_error0_ = NULL;
+       g_return_if_fail (IS_BAR (self));
+       {
+               g_rec_mutex_lock (&BAR_GET_CLASS_PRIVATE (BAR_GET_CLASS (self))->__lock_thing_to_lock_on);
+               {
+                       self->other_variable = 1;
+               }
+               __finally0:
+               {
+                       g_rec_mutex_unlock (&BAR_GET_CLASS_PRIVATE (BAR_GET_CLASS 
(self))->__lock_thing_to_lock_on);
+               }
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+       }
+}
+
+static void
+value_bar_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_bar_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               bar_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_bar_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = bar_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_bar_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_bar_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Bar * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = bar_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_bar_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Bar ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = bar_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_bar (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecBar* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_BAR), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_bar (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_bar (GValue* value,
+               gpointer v_object)
+{
+       Bar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               bar_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_unref (old);
+       }
+}
+
+void
+value_take_bar (GValue* value,
+                gpointer v_object)
+{
+       Bar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_unref (old);
+       }
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       ((BarClass *) klass)->finalize = bar_finalize;
+       g_rec_mutex_init (&BAR_GET_CLASS_PRIVATE (klass)->__lock_thing_to_lock_on);
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+bar_finalize (Bar * obj)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_bar_init, value_bar_free_value, 
value_bar_copy_value, value_bar_peek_pointer, "p", value_bar_collect_value, "p", value_bar_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType bar_type_id;
+       bar_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Bar", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+gpointer
+bar_ref (gpointer instance)
+{
+       Bar * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+bar_unref (gpointer instance)
+{
+       Bar * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               BAR_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/bug631267.c-expected b/tests/objects/bug631267.c-expected
new file mode 100644
index 000000000..e7333f8fe
--- /dev/null
+++ b/tests/objects/bug631267.c-expected
@@ -0,0 +1,813 @@
+/* objects_bug631267.c generated by valac, the Vala compiler
+ * generated from objects_bug631267.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+#include <stdlib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOBJECT (fobject_get_type ())
+#define FOBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOBJECT, FObject))
+#define FOBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOBJECT, FObjectClass))
+#define IS_FOBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOBJECT))
+#define IS_FOBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOBJECT))
+#define FOBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOBJECT, FObjectClass))
+
+typedef struct _FObject FObject;
+typedef struct _FObjectClass FObjectClass;
+typedef struct _FObjectPrivate FObjectPrivate;
+enum  {
+       FOBJECT_0_PROPERTY,
+       FOBJECT_NUM_PROPERTIES
+};
+static GParamSpec* fobject_properties[FOBJECT_NUM_PROPERTIES];
+
+#define TYPE_FSTRUCT (fstruct_get_type ())
+typedef struct _FStruct FStruct;
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_S_PROPERTY,
+       FOO_A_PROPERTY,
+       FOO_I_PROPERTY,
+       FOO_O_PROPERTY,
+       FOO_T_PROPERTY,
+       FOO_P_PROPERTY,
+       FOO_FOO_PROPERTY,
+       FOO_BAR_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+
+struct _FObject {
+       GObject parent_instance;
+       FObjectPrivate * priv;
+};
+
+struct _FObjectClass {
+       GObjectClass parent_class;
+};
+
+struct _FStruct {
+       gint i;
+};
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _FooPrivate {
+       gchar* _s;
+       gchar** _a;
+       gint _a_length1;
+       gint __a_size_;
+       gint _i;
+       FObject* _o;
+       FStruct _t;
+       void* _p;
+};
+
+static gpointer fobject_parent_class = NULL;
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType fobject_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (FObject, g_object_unref)
+VALA_EXTERN FObject* fobject_new (void);
+VALA_EXTERN FObject* fobject_construct (GType object_type);
+static GType fobject_get_type_once (void);
+VALA_EXTERN GType fstruct_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN FStruct* fstruct_dup (const FStruct* self);
+VALA_EXTERN void fstruct_free (FStruct* self);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+VALA_EXTERN const gchar* foo_get_s (Foo* self);
+VALA_EXTERN void foo_set_s (Foo* self,
+                const gchar* value);
+VALA_EXTERN gchar** foo_get_a (Foo* self,
+                   gint* result_length1);
+VALA_EXTERN void foo_set_a (Foo* self,
+                gchar** value,
+                gint value_length1);
+VALA_EXTERN gint foo_get_i (Foo* self);
+VALA_EXTERN void foo_set_i (Foo* self,
+                gint value);
+VALA_EXTERN FObject* foo_get_o (Foo* self);
+VALA_EXTERN void foo_set_o (Foo* self,
+                FObject* value);
+VALA_EXTERN void foo_get_t (Foo* self,
+                FStruct * result);
+VALA_EXTERN void foo_set_t (Foo* self,
+                FStruct * value);
+static gboolean _fstruct_equal (const FStruct * s1,
+                         const FStruct * s2);
+VALA_EXTERN void* foo_get_p (Foo* self);
+VALA_EXTERN void foo_set_p (Foo* self,
+                void* value);
+VALA_EXTERN gint foo_get_foo (Foo* self);
+VALA_EXTERN void foo_set_bar (Foo* self,
+                  gint value);
+static void foo_finalize (GObject * obj);
+static GType foo_get_type_once (void);
+static void _vala_foo_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_foo_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec);
+static void _vala_main (void);
+static void __lambda4_ (void);
+static void ___lambda4__g_object_notify (GObject* _sender,
+                                  GParamSpec* pspec,
+                                  gpointer self);
+static void __lambda5_ (void);
+static void ___lambda5__g_object_notify (GObject* _sender,
+                                  GParamSpec* pspec,
+                                  gpointer self);
+static void __lambda6_ (void);
+static void ___lambda6__g_object_notify (GObject* _sender,
+                                  GParamSpec* pspec,
+                                  gpointer self);
+static void __lambda7_ (void);
+static void ___lambda7__g_object_notify (GObject* _sender,
+                                  GParamSpec* pspec,
+                                  gpointer self);
+static void __lambda8_ (void);
+static void ___lambda8__g_object_notify (GObject* _sender,
+                                  GParamSpec* pspec,
+                                  gpointer self);
+static void __lambda9_ (void);
+static void ___lambda9__g_object_notify (GObject* _sender,
+                                  GParamSpec* pspec,
+                                  gpointer self);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+FObject*
+fobject_construct (GType object_type)
+{
+       FObject * self = NULL;
+       self = (FObject*) g_object_new (object_type, NULL);
+       return self;
+}
+
+FObject*
+fobject_new (void)
+{
+       return fobject_construct (TYPE_FOBJECT);
+}
+
+static void
+fobject_class_init (FObjectClass * klass,
+                    gpointer klass_data)
+{
+       fobject_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+fobject_instance_init (FObject * self,
+                       gpointer klass)
+{
+}
+
+static GType
+fobject_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FObjectClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) fobject_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(FObject), 0, (GInstanceInitFunc) fobject_instance_init, NULL };
+       GType fobject_type_id;
+       fobject_type_id = g_type_register_static (G_TYPE_OBJECT, "FObject", &g_define_type_info, 0);
+       return fobject_type_id;
+}
+
+GType
+fobject_get_type (void)
+{
+       static volatile gsize fobject_type_id__volatile = 0;
+       if (g_once_init_enter (&fobject_type_id__volatile)) {
+               GType fobject_type_id;
+               fobject_type_id = fobject_get_type_once ();
+               g_once_init_leave (&fobject_type_id__volatile, fobject_type_id);
+       }
+       return fobject_type_id__volatile;
+}
+
+FStruct*
+fstruct_dup (const FStruct* self)
+{
+       FStruct* dup;
+       dup = g_new0 (FStruct, 1);
+       memcpy (dup, self, sizeof (FStruct));
+       return dup;
+}
+
+void
+fstruct_free (FStruct* self)
+{
+       g_free (self);
+}
+
+static GType
+fstruct_get_type_once (void)
+{
+       GType fstruct_type_id;
+       fstruct_type_id = g_boxed_type_register_static ("FStruct", (GBoxedCopyFunc) fstruct_dup, 
(GBoxedFreeFunc) fstruct_free);
+       return fstruct_type_id;
+}
+
+GType
+fstruct_get_type (void)
+{
+       static volatile gsize fstruct_type_id__volatile = 0;
+       if (g_once_init_enter (&fstruct_type_id__volatile)) {
+               GType fstruct_type_id;
+               fstruct_type_id = fstruct_get_type_once ();
+               g_once_init_leave (&fstruct_type_id__volatile, fstruct_type_id);
+       }
+       return fstruct_type_id__volatile;
+}
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+const gchar*
+foo_get_s (Foo* self)
+{
+       const gchar* result;
+       const gchar* _tmp0_;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = self->priv->_s;
+       result = _tmp0_;
+       return result;
+}
+
+void
+foo_set_s (Foo* self,
+           const gchar* value)
+{
+       gchar* old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_s (self);
+       if (g_strcmp0 (value, old_value) != 0) {
+               gchar* _tmp0_;
+               _tmp0_ = g_strdup (value);
+               _g_free0 (self->priv->_s);
+               self->priv->_s = _tmp0_;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_S_PROPERTY]);
+       }
+}
+
+gchar**
+foo_get_a (Foo* self,
+           gint* result_length1)
+{
+       gchar** result;
+       gchar** _tmp0_;
+       gint _tmp0__length1;
+       gchar** _tmp1_;
+       gint _tmp1__length1;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = self->priv->_a;
+       _tmp0__length1 = self->priv->_a_length1;
+       _tmp1_ = _tmp0_;
+       _tmp1__length1 = _tmp0__length1;
+       if (result_length1) {
+               *result_length1 = _tmp1__length1;
+       }
+       result = _tmp1_;
+       return result;
+}
+
+void
+foo_set_a (Foo* self,
+           gchar** value,
+           gint value_length1)
+{
+       gchar** old_value;
+       gint old_value_length;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_a (self, &old_value_length);
+       if (old_value != value) {
+               self->priv->_a = value;
+               self->priv->_a_length1 = value_length1;
+               self->priv->__a_size_ = self->priv->_a_length1;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_A_PROPERTY]);
+       }
+}
+
+gint
+foo_get_i (Foo* self)
+{
+       gint result;
+       g_return_val_if_fail (IS_FOO (self), 0);
+       result = self->priv->_i;
+       return result;
+}
+
+void
+foo_set_i (Foo* self,
+           gint value)
+{
+       gint old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_i (self);
+       if (old_value != value) {
+               self->priv->_i = value;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_I_PROPERTY]);
+       }
+}
+
+FObject*
+foo_get_o (Foo* self)
+{
+       FObject* result;
+       FObject* _tmp0_;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = self->priv->_o;
+       result = _tmp0_;
+       return result;
+}
+
+static gpointer
+_g_object_ref0 (gpointer self)
+{
+       return self ? g_object_ref (self) : NULL;
+}
+
+void
+foo_set_o (Foo* self,
+           FObject* value)
+{
+       FObject* old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_o (self);
+       if (old_value != value) {
+               FObject* _tmp0_;
+               _tmp0_ = _g_object_ref0 (value);
+               _g_object_unref0 (self->priv->_o);
+               self->priv->_o = _tmp0_;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_O_PROPERTY]);
+       }
+}
+
+void
+foo_get_t (Foo* self,
+           FStruct * result)
+{
+       FStruct _tmp0_;
+       g_return_if_fail (IS_FOO (self));
+       _tmp0_ = self->priv->_t;
+       *result = _tmp0_;
+       return;
+}
+
+static gboolean
+_fstruct_equal (const FStruct * s1,
+                const FStruct * s2)
+{
+       if (s1 == s2) {
+               return TRUE;
+       }
+       if (s1 == NULL) {
+               return FALSE;
+       }
+       if (s2 == NULL) {
+               return FALSE;
+       }
+       if (s1->i != s2->i) {
+               return FALSE;
+       }
+       return TRUE;
+}
+
+void
+foo_set_t (Foo* self,
+           FStruct * value)
+{
+       FStruct old_value;
+       g_return_if_fail (IS_FOO (self));
+       foo_get_t (self, &old_value);
+       if (_fstruct_equal (value, &old_value) != TRUE) {
+               FStruct _tmp0_;
+               _tmp0_ = *value;
+               self->priv->_t = _tmp0_;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_T_PROPERTY]);
+       }
+}
+
+void*
+foo_get_p (Foo* self)
+{
+       void* result;
+       void* _tmp0_;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = self->priv->_p;
+       result = _tmp0_;
+       return result;
+}
+
+void
+foo_set_p (Foo* self,
+           void* value)
+{
+       void* old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_p (self);
+       if (old_value != value) {
+               self->priv->_p = value;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_P_PROPERTY]);
+       }
+}
+
+gint
+foo_get_foo (Foo* self)
+{
+       gint result;
+       gint _tmp0_;
+       g_return_val_if_fail (IS_FOO (self), 0);
+       _tmp0_ = self->priv->_i;
+       result = _tmp0_;
+       return result;
+}
+
+void
+foo_set_bar (Foo* self,
+             gint value)
+{
+       g_return_if_fail (IS_FOO (self));
+       foo_set_i (self, value);
+       g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_BAR_PROPERTY]);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_foo_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_foo_set_property;
+       G_OBJECT_CLASS (klass)->finalize = foo_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_S_PROPERTY, 
foo_properties[FOO_S_PROPERTY] = g_param_spec_string ("s", "s", "s", NULL, G_PARAM_STATIC_STRINGS | 
G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_A_PROPERTY, 
foo_properties[FOO_A_PROPERTY] = g_param_spec_boxed ("a", "a", "a", G_TYPE_STRV, G_PARAM_STATIC_STRINGS | 
G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_I_PROPERTY, 
foo_properties[FOO_I_PROPERTY] = g_param_spec_int ("i", "i", "i", G_MININT, G_MAXINT, 0, 
G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_O_PROPERTY, 
foo_properties[FOO_O_PROPERTY] = g_param_spec_object ("o", "o", "o", TYPE_FOBJECT, G_PARAM_STATIC_STRINGS | 
G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_T_PROPERTY, 
foo_properties[FOO_T_PROPERTY] = g_param_spec_boxed ("t", "t", "t", TYPE_FSTRUCT, G_PARAM_STATIC_STRINGS | 
G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_P_PROPERTY, 
foo_properties[FOO_P_PROPERTY] = g_param_spec_pointer ("p", "p", "p", G_PARAM_STATIC_STRINGS | 
G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_FOO_PROPERTY, 
foo_properties[FOO_FOO_PROPERTY] = g_param_spec_int ("foo", "foo", "foo", G_MININT, G_MAXINT, 0, 
G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_BAR_PROPERTY, 
foo_properties[FOO_BAR_PROPERTY] = g_param_spec_int ("bar", "bar", "bar", G_MININT, G_MAXINT, 0, 
G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE));
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+}
+
+static void
+foo_finalize (GObject * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       _g_free0 (self->priv->_s);
+       _g_object_unref0 (self->priv->_o);
+       G_OBJECT_CLASS (foo_parent_class)->finalize (obj);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_foo_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_S_PROPERTY:
+               g_value_set_string (value, foo_get_s (self));
+               break;
+               case FOO_A_PROPERTY:
+               {
+                       int length;
+                       g_value_set_boxed (value, foo_get_a (self, &length));
+               }
+               break;
+               case FOO_I_PROPERTY:
+               g_value_set_int (value, foo_get_i (self));
+               break;
+               case FOO_O_PROPERTY:
+               g_value_set_object (value, foo_get_o (self));
+               break;
+               case FOO_T_PROPERTY:
+               {
+                       FStruct boxed;
+                       foo_get_t (self, &boxed);
+                       g_value_set_boxed (value, &boxed);
+               }
+               break;
+               case FOO_P_PROPERTY:
+               g_value_set_pointer (value, foo_get_p (self));
+               break;
+               case FOO_FOO_PROPERTY:
+               g_value_set_int (value, foo_get_foo (self));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_foo_set_property (GObject * object,
+                        guint property_id,
+                        const GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_S_PROPERTY:
+               foo_set_s (self, g_value_get_string (value));
+               break;
+               case FOO_A_PROPERTY:
+               {
+                       gpointer boxed;
+                       boxed = g_value_get_boxed (value);
+                       foo_set_a (self, boxed, (boxed == NULL) ? 0 : g_strv_length (boxed));
+               }
+               break;
+               case FOO_I_PROPERTY:
+               foo_set_i (self, g_value_get_int (value));
+               break;
+               case FOO_O_PROPERTY:
+               foo_set_o (self, g_value_get_object (value));
+               break;
+               case FOO_T_PROPERTY:
+               foo_set_t (self, g_value_get_boxed (value));
+               break;
+               case FOO_P_PROPERTY:
+               foo_set_p (self, g_value_get_pointer (value));
+               break;
+               case FOO_BAR_PROPERTY:
+               foo_set_bar (self, g_value_get_int (value));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+__lambda4_ (void)
+{
+       g_error ("objects_bug631267.vala:39: string-type equality failed");
+}
+
+static void
+___lambda4__g_object_notify (GObject* _sender,
+                             GParamSpec* pspec,
+                             gpointer self)
+{
+       __lambda4_ ();
+}
+
+static void
+__lambda5_ (void)
+{
+       g_error ("objects_bug631267.vala:40: array-type equality failed");
+}
+
+static void
+___lambda5__g_object_notify (GObject* _sender,
+                             GParamSpec* pspec,
+                             gpointer self)
+{
+       __lambda5_ ();
+}
+
+static void
+__lambda6_ (void)
+{
+       g_error ("objects_bug631267.vala:41: simple-type equality failed");
+}
+
+static void
+___lambda6__g_object_notify (GObject* _sender,
+                             GParamSpec* pspec,
+                             gpointer self)
+{
+       __lambda6_ ();
+}
+
+static void
+__lambda7_ (void)
+{
+       g_error ("objects_bug631267.vala:42: object-type equality failed");
+}
+
+static void
+___lambda7__g_object_notify (GObject* _sender,
+                             GParamSpec* pspec,
+                             gpointer self)
+{
+       __lambda7_ ();
+}
+
+static void
+__lambda8_ (void)
+{
+       g_error ("objects_bug631267.vala:43: struct-type equality failed");
+}
+
+static void
+___lambda8__g_object_notify (GObject* _sender,
+                             GParamSpec* pspec,
+                             gpointer self)
+{
+       __lambda8_ ();
+}
+
+static void
+__lambda9_ (void)
+{
+       g_error ("objects_bug631267.vala:44: pointer-type equality failed");
+}
+
+static void
+___lambda9__g_object_notify (GObject* _sender,
+                             GParamSpec* pspec,
+                             gpointer self)
+{
+       __lambda9_ ();
+}
+
+static void
+_vala_main (void)
+{
+       gchar* s = NULL;
+       gchar* _tmp0_;
+       gchar** a = NULL;
+       gchar* _tmp1_;
+       gchar* _tmp2_;
+       gchar** _tmp3_;
+       gint a_length1;
+       gint _a_size_;
+       gint i = 0;
+       FObject* o = NULL;
+       FObject* _tmp4_;
+       FStruct t = {0};
+       FStruct _tmp5_ = {0};
+       void* p = NULL;
+       Foo* foo = NULL;
+       Foo* _tmp6_;
+       FStruct _tmp7_;
+       FStruct _tmp8_;
+       _tmp0_ = g_strdup ("bar");
+       s = _tmp0_;
+       _tmp1_ = g_strdup ("foo");
+       _tmp2_ = g_strdup ("baz");
+       _tmp3_ = g_new0 (gchar*, 2 + 1);
+       _tmp3_[0] = _tmp1_;
+       _tmp3_[1] = _tmp2_;
+       a = _tmp3_;
+       a_length1 = 2;
+       _a_size_ = a_length1;
+       i = 42;
+       _tmp4_ = fobject_new ();
+       o = _tmp4_;
+       t = _tmp5_;
+       p = &o;
+       _tmp6_ = foo_new ();
+       foo = _tmp6_;
+       foo_set_s (foo, s);
+       foo_set_a (foo, a, a_length1);
+       foo_set_i (foo, i);
+       foo_set_o (foo, o);
+       _tmp7_ = t;
+       foo_set_t (foo, &_tmp7_);
+       foo_set_p (foo, p);
+       g_signal_connect (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject), "notify::s", (GCallback) 
___lambda4__g_object_notify, NULL);
+       g_signal_connect (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject), "notify::a", (GCallback) 
___lambda5__g_object_notify, NULL);
+       g_signal_connect (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject), "notify::i", (GCallback) 
___lambda6__g_object_notify, NULL);
+       g_signal_connect (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject), "notify::o", (GCallback) 
___lambda7__g_object_notify, NULL);
+       g_signal_connect (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject), "notify::t", (GCallback) 
___lambda8__g_object_notify, NULL);
+       g_signal_connect (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject), "notify::p", (GCallback) 
___lambda9__g_object_notify, NULL);
+       foo_set_s (foo, s);
+       foo_set_a (foo, a, a_length1);
+       foo_set_i (foo, i);
+       foo_set_o (foo, o);
+       _tmp8_ = t;
+       foo_set_t (foo, &_tmp8_);
+       foo_set_p (foo, p);
+       _g_object_unref0 (foo);
+       _g_object_unref0 (o);
+       a = (_vala_array_free (a, a_length1, (GDestroyNotify) g_free), NULL);
+       _g_free0 (s);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/objects/bug634782.c-expected b/tests/objects/bug634782.c-expected
new file mode 100644
index 000000000..26f1397f5
--- /dev/null
+++ b/tests/objects/bug634782.c-expected
@@ -0,0 +1,366 @@
+/* objects_bug634782.c generated by valac, the Vala compiler
+ * generated from objects_bug634782.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+       guint8* baz;
+       gint baz_length1;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_bar (Foo* self);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+static guint8* _vala_array_dup1 (guint8* self,
+                          gssize length);
+static inline gpointer _vala_memdup2 (gconstpointer mem,
+                        gsize byte_size);
+
+Foo*
+foo_bar (Foo* self)
+{
+       Foo* _tmp0_;
+       Foo* result = NULL;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = foo_new ();
+       result = _tmp0_;
+       return result;
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+       self->baz = (g_free (self->baz), NULL);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static guint8*
+_vala_array_dup1 (guint8* self,
+                  gssize length)
+{
+       if (length > 0) {
+               return _vala_memdup2 (self, length * sizeof (guint8));
+       }
+       return NULL;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       guint8* bar = NULL;
+       Foo* _tmp1_;
+       Foo* _tmp2_;
+       guint8* _tmp3_;
+       gint _tmp3__length1;
+       guint8* _tmp4_;
+       gint _tmp4__length1;
+       guint8* _tmp5_;
+       gint _tmp5__length1;
+       gint bar_length1;
+       gint _bar_size_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       _tmp1_ = foo_bar (foo);
+       _tmp2_ = _tmp1_;
+       _tmp3_ = _tmp2_->baz;
+       _tmp3__length1 = _tmp2_->baz_length1;
+       _tmp4_ = (_tmp3_ != NULL) ? _vala_array_dup1 (_tmp3_, _tmp3__length1) : _tmp3_;
+       _tmp4__length1 = _tmp3__length1;
+       _tmp5_ = _tmp4_;
+       _tmp5__length1 = _tmp4__length1;
+       _foo_unref0 (_tmp2_);
+       bar = _tmp5_;
+       bar_length1 = _tmp5__length1;
+       _bar_size_ = bar_length1;
+       bar = (g_free (bar), NULL);
+       _foo_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static inline gpointer
+_vala_memdup2 (gconstpointer mem,
+               gsize byte_size)
+{
+       gpointer new_mem;
+       if (mem && byte_size != 0) {
+               new_mem = g_malloc (byte_size);
+               memcpy (new_mem, mem, byte_size);
+       } else {
+               new_mem = NULL;
+       }
+       return new_mem;
+}
+
diff --git a/tests/objects/bug641828.c-expected b/tests/objects/bug641828.c-expected
new file mode 100644
index 000000000..cc9b533ec
--- /dev/null
+++ b/tests/objects/bug641828.c-expected
@@ -0,0 +1,242 @@
+/* objects_bug641828.c generated by valac, the Vala compiler
+ * generated from objects_bug641828.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define BAR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_BAR, BarIface))
+
+typedef struct _Bar Bar;
+typedef struct _BarIface BarIface;
+enum  {
+       BAR_BAR_SIGNAL,
+       BAR_NUM_SIGNALS
+};
+static guint bar_signals[BAR_NUM_SIGNALS] = {0};
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _BarIface {
+       GTypeInterface parent_iface;
+};
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+static gpointer foo_parent_class = NULL;
+static BarIface * foo_bar_parent_iface = NULL;
+
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+static void g_cclosure_user_marshal_INT__INT (GClosure * closure,
+                                       GValue * return_value,
+                                       guint n_param_values,
+                                       const GValue * param_values,
+                                       gpointer invocation_hint,
+                                       gpointer marshal_data);
+static GType bar_get_type_once (void);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+static gint __lambda4_ (gint i);
+static gint ___lambda4__bar_bar (Bar* _sender,
+                          gint i,
+                          gpointer self);
+
+static void
+g_cclosure_user_marshal_INT__INT (GClosure * closure,
+                                  GValue * return_value,
+                                  guint n_param_values,
+                                  const GValue * param_values,
+                                  gpointer invocation_hint,
+                                  gpointer marshal_data)
+{
+       typedef gint (*GMarshalFunc_INT__INT) (gpointer data1, gint arg_1, gpointer data2);
+       register GMarshalFunc_INT__INT callback;
+       register GCClosure * cc;
+       register gpointer data1;
+       register gpointer data2;
+       gint v_return;
+       cc = (GCClosure *) closure;
+       g_return_if_fail (return_value != NULL);
+       g_return_if_fail (n_param_values == 2);
+       if (G_CCLOSURE_SWAP_DATA (closure)) {
+               data1 = closure->data;
+               data2 = param_values->data[0].v_pointer;
+       } else {
+               data1 = param_values->data[0].v_pointer;
+               data2 = closure->data;
+       }
+       callback = (GMarshalFunc_INT__INT) (marshal_data ? marshal_data : cc->callback);
+       v_return = callback (data1, g_value_get_int (param_values + 1), data2);
+       g_value_set_int (return_value, v_return);
+}
+
+static void
+bar_default_init (BarIface * iface,
+                  gpointer iface_data)
+{
+       bar_signals[BAR_BAR_SIGNAL] = g_signal_new ("bar", TYPE_BAR, G_SIGNAL_RUN_LAST, 0, NULL, NULL, 
g_cclosure_user_marshal_INT__INT, G_TYPE_INT, 1, G_TYPE_INT);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (G_TYPE_INTERFACE, "Bar", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (bar_type_id, G_TYPE_OBJECT);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+foo_bar_interface_init (BarIface * iface,
+                        gpointer iface_data)
+{
+       foo_bar_parent_iface = g_type_interface_peek_parent (iface);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       static const GInterfaceInfo bar_info = { (GInterfaceInitFunc) foo_bar_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       g_type_add_interface_static (foo_type_id, TYPE_BAR, &bar_info);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static gint
+__lambda4_ (gint i)
+{
+       gint result = 0;
+       result = i + 12;
+       return result;
+}
+
+static gint
+___lambda4__bar_bar (Bar* _sender,
+                     gint i,
+                     gpointer self)
+{
+       gint result;
+       result = __lambda4_ (i);
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* f = NULL;
+       Foo* _tmp0_;
+       gint res = 0;
+       gint _tmp1_ = 0;
+       _tmp0_ = foo_new ();
+       f = _tmp0_;
+       g_signal_connect (G_TYPE_CHECK_INSTANCE_CAST (f, TYPE_BAR, Bar), "bar", (GCallback) 
___lambda4__bar_bar, NULL);
+       g_signal_emit (G_TYPE_CHECK_INSTANCE_CAST (f, TYPE_BAR, Bar), bar_signals[BAR_BAR_SIGNAL], 0, 30, 
&_tmp1_);
+       res = _tmp1_;
+       _vala_assert (res == 42, "res == 42");
+       _g_object_unref0 (f);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/bug642809.c-expected b/tests/objects/bug642809.c-expected
new file mode 100644
index 000000000..a63c8ea22
--- /dev/null
+++ b/tests/objects/bug642809.c-expected
@@ -0,0 +1,183 @@
+/* objects_bug642809.c generated by valac, the Vala compiler
+ * generated from objects_bug642809.vala, do not modify */
+
+#include <glib-object.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define FOO_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_FOO, FooIface))
+
+typedef struct _Foo Foo;
+typedef struct _FooIface FooIface;
+enum  {
+       FOO_VIRTUAL_SIGNAL_SIGNAL,
+       FOO_NUM_SIGNALS
+};
+static guint foo_signals[FOO_NUM_SIGNALS] = {0};
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+enum  {
+       BAR_0_PROPERTY,
+       BAR_NUM_PROPERTIES
+};
+static GParamSpec* bar_properties[BAR_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+
+struct _FooIface {
+       GTypeInterface parent_iface;
+       void (*virtual_signal) (Foo* self);
+};
+
+struct _Bar {
+       GObject parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       GObjectClass parent_class;
+};
+
+static gpointer bar_parent_class = NULL;
+static FooIface * bar_foo_parent_iface = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+static void foo_real_virtual_signal (Foo* self);
+static GType foo_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static GType bar_get_type_once (void);
+static void _vala_main (void);
+
+static void
+foo_real_virtual_signal (Foo* self)
+{
+}
+
+static void
+foo_default_init (FooIface * iface,
+                  gpointer iface_data)
+{
+       iface->virtual_signal = foo_real_virtual_signal;
+       foo_signals[FOO_VIRTUAL_SIGNAL_SIGNAL] = g_signal_new ("virtual-signal", TYPE_FOO, G_SIGNAL_RUN_LAST, 
G_STRUCT_OFFSET (FooIface, virtual_signal), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_INTERFACE, "Foo", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (foo_type_id, G_TYPE_OBJECT);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar * self = NULL;
+       self = (Bar*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+bar_foo_interface_init (FooIface * iface,
+                        gpointer iface_data)
+{
+       bar_foo_parent_iface = g_type_interface_peek_parent (iface);
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       static const GInterfaceInfo foo_info = { (GInterfaceInitFunc) bar_foo_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (G_TYPE_OBJECT, "Bar", &g_define_type_info, 0);
+       g_type_add_interface_static (bar_type_id, TYPE_FOO, &foo_info);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Bar* bar = NULL;
+       Bar* _tmp0_;
+       _tmp0_ = bar_new ();
+       bar = _tmp0_;
+       g_signal_emit (G_TYPE_CHECK_INSTANCE_CAST (bar, TYPE_FOO, Foo), 
foo_signals[FOO_VIRTUAL_SIGNAL_SIGNAL], 0);
+       _g_object_unref0 (bar);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/bug643711.c-expected b/tests/objects/bug643711.c-expected
new file mode 100644
index 000000000..3c79f7a75
--- /dev/null
+++ b/tests/objects/bug643711.c-expected
@@ -0,0 +1,404 @@
+/* objects_bug643711.c generated by valac, the Vala compiler
+ * generated from objects_bug643711.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+
+#define TYPE_BAZ (baz_get_type ())
+typedef struct _Baz Baz;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+       void (*bar) (Foo* self);
+};
+
+struct _Baz {
+       Foo* foo;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN void foo_bar (Foo* self);
+VALA_EXTERN GType baz_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Baz* baz_dup (const Baz* self);
+VALA_EXTERN void baz_free (Baz* self);
+VALA_EXTERN void baz_copy (const Baz* self,
+               Baz* dest);
+VALA_EXTERN void baz_destroy (Baz* self);
+VALA_EXTERN void foo_get_struct (Foo* self,
+                     Baz* result);
+static void foo_real_bar (Foo* self);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN void baz_bar (Baz *self);
+static void _vala_main (void);
+
+void
+foo_get_struct (Foo* self,
+                Baz* result)
+{
+       Baz _tmp0_ = {0};
+       g_return_if_fail (IS_FOO (self));
+       memset (&_tmp0_, 0, sizeof (Baz));
+       *result = _tmp0_;
+       return;
+}
+
+static void
+foo_real_bar (Foo* self)
+{
+       g_critical ("Type `%s' does not implement abstract method `foo_bar'", g_type_name 
(G_TYPE_FROM_INSTANCE (self)));
+       return;
+}
+
+void
+foo_bar (Foo* self)
+{
+       FooClass* _klass_;
+       g_return_if_fail (IS_FOO (self));
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->bar) {
+               _klass_->bar (self);
+       }
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       ((FooClass *) klass)->bar = (void (*) (Foo*)) foo_real_bar;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, G_TYPE_FLAG_ABSTRACT);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+void
+baz_bar (Baz *self)
+{
+       Foo* _tmp0_;
+       _tmp0_ = (*self).foo;
+       foo_bar (_tmp0_);
+}
+
+static gpointer
+_foo_ref0 (gpointer self)
+{
+       return self ? foo_ref (self) : NULL;
+}
+
+void
+baz_copy (const Baz* self,
+          Baz* dest)
+{
+       Foo* _tmp0_;
+       Foo* _tmp1_;
+       _tmp0_ = (*self).foo;
+       _tmp1_ = _foo_ref0 (_tmp0_);
+       _foo_unref0 ((*dest).foo);
+       (*dest).foo = _tmp1_;
+}
+
+void
+baz_destroy (Baz* self)
+{
+       _foo_unref0 ((*self).foo);
+}
+
+Baz*
+baz_dup (const Baz* self)
+{
+       Baz* dup;
+       dup = g_new0 (Baz, 1);
+       baz_copy (self, dup);
+       return dup;
+}
+
+void
+baz_free (Baz* self)
+{
+       baz_destroy (self);
+       g_free (self);
+}
+
+static GType
+baz_get_type_once (void)
+{
+       GType baz_type_id;
+       baz_type_id = g_boxed_type_register_static ("Baz", (GBoxedCopyFunc) baz_dup, (GBoxedFreeFunc) 
baz_free);
+       return baz_type_id;
+}
+
+GType
+baz_get_type (void)
+{
+       static volatile gsize baz_type_id__volatile = 0;
+       if (g_once_init_enter (&baz_type_id__volatile)) {
+               GType baz_type_id;
+               baz_type_id = baz_get_type_once ();
+               g_once_init_leave (&baz_type_id__volatile, baz_type_id);
+       }
+       return baz_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/bug644938.c-expected b/tests/objects/bug644938.c-expected
new file mode 100644
index 000000000..cbbd915c8
--- /dev/null
+++ b/tests/objects/bug644938.c-expected
@@ -0,0 +1,315 @@
+/* objects_bug644938.c generated by valac, the Vala compiler
+ * generated from objects_bug644938.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_TYPE_PARAM_TYPE,
+       FOO_TYPE_PARAM_DUP_FUNC,
+       FOO_TYPE_PARAM_DESTROY_FUNC,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+enum  {
+       BAR_0_PROPERTY,
+       BAR_NUM_PROPERTIES
+};
+static GParamSpec* bar_properties[BAR_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+       void (*method) (Foo* self, gconstpointer o);
+};
+
+struct _FooPrivate {
+       GType type_param_type;
+       GBoxedCopyFunc type_param_dup_func;
+       GDestroyNotify type_param_destroy_func;
+};
+
+struct _Bar {
+       Foo parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       FooClass parent_class;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN void foo_method (Foo* self,
+                 gconstpointer o);
+static void foo_real_method (Foo* self,
+                      gconstpointer o);
+VALA_EXTERN Foo* foo_construct (GType object_type,
+                    GType type_param_type,
+                    GBoxedCopyFunc type_param_dup_func,
+                    GDestroyNotify type_param_destroy_func);
+static GType foo_get_type_once (void);
+static void _vala_foo_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_foo_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
+static void bar_real_method (Foo* base,
+                      gint i);
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static GType bar_get_type_once (void);
+static void _vala_main (void);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+static void
+foo_real_method (Foo* self,
+                 gconstpointer o)
+{
+       g_critical ("Type `%s' does not implement abstract method `foo_method'", g_type_name 
(G_TYPE_FROM_INSTANCE (self)));
+       return;
+}
+
+void
+foo_method (Foo* self,
+            gconstpointer o)
+{
+       FooClass* _klass_;
+       g_return_if_fail (IS_FOO (self));
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->method) {
+               _klass_->method (self, o);
+       }
+}
+
+Foo*
+foo_construct (GType object_type,
+               GType type_param_type,
+               GBoxedCopyFunc type_param_dup_func,
+               GDestroyNotify type_param_destroy_func)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       self->priv->type_param_type = type_param_type;
+       self->priv->type_param_dup_func = type_param_dup_func;
+       self->priv->type_param_destroy_func = type_param_destroy_func;
+       return self;
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+       ((FooClass *) klass)->method = (void (*) (Foo*, gconstpointer)) foo_real_method;
+       G_OBJECT_CLASS (klass)->get_property = _vala_foo_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_foo_set_property;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_TYPE_PARAM_TYPE, g_param_spec_gtype 
("type-param-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | 
G_PARAM_CONSTRUCT_ONLY));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_TYPE_PARAM_DUP_FUNC, 
g_param_spec_pointer ("type-param-dup-func", "dup func", "dup func", G_PARAM_STATIC_STRINGS | 
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_TYPE_PARAM_DESTROY_FUNC, 
g_param_spec_pointer ("type-param-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_STRINGS | 
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 
G_TYPE_FLAG_ABSTRACT);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_foo_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_TYPE_PARAM_TYPE:
+               g_value_set_gtype (value, self->priv->type_param_type);
+               break;
+               case FOO_TYPE_PARAM_DUP_FUNC:
+               g_value_set_pointer (value, self->priv->type_param_dup_func);
+               break;
+               case FOO_TYPE_PARAM_DESTROY_FUNC:
+               g_value_set_pointer (value, self->priv->type_param_destroy_func);
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_foo_set_property (GObject * object,
+                        guint property_id,
+                        const GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_TYPE_PARAM_TYPE:
+               self->priv->type_param_type = g_value_get_gtype (value);
+               break;
+               case FOO_TYPE_PARAM_DUP_FUNC:
+               self->priv->type_param_dup_func = g_value_get_pointer (value);
+               break;
+               case FOO_TYPE_PARAM_DESTROY_FUNC:
+               self->priv->type_param_destroy_func = g_value_get_pointer (value);
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+bar_real_method (Foo* base,
+                 gint i)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAR, Bar);
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar * self = NULL;
+       self = (Bar*) foo_construct (object_type, G_TYPE_INT, NULL, NULL);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->method = (void (*) (Foo*, gconstpointer)) bar_real_method;
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (TYPE_FOO, "Bar", &g_define_type_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Bar* bar = NULL;
+       Bar* _tmp0_;
+       _tmp0_ = bar_new ();
+       bar = _tmp0_;
+       _g_object_unref0 (bar);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/bug646362.c-expected b/tests/objects/bug646362.c-expected
new file mode 100644
index 000000000..733d13a2f
--- /dev/null
+++ b/tests/objects/bug646362.c-expected
@@ -0,0 +1,200 @@
+/* objects_bug646362.c generated by valac, the Vala compiler
+ * generated from objects_bug646362.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+typedef struct _Block1Data Block1Data;
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _FooPrivate {
+       gint bar;
+};
+
+struct _Block1Data {
+       int _ref_count_;
+       Foo* self;
+       gint baz;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static gboolean _foo___lambda4_ (Block1Data* _data1_);
+static gboolean __foo___lambda4__gsource_func (gpointer self);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (GObject * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               Foo* self;
+               self = _data1_->self;
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static gboolean
+_foo___lambda4_ (Block1Data* _data1_)
+{
+       Foo* self;
+       gboolean result = FALSE;
+       self = _data1_->self;
+       result = _data1_->baz == 2;
+       return result;
+}
+
+static gboolean
+__foo___lambda4__gsource_func (gpointer self)
+{
+       gboolean result;
+       result = _foo___lambda4_ (self);
+       return result;
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+       G_OBJECT_CLASS (klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+}
+
+static void
+foo_finalize (GObject * obj)
+{
+       Foo * self;
+       Block1Data* _data1_;
+       GSourceFunc f = NULL;
+       gpointer f_target;
+       GDestroyNotify f_target_destroy_notify;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       _data1_ = g_slice_new0 (Block1Data);
+       _data1_->_ref_count_ = 1;
+       _data1_->self = self;
+       _data1_->baz = self->priv->bar;
+       f = __foo___lambda4__gsource_func;
+       f_target = block1_data_ref (_data1_);
+       f_target_destroy_notify = block1_data_unref;
+       (f_target_destroy_notify == NULL) ? NULL : (f_target_destroy_notify (f_target), NULL);
+       f = NULL;
+       f_target = NULL;
+       f_target_destroy_notify = NULL;
+       block1_data_unref (_data1_);
+       _data1_ = NULL;
+       G_OBJECT_CLASS (foo_parent_class)->finalize (obj);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/bug646792.c-expected b/tests/objects/bug646792.c-expected
new file mode 100644
index 000000000..89ee77f2f
--- /dev/null
+++ b/tests/objects/bug646792.c-expected
@@ -0,0 +1,349 @@
+/* objects_bug646792.c generated by valac, the Vala compiler
+ * generated from objects_bug646792.vala, do not modify */
+
+#include <glib-object.h>
+#include <gobject/gvaluecollector.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_WRAPPER (wrapper_get_type ())
+#define WRAPPER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_WRAPPER, Wrapper))
+#define WRAPPER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_WRAPPER, WrapperClass))
+#define IS_WRAPPER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_WRAPPER))
+#define IS_WRAPPER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_WRAPPER))
+#define WRAPPER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_WRAPPER, WrapperClass))
+
+typedef struct _Wrapper Wrapper;
+typedef struct _WrapperClass WrapperClass;
+typedef struct _WrapperPrivate WrapperPrivate;
+typedef struct _ParamSpecWrapper ParamSpecWrapper;
+#define _wrapper_unref0(var) ((var == NULL) ? NULL : (var = (wrapper_unref (var), NULL)))
+
+struct _Wrapper {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       WrapperPrivate * priv;
+       gpointer item;
+       gconstpointer* ptr;
+};
+
+struct _WrapperClass {
+       GTypeClass parent_class;
+       void (*finalize) (Wrapper *self);
+};
+
+struct _WrapperPrivate {
+       GType g_type;
+       GBoxedCopyFunc g_dup_func;
+       GDestroyNotify g_destroy_func;
+};
+
+struct _ParamSpecWrapper {
+       GParamSpec parent_instance;
+};
+
+static gint Wrapper_private_offset;
+static gpointer wrapper_parent_class = NULL;
+
+VALA_EXTERN gpointer wrapper_ref (gpointer instance);
+VALA_EXTERN void wrapper_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_wrapper (const gchar* name,
+                                const gchar* nick,
+                                const gchar* blurb,
+                                GType object_type,
+                                GParamFlags flags);
+VALA_EXTERN void value_set_wrapper (GValue* value,
+                        gpointer v_object);
+VALA_EXTERN void value_take_wrapper (GValue* value,
+                         gpointer v_object);
+VALA_EXTERN gpointer value_get_wrapper (const GValue* value);
+VALA_EXTERN GType wrapper_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Wrapper, wrapper_unref)
+VALA_EXTERN Wrapper* wrapper_new (GType g_type,
+                      GBoxedCopyFunc g_dup_func,
+                      GDestroyNotify g_destroy_func);
+VALA_EXTERN Wrapper* wrapper_construct (GType object_type,
+                            GType g_type,
+                            GBoxedCopyFunc g_dup_func,
+                            GDestroyNotify g_destroy_func);
+static void wrapper_finalize (Wrapper * obj);
+static GType wrapper_get_type_once (void);
+static void _vala_main (void);
+
+static inline gpointer
+wrapper_get_instance_private (Wrapper* self)
+{
+       return G_STRUCT_MEMBER_P (self, Wrapper_private_offset);
+}
+
+Wrapper*
+wrapper_construct (GType object_type,
+                   GType g_type,
+                   GBoxedCopyFunc g_dup_func,
+                   GDestroyNotify g_destroy_func)
+{
+       Wrapper* self = NULL;
+       self = (Wrapper*) g_type_create_instance (object_type);
+       self->priv->g_type = g_type;
+       self->priv->g_dup_func = g_dup_func;
+       self->priv->g_destroy_func = g_destroy_func;
+       return self;
+}
+
+Wrapper*
+wrapper_new (GType g_type,
+             GBoxedCopyFunc g_dup_func,
+             GDestroyNotify g_destroy_func)
+{
+       return wrapper_construct (TYPE_WRAPPER, g_type, g_dup_func, g_destroy_func);
+}
+
+static void
+value_wrapper_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_wrapper_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               wrapper_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_wrapper_copy_value (const GValue* src_value,
+                          GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = wrapper_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_wrapper_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_wrapper_collect_value (GValue* value,
+                             guint n_collect_values,
+                             GTypeCValue* collect_values,
+                             guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Wrapper * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = wrapper_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_wrapper_lcopy_value (const GValue* value,
+                           guint n_collect_values,
+                           GTypeCValue* collect_values,
+                           guint collect_flags)
+{
+       Wrapper ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = wrapper_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_wrapper (const gchar* name,
+                    const gchar* nick,
+                    const gchar* blurb,
+                    GType object_type,
+                    GParamFlags flags)
+{
+       ParamSpecWrapper* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_WRAPPER), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_wrapper (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_WRAPPER), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_wrapper (GValue* value,
+                   gpointer v_object)
+{
+       Wrapper * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_WRAPPER));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_WRAPPER));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               wrapper_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               wrapper_unref (old);
+       }
+}
+
+void
+value_take_wrapper (GValue* value,
+                    gpointer v_object)
+{
+       Wrapper * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_WRAPPER));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_WRAPPER));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               wrapper_unref (old);
+       }
+}
+
+static void
+wrapper_class_init (WrapperClass * klass,
+                    gpointer klass_data)
+{
+       wrapper_parent_class = g_type_class_peek_parent (klass);
+       ((WrapperClass *) klass)->finalize = wrapper_finalize;
+       g_type_class_adjust_private_offset (klass, &Wrapper_private_offset);
+}
+
+static void
+wrapper_instance_init (Wrapper * self,
+                       gpointer klass)
+{
+       self->priv = wrapper_get_instance_private (self);
+       self->ref_count = 1;
+}
+
+static void
+wrapper_finalize (Wrapper * obj)
+{
+       Wrapper * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_WRAPPER, Wrapper);
+       g_signal_handlers_destroy (self);
+       ((self->item == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (self->item = 
(self->priv->g_destroy_func (self->item), NULL));
+}
+
+static GType
+wrapper_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_wrapper_init, 
value_wrapper_free_value, value_wrapper_copy_value, value_wrapper_peek_pointer, "p", 
value_wrapper_collect_value, "p", value_wrapper_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (WrapperClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) wrapper_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(Wrapper), 0, (GInstanceInitFunc) wrapper_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType wrapper_type_id;
+       wrapper_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Wrapper", 
&g_define_type_info, &g_define_type_fundamental_info, 0);
+       Wrapper_private_offset = g_type_add_instance_private (wrapper_type_id, sizeof (WrapperPrivate));
+       return wrapper_type_id;
+}
+
+GType
+wrapper_get_type (void)
+{
+       static volatile gsize wrapper_type_id__volatile = 0;
+       if (g_once_init_enter (&wrapper_type_id__volatile)) {
+               GType wrapper_type_id;
+               wrapper_type_id = wrapper_get_type_once ();
+               g_once_init_leave (&wrapper_type_id__volatile, wrapper_type_id);
+       }
+       return wrapper_type_id__volatile;
+}
+
+gpointer
+wrapper_ref (gpointer instance)
+{
+       Wrapper * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+wrapper_unref (gpointer instance)
+{
+       Wrapper * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               WRAPPER_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static gpointer
+_wrapper_ref0 (gpointer self)
+{
+       return self ? wrapper_ref (self) : NULL;
+}
+
+static void
+_vala_main (void)
+{
+       Wrapper* item = NULL;
+       Wrapper* _tmp0_;
+       Wrapper* inner_item = NULL;
+       gconstpointer _tmp1_;
+       Wrapper* _tmp2_;
+       Wrapper* inner_ptr = NULL;
+       gconstpointer* _tmp3_;
+       _tmp0_ = wrapper_new (TYPE_WRAPPER, (GBoxedCopyFunc) wrapper_ref, (GDestroyNotify) wrapper_unref);
+       item = _tmp0_;
+       _tmp1_ = item->item;
+       _tmp2_ = _wrapper_ref0 ((Wrapper*) _tmp1_);
+       inner_item = _tmp2_;
+       _tmp3_ = item->ptr;
+       inner_ptr = _tmp3_;
+       _wrapper_unref0 (inner_item);
+       _wrapper_unref0 (item);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/bug647018.c-expected b/tests/objects/bug647018.c-expected
new file mode 100644
index 000000000..5ddb3f216
--- /dev/null
+++ b/tests/objects/bug647018.c-expected
@@ -0,0 +1,35 @@
+/* objects_bug647018.c generated by valac, the Vala compiler
+ * generated from objects_bug647018.vala, do not modify */
+
+/* allow fields starting with a digit if the cname is valid*/
+
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+VALA_EXTERN gint good;
+gint good = 0;
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/bug653138.c-expected b/tests/objects/bug653138.c-expected
new file mode 100644
index 000000000..895de9abd
--- /dev/null
+++ b/tests/objects/bug653138.c-expected
@@ -0,0 +1,359 @@
+/* objects_bug653138.c generated by valac, the Vala compiler
+ * generated from objects_bug653138.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _FooPrivate {
+       GSourceFunc _foo;
+       gpointer _foo_target;
+       GDestroyNotify _foo_target_destroy_notify;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN void foo_bar (Foo* self);
+static void foo_set_foo (Foo* self,
+                  GSourceFunc value,
+                  gpointer value_target);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+VALA_EXTERN GSourceFunc foo_get_foo (Foo* self,
+                         gpointer* result_target);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+void
+foo_bar (Foo* self)
+{
+       g_return_if_fail (IS_FOO (self));
+       foo_set_foo (self, NULL, NULL);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+GSourceFunc
+foo_get_foo (Foo* self,
+             gpointer* result_target)
+{
+       GSourceFunc result;
+       GSourceFunc _tmp0_;
+       gpointer _tmp0__target;
+       GSourceFunc _tmp1_;
+       gpointer _tmp1__target;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = self->priv->_foo;
+       _tmp0__target = self->priv->_foo_target;
+       _tmp1_ = _tmp0_;
+       _tmp1__target = _tmp0__target;
+       *result_target = _tmp1__target;
+       result = _tmp1_;
+       return result;
+}
+
+static void
+foo_set_foo (Foo* self,
+             GSourceFunc value,
+             gpointer value_target)
+{
+       g_return_if_fail (IS_FOO (self));
+       (self->priv->_foo_target_destroy_notify == NULL) ? NULL : (self->priv->_foo_target_destroy_notify 
(self->priv->_foo_target), NULL);
+       self->priv->_foo = NULL;
+       self->priv->_foo_target = NULL;
+       self->priv->_foo_target_destroy_notify = NULL;
+       self->priv->_foo = value;
+       self->priv->_foo_target = value_target;
+       self->priv->_foo_target_destroy_notify = NULL;
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+       (self->priv->_foo_target_destroy_notify == NULL) ? NULL : (self->priv->_foo_target_destroy_notify 
(self->priv->_foo_target), NULL);
+       self->priv->_foo = NULL;
+       self->priv->_foo_target = NULL;
+       self->priv->_foo_target_destroy_notify = NULL;
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/bug654702.c-expected b/tests/objects/bug654702.c-expected
new file mode 100644
index 000000000..90effd29b
--- /dev/null
+++ b/tests/objects/bug654702.c-expected
@@ -0,0 +1,291 @@
+/* objects_bug654702.c generated by valac, the Vala compiler
+ * generated from objects_bug654702.vala, do not modify */
+
+#include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_T_TYPE,
+       FOO_T_DUP_FUNC,
+       FOO_T_DESTROY_FUNC,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+enum  {
+       BAR_0_PROPERTY,
+       BAR_NUM_PROPERTIES
+};
+static GParamSpec* bar_properties[BAR_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _FooPrivate {
+       GType t_type;
+       GBoxedCopyFunc t_dup_func;
+       GDestroyNotify t_destroy_func;
+};
+
+struct _Bar {
+       Foo parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       FooClass parent_class;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (GType t_type,
+              GBoxedCopyFunc t_dup_func,
+              GDestroyNotify t_destroy_func);
+VALA_EXTERN Foo* foo_construct (GType object_type,
+                    GType t_type,
+                    GBoxedCopyFunc t_dup_func,
+                    GDestroyNotify t_destroy_func);
+static GType foo_get_type_once (void);
+static void _vala_foo_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_foo_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static GType bar_get_type_once (void);
+static void _vala_main (void);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct (GType object_type,
+               GType t_type,
+               GBoxedCopyFunc t_dup_func,
+               GDestroyNotify t_destroy_func)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       self->priv->t_type = t_type;
+       self->priv->t_dup_func = t_dup_func;
+       self->priv->t_destroy_func = t_destroy_func;
+       return self;
+}
+
+Foo*
+foo_new (GType t_type,
+         GBoxedCopyFunc t_dup_func,
+         GDestroyNotify t_destroy_func)
+{
+       return foo_construct (TYPE_FOO, t_type, t_dup_func, t_destroy_func);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_foo_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_foo_set_property;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_T_TYPE, g_param_spec_gtype ("t-type", 
"type", "type", G_TYPE_NONE, G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_T_DUP_FUNC, g_param_spec_pointer 
("t-dup-func", "dup func", "dup func", G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_T_DESTROY_FUNC, g_param_spec_pointer 
("t-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | 
G_PARAM_CONSTRUCT_ONLY));
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_foo_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_T_TYPE:
+               g_value_set_gtype (value, self->priv->t_type);
+               break;
+               case FOO_T_DUP_FUNC:
+               g_value_set_pointer (value, self->priv->t_dup_func);
+               break;
+               case FOO_T_DESTROY_FUNC:
+               g_value_set_pointer (value, self->priv->t_destroy_func);
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_foo_set_property (GObject * object,
+                        guint property_id,
+                        const GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_T_TYPE:
+               self->priv->t_type = g_value_get_gtype (value);
+               break;
+               case FOO_T_DUP_FUNC:
+               self->priv->t_dup_func = g_value_get_pointer (value);
+               break;
+               case FOO_T_DESTROY_FUNC:
+               self->priv->t_destroy_func = g_value_get_pointer (value);
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar * self = NULL;
+       self = (Bar*) g_object_new (object_type, "t-type", G_TYPE_STRING, "t-dup-func", (GBoxedCopyFunc) 
g_strdup, "t-destroy-func", (GDestroyNotify) g_free, NULL);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (TYPE_FOO, "Bar", &g_define_type_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Bar* _tmp0_;
+       Bar* _tmp1_;
+       _tmp0_ = bar_new ();
+       _tmp1_ = _tmp0_;
+       _g_object_unref0 (_tmp1_);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/bug663134.c-expected b/tests/objects/bug663134.c-expected
new file mode 100644
index 000000000..cb3a1bc4e
--- /dev/null
+++ b/tests/objects/bug663134.c-expected
@@ -0,0 +1,440 @@
+/* objects_bug663134.c generated by valac, the Vala compiler
+ * generated from objects_bug663134.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _Block1Data Block1Data;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _FooPrivate {
+       GType t_type;
+       GBoxedCopyFunc t_dup_func;
+       GDestroyNotify t_destroy_func;
+};
+
+struct _Block1Data {
+       int _ref_count_;
+       Foo* self;
+       gpointer baz;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN void foo_bar (Foo* self);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static gboolean __lambda4_ (Block1Data* _data1_);
+static gboolean __lambda5_ (Block1Data* _data1_);
+static gboolean ___lambda5__gsource_func (gpointer self);
+static gboolean ___lambda4__gsource_func (gpointer self);
+VALA_EXTERN Foo* foo_new (GType t_type,
+              GBoxedCopyFunc t_dup_func,
+              GDestroyNotify t_destroy_func);
+VALA_EXTERN Foo* foo_construct (GType object_type,
+                    GType t_type,
+                    GBoxedCopyFunc t_dup_func,
+                    GDestroyNotify t_destroy_func);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               Foo* self;
+               self = _data1_->self;
+               ((_data1_->baz == NULL) || (self->priv->t_destroy_func == NULL)) ? NULL : (_data1_->baz = 
(self->priv->t_destroy_func (_data1_->baz), NULL));
+               _foo_unref0 (self);
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static gboolean
+__lambda5_ (Block1Data* _data1_)
+{
+       Foo* self;
+       gboolean result = FALSE;
+       self = _data1_->self;
+       ((_data1_->baz == NULL) || (self->priv->t_destroy_func == NULL)) ? NULL : (_data1_->baz = 
(self->priv->t_destroy_func (_data1_->baz), NULL));
+       _data1_->baz = NULL;
+       result = FALSE;
+       return result;
+}
+
+static gboolean
+___lambda5__gsource_func (gpointer self)
+{
+       gboolean result;
+       result = __lambda5_ (self);
+       return result;
+}
+
+static gboolean
+__lambda4_ (Block1Data* _data1_)
+{
+       Foo* self;
+       GSourceFunc ff = NULL;
+       gpointer ff_target;
+       GDestroyNotify ff_target_destroy_notify;
+       gboolean result = FALSE;
+       self = _data1_->self;
+       ((_data1_->baz == NULL) || (self->priv->t_destroy_func == NULL)) ? NULL : (_data1_->baz = 
(self->priv->t_destroy_func (_data1_->baz), NULL));
+       _data1_->baz = NULL;
+       ff = ___lambda5__gsource_func;
+       ff_target = block1_data_ref (_data1_);
+       ff_target_destroy_notify = block1_data_unref;
+       ff (ff_target);
+       result = FALSE;
+       (ff_target_destroy_notify == NULL) ? NULL : (ff_target_destroy_notify (ff_target), NULL);
+       ff = NULL;
+       ff_target = NULL;
+       ff_target_destroy_notify = NULL;
+       return result;
+}
+
+static gboolean
+___lambda4__gsource_func (gpointer self)
+{
+       gboolean result;
+       result = __lambda4_ (self);
+       return result;
+}
+
+void
+foo_bar (Foo* self)
+{
+       Block1Data* _data1_;
+       GSourceFunc f = NULL;
+       gpointer f_target;
+       GDestroyNotify f_target_destroy_notify;
+       g_return_if_fail (IS_FOO (self));
+       _data1_ = g_slice_new0 (Block1Data);
+       _data1_->_ref_count_ = 1;
+       _data1_->self = foo_ref (self);
+       _data1_->baz = NULL;
+       f = ___lambda4__gsource_func;
+       f_target = block1_data_ref (_data1_);
+       f_target_destroy_notify = block1_data_unref;
+       f (f_target);
+       (f_target_destroy_notify == NULL) ? NULL : (f_target_destroy_notify (f_target), NULL);
+       f = NULL;
+       f_target = NULL;
+       f_target_destroy_notify = NULL;
+       block1_data_unref (_data1_);
+       _data1_ = NULL;
+}
+
+Foo*
+foo_construct (GType object_type,
+               GType t_type,
+               GBoxedCopyFunc t_dup_func,
+               GDestroyNotify t_destroy_func)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       self->priv->t_type = t_type;
+       self->priv->t_dup_func = t_dup_func;
+       self->priv->t_destroy_func = t_destroy_func;
+       return self;
+}
+
+Foo*
+foo_new (GType t_type,
+         GBoxedCopyFunc t_dup_func,
+         GDestroyNotify t_destroy_func)
+{
+       return foo_construct (TYPE_FOO, t_type, t_dup_func, t_destroy_func);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       _tmp0_ = foo_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free);
+       foo = _tmp0_;
+       foo_bar (foo);
+       _foo_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/bug664529.c-expected b/tests/objects/bug664529.c-expected
new file mode 100644
index 000000000..42398dc81
--- /dev/null
+++ b/tests/objects/bug664529.c-expected
@@ -0,0 +1,65 @@
+/* objects_bug664529.c generated by valac, the Vala compiler
+ * generated from objects_bug664529.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (void);
+static void _g_object_unref0_ (gpointer var);
+static inline void _g_queue_free__g_object_unref0_ (GQueue* self);
+
+static gpointer
+_g_object_ref0 (gpointer self)
+{
+       return self ? g_object_ref (self) : NULL;
+}
+
+static void
+_g_object_unref0_ (gpointer var)
+{
+       (var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
+}
+
+static inline void
+_g_queue_free__g_object_unref0_ (GQueue* self)
+{
+       g_queue_free_full (self, (GDestroyNotify) _g_object_unref0_);
+}
+
+static void
+_vala_main (void)
+{
+       GObject* foo = NULL;
+       GObject* _tmp0_;
+       GQueue* bar = NULL;
+       GQueue* _tmp1_;
+       GQueue* _tmp2_;
+       GObject* _tmp3_;
+       _tmp0_ = g_object_new (G_TYPE_OBJECT, NULL);
+       foo = _tmp0_;
+       _tmp1_ = g_queue_new ();
+       bar = _tmp1_;
+       _tmp2_ = bar;
+       _tmp3_ = _g_object_ref0 (foo);
+       g_queue_push_head (_tmp2_, _tmp3_);
+       (bar == NULL) ? NULL : (bar = (_g_queue_free__g_object_unref0_ (bar), NULL));
+       bar = NULL;
+       _vala_assert (foo->ref_count == ((guint) 1), "foo.ref_count == 1");
+       (bar == NULL) ? NULL : (bar = (_g_queue_free__g_object_unref0_ (bar), NULL));
+       _g_object_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/bug667668.c-expected b/tests/objects/bug667668.c-expected
new file mode 100644
index 000000000..a2a70c2dd
--- /dev/null
+++ b/tests/objects/bug667668.c-expected
@@ -0,0 +1,426 @@
+/* objects_bug667668.c generated by valac, the Vala compiler
+ * generated from objects_bug667668.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_G_TYPE,
+       FOO_G_DUP_FUNC,
+       FOO_G_DESTROY_FUNC,
+       FOO_FOO_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+enum  {
+       BAR_0_PROPERTY,
+       BAR_FOO_PROPERTY,
+       BAR_NUM_PROPERTIES
+};
+static GParamSpec* bar_properties[BAR_NUM_PROPERTIES];
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+       gconstpointer (*get_foo) (Foo* self);
+       void (*set_foo) (Foo* self, gconstpointer value);
+};
+
+struct _FooPrivate {
+       GType g_type;
+       GBoxedCopyFunc g_dup_func;
+       GDestroyNotify g_destroy_func;
+};
+
+struct _Bar {
+       Foo parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       FooClass parent_class;
+};
+
+struct _BarPrivate {
+       gchar* _foo;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+static gint Bar_private_offset;
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_construct (GType object_type,
+                    GType g_type,
+                    GBoxedCopyFunc g_dup_func,
+                    GDestroyNotify g_destroy_func);
+VALA_EXTERN gconstpointer foo_get_foo (Foo* self);
+VALA_EXTERN void foo_set_foo (Foo* self,
+                  gconstpointer value);
+static GType foo_get_type_once (void);
+static void _vala_foo_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_foo_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static void bar_finalize (GObject * obj);
+static GType bar_get_type_once (void);
+static void _vala_bar_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_bar_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec);
+static void _vala_main (void);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct (GType object_type,
+               GType g_type,
+               GBoxedCopyFunc g_dup_func,
+               GDestroyNotify g_destroy_func)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       self->priv->g_type = g_type;
+       self->priv->g_dup_func = g_dup_func;
+       self->priv->g_destroy_func = g_destroy_func;
+       return self;
+}
+
+gconstpointer
+foo_get_foo (Foo* self)
+{
+       FooClass* _klass_;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->get_foo) {
+               return _klass_->get_foo (self);
+       }
+       return NULL;
+}
+
+void
+foo_set_foo (Foo* self,
+             gconstpointer value)
+{
+       FooClass* _klass_;
+       g_return_if_fail (IS_FOO (self));
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->set_foo) {
+               _klass_->set_foo (self, value);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_foo_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_foo_set_property;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_G_TYPE, g_param_spec_gtype ("g-type", 
"type", "type", G_TYPE_NONE, G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_G_DUP_FUNC, g_param_spec_pointer 
("g-dup-func", "dup func", "dup func", G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_G_DESTROY_FUNC, g_param_spec_pointer 
("g-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | 
G_PARAM_CONSTRUCT_ONLY));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_FOO_PROPERTY, 
foo_properties[FOO_FOO_PROPERTY] = g_param_spec_pointer ("foo", "foo", "foo", G_PARAM_STATIC_STRINGS | 
G_PARAM_READABLE | G_PARAM_WRITABLE));
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 
G_TYPE_FLAG_ABSTRACT);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_foo_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_G_TYPE:
+               g_value_set_gtype (value, self->priv->g_type);
+               break;
+               case FOO_G_DUP_FUNC:
+               g_value_set_pointer (value, self->priv->g_dup_func);
+               break;
+               case FOO_G_DESTROY_FUNC:
+               g_value_set_pointer (value, self->priv->g_destroy_func);
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_foo_set_property (GObject * object,
+                        guint property_id,
+                        const GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_G_TYPE:
+               self->priv->g_type = g_value_get_gtype (value);
+               break;
+               case FOO_G_DUP_FUNC:
+               self->priv->g_dup_func = g_value_get_pointer (value);
+               break;
+               case FOO_G_DESTROY_FUNC:
+               self->priv->g_destroy_func = g_value_get_pointer (value);
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static inline gpointer
+bar_get_instance_private (Bar* self)
+{
+       return G_STRUCT_MEMBER_P (self, Bar_private_offset);
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar * self = NULL;
+       self = (Bar*) foo_construct (object_type, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) 
g_free);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static const gchar*
+bar_real_get_foo (Foo* base)
+{
+       const gchar* result;
+       Bar* self;
+       const gchar* _tmp0_;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAR, Bar);
+       _tmp0_ = self->priv->_foo;
+       result = _tmp0_;
+       return result;
+}
+
+static void
+bar_real_set_foo (Foo* base,
+                  const gchar* value)
+{
+       Bar* self;
+       gchar* old_value;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAR, Bar);
+       old_value = bar_real_get_foo (base);
+       if (g_strcmp0 (value, old_value) != 0) {
+               gchar* _tmp0_;
+               _tmp0_ = g_strdup (value);
+               _g_free0 (self->priv->_foo);
+               self->priv->_foo = _tmp0_;
+               g_object_notify_by_pspec ((GObject *) self, bar_properties[BAR_FOO_PROPERTY]);
+       }
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Bar_private_offset);
+       FOO_CLASS (klass)->get_foo = bar_real_get_foo;
+       FOO_CLASS (klass)->set_foo = bar_real_set_foo;
+       G_OBJECT_CLASS (klass)->get_property = _vala_bar_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_bar_set_property;
+       G_OBJECT_CLASS (klass)->finalize = bar_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), BAR_FOO_PROPERTY, 
bar_properties[BAR_FOO_PROPERTY] = g_param_spec_string ("foo", "foo", "foo", NULL, G_PARAM_STATIC_STRINGS | 
G_PARAM_READABLE | G_PARAM_WRITABLE));
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+       self->priv = bar_get_instance_private (self);
+}
+
+static void
+bar_finalize (GObject * obj)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       _g_free0 (self->priv->_foo);
+       G_OBJECT_CLASS (bar_parent_class)->finalize (obj);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (TYPE_FOO, "Bar", &g_define_type_info, 0);
+       Bar_private_offset = g_type_add_instance_private (bar_type_id, sizeof (BarPrivate));
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_bar_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_BAR, Bar);
+       switch (property_id) {
+               case BAR_FOO_PROPERTY:
+               g_value_set_string (value, foo_get_foo (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_FOO, Foo)));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_bar_set_property (GObject * object,
+                        guint property_id,
+                        const GValue * value,
+                        GParamSpec * pspec)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_BAR, Bar);
+       switch (property_id) {
+               case BAR_FOO_PROPERTY:
+               foo_set_foo (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_FOO, Foo), g_value_get_string (value));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Bar* bar = NULL;
+       Bar* _tmp0_;
+       gconstpointer _tmp1_;
+       gconstpointer _tmp2_;
+       _tmp0_ = bar_new ();
+       bar = _tmp0_;
+       foo_set_foo (G_TYPE_CHECK_INSTANCE_CAST (bar, TYPE_FOO, Foo), "foo");
+       _tmp1_ = foo_get_foo (G_TYPE_CHECK_INSTANCE_CAST (bar, TYPE_FOO, Foo));
+       _tmp2_ = _tmp1_;
+       _vala_assert (g_strcmp0 ((const gchar*) _tmp2_, "foo") == 0, "bar.foo == \"foo\"");
+       _g_object_unref0 (bar);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/bug681356.c-expected b/tests/objects/bug681356.c-expected
new file mode 100644
index 000000000..0f919bb63
--- /dev/null
+++ b/tests/objects/bug681356.c-expected
@@ -0,0 +1,204 @@
+/* objects_bug681356.c generated by valac, the Vala compiler
+ * generated from objects_bug681356.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+enum  {
+       FOO_BAR_SIGNAL,
+       FOO_NUM_SIGNALS
+};
+static guint foo_signals[FOO_NUM_SIGNALS] = {0};
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+VALA_EXTERN gint foo_bar (Foo* self,
+              gint i);
+static void g_cclosure_user_marshal_INT__INT (GClosure * closure,
+                                       GValue * return_value,
+                                       guint n_param_values,
+                                       const GValue * param_values,
+                                       gpointer invocation_hint,
+                                       gpointer marshal_data);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+static gint __lambda4_ (gint i);
+static gint ___lambda4__foo_bar (Foo* _sender,
+                          gint i,
+                          gpointer self);
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+gint
+foo_bar (Foo* self,
+         gint i)
+{
+       gint _tmp0_ = 0;
+       gint result = 0;
+       g_return_val_if_fail (IS_FOO (self), 0);
+       g_signal_emit (self, foo_signals[FOO_BAR_SIGNAL], 0, i, &_tmp0_);
+       result = _tmp0_;
+       return result;
+}
+
+static void
+g_cclosure_user_marshal_INT__INT (GClosure * closure,
+                                  GValue * return_value,
+                                  guint n_param_values,
+                                  const GValue * param_values,
+                                  gpointer invocation_hint,
+                                  gpointer marshal_data)
+{
+       typedef gint (*GMarshalFunc_INT__INT) (gpointer data1, gint arg_1, gpointer data2);
+       register GMarshalFunc_INT__INT callback;
+       register GCClosure * cc;
+       register gpointer data1;
+       register gpointer data2;
+       gint v_return;
+       cc = (GCClosure *) closure;
+       g_return_if_fail (return_value != NULL);
+       g_return_if_fail (n_param_values == 2);
+       if (G_CCLOSURE_SWAP_DATA (closure)) {
+               data1 = closure->data;
+               data2 = param_values->data[0].v_pointer;
+       } else {
+               data1 = param_values->data[0].v_pointer;
+               data2 = closure->data;
+       }
+       callback = (GMarshalFunc_INT__INT) (marshal_data ? marshal_data : cc->callback);
+       v_return = callback (data1, g_value_get_int (param_values + 1), data2);
+       g_value_set_int (return_value, v_return);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       foo_signals[FOO_BAR_SIGNAL] = g_signal_new ("bar", TYPE_FOO, G_SIGNAL_RUN_LAST, 0, NULL, NULL, 
g_cclosure_user_marshal_INT__INT, G_TYPE_INT, 1, G_TYPE_INT);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static gint
+__lambda4_ (gint i)
+{
+       gint result = 0;
+       result = i + 12;
+       return result;
+}
+
+static gint
+___lambda4__foo_bar (Foo* _sender,
+                     gint i,
+                     gpointer self)
+{
+       gint result;
+       result = __lambda4_ (i);
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* f = NULL;
+       Foo* _tmp0_;
+       gint res = 0;
+       gint _tmp1_ = 0;
+       _tmp0_ = foo_new ();
+       f = _tmp0_;
+       g_signal_connect (f, "bar", (GCallback) ___lambda4__foo_bar, NULL);
+       g_signal_emit (f, foo_signals[FOO_BAR_SIGNAL], 0, 30, &_tmp1_);
+       res = _tmp1_;
+       _vala_assert (res == 42, "res == 42");
+       _g_object_unref0 (f);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/bug683646.c-expected b/tests/objects/bug683646.c-expected
new file mode 100644
index 000000000..97f2b21a2
--- /dev/null
+++ b/tests/objects/bug683646.c-expected
@@ -0,0 +1,134 @@
+/* objects_bug683646.c generated by valac, the Vala compiler
+ * generated from objects_bug683646.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef void (*Func) (gpointer user_data);
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+typedef struct _Block1Data Block1Data;
+
+struct _Block1Data {
+       int _ref_count_;
+       GObject* a;
+       GObject* b;
+};
+
+VALA_EXTERN void foo (GObject* a,
+          GObject* b);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static void __lambda4_ (Block1Data* _data1_);
+static void ___lambda4__func (gpointer self);
+static void _vala_main (void);
+
+static gpointer
+_g_object_ref0 (gpointer self)
+{
+       return self ? g_object_ref (self) : NULL;
+}
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               _g_object_unref0 (_data1_->a);
+               _g_object_unref0 (_data1_->b);
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static void
+__lambda4_ (Block1Data* _data1_)
+{
+       GObject* c = NULL;
+       GObject* _tmp0_;
+       GObject* d = NULL;
+       GObject* _tmp1_;
+       _tmp0_ = _g_object_ref0 (_data1_->a);
+       c = _tmp0_;
+       _tmp1_ = _g_object_ref0 (_data1_->b);
+       d = _tmp1_;
+       _g_object_unref0 (d);
+       _g_object_unref0 (c);
+}
+
+static void
+___lambda4__func (gpointer self)
+{
+       __lambda4_ (self);
+}
+
+void
+foo (GObject* a,
+     GObject* b)
+{
+       Block1Data* _data1_;
+       GObject* _tmp0_;
+       GObject* _tmp1_;
+       GObject* _tmp2_;
+       Func sub = NULL;
+       gpointer sub_target;
+       GDestroyNotify sub_target_destroy_notify;
+       g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (a, G_TYPE_OBJECT));
+       g_return_if_fail ((b == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (b, G_TYPE_OBJECT));
+       _data1_ = g_slice_new0 (Block1Data);
+       _data1_->_ref_count_ = 1;
+       _tmp0_ = _g_object_ref0 (a);
+       _g_object_unref0 (_data1_->a);
+       _data1_->a = _tmp0_;
+       _tmp1_ = _g_object_ref0 (b);
+       _g_object_unref0 (_data1_->b);
+       _data1_->b = _tmp1_;
+       _tmp2_ = _g_object_ref0 (_data1_->a);
+       _g_object_unref0 (_data1_->b);
+       _data1_->b = _tmp2_;
+       sub = ___lambda4__func;
+       sub_target = block1_data_ref (_data1_);
+       sub_target_destroy_notify = block1_data_unref;
+       (sub_target_destroy_notify == NULL) ? NULL : (sub_target_destroy_notify (sub_target), NULL);
+       sub = NULL;
+       sub_target = NULL;
+       sub_target_destroy_notify = NULL;
+       block1_data_unref (_data1_);
+       _data1_ = NULL;
+}
+
+static void
+_vala_main (void)
+{
+       GObject* _tmp0_;
+       GObject* _tmp1_;
+       _tmp0_ = g_object_new (G_TYPE_OBJECT, NULL);
+       _tmp1_ = _tmp0_;
+       foo (_tmp1_, NULL);
+       _g_object_unref0 (_tmp1_);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/bug695671.c-expected b/tests/objects/bug695671.c-expected
new file mode 100644
index 000000000..240f74971
--- /dev/null
+++ b/tests/objects/bug695671.c-expected
@@ -0,0 +1,211 @@
+/* objects_bug695671.c generated by valac, the Vala compiler
+ * generated from objects_bug695671.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static GType foo_get_type_once (void);
+VALA_EXTERN gpointer ref_generic (GType g_type,
+                      GBoxedCopyFunc g_dup_func,
+                      GDestroyNotify g_destroy_func,
+                      gconstpointer o);
+VALA_EXTERN GObject* ref (GObject* o);
+static void _vala_main (void);
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+ref_generic (GType g_type,
+             GBoxedCopyFunc g_dup_func,
+             GDestroyNotify g_destroy_func,
+             gconstpointer o)
+{
+       gpointer _tmp0_;
+       gpointer result = NULL;
+       _tmp0_ = ((o != NULL) && (g_dup_func != NULL)) ? g_dup_func ((gpointer) o) : ((gpointer) o);
+       result = _tmp0_;
+       return result;
+}
+
+static gpointer
+_g_object_ref0 (gpointer self)
+{
+       return self ? g_object_ref (self) : NULL;
+}
+
+GObject*
+ref (GObject* o)
+{
+       GObject* _tmp0_;
+       GObject* result = NULL;
+       g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (o, G_TYPE_OBJECT), NULL);
+       _tmp0_ = _g_object_ref0 (o);
+       result = _tmp0_;
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       GObject* o = NULL;
+       GObject* _tmp0_;
+       Foo* f = NULL;
+       GObject* _tmp1_;
+       Foo* _tmp2_;
+       Foo* g = NULL;
+       gpointer _tmp3_;
+       GObject* _tmp4_;
+       Foo* _tmp5_;
+       GObject* r = NULL;
+       gpointer _tmp6_;
+       GObject* _tmp7_;
+       GObject* _tmp8_;
+       GObject* r2 = NULL;
+       GObject* _tmp9_;
+       GObject* r3 = NULL;
+       GObject* r4 = NULL;
+       _tmp0_ = g_object_new (G_TYPE_OBJECT, NULL);
+       o = _tmp0_;
+       _tmp1_ = ref (o);
+       _tmp2_ = IS_FOO (_tmp1_) ? ((Foo*) _tmp1_) : NULL;
+       if (_tmp2_ == NULL) {
+               _g_object_unref0 (_tmp1_);
+       }
+       f = _tmp2_;
+       _vala_assert (f == NULL, "f == null");
+       _vala_assert (o->ref_count == ((guint) 1), "o.ref_count == 1");
+       _tmp3_ = ref_generic (G_TYPE_OBJECT, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, 
o);
+       _tmp4_ = (GObject*) _tmp3_;
+       _tmp5_ = IS_FOO (_tmp4_) ? ((Foo*) _tmp4_) : NULL;
+       if (_tmp5_ == NULL) {
+               _g_object_unref0 (_tmp4_);
+       }
+       g = _tmp5_;
+       _vala_assert (g == NULL, "g == null");
+       _vala_assert (o->ref_count == ((guint) 1), "o.ref_count == 1");
+       _tmp6_ = ref_generic (G_TYPE_OBJECT, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, 
o);
+       _tmp7_ = (GObject*) _tmp6_;
+       _tmp8_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp7_, G_TYPE_OBJECT) ? ((GObject*) _tmp7_) : NULL;
+       if (_tmp8_ == NULL) {
+               _g_object_unref0 (_tmp7_);
+       }
+       r = _tmp8_;
+       _vala_assert (r == o, "r == o");
+       _vala_assert (o->ref_count == ((guint) 2), "o.ref_count == 2");
+       _tmp9_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (o, G_TYPE_OBJECT) ? ((GObject*) o) : NULL);
+       r2 = _tmp9_;
+       _vala_assert (r2 == o, "r2 == o");
+       _vala_assert (o->ref_count == ((guint) 3), "o.ref_count == 3");
+       r3 = G_TYPE_CHECK_INSTANCE_TYPE (o, G_TYPE_OBJECT) ? ((GObject*) o) : NULL;
+       _vala_assert (r3 == o, "r3 == o");
+       _vala_assert (o->ref_count == ((guint) 3), "o.ref_count == 3");
+       r4 = G_TYPE_CHECK_INSTANCE_CAST (IS_FOO (o) ? ((Foo*) o) : NULL, G_TYPE_OBJECT, GObject);
+       _vala_assert (r4 == NULL, "r4 == null");
+       _vala_assert (o->ref_count == ((guint) 3), "o.ref_count == 3");
+       _g_object_unref0 (r2);
+       _g_object_unref0 (r);
+       _g_object_unref0 (g);
+       _g_object_unref0 (f);
+       _g_object_unref0 (o);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/bug702736.c-expected b/tests/objects/bug702736.c-expected
new file mode 100644
index 000000000..7798d7b9a
--- /dev/null
+++ b/tests/objects/bug702736.c-expected
@@ -0,0 +1,475 @@
+/* objects_bug702736.c generated by valac, the Vala compiler
+ * generated from objects_bug702736.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_CLASS_A (class_a_get_type ())
+#define CLASS_A(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_CLASS_A, ClassA))
+#define CLASS_A_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_CLASS_A, ClassAClass))
+#define IS_CLASS_A(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_CLASS_A))
+#define IS_CLASS_A_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_CLASS_A))
+#define CLASS_A_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_CLASS_A, ClassAClass))
+
+typedef struct _ClassA ClassA;
+typedef struct _ClassAClass ClassAClass;
+typedef struct _ClassAPrivate ClassAPrivate;
+enum  {
+       CLASS_A_0_PROPERTY,
+       CLASS_A_FLAGS_PROPERTY,
+       CLASS_A_NUM_PROPERTIES
+};
+static GParamSpec* class_a_properties[CLASS_A_NUM_PROPERTIES];
+
+#define TYPE_CLASS_B (class_b_get_type ())
+#define CLASS_B(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_CLASS_B, ClassB))
+#define CLASS_B_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_CLASS_B, ClassBClass))
+#define IS_CLASS_B(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_CLASS_B))
+#define IS_CLASS_B_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_CLASS_B))
+#define CLASS_B_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_CLASS_B, ClassBClass))
+
+typedef struct _ClassB ClassB;
+typedef struct _ClassBClass ClassBClass;
+typedef struct _ClassBPrivate ClassBPrivate;
+enum  {
+       CLASS_B_0_PROPERTY,
+       CLASS_B_FLAGS_PROPERTY,
+       CLASS_B_NUM_PROPERTIES
+};
+static GParamSpec* class_b_properties[CLASS_B_NUM_PROPERTIES];
+
+#define TYPE_CLASS_C (class_c_get_type ())
+#define CLASS_C(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_CLASS_C, ClassC))
+#define CLASS_C_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_CLASS_C, ClassCClass))
+#define IS_CLASS_C(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_CLASS_C))
+#define IS_CLASS_C_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_CLASS_C))
+#define CLASS_C_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_CLASS_C, ClassCClass))
+
+typedef struct _ClassC ClassC;
+typedef struct _ClassCClass ClassCClass;
+typedef struct _ClassCPrivate ClassCPrivate;
+enum  {
+       CLASS_C_0_PROPERTY,
+       CLASS_C_NUM_PROPERTIES
+};
+static GParamSpec* class_c_properties[CLASS_C_NUM_PROPERTIES];
+
+#define TYPE_CLASS_D (class_d_get_type ())
+#define CLASS_D(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_CLASS_D, ClassD))
+#define CLASS_D_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_CLASS_D, ClassDClass))
+#define IS_CLASS_D(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_CLASS_D))
+#define IS_CLASS_D_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_CLASS_D))
+#define CLASS_D_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_CLASS_D, ClassDClass))
+
+typedef struct _ClassD ClassD;
+typedef struct _ClassDClass ClassDClass;
+typedef struct _ClassDPrivate ClassDPrivate;
+enum  {
+       CLASS_D_0_PROPERTY,
+       CLASS_D_FLAGS_PROPERTY,
+       CLASS_D_NUM_PROPERTIES
+};
+static GParamSpec* class_d_properties[CLASS_D_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _ClassA {
+       GObject parent_instance;
+       ClassAPrivate * priv;
+};
+
+struct _ClassAClass {
+       GObjectClass parent_class;
+       gint (*get_flags) (ClassA* self);
+};
+
+struct _ClassB {
+       ClassA parent_instance;
+       ClassBPrivate * priv;
+};
+
+struct _ClassBClass {
+       ClassAClass parent_class;
+};
+
+struct _ClassC {
+       ClassB parent_instance;
+       ClassCPrivate * priv;
+};
+
+struct _ClassCClass {
+       ClassBClass parent_class;
+};
+
+struct _ClassD {
+       ClassC parent_instance;
+       ClassDPrivate * priv;
+};
+
+struct _ClassDClass {
+       ClassCClass parent_class;
+};
+
+static gpointer class_a_parent_class = NULL;
+static gpointer class_b_parent_class = NULL;
+static gpointer class_c_parent_class = NULL;
+static gpointer class_d_parent_class = NULL;
+
+VALA_EXTERN GType class_a_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClassA, g_object_unref)
+VALA_EXTERN ClassA* class_a_construct (GType object_type);
+VALA_EXTERN gint class_a_get_flags (ClassA* self);
+static GType class_a_get_type_once (void);
+static void _vala_class_a_get_property (GObject * object,
+                                 guint property_id,
+                                 GValue * value,
+                                 GParamSpec * pspec);
+VALA_EXTERN GType class_b_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClassB, g_object_unref)
+VALA_EXTERN ClassB* class_b_new (void);
+VALA_EXTERN ClassB* class_b_construct (GType object_type);
+static GType class_b_get_type_once (void);
+static void _vala_class_b_get_property (GObject * object,
+                                 guint property_id,
+                                 GValue * value,
+                                 GParamSpec * pspec);
+VALA_EXTERN GType class_c_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClassC, g_object_unref)
+VALA_EXTERN void class_c_foo (ClassC* self);
+VALA_EXTERN ClassC* class_c_new (void);
+VALA_EXTERN ClassC* class_c_construct (GType object_type);
+static GType class_c_get_type_once (void);
+VALA_EXTERN GType class_d_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClassD, g_object_unref)
+VALA_EXTERN ClassD* class_d_new (void);
+VALA_EXTERN ClassD* class_d_construct (GType object_type);
+static GType class_d_get_type_once (void);
+static void _vala_class_d_get_property (GObject * object,
+                                 guint property_id,
+                                 GValue * value,
+                                 GParamSpec * pspec);
+static void _vala_main (void);
+
+ClassA*
+class_a_construct (GType object_type)
+{
+       ClassA * self = NULL;
+       self = (ClassA*) g_object_new (object_type, NULL);
+       return self;
+}
+
+gint
+class_a_get_flags (ClassA* self)
+{
+       ClassAClass* _klass_;
+       g_return_val_if_fail (IS_CLASS_A (self), 0);
+       _klass_ = CLASS_A_GET_CLASS (self);
+       if (_klass_->get_flags) {
+               return _klass_->get_flags (self);
+       }
+       return -1;
+}
+
+static void
+class_a_class_init (ClassAClass * klass,
+                    gpointer klass_data)
+{
+       class_a_parent_class = g_type_class_peek_parent (klass);
+       G_OBJECT_CLASS (klass)->get_property = _vala_class_a_get_property;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), CLASS_A_FLAGS_PROPERTY, 
class_a_properties[CLASS_A_FLAGS_PROPERTY] = g_param_spec_int ("flags", "flags", "flags", G_MININT, G_MAXINT, 
0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
+}
+
+static void
+class_a_instance_init (ClassA * self,
+                       gpointer klass)
+{
+}
+
+static GType
+class_a_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (ClassAClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) class_a_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(ClassA), 0, (GInstanceInitFunc) class_a_instance_init, NULL };
+       GType class_a_type_id;
+       class_a_type_id = g_type_register_static (G_TYPE_OBJECT, "ClassA", &g_define_type_info, 
G_TYPE_FLAG_ABSTRACT);
+       return class_a_type_id;
+}
+
+GType
+class_a_get_type (void)
+{
+       static volatile gsize class_a_type_id__volatile = 0;
+       if (g_once_init_enter (&class_a_type_id__volatile)) {
+               GType class_a_type_id;
+               class_a_type_id = class_a_get_type_once ();
+               g_once_init_leave (&class_a_type_id__volatile, class_a_type_id);
+       }
+       return class_a_type_id__volatile;
+}
+
+static void
+_vala_class_a_get_property (GObject * object,
+                            guint property_id,
+                            GValue * value,
+                            GParamSpec * pspec)
+{
+       ClassA * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_CLASS_A, ClassA);
+       switch (property_id) {
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+ClassB*
+class_b_construct (GType object_type)
+{
+       ClassB * self = NULL;
+       self = (ClassB*) class_a_construct (object_type);
+       return self;
+}
+
+ClassB*
+class_b_new (void)
+{
+       return class_b_construct (TYPE_CLASS_B);
+}
+
+static gint
+class_b_real_get_flags (ClassA* base)
+{
+       gint result;
+       ClassB* self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_CLASS_B, ClassB);
+       result = 1;
+       return result;
+}
+
+static void
+class_b_class_init (ClassBClass * klass,
+                    gpointer klass_data)
+{
+       class_b_parent_class = g_type_class_peek_parent (klass);
+       CLASS_A_CLASS (klass)->get_flags = class_b_real_get_flags;
+       G_OBJECT_CLASS (klass)->get_property = _vala_class_b_get_property;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), CLASS_B_FLAGS_PROPERTY, 
class_b_properties[CLASS_B_FLAGS_PROPERTY] = g_param_spec_int ("flags", "flags", "flags", G_MININT, G_MAXINT, 
0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
+}
+
+static void
+class_b_instance_init (ClassB * self,
+                       gpointer klass)
+{
+}
+
+static GType
+class_b_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (ClassBClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) class_b_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(ClassB), 0, (GInstanceInitFunc) class_b_instance_init, NULL };
+       GType class_b_type_id;
+       class_b_type_id = g_type_register_static (TYPE_CLASS_A, "ClassB", &g_define_type_info, 0);
+       return class_b_type_id;
+}
+
+GType
+class_b_get_type (void)
+{
+       static volatile gsize class_b_type_id__volatile = 0;
+       if (g_once_init_enter (&class_b_type_id__volatile)) {
+               GType class_b_type_id;
+               class_b_type_id = class_b_get_type_once ();
+               g_once_init_leave (&class_b_type_id__volatile, class_b_type_id);
+       }
+       return class_b_type_id__volatile;
+}
+
+static void
+_vala_class_b_get_property (GObject * object,
+                            guint property_id,
+                            GValue * value,
+                            GParamSpec * pspec)
+{
+       ClassB * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_CLASS_B, ClassB);
+       switch (property_id) {
+               case CLASS_B_FLAGS_PROPERTY:
+               g_value_set_int (value, class_a_get_flags (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_CLASS_A, 
ClassA)));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+void
+class_c_foo (ClassC* self)
+{
+       g_return_if_fail (IS_CLASS_C (self));
+}
+
+ClassC*
+class_c_construct (GType object_type)
+{
+       ClassC * self = NULL;
+       self = (ClassC*) class_b_construct (object_type);
+       return self;
+}
+
+ClassC*
+class_c_new (void)
+{
+       return class_c_construct (TYPE_CLASS_C);
+}
+
+static void
+class_c_class_init (ClassCClass * klass,
+                    gpointer klass_data)
+{
+       class_c_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+class_c_instance_init (ClassC * self,
+                       gpointer klass)
+{
+}
+
+static GType
+class_c_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (ClassCClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) class_c_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(ClassC), 0, (GInstanceInitFunc) class_c_instance_init, NULL };
+       GType class_c_type_id;
+       class_c_type_id = g_type_register_static (TYPE_CLASS_B, "ClassC", &g_define_type_info, 0);
+       return class_c_type_id;
+}
+
+GType
+class_c_get_type (void)
+{
+       static volatile gsize class_c_type_id__volatile = 0;
+       if (g_once_init_enter (&class_c_type_id__volatile)) {
+               GType class_c_type_id;
+               class_c_type_id = class_c_get_type_once ();
+               g_once_init_leave (&class_c_type_id__volatile, class_c_type_id);
+       }
+       return class_c_type_id__volatile;
+}
+
+ClassD*
+class_d_construct (GType object_type)
+{
+       ClassD * self = NULL;
+       self = (ClassD*) class_c_construct (object_type);
+       return self;
+}
+
+ClassD*
+class_d_new (void)
+{
+       return class_d_construct (TYPE_CLASS_D);
+}
+
+static gint
+class_d_real_get_flags (ClassA* base)
+{
+       gint result;
+       ClassD* self;
+       gint old_flags = 0;
+       gint _tmp0_;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_CLASS_D, ClassD);
+       _tmp0_ = CLASS_A_CLASS (class_d_parent_class)->get_flags (G_TYPE_CHECK_INSTANCE_CAST 
(G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_CLASS_C, ClassC), TYPE_CLASS_A, ClassA));
+       old_flags = _tmp0_;
+       result = old_flags | 2;
+       return result;
+}
+
+static void
+class_d_class_init (ClassDClass * klass,
+                    gpointer klass_data)
+{
+       class_d_parent_class = g_type_class_peek_parent (klass);
+       CLASS_A_CLASS (klass)->get_flags = class_d_real_get_flags;
+       G_OBJECT_CLASS (klass)->get_property = _vala_class_d_get_property;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), CLASS_D_FLAGS_PROPERTY, 
class_d_properties[CLASS_D_FLAGS_PROPERTY] = g_param_spec_int ("flags", "flags", "flags", G_MININT, G_MAXINT, 
0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
+}
+
+static void
+class_d_instance_init (ClassD * self,
+                       gpointer klass)
+{
+}
+
+static GType
+class_d_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (ClassDClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) class_d_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(ClassD), 0, (GInstanceInitFunc) class_d_instance_init, NULL };
+       GType class_d_type_id;
+       class_d_type_id = g_type_register_static (TYPE_CLASS_C, "ClassD", &g_define_type_info, 0);
+       return class_d_type_id;
+}
+
+GType
+class_d_get_type (void)
+{
+       static volatile gsize class_d_type_id__volatile = 0;
+       if (g_once_init_enter (&class_d_type_id__volatile)) {
+               GType class_d_type_id;
+               class_d_type_id = class_d_get_type_once ();
+               g_once_init_leave (&class_d_type_id__volatile, class_d_type_id);
+       }
+       return class_d_type_id__volatile;
+}
+
+static void
+_vala_class_d_get_property (GObject * object,
+                            guint property_id,
+                            GValue * value,
+                            GParamSpec * pspec)
+{
+       ClassD * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_CLASS_D, ClassD);
+       switch (property_id) {
+               case CLASS_D_FLAGS_PROPERTY:
+               g_value_set_int (value, class_a_get_flags (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_CLASS_A, 
ClassA)));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_main (void)
+{
+       ClassD* d = NULL;
+       ClassD* _tmp0_;
+       gint _tmp1_;
+       gint _tmp2_;
+       _tmp0_ = class_d_new ();
+       d = _tmp0_;
+       _tmp1_ = class_a_get_flags (G_TYPE_CHECK_INSTANCE_CAST (d, TYPE_CLASS_A, ClassA));
+       _tmp2_ = _tmp1_;
+       _vala_assert (_tmp2_ == 3, "d.flags == 3");
+       _g_object_unref0 (d);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/bug702846.c-expected b/tests/objects/bug702846.c-expected
new file mode 100644
index 000000000..452e33ef1
--- /dev/null
+++ b/tests/objects/bug702846.c-expected
@@ -0,0 +1,65 @@
+/* objects_bug702846.c generated by valac, the Vala compiler
+ * generated from objects_bug702846.vala, do not modify */
+
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (void);
+static GVariant* _variant_new1 (const gchar* value);
+static gchar* _variant_get1 (GVariant* value);
+
+static GVariant*
+_variant_new1 (const gchar* value)
+{
+       return g_variant_ref_sink (g_variant_new_string (value));
+}
+
+static gpointer
+_g_variant_ref0 (gpointer self)
+{
+       return self ? g_variant_ref (self) : NULL;
+}
+
+static gchar*
+_variant_get1 (GVariant* value)
+{
+       return g_variant_dup_string (value, NULL);
+}
+
+static void
+_vala_main (void)
+{
+       GVariant* foo = NULL;
+       GVariant* _tmp0_;
+       GVariant* bar = NULL;
+       GVariant* _tmp1_;
+       gchar* baz = NULL;
+       gchar* _tmp2_;
+       _tmp0_ = _variant_new1 ("baz");
+       foo = _tmp0_;
+       _tmp1_ = _g_variant_ref0 ((GVariant*) foo);
+       bar = _tmp1_;
+       _tmp2_ = _variant_get1 (bar);
+       baz = _tmp2_;
+       _vala_assert (g_strcmp0 (baz, "baz") == 0, "baz == \"baz\"");
+       _g_free0 (baz);
+       _g_variant_unref0 (bar);
+       _g_variant_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/bug731547.c-expected b/tests/objects/bug731547.c-expected
new file mode 100644
index 000000000..a6bfd3aaa
--- /dev/null
+++ b/tests/objects/bug731547.c-expected
@@ -0,0 +1,183 @@
+/* objects_bug731547.c generated by valac, the Vala compiler
+ * generated from objects_bug731547.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+enum  {
+       FOO_BAZ_SIGNAL,
+       FOO_BAZ_BAR_SIGNAL,
+       FOO_BAZ_VIRT_SIGNAL,
+       FOO_NUM_SIGNALS
+};
+static guint foo_signals[FOO_NUM_SIGNALS] = {0};
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+       void (*baz_virt) (Foo* self);
+};
+
+static gpointer foo_parent_class = NULL;
+VALA_EXTERN gint baz;
+gint baz = 0;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_real_baz_virt (Foo* self);
+VALA_EXTERN void callback (void);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+static void _callback_foo_baz (Foo* _sender,
+                        gpointer self);
+static void _callback_foo_baz_bar (Foo* _sender,
+                            gpointer self);
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+foo_real_baz_virt (Foo* self)
+{
+       callback ();
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->baz_virt = foo_real_baz_virt;
+       foo_signals[FOO_BAZ_SIGNAL] = g_signal_new ("baz", TYPE_FOO, G_SIGNAL_RUN_LAST, 0, NULL, NULL, 
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+       foo_signals[FOO_BAZ_BAR_SIGNAL] = g_signal_new ("baz-bar", TYPE_FOO, G_SIGNAL_RUN_LAST, 0, NULL, 
NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+       foo_signals[FOO_BAZ_VIRT_SIGNAL] = g_signal_new ("baz-virt", TYPE_FOO, G_SIGNAL_RUN_LAST, 
G_STRUCT_OFFSET (FooClass, baz_virt), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+void
+callback (void)
+{
+       gint _tmp0_;
+       _tmp0_ = baz;
+       baz = _tmp0_ + 1;
+}
+
+static void
+_callback_foo_baz (Foo* _sender,
+                   gpointer self)
+{
+       callback ();
+}
+
+static void
+_callback_foo_baz_bar (Foo* _sender,
+                       gpointer self)
+{
+       callback ();
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       g_signal_connect (foo, "baz", (GCallback) _callback_foo_baz, NULL);
+       g_signal_connect (foo, "baz-bar", (GCallback) _callback_foo_baz_bar, NULL);
+       g_signal_emit (foo, foo_signals[FOO_BAZ_SIGNAL], 0);
+       _vala_assert (baz == 1, "baz == 1");
+       g_signal_emit (foo, foo_signals[FOO_BAZ_BAR_SIGNAL], 0);
+       _vala_assert (baz == 2, "baz == 2");
+       g_signal_emit (foo, foo_signals[FOO_BAZ_VIRT_SIGNAL], 0);
+       _vala_assert (baz == 3, "baz == 3");
+       g_signal_emit_by_name (foo, "baz", NULL);
+       _vala_assert (baz == 4, "baz == 4");
+       g_signal_emit_by_name (foo, "baz-bar", NULL);
+       _vala_assert (baz == 5, "baz == 5");
+       g_signal_emit_by_name (foo, "baz-virt", NULL);
+       _vala_assert (baz == 6, "baz == 6");
+       _g_object_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/bug741465.c-expected b/tests/objects/bug741465.c-expected
new file mode 100644
index 000000000..a572f1684
--- /dev/null
+++ b/tests/objects/bug741465.c-expected
@@ -0,0 +1,441 @@
+/* objects_bug741465.c generated by valac, the Vala compiler
+ * generated from objects_bug741465.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef struct _AbstractFoo AbstractFoo;
+typedef AbstractFoo Foo;
+typedef Foo Bar;
+typedef struct _Manam Manam;
+typedef Manam Baz;
+#define _manam_free0(var) ((var == NULL) ? NULL : (var = (manam_free (var), NULL)))
+#define _abstract_foo_free0(var) ((var == NULL) ? NULL : (var = (abstract_foo_free (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _AbstractFoo {
+       const gchar* (*foo) (AbstractFoo* self);
+       gint (*get_prop) (AbstractFoo* self);
+       void (*set_prop) (AbstractFoo* self, gint value);
+       gint field;
+};
+
+struct _Manam {
+       const gchar* (*foo) (Manam* self);
+       gint (*foo_plain) (Manam* self);
+       gint (*get_prop) (Manam* self);
+       void (*set_prop) (Manam* self, gint value);
+       gint field;
+};
+
+VALA_EXTERN void abstract_foo_free (AbstractFoo * self);
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (AbstractFoo, abstract_foo_free)
+static void abstract_foo_instance_init (AbstractFoo * self);
+VALA_EXTERN const gchar* abstract_foo_foo (AbstractFoo* self);
+static const gchar* abstract_foo_real_foo (AbstractFoo* self);
+VALA_EXTERN AbstractFoo* abstract_foo_new (void);
+VALA_EXTERN gint abstract_foo_get_prop (AbstractFoo* self);
+VALA_EXTERN void abstract_foo_set_prop (AbstractFoo* self,
+                            gint value);
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, abstract_foo_free)
+static void foo_instance_init (Foo * self);
+VALA_EXTERN Foo* foo_new (void);
+static const gchar* foo_real_foo (AbstractFoo* base);
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, abstract_foo_free)
+static void bar_instance_init (Bar * self);
+VALA_EXTERN Bar* bar_new (void);
+static const gchar* bar_real_foo (AbstractFoo* base);
+VALA_EXTERN void manam_free (Manam * self);
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Manam, manam_free)
+static void manam_instance_init (Manam * self);
+VALA_EXTERN const gchar* manam_foo (Manam* self);
+VALA_EXTERN gint manam_get_prop (Manam* self);
+VALA_EXTERN void manam_set_prop (Manam* self,
+                     gint value);
+static const gchar* manam_real_foo (Manam* self);
+static gint manam_real_foo_plain (Manam* self);
+VALA_EXTERN Manam* manam_new (void);
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Baz, manam_free)
+static void baz_instance_init (Baz * self);
+static const gchar* baz_real_foo (Manam* base);
+static gint baz_real_foo_plain (Manam* base);
+VALA_EXTERN Baz* baz_new (void);
+static void _vala_main (void);
+
+static const gchar*
+abstract_foo_real_foo (AbstractFoo* self)
+{
+       g_critical ("Abstract method `abstract_foo_foo' is not implemented");
+       return NULL;
+}
+
+const gchar*
+abstract_foo_foo (AbstractFoo* self)
+{
+       g_return_val_if_fail (self != NULL, NULL);
+       if (self->foo) {
+               return self->foo (self);
+       }
+       return NULL;
+}
+
+AbstractFoo*
+abstract_foo_new (void)
+{
+       AbstractFoo* self;
+       self = g_slice_new0 (AbstractFoo);
+       abstract_foo_instance_init (self);
+       return self;
+}
+
+gint
+abstract_foo_get_prop (AbstractFoo* self)
+{
+       g_return_val_if_fail (self != NULL, 0);
+       if (self->get_prop) {
+               return self->get_prop (self);
+       }
+       return -1;
+}
+
+void
+abstract_foo_set_prop (AbstractFoo* self,
+                       gint value)
+{
+       g_return_if_fail (self != NULL);
+       if (self->set_prop) {
+               self->set_prop (self, value);
+       }
+}
+
+static void
+abstract_foo_instance_init (AbstractFoo * self)
+{
+       ((AbstractFoo *) self)->foo = (const gchar* (*) (AbstractFoo*)) abstract_foo_real_foo;
+       self->field = 23;
+}
+
+void
+abstract_foo_free (AbstractFoo * self)
+{
+       g_slice_free (AbstractFoo, self);
+}
+
+Foo*
+foo_new (void)
+{
+       Foo* self;
+       gint _tmp0_;
+       gint _tmp1_;
+       self = (Foo*) abstract_foo_new ();
+       foo_instance_init (self);
+       _vala_assert (((AbstractFoo*) self)->field == 23, "field == 23");
+       ((AbstractFoo*) self)->field = 37;
+       _tmp0_ = abstract_foo_get_prop ((AbstractFoo*) self);
+       _tmp1_ = _tmp0_;
+       _vala_assert (_tmp1_ == 38, "prop == 38");
+       return self;
+}
+
+static const gchar*
+foo_real_foo (AbstractFoo* base)
+{
+       Foo * self;
+       const gchar* result = NULL;
+       self = (Foo*) base;
+       result = "Foo";
+       return result;
+}
+
+static gint
+foo_real_get_prop (AbstractFoo* base)
+{
+       gint result;
+       Foo* self;
+       self = (Foo*) base;
+       result = ((AbstractFoo*) self)->field + 1;
+       return result;
+}
+
+static void
+foo_real_set_prop (AbstractFoo* base,
+                   gint value)
+{
+       Foo* self;
+       self = (Foo*) base;
+       ((AbstractFoo*) self)->field = value - 1;
+}
+
+static void
+foo_instance_init (Foo * self)
+{
+       ((AbstractFoo *) self)->foo = (const gchar* (*) (AbstractFoo*)) foo_real_foo;
+       ((AbstractFoo *) self)->get_prop = foo_real_get_prop;
+       ((AbstractFoo *) self)->set_prop = foo_real_set_prop;
+}
+
+Bar*
+bar_new (void)
+{
+       Bar* self;
+       gint _tmp0_;
+       gint _tmp1_;
+       self = (Bar*) foo_new ();
+       bar_instance_init (self);
+       _vala_assert (((AbstractFoo*) self)->field == 37, "field == 37");
+       ((AbstractFoo*) self)->field = 42;
+       _tmp0_ = abstract_foo_get_prop ((AbstractFoo*) self);
+       _tmp1_ = _tmp0_;
+       _vala_assert (_tmp1_ == 84, "prop == 84");
+       return self;
+}
+
+static const gchar*
+bar_real_foo (AbstractFoo* base)
+{
+       Bar * self;
+       const gchar* result = NULL;
+       self = (Bar*) base;
+       result = "Bar";
+       return result;
+}
+
+static gint
+bar_real_get_prop (AbstractFoo* base)
+{
+       gint result;
+       Bar* self;
+       self = (Bar*) base;
+       result = ((AbstractFoo*) self)->field * 2;
+       return result;
+}
+
+static void
+bar_real_set_prop (AbstractFoo* base,
+                   gint value)
+{
+       Bar* self;
+       self = (Bar*) base;
+       ((AbstractFoo*) self)->field = value / 2;
+}
+
+static void
+bar_instance_init (Bar * self)
+{
+       ((AbstractFoo *) self)->foo = (const gchar* (*) (AbstractFoo*)) bar_real_foo;
+       ((AbstractFoo *) self)->get_prop = bar_real_get_prop;
+       ((AbstractFoo *) self)->set_prop = bar_real_set_prop;
+}
+
+static const gchar*
+manam_real_foo (Manam* self)
+{
+       const gchar* result = NULL;
+       result = "Manam";
+       return result;
+}
+
+const gchar*
+manam_foo (Manam* self)
+{
+       g_return_val_if_fail (self != NULL, NULL);
+       if (self->foo) {
+               return self->foo (self);
+       }
+       return NULL;
+}
+
+static gint
+manam_real_foo_plain (Manam* self)
+{
+       gint result = 0;
+       result = 13;
+       return result;
+}
+
+Manam*
+manam_new (void)
+{
+       Manam* self;
+       self = g_slice_new0 (Manam);
+       manam_instance_init (self);
+       return self;
+}
+
+gint
+manam_get_prop (Manam* self)
+{
+       g_return_val_if_fail (self != NULL, 0);
+       if (self->get_prop) {
+               return self->get_prop (self);
+       }
+       return -1;
+}
+
+static gint
+manam_real_get_prop (Manam* base)
+{
+       gint result;
+       Manam* self;
+       self = base;
+       result = self->field + 1;
+       return result;
+}
+
+void
+manam_set_prop (Manam* self,
+                gint value)
+{
+       g_return_if_fail (self != NULL);
+       if (self->set_prop) {
+               self->set_prop (self, value);
+       }
+}
+
+static void
+manam_real_set_prop (Manam* base,
+                     gint value)
+{
+       Manam* self;
+       self = base;
+       self->field = value - 1;
+}
+
+static void
+manam_instance_init (Manam * self)
+{
+       ((Manam *) self)->foo = (const gchar* (*) (Manam*)) manam_real_foo;
+       ((Manam *) self)->foo_plain = (gint (*) (Manam*)) manam_real_foo_plain;
+       ((Manam *) self)->get_prop = manam_real_get_prop;
+       ((Manam *) self)->set_prop = manam_real_set_prop;
+       self->field = 23;
+}
+
+void
+manam_free (Manam * self)
+{
+       g_slice_free (Manam, self);
+}
+
+static const gchar*
+baz_real_foo (Manam* base)
+{
+       Baz * self;
+       const gchar* result = NULL;
+       self = (Baz*) base;
+       result = "Baz";
+       return result;
+}
+
+static gint
+baz_real_foo_plain (Manam* base)
+{
+       Baz * self;
+       gint result = 0;
+       self = (Baz*) base;
+       result = 23;
+       return result;
+}
+
+Baz*
+baz_new (void)
+{
+       Baz* self;
+       self = (Baz*) manam_new ();
+       baz_instance_init (self);
+       return self;
+}
+
+static void
+baz_instance_init (Baz * self)
+{
+       ((Manam *) self)->foo = (const gchar* (*) (Manam*)) baz_real_foo;
+       ((Manam *) self)->foo_plain = (gint (*) (Manam*)) baz_real_foo_plain;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       const gchar* _tmp1_;
+       gint _tmp2_;
+       gint _tmp3_;
+       Bar* bar = NULL;
+       Bar* _tmp4_;
+       const gchar* _tmp5_;
+       gint _tmp6_;
+       gint _tmp7_;
+       Manam* manam = NULL;
+       Manam* _tmp8_;
+       const gchar* _tmp9_;
+       gint _tmp10_;
+       gint _tmp11_;
+       Baz* baz = NULL;
+       Baz* _tmp12_;
+       const gchar* _tmp13_;
+       gint _tmp14_;
+       gint _tmp15_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       _tmp1_ = abstract_foo_foo ((AbstractFoo*) foo);
+       _vala_assert (g_strcmp0 (_tmp1_, "Foo") == 0, "foo.foo () == \"Foo\"");
+       _tmp2_ = abstract_foo_get_prop ((AbstractFoo*) foo);
+       _tmp3_ = _tmp2_;
+       _vala_assert (_tmp3_ == 38, "foo.prop == 38");
+       abstract_foo_set_prop ((AbstractFoo*) foo, 4711);
+       _vala_assert (((AbstractFoo*) foo)->field == 4710, "foo.field == 4710");
+       _tmp4_ = bar_new ();
+       bar = _tmp4_;
+       _tmp5_ = abstract_foo_foo ((AbstractFoo*) bar);
+       _vala_assert (g_strcmp0 (_tmp5_, "Bar") == 0, "bar.foo () == \"Bar\"");
+       _tmp6_ = abstract_foo_get_prop ((AbstractFoo*) bar);
+       _tmp7_ = _tmp6_;
+       _vala_assert (_tmp7_ == 84, "bar.prop == 84");
+       abstract_foo_set_prop ((AbstractFoo*) bar, 32);
+       _vala_assert (((AbstractFoo*) bar)->field == 16, "bar.field == 16");
+       _tmp8_ = manam_new ();
+       manam = _tmp8_;
+       _tmp9_ = manam_foo (manam);
+       _vala_assert (g_strcmp0 (_tmp9_, "Manam") == 0, "manam.foo () == \"Manam\"");
+       _tmp10_ = manam_get_prop (manam);
+       _tmp11_ = _tmp10_;
+       _vala_assert (_tmp11_ == 24, "manam.prop == 24");
+       _vala_assert (manam->foo_plain (manam) == 13, "manam.foo_plain () == 13");
+       _tmp12_ = baz_new ();
+       baz = _tmp12_;
+       _tmp13_ = manam_foo ((Manam*) baz);
+       _vala_assert (g_strcmp0 (_tmp13_, "Baz") == 0, "baz.foo () == \"Baz\"");
+       manam_set_prop ((Manam*) baz, 42);
+       _tmp14_ = manam_get_prop ((Manam*) baz);
+       _tmp15_ = _tmp14_;
+       _vala_assert (_tmp15_ == 42, "baz.prop == 42");
+       _vala_assert (((Manam*) baz)->foo_plain ((Manam*) baz) == 23, "baz.foo_plain () == 23");
+       _manam_free0 (baz);
+       _manam_free0 (manam);
+       _abstract_foo_free0 (bar);
+       _abstract_foo_free0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/bug751338.c-expected b/tests/objects/bug751338.c-expected
new file mode 100644
index 000000000..a85f1a77f
--- /dev/null
+++ b/tests/objects/bug751338.c-expected
@@ -0,0 +1,416 @@
+/* objects_bug751338.c generated by valac, the Vala compiler
+ * generated from objects_bug751338.vala, do not modify */
+
+#include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_STRINGS_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _FooPrivate {
+       gchar** _strings;
+       gint _strings_length1;
+       gint __strings_size_;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+VALA_EXTERN gchar** foo_get_strings (Foo* self,
+                         gint* result_length1);
+VALA_EXTERN void foo_set_strings (Foo* self,
+                      gchar** value,
+                      gint value_length1);
+static gchar** _vala_array_dup1 (gchar** self,
+                          gssize length);
+static void foo_finalize (GObject * obj);
+static GType foo_get_type_once (void);
+static void _vala_foo_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_foo_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec);
+static void _vala_main (void);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+gchar**
+foo_get_strings (Foo* self,
+                 gint* result_length1)
+{
+       gchar** result;
+       gchar** _tmp0_;
+       gint _tmp0__length1;
+       gchar** _tmp1_;
+       gint _tmp1__length1;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = self->priv->_strings;
+       _tmp0__length1 = self->priv->_strings_length1;
+       _tmp1_ = _tmp0_;
+       _tmp1__length1 = _tmp0__length1;
+       if (result_length1) {
+               *result_length1 = _tmp1__length1;
+       }
+       result = _tmp1_;
+       return result;
+}
+
+static gchar**
+_vala_array_dup1 (gchar** self,
+                  gssize length)
+{
+       if (length >= 0) {
+               gchar** result;
+               gssize i;
+               result = g_new0 (gchar*, length + 1);
+               for (i = 0; i < length; i++) {
+                       gchar* _tmp0_;
+                       _tmp0_ = g_strdup (self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+void
+foo_set_strings (Foo* self,
+                 gchar** value,
+                 gint value_length1)
+{
+       gchar** _tmp0_;
+       gint _tmp0__length1;
+       g_return_if_fail (IS_FOO (self));
+       _tmp0_ = (value != NULL) ? _vala_array_dup1 (value, value_length1) : value;
+       _tmp0__length1 = value_length1;
+       self->priv->_strings = (_vala_array_free (self->priv->_strings, self->priv->_strings_length1, 
(GDestroyNotify) g_free), NULL);
+       self->priv->_strings = _tmp0_;
+       self->priv->_strings_length1 = _tmp0__length1;
+       self->priv->__strings_size_ = self->priv->_strings_length1;
+       g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_STRINGS_PROPERTY]);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_foo_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_foo_set_property;
+       G_OBJECT_CLASS (klass)->finalize = foo_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_STRINGS_PROPERTY, 
foo_properties[FOO_STRINGS_PROPERTY] = g_param_spec_boxed ("strings", "strings", "strings", G_TYPE_STRV, 
G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+}
+
+static void
+foo_finalize (GObject * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       self->priv->_strings = (_vala_array_free (self->priv->_strings, self->priv->_strings_length1, 
(GDestroyNotify) g_free), NULL);
+       G_OBJECT_CLASS (foo_parent_class)->finalize (obj);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_foo_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_STRINGS_PROPERTY:
+               {
+                       int length;
+                       g_value_set_boxed (value, foo_get_strings (self, &length));
+               }
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_foo_set_property (GObject * object,
+                        guint property_id,
+                        const GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_STRINGS_PROPERTY:
+               {
+                       gpointer boxed;
+                       boxed = g_value_get_boxed (value);
+                       foo_set_strings (self, boxed, (boxed == NULL) ? 0 : g_strv_length (boxed));
+               }
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_main (void)
+{
+       gchar** strings = NULL;
+       gint strings_length1 = 0;
+       gint _strings_size_ = 0;
+       Foo* f = NULL;
+       Foo* _tmp0_;
+       Foo* _tmp1_;
+       gchar* _tmp2_;
+       gchar* _tmp3_;
+       gchar** _tmp4_;
+       gchar** _tmp5_;
+       gint _tmp5__length1;
+       Foo* _tmp6_;
+       gchar** _tmp7_ = NULL;
+       gchar** _tmp8_;
+       gint _tmp8__length1;
+       const gchar* _tmp9_;
+       gchar** _tmp10_;
+       gint _tmp10__length1;
+       const gchar* _tmp11_;
+       gchar** _tmp12_;
+       gint _tmp12__length1;
+       Foo* _tmp14_;
+       Foo* _tmp15_;
+       gchar** _tmp16_ = NULL;
+       gchar** _tmp17_;
+       gint _tmp17__length1;
+       Foo* _tmp18_;
+       gchar* _tmp19_;
+       gchar* _tmp20_;
+       gchar** _tmp21_;
+       gchar** _tmp22_;
+       gint _tmp22__length1;
+       Foo* _tmp23_;
+       gchar** _tmp24_ = NULL;
+       gchar** _tmp25_;
+       gint _tmp25__length1;
+       const gchar* _tmp26_;
+       gchar** _tmp27_;
+       gint _tmp27__length1;
+       const gchar* _tmp28_;
+       gchar** _tmp29_;
+       gint _tmp29__length1;
+       _tmp0_ = foo_new ();
+       f = _tmp0_;
+       _tmp1_ = f;
+       _tmp2_ = g_strdup ("foo");
+       _tmp3_ = g_strdup ("bar");
+       _tmp4_ = g_new0 (gchar*, 2 + 1);
+       _tmp4_[0] = _tmp2_;
+       _tmp4_[1] = _tmp3_;
+       _tmp5_ = _tmp4_;
+       _tmp5__length1 = 2;
+       g_object_set (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, G_TYPE_OBJECT, GObject), "strings", _tmp5_, NULL);
+       _tmp5_ = (_vala_array_free (_tmp5_, _tmp5__length1, (GDestroyNotify) g_free), NULL);
+       _tmp6_ = f;
+       g_object_get (G_TYPE_CHECK_INSTANCE_CAST (_tmp6_, G_TYPE_OBJECT, GObject), "strings", &_tmp7_, NULL);
+       strings = (_vala_array_free (strings, strings_length1, (GDestroyNotify) g_free), NULL);
+       strings = _tmp7_;
+       strings_length1 = -1;
+       _strings_size_ = strings_length1;
+       _tmp8_ = strings;
+       _tmp8__length1 = strings_length1;
+       _tmp9_ = _tmp8_[0];
+       _vala_assert (g_strcmp0 (_tmp9_, "foo") == 0, "strings[0] == \"foo\"");
+       _tmp10_ = strings;
+       _tmp10__length1 = strings_length1;
+       _tmp11_ = _tmp10_[1];
+       _vala_assert (g_strcmp0 (_tmp11_, "bar") == 0, "strings[1] == \"bar\"");
+       _tmp12_ = strings;
+       _tmp12__length1 = strings_length1;
+       if (_tmp12__length1 == -1) {
+               gchar** _tmp13_;
+               gint _tmp13__length1;
+               _tmp13_ = strings;
+               _tmp13__length1 = strings_length1;
+               strings_length1 = (gint) g_strv_length (_tmp13_);
+       }
+       _tmp14_ = f;
+       g_object_set (G_TYPE_CHECK_INSTANCE_CAST (_tmp14_, G_TYPE_OBJECT, GObject), "strings", NULL, NULL);
+       _tmp15_ = f;
+       g_object_get (G_TYPE_CHECK_INSTANCE_CAST (_tmp15_, G_TYPE_OBJECT, GObject), "strings", &_tmp16_, 
NULL);
+       strings = (_vala_array_free (strings, strings_length1, (GDestroyNotify) g_free), NULL);
+       strings = _tmp16_;
+       strings_length1 = -1;
+       _strings_size_ = strings_length1;
+       _tmp17_ = strings;
+       _tmp17__length1 = strings_length1;
+       _vala_assert (_tmp17_ == NULL, "strings == null");
+       _tmp18_ = f;
+       _tmp19_ = g_strdup ("foo");
+       _tmp20_ = g_strdup ("bar");
+       _tmp21_ = g_new0 (gchar*, 2 + 1);
+       _tmp21_[0] = _tmp19_;
+       _tmp21_[1] = _tmp20_;
+       _tmp22_ = _tmp21_;
+       _tmp22__length1 = 2;
+       g_object_set (G_TYPE_CHECK_INSTANCE_CAST (_tmp18_, G_TYPE_OBJECT, GObject), "strings", _tmp22_, NULL);
+       _tmp22_ = (_vala_array_free (_tmp22_, _tmp22__length1, (GDestroyNotify) g_free), NULL);
+       _tmp23_ = f;
+       g_object_get (G_TYPE_CHECK_INSTANCE_CAST (_tmp23_, G_TYPE_OBJECT, GObject), "strings", &_tmp24_, 
NULL);
+       strings = (_vala_array_free (strings, strings_length1, (GDestroyNotify) g_free), NULL);
+       strings = _tmp24_;
+       strings_length1 = -1;
+       _strings_size_ = strings_length1;
+       _tmp25_ = strings;
+       _tmp25__length1 = strings_length1;
+       _tmp26_ = _tmp25_[0];
+       _vala_assert (g_strcmp0 (_tmp26_, "foo") == 0, "strings[0] == \"foo\"");
+       _tmp27_ = strings;
+       _tmp27__length1 = strings_length1;
+       _tmp28_ = _tmp27_[1];
+       _vala_assert (g_strcmp0 (_tmp28_, "bar") == 0, "strings[1] == \"bar\"");
+       _tmp29_ = strings;
+       _tmp29__length1 = strings_length1;
+       if (_tmp29__length1 == -1) {
+               gchar** _tmp30_;
+               gint _tmp30__length1;
+               _tmp30_ = strings;
+               _tmp30__length1 = strings_length1;
+               strings_length1 = (gint) g_strv_length (_tmp30_);
+       }
+       _g_object_unref0 (f);
+       strings = (_vala_array_free (strings, strings_length1, (GDestroyNotify) g_free), NULL);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/objects/bug758816.c-expected b/tests/objects/bug758816.c-expected
new file mode 100644
index 000000000..ed840464e
--- /dev/null
+++ b/tests/objects/bug758816.c-expected
@@ -0,0 +1,541 @@
+/* objects_bug758816.c generated by valac, the Vala compiler
+ * generated from objects_bug758816.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef enum  {
+       BAR_FAIL,
+       BAR_FOO,
+       BAR_BAR,
+       BAR_BAZ
+} Bar;
+
+#define TYPE_BAR (bar_get_type ())
+
+#define TYPE_MANAM (manam_get_type ())
+typedef struct _Manam Manam;
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_free0(var) ((var == NULL) ? NULL : (var = (g_free (var), NULL)))
+#define _manam_free0(var) ((var == NULL) ? NULL : (var = (manam_free (var), NULL)))
+enum  {
+       FOO_BAR_SIGNAL,
+       FOO_BAR2_SIGNAL,
+       FOO_MANAM_SIGNAL,
+       FOO_MANAM2_SIGNAL,
+       FOO_NUM_SIGNALS
+};
+static guint foo_signals[FOO_NUM_SIGNALS] = {0};
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Manam {
+       gint i;
+       gint j;
+};
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN GType manam_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Manam* manam_dup (const Manam* self);
+VALA_EXTERN void manam_free (Manam* self);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN void foo_emit_bar (Foo* self);
+static gboolean _bar_equal (const Bar * s1,
+                     const Bar * s2);
+VALA_EXTERN void foo_emit_bar2 (Foo* self);
+VALA_EXTERN void foo_emit_manam (Foo* self);
+static gboolean _manam_equal (const Manam * s1,
+                       const Manam * s2);
+VALA_EXTERN void foo_emit_manam2 (Foo* self);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void g_cclosure_user_marshal_POINTER__VOID (GClosure * closure,
+                                            GValue * return_value,
+                                            guint n_param_values,
+                                            const GValue * param_values,
+                                            gpointer invocation_hint,
+                                            gpointer marshal_data);
+static void g_cclosure_user_marshal_POINTER__POINTER (GClosure * closure,
+                                               GValue * return_value,
+                                               guint n_param_values,
+                                               const GValue * param_values,
+                                               gpointer invocation_hint,
+                                               gpointer marshal_data);
+static GType foo_get_type_once (void);
+VALA_EXTERN Bar* callback_bar (void);
+static Bar* _bar_dup (Bar* self);
+VALA_EXTERN Bar* callback_bar2 (Bar* bar);
+VALA_EXTERN Manam* callback_manam (void);
+VALA_EXTERN Manam* callback_manam2 (Manam* manam);
+static void _vala_main (void);
+static Bar* _callback_bar_foo_bar (Foo* _sender,
+                            gpointer self);
+static Bar* _callback_bar2_foo_bar2 (Foo* _sender,
+                              Bar* bar,
+                              gpointer self);
+static Manam* _callback_manam_foo_manam (Foo* _sender,
+                                  gpointer self);
+static Manam* _callback_manam2_foo_manam2 (Foo* _sender,
+                                    Manam* manam,
+                                    gpointer self);
+
+static GType
+bar_get_type_once (void)
+{
+       static const GEnumValue values[] = {{BAR_FAIL, "BAR_FAIL", "fail"}, {BAR_FOO, "BAR_FOO", "foo"}, 
{BAR_BAR, "BAR_BAR", "bar"}, {BAR_BAZ, "BAR_BAZ", "baz"}, {0, NULL, NULL}};
+       GType bar_type_id;
+       bar_type_id = g_enum_register_static ("Bar", values);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+Manam*
+manam_dup (const Manam* self)
+{
+       Manam* dup;
+       dup = g_new0 (Manam, 1);
+       memcpy (dup, self, sizeof (Manam));
+       return dup;
+}
+
+void
+manam_free (Manam* self)
+{
+       g_free (self);
+}
+
+static GType
+manam_get_type_once (void)
+{
+       GType manam_type_id;
+       manam_type_id = g_boxed_type_register_static ("Manam", (GBoxedCopyFunc) manam_dup, (GBoxedFreeFunc) 
manam_free);
+       return manam_type_id;
+}
+
+GType
+manam_get_type (void)
+{
+       static volatile gsize manam_type_id__volatile = 0;
+       if (g_once_init_enter (&manam_type_id__volatile)) {
+               GType manam_type_id;
+               manam_type_id = manam_get_type_once ();
+               g_once_init_leave (&manam_type_id__volatile, manam_type_id);
+       }
+       return manam_type_id__volatile;
+}
+
+static gboolean
+_bar_equal (const Bar * s1,
+            const Bar * s2)
+{
+       if (s1 == s2) {
+               return TRUE;
+       }
+       if (s1 == NULL) {
+               return FALSE;
+       }
+       if (s2 == NULL) {
+               return FALSE;
+       }
+       return (*s1) == (*s2);
+}
+
+void
+foo_emit_bar (Foo* self)
+{
+       Bar* _tmp0_ = NULL;
+       Bar* _tmp1_;
+       Bar _tmp2_;
+       g_return_if_fail (IS_FOO (self));
+       g_signal_emit (self, foo_signals[FOO_BAR_SIGNAL], 0, &_tmp0_);
+       _tmp1_ = _tmp0_;
+       _tmp2_ = BAR_FOO;
+       _vala_assert (_bar_equal (_tmp1_, &_tmp2_) == TRUE, "bar () == Bar.FOO");
+       _g_free0 (_tmp1_);
+}
+
+void
+foo_emit_bar2 (Foo* self)
+{
+       Bar _tmp0_;
+       Bar* _tmp1_ = NULL;
+       Bar* _tmp2_;
+       Bar _tmp3_;
+       g_return_if_fail (IS_FOO (self));
+       _tmp0_ = BAR_BAZ;
+       g_signal_emit (self, foo_signals[FOO_BAR2_SIGNAL], 0, &_tmp0_, &_tmp1_);
+       _tmp2_ = _tmp1_;
+       _tmp3_ = BAR_BAZ;
+       _vala_assert (_bar_equal (_tmp2_, &_tmp3_) == TRUE, "bar2 (Bar.BAZ) == Bar.BAZ");
+       _g_free0 (_tmp2_);
+}
+
+static gpointer
+_manam_dup0 (gpointer self)
+{
+       return self ? manam_dup (self) : NULL;
+}
+
+static gboolean
+_manam_equal (const Manam * s1,
+              const Manam * s2)
+{
+       if (s1 == s2) {
+               return TRUE;
+       }
+       if (s1 == NULL) {
+               return FALSE;
+       }
+       if (s2 == NULL) {
+               return FALSE;
+       }
+       if (s1->i != s2->i) {
+               return FALSE;
+       }
+       if (s1->j != s2->j) {
+               return FALSE;
+       }
+       return TRUE;
+}
+
+void
+foo_emit_manam (Foo* self)
+{
+       Manam* m = NULL;
+       Manam _tmp0_ = {0};
+       Manam* _tmp1_;
+       Manam* _tmp2_ = NULL;
+       Manam* _tmp3_;
+       g_return_if_fail (IS_FOO (self));
+       _tmp0_.i = 23;
+       _tmp0_.j = 42;
+       _tmp1_ = _manam_dup0 (&_tmp0_);
+       m = _tmp1_;
+       g_signal_emit (self, foo_signals[FOO_MANAM_SIGNAL], 0, &_tmp2_);
+       _tmp3_ = _tmp2_;
+       _vala_assert (_manam_equal (_tmp3_, m) == TRUE, "manam () == m");
+       _manam_free0 (_tmp3_);
+       _manam_free0 (m);
+}
+
+void
+foo_emit_manam2 (Foo* self)
+{
+       Manam* m = NULL;
+       Manam _tmp0_ = {0};
+       Manam* _tmp1_;
+       Manam _tmp2_ = {0};
+       Manam* _tmp3_ = NULL;
+       Manam* _tmp4_;
+       g_return_if_fail (IS_FOO (self));
+       _tmp0_.i = 23;
+       _tmp0_.j = 42;
+       _tmp1_ = _manam_dup0 (&_tmp0_);
+       m = _tmp1_;
+       _tmp2_.i = 23;
+       _tmp2_.j = 42;
+       g_signal_emit (self, foo_signals[FOO_MANAM2_SIGNAL], 0, &_tmp2_, &_tmp3_);
+       _tmp4_ = _tmp3_;
+       _vala_assert (_manam_equal (_tmp4_, m) == TRUE, "manam2 ({23, 42}) == m");
+       _manam_free0 (_tmp4_);
+       _manam_free0 (m);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+g_cclosure_user_marshal_POINTER__VOID (GClosure * closure,
+                                       GValue * return_value,
+                                       guint n_param_values,
+                                       const GValue * param_values,
+                                       gpointer invocation_hint,
+                                       gpointer marshal_data)
+{
+       typedef gpointer (*GMarshalFunc_POINTER__VOID) (gpointer data1, gpointer data2);
+       register GMarshalFunc_POINTER__VOID callback;
+       register GCClosure * cc;
+       register gpointer data1;
+       register gpointer data2;
+       gpointer v_return;
+       cc = (GCClosure *) closure;
+       g_return_if_fail (return_value != NULL);
+       g_return_if_fail (n_param_values == 1);
+       if (G_CCLOSURE_SWAP_DATA (closure)) {
+               data1 = closure->data;
+               data2 = param_values->data[0].v_pointer;
+       } else {
+               data1 = param_values->data[0].v_pointer;
+               data2 = closure->data;
+       }
+       callback = (GMarshalFunc_POINTER__VOID) (marshal_data ? marshal_data : cc->callback);
+       v_return = callback (data1, data2);
+       g_value_set_pointer (return_value, v_return);
+}
+
+static void
+g_cclosure_user_marshal_POINTER__POINTER (GClosure * closure,
+                                          GValue * return_value,
+                                          guint n_param_values,
+                                          const GValue * param_values,
+                                          gpointer invocation_hint,
+                                          gpointer marshal_data)
+{
+       typedef gpointer (*GMarshalFunc_POINTER__POINTER) (gpointer data1, gpointer arg_1, gpointer data2);
+       register GMarshalFunc_POINTER__POINTER callback;
+       register GCClosure * cc;
+       register gpointer data1;
+       register gpointer data2;
+       gpointer v_return;
+       cc = (GCClosure *) closure;
+       g_return_if_fail (return_value != NULL);
+       g_return_if_fail (n_param_values == 2);
+       if (G_CCLOSURE_SWAP_DATA (closure)) {
+               data1 = closure->data;
+               data2 = param_values->data[0].v_pointer;
+       } else {
+               data1 = param_values->data[0].v_pointer;
+               data2 = closure->data;
+       }
+       callback = (GMarshalFunc_POINTER__POINTER) (marshal_data ? marshal_data : cc->callback);
+       v_return = callback (data1, g_value_get_pointer (param_values + 1), data2);
+       g_value_set_pointer (return_value, v_return);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       foo_signals[FOO_BAR_SIGNAL] = g_signal_new ("bar", TYPE_FOO, G_SIGNAL_RUN_LAST, 0, NULL, NULL, 
g_cclosure_user_marshal_POINTER__VOID, G_TYPE_POINTER, 0);
+       foo_signals[FOO_BAR2_SIGNAL] = g_signal_new ("bar2", TYPE_FOO, G_SIGNAL_RUN_LAST, 0, NULL, NULL, 
g_cclosure_user_marshal_POINTER__POINTER, G_TYPE_POINTER, 1, G_TYPE_POINTER);
+       foo_signals[FOO_MANAM_SIGNAL] = g_signal_new ("manam", TYPE_FOO, G_SIGNAL_RUN_LAST, 0, NULL, NULL, 
g_cclosure_user_marshal_POINTER__VOID, G_TYPE_POINTER, 0);
+       foo_signals[FOO_MANAM2_SIGNAL] = g_signal_new ("manam2", TYPE_FOO, G_SIGNAL_RUN_LAST, 0, NULL, NULL, 
g_cclosure_user_marshal_POINTER__POINTER, G_TYPE_POINTER, 1, G_TYPE_POINTER);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static Bar*
+_bar_dup (Bar* self)
+{
+       Bar* dup;
+       dup = g_new0 (Bar, 1);
+       memcpy (dup, self, sizeof (Bar));
+       return dup;
+}
+
+static gpointer
+__bar_dup0 (gpointer self)
+{
+       return self ? _bar_dup (self) : NULL;
+}
+
+Bar*
+callback_bar (void)
+{
+       Bar _tmp0_;
+       Bar* _tmp1_;
+       Bar* result = NULL;
+       _tmp0_ = BAR_FOO;
+       _tmp1_ = __bar_dup0 (&_tmp0_);
+       result = _tmp1_;
+       return result;
+}
+
+Bar*
+callback_bar2 (Bar* bar)
+{
+       Bar _tmp0_;
+       Bar* _tmp1_;
+       Bar* result = NULL;
+       _tmp0_ = BAR_BAZ;
+       _vala_assert (_bar_equal (bar, &_tmp0_) == TRUE, "bar == Bar.BAZ");
+       _tmp1_ = __bar_dup0 (bar);
+       result = _tmp1_;
+       return result;
+}
+
+Manam*
+callback_manam (void)
+{
+       Manam _tmp0_ = {0};
+       Manam* _tmp1_;
+       Manam* result = NULL;
+       _tmp0_.i = 23;
+       _tmp0_.j = 42;
+       _tmp1_ = _manam_dup0 (&_tmp0_);
+       result = _tmp1_;
+       return result;
+}
+
+Manam*
+callback_manam2 (Manam* manam)
+{
+       Manam* m = NULL;
+       Manam _tmp0_ = {0};
+       Manam* _tmp1_;
+       Manam* _tmp2_;
+       Manam* result = NULL;
+       _tmp0_.i = 23;
+       _tmp0_.j = 42;
+       _tmp1_ = _manam_dup0 (&_tmp0_);
+       m = _tmp1_;
+       _vala_assert (_manam_equal (manam, m) == TRUE, "manam == m");
+       _tmp2_ = _manam_dup0 (manam);
+       result = _tmp2_;
+       _manam_free0 (m);
+       return result;
+}
+
+static Bar*
+_callback_bar_foo_bar (Foo* _sender,
+                       gpointer self)
+{
+       Bar* result;
+       result = callback_bar ();
+       return result;
+}
+
+static Bar*
+_callback_bar2_foo_bar2 (Foo* _sender,
+                         Bar* bar,
+                         gpointer self)
+{
+       Bar* result;
+       result = callback_bar2 (bar);
+       return result;
+}
+
+static Manam*
+_callback_manam_foo_manam (Foo* _sender,
+                           gpointer self)
+{
+       Manam* result;
+       result = callback_manam ();
+       return result;
+}
+
+static Manam*
+_callback_manam2_foo_manam2 (Foo* _sender,
+                             Manam* manam,
+                             gpointer self)
+{
+       Manam* result;
+       result = callback_manam2 (manam);
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       g_signal_connect (foo, "bar", (GCallback) _callback_bar_foo_bar, NULL);
+       foo_emit_bar (foo);
+       g_signal_connect (foo, "bar2", (GCallback) _callback_bar2_foo_bar2, NULL);
+       foo_emit_bar2 (foo);
+       g_signal_connect (foo, "manam", (GCallback) _callback_manam_foo_manam, NULL);
+       foo_emit_manam (foo);
+       g_signal_connect (foo, "manam2", (GCallback) _callback_manam2_foo_manam2, NULL);
+       foo_emit_manam2 (foo);
+       _g_object_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/bug764481.c-expected b/tests/objects/bug764481.c-expected
new file mode 100644
index 000000000..9f6ee4d85
--- /dev/null
+++ b/tests/objects/bug764481.c-expected
@@ -0,0 +1,880 @@
+/* objects_bug764481.c generated by valac, the Vala compiler
+ * generated from objects_bug764481.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_MANAM (manam_get_type ())
+typedef struct _Manam Manam;
+
+#define TYPE_BASE_FOO (base_foo_get_type ())
+#define BASE_FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BASE_FOO, BaseFoo))
+#define BASE_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BASE_FOO, BaseFooClass))
+#define IS_BASE_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BASE_FOO))
+#define IS_BASE_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BASE_FOO))
+#define BASE_FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BASE_FOO, BaseFooClass))
+
+typedef struct _BaseFoo BaseFoo;
+typedef struct _BaseFooClass BaseFooClass;
+typedef struct _BaseFooPrivate BaseFooPrivate;
+enum  {
+       BASE_FOO_0_PROPERTY,
+       BASE_FOO_ST_PROPERTY,
+       BASE_FOO_NUM_PROPERTIES
+};
+static GParamSpec* base_foo_properties[BASE_FOO_NUM_PROPERTIES];
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_ST_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+enum  {
+       BAR_0_PROPERTY,
+       BAR_ST_PROPERTY,
+       BAR_NUM_PROPERTIES
+};
+static GParamSpec* bar_properties[BAR_NUM_PROPERTIES];
+
+#define TYPE_BAZ (baz_get_type ())
+#define BAZ(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAZ, Baz))
+#define BAZ_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAZ, BazClass))
+#define IS_BAZ(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAZ))
+#define IS_BAZ_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAZ))
+#define BAZ_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAZ, BazClass))
+
+typedef struct _Baz Baz;
+typedef struct _BazClass BazClass;
+typedef struct _BazPrivate BazPrivate;
+enum  {
+       BAZ_0_PROPERTY,
+       BAZ_ST_PROPERTY,
+       BAZ_NUM_PROPERTIES
+};
+static GParamSpec* baz_properties[BAZ_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Manam {
+       gint a;
+};
+
+struct _BaseFoo {
+       GObject parent_instance;
+       BaseFooPrivate * priv;
+};
+
+struct _BaseFooClass {
+       GObjectClass parent_class;
+       void (*get_st) (BaseFoo* self, Manam * result);
+       void (*set_st) (BaseFoo* self, Manam * value);
+};
+
+struct _BaseFooPrivate {
+       Manam _st;
+};
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+       void (*get_st) (Foo* self, Manam * result);
+       void (*set_st) (Foo* self, Manam * value);
+};
+
+struct _FooPrivate {
+       Manam _st;
+};
+
+struct _Bar {
+       Foo parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       FooClass parent_class;
+};
+
+struct _Baz {
+       BaseFoo parent_instance;
+       BazPrivate * priv;
+};
+
+struct _BazClass {
+       BaseFooClass parent_class;
+};
+
+static gint BaseFoo_private_offset;
+static gpointer base_foo_parent_class = NULL;
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+static gpointer bar_parent_class = NULL;
+static gpointer baz_parent_class = NULL;
+
+VALA_EXTERN GType manam_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Manam* manam_dup (const Manam* self);
+VALA_EXTERN void manam_free (Manam* self);
+VALA_EXTERN GType base_foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (BaseFoo, g_object_unref)
+VALA_EXTERN void base_foo_get_st (BaseFoo* self,
+                      Manam * result);
+VALA_EXTERN void base_foo_set_st (BaseFoo* self,
+                      Manam * value);
+VALA_EXTERN BaseFoo* base_foo_new (void);
+VALA_EXTERN BaseFoo* base_foo_construct (GType object_type);
+static gboolean _manam_equal (const Manam * s1,
+                       const Manam * s2);
+static void base_foo_finalize (GObject * obj);
+static GType base_foo_get_type_once (void);
+static void _vala_base_foo_get_property (GObject * object,
+                                  guint property_id,
+                                  GValue * value,
+                                  GParamSpec * pspec);
+static void _vala_base_foo_set_property (GObject * object,
+                                  guint property_id,
+                                  const GValue * value,
+                                  GParamSpec * pspec);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN void foo_get_st (Foo* self,
+                 Manam * result);
+VALA_EXTERN void foo_set_st (Foo* self,
+                 Manam * value);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (GObject * obj);
+static GType foo_get_type_once (void);
+static void _vala_foo_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_foo_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static GType bar_get_type_once (void);
+static void _vala_bar_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_bar_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec);
+VALA_EXTERN GType baz_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Baz, g_object_unref)
+VALA_EXTERN Baz* baz_new (void);
+VALA_EXTERN Baz* baz_construct (GType object_type);
+static GType baz_get_type_once (void);
+static void _vala_baz_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_baz_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec);
+static void _vala_main (void);
+
+Manam*
+manam_dup (const Manam* self)
+{
+       Manam* dup;
+       dup = g_new0 (Manam, 1);
+       memcpy (dup, self, sizeof (Manam));
+       return dup;
+}
+
+void
+manam_free (Manam* self)
+{
+       g_free (self);
+}
+
+static GType
+manam_get_type_once (void)
+{
+       GType manam_type_id;
+       manam_type_id = g_boxed_type_register_static ("Manam", (GBoxedCopyFunc) manam_dup, (GBoxedFreeFunc) 
manam_free);
+       return manam_type_id;
+}
+
+GType
+manam_get_type (void)
+{
+       static volatile gsize manam_type_id__volatile = 0;
+       if (g_once_init_enter (&manam_type_id__volatile)) {
+               GType manam_type_id;
+               manam_type_id = manam_get_type_once ();
+               g_once_init_leave (&manam_type_id__volatile, manam_type_id);
+       }
+       return manam_type_id__volatile;
+}
+
+static inline gpointer
+base_foo_get_instance_private (BaseFoo* self)
+{
+       return G_STRUCT_MEMBER_P (self, BaseFoo_private_offset);
+}
+
+BaseFoo*
+base_foo_construct (GType object_type)
+{
+       BaseFoo * self = NULL;
+       self = (BaseFoo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+BaseFoo*
+base_foo_new (void)
+{
+       return base_foo_construct (TYPE_BASE_FOO);
+}
+
+void
+base_foo_get_st (BaseFoo* self,
+                 Manam * result)
+{
+       BaseFooClass* _klass_;
+       g_return_if_fail (IS_BASE_FOO (self));
+       _klass_ = BASE_FOO_GET_CLASS (self);
+       if (_klass_->get_st) {
+               _klass_->get_st (self, result);
+       }
+       return;
+}
+
+static void
+base_foo_real_get_st (BaseFoo* base,
+                      Manam * result)
+{
+       BaseFoo* self;
+       Manam _tmp0_;
+       self = base;
+       _tmp0_ = self->priv->_st;
+       *result = _tmp0_;
+       return;
+}
+
+void
+base_foo_set_st (BaseFoo* self,
+                 Manam * value)
+{
+       BaseFooClass* _klass_;
+       g_return_if_fail (IS_BASE_FOO (self));
+       _klass_ = BASE_FOO_GET_CLASS (self);
+       if (_klass_->set_st) {
+               _klass_->set_st (self, value);
+       }
+}
+
+static gboolean
+_manam_equal (const Manam * s1,
+              const Manam * s2)
+{
+       if (s1 == s2) {
+               return TRUE;
+       }
+       if (s1 == NULL) {
+               return FALSE;
+       }
+       if (s2 == NULL) {
+               return FALSE;
+       }
+       if (s1->a != s2->a) {
+               return FALSE;
+       }
+       return TRUE;
+}
+
+static void
+base_foo_real_set_st (BaseFoo* base,
+                      Manam * value)
+{
+       BaseFoo* self;
+       Manam old_value;
+       self = base;
+       base_foo_real_get_st (base, &old_value);
+       if (_manam_equal (value, &old_value) != TRUE) {
+               Manam _tmp0_;
+               _tmp0_ = *value;
+               self->priv->_st = _tmp0_;
+               g_object_notify_by_pspec ((GObject *) self, base_foo_properties[BASE_FOO_ST_PROPERTY]);
+       }
+}
+
+static void
+base_foo_class_init (BaseFooClass * klass,
+                     gpointer klass_data)
+{
+       base_foo_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &BaseFoo_private_offset);
+       BASE_FOO_CLASS (klass)->get_st = base_foo_real_get_st;
+       BASE_FOO_CLASS (klass)->set_st = base_foo_real_set_st;
+       G_OBJECT_CLASS (klass)->get_property = _vala_base_foo_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_base_foo_set_property;
+       G_OBJECT_CLASS (klass)->finalize = base_foo_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), BASE_FOO_ST_PROPERTY, 
base_foo_properties[BASE_FOO_ST_PROPERTY] = g_param_spec_boxed ("st", "st", "st", TYPE_MANAM, 
G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+}
+
+static void
+base_foo_instance_init (BaseFoo * self,
+                        gpointer klass)
+{
+       self->priv = base_foo_get_instance_private (self);
+}
+
+static void
+base_foo_finalize (GObject * obj)
+{
+       BaseFoo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BASE_FOO, BaseFoo);
+       G_OBJECT_CLASS (base_foo_parent_class)->finalize (obj);
+}
+
+static GType
+base_foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BaseFooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) base_foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(BaseFoo), 0, (GInstanceInitFunc) base_foo_instance_init, NULL };
+       GType base_foo_type_id;
+       base_foo_type_id = g_type_register_static (G_TYPE_OBJECT, "BaseFoo", &g_define_type_info, 0);
+       BaseFoo_private_offset = g_type_add_instance_private (base_foo_type_id, sizeof (BaseFooPrivate));
+       return base_foo_type_id;
+}
+
+GType
+base_foo_get_type (void)
+{
+       static volatile gsize base_foo_type_id__volatile = 0;
+       if (g_once_init_enter (&base_foo_type_id__volatile)) {
+               GType base_foo_type_id;
+               base_foo_type_id = base_foo_get_type_once ();
+               g_once_init_leave (&base_foo_type_id__volatile, base_foo_type_id);
+       }
+       return base_foo_type_id__volatile;
+}
+
+static void
+_vala_base_foo_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec)
+{
+       BaseFoo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_BASE_FOO, BaseFoo);
+       switch (property_id) {
+               case BASE_FOO_ST_PROPERTY:
+               {
+                       Manam boxed;
+                       base_foo_get_st (self, &boxed);
+                       g_value_set_boxed (value, &boxed);
+               }
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_base_foo_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec)
+{
+       BaseFoo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_BASE_FOO, BaseFoo);
+       switch (property_id) {
+               case BASE_FOO_ST_PROPERTY:
+               base_foo_set_st (self, g_value_get_boxed (value));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+void
+foo_get_st (Foo* self,
+            Manam * result)
+{
+       FooClass* _klass_;
+       g_return_if_fail (IS_FOO (self));
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->get_st) {
+               _klass_->get_st (self, result);
+       }
+       return;
+}
+
+static void
+foo_real_get_st (Foo* base,
+                 Manam * result)
+{
+       Foo* self;
+       Manam _tmp0_;
+       self = base;
+       _tmp0_ = self->priv->_st;
+       *result = _tmp0_;
+       return;
+}
+
+void
+foo_set_st (Foo* self,
+            Manam * value)
+{
+       FooClass* _klass_;
+       g_return_if_fail (IS_FOO (self));
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->set_st) {
+               _klass_->set_st (self, value);
+       }
+}
+
+static void
+foo_real_set_st (Foo* base,
+                 Manam * value)
+{
+       Foo* self;
+       Manam old_value;
+       self = base;
+       foo_real_get_st (base, &old_value);
+       if (_manam_equal (value, &old_value) != TRUE) {
+               Manam _tmp0_;
+               _tmp0_ = *value;
+               self->priv->_st = _tmp0_;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_ST_PROPERTY]);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+       FOO_CLASS (klass)->get_st = foo_real_get_st;
+       FOO_CLASS (klass)->set_st = foo_real_set_st;
+       G_OBJECT_CLASS (klass)->get_property = _vala_foo_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_foo_set_property;
+       G_OBJECT_CLASS (klass)->finalize = foo_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_ST_PROPERTY, 
foo_properties[FOO_ST_PROPERTY] = g_param_spec_boxed ("st", "st", "st", TYPE_MANAM, G_PARAM_STATIC_STRINGS | 
G_PARAM_READABLE | G_PARAM_WRITABLE));
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+}
+
+static void
+foo_finalize (GObject * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       G_OBJECT_CLASS (foo_parent_class)->finalize (obj);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_foo_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_ST_PROPERTY:
+               {
+                       Manam boxed;
+                       foo_get_st (self, &boxed);
+                       g_value_set_boxed (value, &boxed);
+               }
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_foo_set_property (GObject * object,
+                        guint property_id,
+                        const GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_ST_PROPERTY:
+               foo_set_st (self, g_value_get_boxed (value));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar * self = NULL;
+       self = (Bar*) foo_construct (object_type);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+bar_real_get_st (Foo* base,
+                 Manam * result)
+{
+       Bar* self;
+       Manam _tmp0_;
+       Manam _tmp1_;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAR, Bar);
+       FOO_CLASS (bar_parent_class)->get_st (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_FOO, Foo), &_tmp0_);
+       _tmp1_ = _tmp0_;
+       *result = _tmp1_;
+       return;
+}
+
+static void
+bar_real_set_st (Foo* base,
+                 Manam * value)
+{
+       Bar* self;
+       Manam _tmp0_;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAR, Bar);
+       _tmp0_ = *value;
+       FOO_CLASS (bar_parent_class)->set_st (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_FOO, Foo), &_tmp0_);
+       g_object_notify_by_pspec ((GObject *) self, bar_properties[BAR_ST_PROPERTY]);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       FOO_CLASS (klass)->get_st = bar_real_get_st;
+       FOO_CLASS (klass)->set_st = bar_real_set_st;
+       G_OBJECT_CLASS (klass)->get_property = _vala_bar_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_bar_set_property;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), BAR_ST_PROPERTY, 
bar_properties[BAR_ST_PROPERTY] = g_param_spec_boxed ("st", "st", "st", TYPE_MANAM, G_PARAM_STATIC_STRINGS | 
G_PARAM_READABLE | G_PARAM_WRITABLE));
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (TYPE_FOO, "Bar", &g_define_type_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_bar_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_BAR, Bar);
+       switch (property_id) {
+               case BAR_ST_PROPERTY:
+               {
+                       Manam boxed;
+                       foo_get_st (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_FOO, Foo), &boxed);
+                       g_value_set_boxed (value, &boxed);
+               }
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_bar_set_property (GObject * object,
+                        guint property_id,
+                        const GValue * value,
+                        GParamSpec * pspec)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_BAR, Bar);
+       switch (property_id) {
+               case BAR_ST_PROPERTY:
+               foo_set_st (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_FOO, Foo), g_value_get_boxed (value));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+Baz*
+baz_construct (GType object_type)
+{
+       Baz * self = NULL;
+       self = (Baz*) base_foo_construct (object_type);
+       return self;
+}
+
+Baz*
+baz_new (void)
+{
+       return baz_construct (TYPE_BAZ);
+}
+
+static void
+baz_real_get_st (BaseFoo* base,
+                 Manam * result)
+{
+       Baz* self;
+       Manam _tmp0_;
+       Manam _tmp1_;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAZ, Baz);
+       BASE_FOO_CLASS (baz_parent_class)->get_st (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_BASE_FOO, BaseFoo), 
&_tmp0_);
+       _tmp1_ = _tmp0_;
+       *result = _tmp1_;
+       return;
+}
+
+static void
+baz_real_set_st (BaseFoo* base,
+                 Manam * value)
+{
+       Baz* self;
+       Manam _tmp0_;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAZ, Baz);
+       _tmp0_ = *value;
+       BASE_FOO_CLASS (baz_parent_class)->set_st (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_BASE_FOO, BaseFoo), 
&_tmp0_);
+       g_object_notify_by_pspec ((GObject *) self, baz_properties[BAZ_ST_PROPERTY]);
+}
+
+static void
+baz_class_init (BazClass * klass,
+                gpointer klass_data)
+{
+       baz_parent_class = g_type_class_peek_parent (klass);
+       BASE_FOO_CLASS (klass)->get_st = baz_real_get_st;
+       BASE_FOO_CLASS (klass)->set_st = baz_real_set_st;
+       G_OBJECT_CLASS (klass)->get_property = _vala_baz_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_baz_set_property;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), BAZ_ST_PROPERTY, 
baz_properties[BAZ_ST_PROPERTY] = g_param_spec_boxed ("st", "st", "st", TYPE_MANAM, G_PARAM_STATIC_STRINGS | 
G_PARAM_READABLE | G_PARAM_WRITABLE));
+}
+
+static void
+baz_instance_init (Baz * self,
+                   gpointer klass)
+{
+}
+
+static GType
+baz_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BazClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) baz_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Baz), 0, 
(GInstanceInitFunc) baz_instance_init, NULL };
+       GType baz_type_id;
+       baz_type_id = g_type_register_static (TYPE_BASE_FOO, "Baz", &g_define_type_info, 0);
+       return baz_type_id;
+}
+
+GType
+baz_get_type (void)
+{
+       static volatile gsize baz_type_id__volatile = 0;
+       if (g_once_init_enter (&baz_type_id__volatile)) {
+               GType baz_type_id;
+               baz_type_id = baz_get_type_once ();
+               g_once_init_leave (&baz_type_id__volatile, baz_type_id);
+       }
+       return baz_type_id__volatile;
+}
+
+static void
+_vala_baz_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Baz * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_BAZ, Baz);
+       switch (property_id) {
+               case BAZ_ST_PROPERTY:
+               {
+                       Manam boxed;
+                       base_foo_get_st (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_BASE_FOO, BaseFoo), &boxed);
+                       g_value_set_boxed (value, &boxed);
+               }
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_baz_set_property (GObject * object,
+                        guint property_id,
+                        const GValue * value,
+                        GParamSpec * pspec)
+{
+       Baz * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_BAZ, Baz);
+       switch (property_id) {
+               case BAZ_ST_PROPERTY:
+               base_foo_set_st (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_BASE_FOO, BaseFoo), g_value_get_boxed 
(value));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Bar* bar = NULL;
+       Bar* _tmp0_;
+       Manam _tmp1_ = {0};
+       Manam _tmp2_ = {0};
+       Manam _tmp3_;
+       Baz* baz = NULL;
+       Baz* _tmp4_;
+       Manam _tmp5_ = {0};
+       Manam _tmp6_ = {0};
+       Manam _tmp7_;
+       _tmp0_ = bar_new ();
+       bar = _tmp0_;
+       _tmp1_.a = 42;
+       foo_set_st (G_TYPE_CHECK_INSTANCE_CAST (bar, TYPE_FOO, Foo), &_tmp1_);
+       foo_get_st (G_TYPE_CHECK_INSTANCE_CAST (bar, TYPE_FOO, Foo), &_tmp2_);
+       _tmp3_ = _tmp2_;
+       _vala_assert (_tmp3_.a == 42, "bar.st.a == 42");
+       _tmp4_ = baz_new ();
+       baz = _tmp4_;
+       _tmp5_.a = 23;
+       base_foo_set_st (G_TYPE_CHECK_INSTANCE_CAST (baz, TYPE_BASE_FOO, BaseFoo), &_tmp5_);
+       base_foo_get_st (G_TYPE_CHECK_INSTANCE_CAST (baz, TYPE_BASE_FOO, BaseFoo), &_tmp6_);
+       _tmp7_ = _tmp6_;
+       _vala_assert (_tmp7_.a == 23, "baz.st.a == 23");
+       _g_object_unref0 (baz);
+       _g_object_unref0 (bar);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/bug766739.c-expected b/tests/objects/bug766739.c-expected
new file mode 100644
index 000000000..1d4f4096d
--- /dev/null
+++ b/tests/objects/bug766739.c-expected
@@ -0,0 +1,1085 @@
+/* objects_bug766739.c generated by valac, the Vala compiler
+ * generated from objects_bug766739.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+#include <gobject/gvaluecollector.h>
+#include <stdlib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO_STRUCT (foo_struct_get_type ())
+typedef struct _FooStruct FooStruct;
+
+#define TYPE_FOOCLASS (fooclass_get_type ())
+#define FOOCLASS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOOCLASS, FooClass))
+#define FOOCLASS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOOCLASS, FooClassClass))
+#define IS_FOOCLASS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOOCLASS))
+#define IS_FOOCLASS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOOCLASS))
+#define FOOCLASS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOOCLASS, FooClassClass))
+
+typedef struct _FooClass FooClass;
+typedef struct _FooClassClass FooClassClass;
+typedef struct _FooClassPrivate FooClassPrivate;
+typedef struct _ParamSpecFooClass ParamSpecFooClass;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _fooclass_unref0(var) ((var == NULL) ? NULL : (var = (fooclass_unref (var), NULL)))
+typedef struct _ParamSpecBar ParamSpecBar;
+#define _bar_unref0(var) ((var == NULL) ? NULL : (var = (bar_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _FooStruct {
+       gint bar;
+};
+
+struct _FooClass {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooClassPrivate * priv;
+       gint bar;
+};
+
+struct _FooClassClass {
+       GTypeClass parent_class;
+       void (*finalize) (FooClass *self);
+};
+
+struct _ParamSpecFooClass {
+       GParamSpec parent_instance;
+};
+
+struct _Bar {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       BarPrivate * priv;
+       gint f_simple;
+       gchar* f_string;
+       gchar** f_array;
+       gint f_array_length1;
+       gint _f_array_size_;
+       FooStruct f_struct;
+       FooClass* f_class;
+       const gchar* fu_string;
+       gchar** fu_array;
+       gint fu_array_length1;
+       gint _fu_array_size_;
+       FooStruct* fu_struct;
+       FooClass* fu_class;
+};
+
+struct _BarClass {
+       GTypeClass parent_class;
+       void (*finalize) (Bar *self);
+};
+
+struct _BarPrivate {
+       gint _p_simple;
+       gchar* _p_string;
+       gchar** _p_array;
+       gint _p_array_length1;
+       gint __p_array_size_;
+       FooStruct _p_struct;
+       FooClass* _p_class;
+};
+
+struct _ParamSpecBar {
+       GParamSpec parent_instance;
+};
+
+static gpointer fooclass_parent_class = NULL;
+static gint Bar_private_offset;
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN GType foo_struct_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN FooStruct* foo_struct_dup (const FooStruct* self);
+VALA_EXTERN void foo_struct_free (FooStruct* self);
+VALA_EXTERN gpointer fooclass_ref (gpointer instance);
+VALA_EXTERN void fooclass_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_fooclass (const gchar* name,
+                                 const gchar* nick,
+                                 const gchar* blurb,
+                                 GType object_type,
+                                 GParamFlags flags);
+VALA_EXTERN void value_set_fooclass (GValue* value,
+                         gpointer v_object);
+VALA_EXTERN void value_take_fooclass (GValue* value,
+                          gpointer v_object);
+VALA_EXTERN gpointer value_get_fooclass (const GValue* value);
+VALA_EXTERN GType fooclass_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (FooClass, fooclass_unref)
+VALA_EXTERN FooClass* fooclass_new (void);
+VALA_EXTERN FooClass* fooclass_construct (GType object_type);
+static void fooclass_finalize (FooClass * obj);
+static GType fooclass_get_type_once (void);
+VALA_EXTERN gpointer bar_ref (gpointer instance);
+VALA_EXTERN void bar_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_bar (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_bar (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_bar (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_bar (const GValue* value);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, bar_unref)
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+VALA_EXTERN gint bar_get_p_simple (Bar* self);
+VALA_EXTERN void bar_set_p_simple (Bar* self,
+                       gint value);
+VALA_EXTERN const gchar* bar_get_p_string (Bar* self);
+VALA_EXTERN void bar_set_p_string (Bar* self,
+                       const gchar* value);
+VALA_EXTERN gchar** bar_get_p_array (Bar* self,
+                         gint* result_length1);
+VALA_EXTERN void bar_set_p_array (Bar* self,
+                      gchar** value,
+                      gint value_length1);
+static gchar** _vala_array_dup1 (gchar** self,
+                          gssize length);
+VALA_EXTERN void bar_get_p_struct (Bar* self,
+                       FooStruct * result);
+VALA_EXTERN void bar_set_p_struct (Bar* self,
+                       FooStruct * value);
+VALA_EXTERN FooClass* bar_get_p_class (Bar* self);
+VALA_EXTERN void bar_set_p_class (Bar* self,
+                      FooClass* value);
+static void bar_finalize (Bar * obj);
+static GType bar_get_type_once (void);
+static void _vala_main (void);
+static gchar** _vala_array_dup2 (gchar** self,
+                          gssize length);
+static gchar** _vala_array_dup3 (gchar** self,
+                          gssize length);
+static gboolean _foo_struct_equal (const FooStruct * s1,
+                            const FooStruct * s2);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+FooStruct*
+foo_struct_dup (const FooStruct* self)
+{
+       FooStruct* dup;
+       dup = g_new0 (FooStruct, 1);
+       memcpy (dup, self, sizeof (FooStruct));
+       return dup;
+}
+
+void
+foo_struct_free (FooStruct* self)
+{
+       g_free (self);
+}
+
+static GType
+foo_struct_get_type_once (void)
+{
+       GType foo_struct_type_id;
+       foo_struct_type_id = g_boxed_type_register_static ("FooStruct", (GBoxedCopyFunc) foo_struct_dup, 
(GBoxedFreeFunc) foo_struct_free);
+       return foo_struct_type_id;
+}
+
+GType
+foo_struct_get_type (void)
+{
+       static volatile gsize foo_struct_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_struct_type_id__volatile)) {
+               GType foo_struct_type_id;
+               foo_struct_type_id = foo_struct_get_type_once ();
+               g_once_init_leave (&foo_struct_type_id__volatile, foo_struct_type_id);
+       }
+       return foo_struct_type_id__volatile;
+}
+
+FooClass*
+fooclass_construct (GType object_type)
+{
+       FooClass* self = NULL;
+       self = (FooClass*) g_type_create_instance (object_type);
+       return self;
+}
+
+FooClass*
+fooclass_new (void)
+{
+       return fooclass_construct (TYPE_FOOCLASS);
+}
+
+static void
+value_fooclass_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_fooclass_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               fooclass_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_fooclass_copy_value (const GValue* src_value,
+                           GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = fooclass_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_fooclass_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_fooclass_collect_value (GValue* value,
+                              guint n_collect_values,
+                              GTypeCValue* collect_values,
+                              guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               FooClass * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = fooclass_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_fooclass_lcopy_value (const GValue* value,
+                            guint n_collect_values,
+                            GTypeCValue* collect_values,
+                            guint collect_flags)
+{
+       FooClass ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = fooclass_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_fooclass (const gchar* name,
+                     const gchar* nick,
+                     const gchar* blurb,
+                     GType object_type,
+                     GParamFlags flags)
+{
+       ParamSpecFooClass* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOOCLASS), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_fooclass (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOOCLASS), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_fooclass (GValue* value,
+                    gpointer v_object)
+{
+       FooClass * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOOCLASS));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOOCLASS));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               fooclass_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               fooclass_unref (old);
+       }
+}
+
+void
+value_take_fooclass (GValue* value,
+                     gpointer v_object)
+{
+       FooClass * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOOCLASS));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOOCLASS));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               fooclass_unref (old);
+       }
+}
+
+static void
+fooclass_class_init (FooClassClass * klass,
+                     gpointer klass_data)
+{
+       fooclass_parent_class = g_type_class_peek_parent (klass);
+       ((FooClassClass *) klass)->finalize = fooclass_finalize;
+}
+
+static void
+fooclass_instance_init (FooClass * self,
+                        gpointer klass)
+{
+       self->bar = 42;
+       self->ref_count = 1;
+}
+
+static void
+fooclass_finalize (FooClass * obj)
+{
+       FooClass * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOOCLASS, FooClass);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+fooclass_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_fooclass_init, 
value_fooclass_free_value, value_fooclass_copy_value, value_fooclass_peek_pointer, "p", 
value_fooclass_collect_value, "p", value_fooclass_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClassClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) fooclass_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(FooClass), 0, (GInstanceInitFunc) fooclass_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType fooclass_type_id;
+       fooclass_type_id = g_type_register_fundamental (g_type_fundamental_next (), "FooClass", 
&g_define_type_info, &g_define_type_fundamental_info, 0);
+       return fooclass_type_id;
+}
+
+GType
+fooclass_get_type (void)
+{
+       static volatile gsize fooclass_type_id__volatile = 0;
+       if (g_once_init_enter (&fooclass_type_id__volatile)) {
+               GType fooclass_type_id;
+               fooclass_type_id = fooclass_get_type_once ();
+               g_once_init_leave (&fooclass_type_id__volatile, fooclass_type_id);
+       }
+       return fooclass_type_id__volatile;
+}
+
+gpointer
+fooclass_ref (gpointer instance)
+{
+       FooClass * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+fooclass_unref (gpointer instance)
+{
+       FooClass * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOOCLASS_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static inline gpointer
+bar_get_instance_private (Bar* self)
+{
+       return G_STRUCT_MEMBER_P (self, Bar_private_offset);
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar* self = NULL;
+       self = (Bar*) g_type_create_instance (object_type);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+gint
+bar_get_p_simple (Bar* self)
+{
+       gint result;
+       g_return_val_if_fail (IS_BAR (self), 0);
+       result = self->priv->_p_simple;
+       return result;
+}
+
+void
+bar_set_p_simple (Bar* self,
+                  gint value)
+{
+       g_return_if_fail (IS_BAR (self));
+       self->priv->_p_simple = value;
+}
+
+const gchar*
+bar_get_p_string (Bar* self)
+{
+       const gchar* result;
+       const gchar* _tmp0_;
+       g_return_val_if_fail (IS_BAR (self), NULL);
+       _tmp0_ = self->priv->_p_string;
+       result = _tmp0_;
+       return result;
+}
+
+void
+bar_set_p_string (Bar* self,
+                  const gchar* value)
+{
+       gchar* _tmp0_;
+       g_return_if_fail (IS_BAR (self));
+       _tmp0_ = g_strdup (value);
+       _g_free0 (self->priv->_p_string);
+       self->priv->_p_string = _tmp0_;
+}
+
+gchar**
+bar_get_p_array (Bar* self,
+                 gint* result_length1)
+{
+       gchar** result;
+       gchar** _tmp0_;
+       gint _tmp0__length1;
+       gchar** _tmp1_;
+       gint _tmp1__length1;
+       g_return_val_if_fail (IS_BAR (self), NULL);
+       _tmp0_ = self->priv->_p_array;
+       _tmp0__length1 = self->priv->_p_array_length1;
+       _tmp1_ = _tmp0_;
+       _tmp1__length1 = _tmp0__length1;
+       if (result_length1) {
+               *result_length1 = _tmp1__length1;
+       }
+       result = _tmp1_;
+       return result;
+}
+
+static gchar**
+_vala_array_dup1 (gchar** self,
+                  gssize length)
+{
+       if (length >= 0) {
+               gchar** result;
+               gssize i;
+               result = g_new0 (gchar*, length + 1);
+               for (i = 0; i < length; i++) {
+                       gchar* _tmp0_;
+                       _tmp0_ = g_strdup (self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+void
+bar_set_p_array (Bar* self,
+                 gchar** value,
+                 gint value_length1)
+{
+       gchar** _tmp0_;
+       gint _tmp0__length1;
+       g_return_if_fail (IS_BAR (self));
+       _tmp0_ = (value != NULL) ? _vala_array_dup1 (value, value_length1) : value;
+       _tmp0__length1 = value_length1;
+       self->priv->_p_array = (_vala_array_free (self->priv->_p_array, self->priv->_p_array_length1, 
(GDestroyNotify) g_free), NULL);
+       self->priv->_p_array = _tmp0_;
+       self->priv->_p_array_length1 = _tmp0__length1;
+       self->priv->__p_array_size_ = self->priv->_p_array_length1;
+}
+
+void
+bar_get_p_struct (Bar* self,
+                  FooStruct * result)
+{
+       FooStruct _tmp0_;
+       g_return_if_fail (IS_BAR (self));
+       _tmp0_ = self->priv->_p_struct;
+       *result = _tmp0_;
+       return;
+}
+
+void
+bar_set_p_struct (Bar* self,
+                  FooStruct * value)
+{
+       FooStruct _tmp0_;
+       g_return_if_fail (IS_BAR (self));
+       _tmp0_ = *value;
+       self->priv->_p_struct = _tmp0_;
+}
+
+FooClass*
+bar_get_p_class (Bar* self)
+{
+       FooClass* result;
+       FooClass* _tmp0_;
+       g_return_val_if_fail (IS_BAR (self), NULL);
+       _tmp0_ = self->priv->_p_class;
+       result = _tmp0_;
+       return result;
+}
+
+static gpointer
+_fooclass_ref0 (gpointer self)
+{
+       return self ? fooclass_ref (self) : NULL;
+}
+
+void
+bar_set_p_class (Bar* self,
+                 FooClass* value)
+{
+       FooClass* _tmp0_;
+       g_return_if_fail (IS_BAR (self));
+       _tmp0_ = _fooclass_ref0 (value);
+       _fooclass_unref0 (self->priv->_p_class);
+       self->priv->_p_class = _tmp0_;
+}
+
+static void
+value_bar_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_bar_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               bar_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_bar_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = bar_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_bar_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_bar_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Bar * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = bar_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_bar_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Bar ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = bar_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_bar (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecBar* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_BAR), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_bar (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_bar (GValue* value,
+               gpointer v_object)
+{
+       Bar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               bar_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_unref (old);
+       }
+}
+
+void
+value_take_bar (GValue* value,
+                gpointer v_object)
+{
+       Bar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_unref (old);
+       }
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       ((BarClass *) klass)->finalize = bar_finalize;
+       g_type_class_adjust_private_offset (klass, &Bar_private_offset);
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+       self->priv = bar_get_instance_private (self);
+       self->ref_count = 1;
+}
+
+static void
+bar_finalize (Bar * obj)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       g_signal_handlers_destroy (self);
+       _g_free0 (self->f_string);
+       self->f_array = (_vala_array_free (self->f_array, self->f_array_length1, (GDestroyNotify) g_free), 
NULL);
+       _fooclass_unref0 (self->f_class);
+       _g_free0 (self->priv->_p_string);
+       self->priv->_p_array = (_vala_array_free (self->priv->_p_array, self->priv->_p_array_length1, 
(GDestroyNotify) g_free), NULL);
+       _fooclass_unref0 (self->priv->_p_class);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_bar_init, value_bar_free_value, 
value_bar_copy_value, value_bar_peek_pointer, "p", value_bar_collect_value, "p", value_bar_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType bar_type_id;
+       bar_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Bar", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       Bar_private_offset = g_type_add_instance_private (bar_type_id, sizeof (BarPrivate));
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+gpointer
+bar_ref (gpointer instance)
+{
+       Bar * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+bar_unref (gpointer instance)
+{
+       Bar * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               BAR_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static gchar**
+_vala_array_dup2 (gchar** self,
+                  gssize length)
+{
+       if (length >= 0) {
+               gchar** result;
+               gssize i;
+               result = g_new0 (gchar*, length + 1);
+               for (i = 0; i < length; i++) {
+                       gchar* _tmp0_;
+                       _tmp0_ = g_strdup (self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+static gchar**
+_vala_array_dup3 (gchar** self,
+                  gssize length)
+{
+       if (length >= 0) {
+               gchar** result;
+               gssize i;
+               result = g_new0 (gchar*, length + 1);
+               for (i = 0; i < length; i++) {
+                       gchar* _tmp0_;
+                       _tmp0_ = g_strdup (self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+static gboolean
+_foo_struct_equal (const FooStruct * s1,
+                   const FooStruct * s2)
+{
+       if (s1 == s2) {
+               return TRUE;
+       }
+       if (s1 == NULL) {
+               return FALSE;
+       }
+       if (s2 == NULL) {
+               return FALSE;
+       }
+       if (s1->bar != s2->bar) {
+               return FALSE;
+       }
+       return TRUE;
+}
+
+static void
+_vala_main (void)
+{
+       FooStruct fs = {0};
+       FooStruct _tmp0_ = {0};
+       FooClass* fc = NULL;
+       FooClass* _tmp1_;
+       gchar* s = NULL;
+       gchar* _tmp2_;
+       gchar** a = NULL;
+       gchar* _tmp3_;
+       gchar* _tmp4_;
+       gchar** _tmp5_;
+       gint a_length1;
+       gint _a_size_;
+       Bar* bar = NULL;
+       gchar* _tmp6_;
+       gchar** _tmp7_;
+       gint _tmp7__length1;
+       FooStruct _tmp8_;
+       FooClass* _tmp9_;
+       FooStruct _tmp10_;
+       gchar* _tmp11_;
+       gchar** _tmp12_;
+       gint _tmp12__length1;
+       FooStruct _tmp13_;
+       FooClass* _tmp14_;
+       Bar* _tmp15_ = NULL;
+       Bar* _tmp16_;
+       Bar* _tmp17_;
+       const gchar* _tmp18_;
+       Bar* _tmp19_;
+       gchar** _tmp20_;
+       gint _tmp20__length1;
+       const gchar* _tmp21_;
+       Bar* _tmp22_;
+       FooStruct _tmp23_;
+       Bar* _tmp24_;
+       FooClass* _tmp25_;
+       Bar* _tmp26_;
+       const gchar* _tmp27_;
+       Bar* _tmp28_;
+       gchar** _tmp29_;
+       gint _tmp29__length1;
+       const gchar* _tmp30_;
+       Bar* _tmp31_;
+       FooStruct* _tmp32_;
+       FooStruct _tmp33_;
+       Bar* _tmp34_;
+       FooClass* _tmp35_;
+       Bar* _tmp36_;
+       gint _tmp37_;
+       gint _tmp38_;
+       Bar* _tmp39_;
+       const gchar* _tmp40_;
+       const gchar* _tmp41_;
+       Bar* _tmp42_;
+       gchar** _tmp43_;
+       gint _tmp43__length1;
+       gint _tmp44_ = 0;
+       gchar** _tmp45_;
+       gint _tmp45__length1;
+       const gchar* _tmp46_;
+       Bar* _tmp47_;
+       FooStruct _tmp48_ = {0};
+       FooStruct _tmp49_;
+       Bar* _tmp50_;
+       FooClass* _tmp51_;
+       FooClass* _tmp52_;
+       FooStruct _tmp53_;
+       const gchar* _tmp54_;
+       _tmp0_.bar = 42;
+       fs = _tmp0_;
+       _tmp1_ = fooclass_new ();
+       fc = _tmp1_;
+       _tmp2_ = g_strdup ("foo");
+       s = _tmp2_;
+       _tmp3_ = g_strdup ("foo");
+       _tmp4_ = g_strdup ("bar");
+       _tmp5_ = g_new0 (gchar*, 2 + 1);
+       _tmp5_[0] = _tmp3_;
+       _tmp5_[1] = _tmp4_;
+       a = _tmp5_;
+       a_length1 = 2;
+       _a_size_ = a_length1;
+       _tmp6_ = g_strdup (s);
+       _tmp7_ = (a != NULL) ? _vala_array_dup2 (a, a_length1) : a;
+       _tmp7__length1 = a_length1;
+       _tmp8_ = fs;
+       _tmp9_ = _fooclass_ref0 (fc);
+       _tmp10_ = fs;
+       _tmp11_ = g_strdup (s);
+       _tmp12_ = (a != NULL) ? _vala_array_dup3 (a, a_length1) : a;
+       _tmp12__length1 = a_length1;
+       _tmp13_ = fs;
+       _tmp14_ = _fooclass_ref0 (fc);
+       _tmp15_ = bar_new ();
+       _tmp15_->f_simple = 42;
+       _g_free0 (_tmp15_->f_string);
+       _tmp15_->f_string = _tmp6_;
+       _tmp15_->f_array = (_vala_array_free (_tmp15_->f_array, _tmp15_->f_array_length1, (GDestroyNotify) 
g_free), NULL);
+       _tmp15_->f_array = _tmp7_;
+       _tmp15_->f_array_length1 = _tmp7__length1;
+       _tmp15_->_f_array_size_ = _tmp15_->f_array_length1;
+       _tmp15_->f_struct = _tmp8_;
+       _fooclass_unref0 (_tmp15_->f_class);
+       _tmp15_->f_class = _tmp9_;
+       _tmp15_->fu_string = s;
+       _tmp15_->fu_array = a;
+       _tmp15_->fu_array_length1 = a_length1;
+       _tmp15_->_fu_array_size_ = _tmp15_->fu_array_length1;
+       _tmp15_->fu_struct = &_tmp10_;
+       _tmp15_->fu_class = fc;
+       bar_set_p_simple (_tmp15_, 42);
+       bar_set_p_string (_tmp15_, _tmp11_);
+       _g_free0 (_tmp11_);
+       bar_set_p_array (_tmp15_, _tmp12_, _tmp12__length1);
+       _tmp12_ = (_vala_array_free (_tmp12_, _tmp12__length1, (GDestroyNotify) g_free), NULL);
+       bar_set_p_struct (_tmp15_, &_tmp13_);
+       bar_set_p_class (_tmp15_, _tmp14_);
+       _fooclass_unref0 (_tmp14_);
+       bar = _tmp15_;
+       _tmp16_ = bar;
+       _vala_assert (_tmp16_->f_simple == 42, "bar.f_simple == 42");
+       _tmp17_ = bar;
+       _tmp18_ = _tmp17_->f_string;
+       _vala_assert (g_strcmp0 (_tmp18_, "foo") == 0, "bar.f_string == \"foo\"");
+       _tmp19_ = bar;
+       _tmp20_ = _tmp19_->f_array;
+       _tmp20__length1 = _tmp19_->f_array_length1;
+       _tmp21_ = _tmp20_[1];
+       _vala_assert (g_strcmp0 (_tmp21_, "bar") == 0, "bar.f_array[1] == \"bar\"");
+       _tmp22_ = bar;
+       _tmp23_ = _tmp22_->f_struct;
+       _vala_assert (_tmp23_.bar == 42, "bar.f_struct.bar == 42");
+       _tmp24_ = bar;
+       _tmp25_ = _tmp24_->f_class;
+       _vala_assert (_tmp25_ == fc, "bar.f_class == fc");
+       _tmp26_ = bar;
+       _tmp27_ = _tmp26_->fu_string;
+       _vala_assert (g_strcmp0 (_tmp27_, "foo") == 0, "bar.fu_string == \"foo\"");
+       _tmp28_ = bar;
+       _tmp29_ = _tmp28_->fu_array;
+       _tmp29__length1 = _tmp28_->fu_array_length1;
+       _tmp30_ = _tmp29_[1];
+       _vala_assert (g_strcmp0 (_tmp30_, "bar") == 0, "bar.fu_array[1] == \"bar\"");
+       _tmp31_ = bar;
+       _tmp32_ = _tmp31_->fu_struct;
+       _tmp33_ = fs;
+       _vala_assert (_foo_struct_equal (_tmp32_, &_tmp33_) == TRUE, "bar.fu_struct == fs");
+       _tmp34_ = bar;
+       _tmp35_ = _tmp34_->fu_class;
+       _vala_assert (_tmp35_ == fc, "bar.fu_class == fc");
+       _tmp36_ = bar;
+       _tmp37_ = bar_get_p_simple (_tmp36_);
+       _tmp38_ = _tmp37_;
+       _vala_assert (_tmp38_ == 42, "bar.p_simple == 42");
+       _tmp39_ = bar;
+       _tmp40_ = bar_get_p_string (_tmp39_);
+       _tmp41_ = _tmp40_;
+       _vala_assert (g_strcmp0 (_tmp41_, "foo") == 0, "bar.p_string == \"foo\"");
+       _tmp42_ = bar;
+       _tmp43_ = bar_get_p_array (_tmp42_, &_tmp44_);
+       _tmp43__length1 = _tmp44_;
+       _tmp45_ = _tmp43_;
+       _tmp45__length1 = _tmp43__length1;
+       _tmp46_ = _tmp45_[1];
+       _vala_assert (g_strcmp0 (_tmp46_, "bar") == 0, "bar.p_array[1] == \"bar\"");
+       _tmp47_ = bar;
+       bar_get_p_struct (_tmp47_, &_tmp48_);
+       _tmp49_ = _tmp48_;
+       _vala_assert (_tmp49_.bar == 42, "bar.p_struct.bar == 42");
+       _tmp50_ = bar;
+       _tmp51_ = bar_get_p_class (_tmp50_);
+       _tmp52_ = _tmp51_;
+       _vala_assert (_tmp52_ == fc, "bar.p_class == fc");
+       _bar_unref0 (bar);
+       bar = NULL;
+       _tmp53_ = fs;
+       _vala_assert (_tmp53_.bar == 42, "fs.bar == 42");
+       _vala_assert (fc->bar == 42, "fc.bar == 42");
+       _vala_assert (g_strcmp0 (s, "foo") == 0, "s == \"foo\"");
+       _tmp54_ = a[1];
+       _vala_assert (g_strcmp0 (_tmp54_, "bar") == 0, "a[1] == \"bar\"");
+       _bar_unref0 (bar);
+       a = (_vala_array_free (a, a_length1, (GDestroyNotify) g_free), NULL);
+       _g_free0 (s);
+       _fooclass_unref0 (fc);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/objects/bug778632.c-expected b/tests/objects/bug778632.c-expected
new file mode 100644
index 000000000..6477b5790
--- /dev/null
+++ b/tests/objects/bug778632.c-expected
@@ -0,0 +1,236 @@
+/* objects_bug778632.c generated by valac, the Vala compiler
+ * generated from objects_bug778632.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+enum  {
+       FOO_BAR_SIGNAL,
+       FOO_NUM_SIGNALS
+};
+static guint foo_signals[FOO_NUM_SIGNALS] = {0};
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN void foo_bar_emit (Foo* self);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void g_cclosure_user_marshal_VOID__POINTER_INT_INT_INT (GClosure * closure,
+                                                        GValue * return_value,
+                                                        guint n_param_values,
+                                                        const GValue * param_values,
+                                                        gpointer invocation_hint,
+                                                        gpointer marshal_data);
+static GType foo_get_type_once (void);
+VALA_EXTERN void bar_callback (gint* a,
+                   gint a_length1,
+                   gint a_length2,
+                   gint a_length3);
+static void _vala_main (void);
+static void _bar_callback_foo_bar (Foo* _sender,
+                            gint* a,
+                            gint a_length1,
+                            gint a_length2,
+                            gint a_length3,
+                            gpointer self);
+
+void
+foo_bar_emit (Foo* self)
+{
+       gint* a = NULL;
+       gint* _tmp0_;
+       gint a_length1;
+       gint a_length2;
+       gint a_length3;
+       g_return_if_fail (IS_FOO (self));
+       _tmp0_ = g_new0 (gint, (2 * 3) * 2);
+       _tmp0_[0] = 1;
+       _tmp0_[1] = 2;
+       _tmp0_[2] = 3;
+       _tmp0_[3] = 4;
+       _tmp0_[4] = 5;
+       _tmp0_[5] = 6;
+       _tmp0_[6] = 7;
+       _tmp0_[7] = 8;
+       _tmp0_[8] = 9;
+       _tmp0_[9] = 10;
+       _tmp0_[10] = 11;
+       _tmp0_[11] = 12;
+       a = _tmp0_;
+       a_length1 = 2;
+       a_length2 = 3;
+       a_length3 = 2;
+       g_signal_emit (self, foo_signals[FOO_BAR_SIGNAL], 0, a, (gint) a_length1, (gint) a_length2, (gint) 
a_length3);
+       a = (g_free (a), NULL);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+g_cclosure_user_marshal_VOID__POINTER_INT_INT_INT (GClosure * closure,
+                                                   GValue * return_value,
+                                                   guint n_param_values,
+                                                   const GValue * param_values,
+                                                   gpointer invocation_hint,
+                                                   gpointer marshal_data)
+{
+       typedef void (*GMarshalFunc_VOID__POINTER_INT_INT_INT) (gpointer data1, gpointer arg_1, gint arg_2, 
gint arg_3, gint arg_4, gpointer data2);
+       register GMarshalFunc_VOID__POINTER_INT_INT_INT callback;
+       register GCClosure * cc;
+       register gpointer data1;
+       register gpointer data2;
+       cc = (GCClosure *) closure;
+       g_return_if_fail (n_param_values == 5);
+       if (G_CCLOSURE_SWAP_DATA (closure)) {
+               data1 = closure->data;
+               data2 = param_values->data[0].v_pointer;
+       } else {
+               data1 = param_values->data[0].v_pointer;
+               data2 = closure->data;
+       }
+       callback = (GMarshalFunc_VOID__POINTER_INT_INT_INT) (marshal_data ? marshal_data : cc->callback);
+       callback (data1, g_value_get_pointer (param_values + 1), g_value_get_int (param_values + 2), 
g_value_get_int (param_values + 3), g_value_get_int (param_values + 4), data2);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       foo_signals[FOO_BAR_SIGNAL] = g_signal_new ("bar", TYPE_FOO, G_SIGNAL_RUN_LAST, 0, NULL, NULL, 
g_cclosure_user_marshal_VOID__POINTER_INT_INT_INT, G_TYPE_NONE, 4, G_TYPE_POINTER, G_TYPE_INT, G_TYPE_INT, 
G_TYPE_INT);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+void
+bar_callback (gint* a,
+              gint a_length1,
+              gint a_length2,
+              gint a_length3)
+{
+       gint _tmp0_;
+       gint _tmp1_;
+       gint _tmp2_;
+       gint _tmp3_;
+       gint _tmp4_;
+       _tmp0_ = a_length1;
+       _vala_assert (_tmp0_ == 2, "a.length[0] == 2");
+       _tmp1_ = a_length2;
+       _vala_assert (_tmp1_ == 3, "a.length[1] == 3");
+       _tmp2_ = a_length3;
+       _vala_assert (_tmp2_ == 2, "a.length[2] == 2");
+       _tmp3_ = a[(((0 * a_length2) + 2) * a_length3) + 0];
+       _vala_assert (_tmp3_ == 5, "a[0,2,0] == 5");
+       _tmp4_ = a[(((1 * a_length2) + 2) * a_length3) + 1];
+       _vala_assert (_tmp4_ == 12, "a[1,2,1] == 12");
+}
+
+static void
+_bar_callback_foo_bar (Foo* _sender,
+                       gint* a,
+                       gint a_length1,
+                       gint a_length2,
+                       gint a_length3,
+                       gpointer self)
+{
+       bar_callback (a, a_length1, a_length2, a_length3);
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       g_signal_connect (foo, "bar", (GCallback) _bar_callback_foo_bar, NULL);
+       foo_bar_emit (foo);
+       _g_object_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/bug779219.c-expected b/tests/objects/bug779219.c-expected
new file mode 100644
index 000000000..e16787701
--- /dev/null
+++ b/tests/objects/bug779219.c-expected
@@ -0,0 +1,338 @@
+/* objects_bug779219.c generated by valac, the Vala compiler
+ * generated from objects_bug779219.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_IFOO (ifoo_get_type ())
+#define IFOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IFOO, IFoo))
+#define IS_IFOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IFOO))
+#define IFOO_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_IFOO, IFooIface))
+
+typedef struct _IFoo IFoo;
+typedef struct _IFooIface IFooIface;
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_FOO_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+enum  {
+       BAR_0_PROPERTY,
+       BAR_FOO_PROPERTY,
+       BAR_NUM_PROPERTIES
+};
+static GParamSpec* bar_properties[BAR_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _IFooIface {
+       GTypeInterface parent_iface;
+       gint (*get_foo) (IFoo* self);
+};
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+       gint (*get_foo) (Foo* self);
+};
+
+struct _Bar {
+       Foo parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       FooClass parent_class;
+};
+
+static gpointer foo_parent_class = NULL;
+static IFooIface * foo_ifoo_parent_iface = NULL;
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN GType ifoo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN gint ifoo_get_foo (IFoo* self);
+static GType ifoo_get_type_once (void);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_construct (GType object_type);
+VALA_EXTERN gint foo_get_foo (Foo* self);
+static GType foo_get_type_once (void);
+static void _vala_foo_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static GType bar_get_type_once (void);
+static void _vala_bar_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_main (void);
+
+gint
+ifoo_get_foo (IFoo* self)
+{
+       IFooIface* _iface_;
+       g_return_val_if_fail (IS_IFOO (self), 0);
+       _iface_ = IFOO_GET_INTERFACE (self);
+       if (_iface_->get_foo) {
+               return _iface_->get_foo (self);
+       }
+       return -1;
+}
+
+static void
+ifoo_default_init (IFooIface * iface,
+                   gpointer iface_data)
+{
+       g_object_interface_install_property (iface, g_param_spec_int ("foo", "foo", "foo", G_MININT, 
G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
+}
+
+static GType
+ifoo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (IFooIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) ifoo_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType ifoo_type_id;
+       ifoo_type_id = g_type_register_static (G_TYPE_INTERFACE, "IFoo", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (ifoo_type_id, G_TYPE_OBJECT);
+       return ifoo_type_id;
+}
+
+GType
+ifoo_get_type (void)
+{
+       static volatile gsize ifoo_type_id__volatile = 0;
+       if (g_once_init_enter (&ifoo_type_id__volatile)) {
+               GType ifoo_type_id;
+               ifoo_type_id = ifoo_get_type_once ();
+               g_once_init_leave (&ifoo_type_id__volatile, ifoo_type_id);
+       }
+       return ifoo_type_id__volatile;
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+gint
+foo_get_foo (Foo* self)
+{
+       FooClass* _klass_;
+       g_return_val_if_fail (IS_FOO (self), 0);
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->get_foo) {
+               return _klass_->get_foo (self);
+       }
+       return -1;
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       G_OBJECT_CLASS (klass)->get_property = _vala_foo_get_property;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_FOO_PROPERTY, 
foo_properties[FOO_FOO_PROPERTY] = g_param_spec_int ("foo", "foo", "foo", G_MININT, G_MAXINT, 0, 
G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
+}
+
+static void
+foo_ifoo_interface_init (IFooIface * iface,
+                         gpointer iface_data)
+{
+       foo_ifoo_parent_iface = g_type_interface_peek_parent (iface);
+       iface->get_foo = (gint (*) (IFoo *)) foo_get_foo;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       static const GInterfaceInfo ifoo_info = { (GInterfaceInitFunc) foo_ifoo_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 
G_TYPE_FLAG_ABSTRACT);
+       g_type_add_interface_static (foo_type_id, TYPE_IFOO, &ifoo_info);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_foo_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar * self = NULL;
+       self = (Bar*) foo_construct (object_type);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static gint
+bar_real_get_foo (Foo* base)
+{
+       gint result;
+       Bar* self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAR, Bar);
+       result = 42;
+       return result;
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       FOO_CLASS (klass)->get_foo = bar_real_get_foo;
+       G_OBJECT_CLASS (klass)->get_property = _vala_bar_get_property;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), BAR_FOO_PROPERTY, 
bar_properties[BAR_FOO_PROPERTY] = g_param_spec_int ("foo", "foo", "foo", G_MININT, G_MAXINT, 0, 
G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (TYPE_FOO, "Bar", &g_define_type_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_bar_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_BAR, Bar);
+       switch (property_id) {
+               case BAR_FOO_PROPERTY:
+               g_value_set_int (value, foo_get_foo (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_FOO, Foo)));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Bar* bar = NULL;
+       Bar* _tmp0_;
+       gint _tmp1_;
+       gint _tmp2_;
+       _tmp0_ = bar_new ();
+       bar = _tmp0_;
+       _tmp1_ = foo_get_foo (G_TYPE_CHECK_INSTANCE_CAST (bar, TYPE_FOO, Foo));
+       _tmp2_ = _tmp1_;
+       _vala_assert (_tmp2_ == 42, "bar.foo == 42");
+       _g_object_unref0 (bar);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/bug779955.c-expected b/tests/objects/bug779955.c-expected
new file mode 100644
index 000000000..b7c1aa9b9
--- /dev/null
+++ b/tests/objects/bug779955.c-expected
@@ -0,0 +1,223 @@
+/* objects_bug779955.c generated by valac, the Vala compiler
+ * generated from objects_bug779955.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_BAR_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _FooPrivate {
+       gint i;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+VALA_EXTERN gint foo_get_bar (Foo* self);
+VALA_EXTERN void foo_set_bar (Foo* self,
+                  gint value);
+static void foo_finalize (GObject * obj);
+static GType foo_get_type_once (void);
+static void _vala_foo_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_foo_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec);
+static void _vala_main (void);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+gint
+foo_get_bar (Foo* self)
+{
+       gint result;
+       g_return_val_if_fail (IS_FOO (self), 0);
+       result = self->priv->i;
+       return result;
+}
+
+void
+foo_set_bar (Foo* self,
+             gint value)
+{
+       g_return_if_fail (IS_FOO (self));
+       if (value == 42) {
+               self->priv->i = 23;
+       }
+       g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_BAR_PROPERTY]);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_foo_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_foo_set_property;
+       G_OBJECT_CLASS (klass)->finalize = foo_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_BAR_PROPERTY, 
foo_properties[FOO_BAR_PROPERTY] = g_param_spec_int ("bar", "bar", "bar", G_MININT, G_MAXINT, 0, 
G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+       self->priv->i = 42;
+}
+
+static void
+foo_finalize (GObject * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       G_OBJECT_CLASS (foo_parent_class)->finalize (obj);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_foo_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_BAR_PROPERTY:
+               g_value_set_int (value, foo_get_bar (self));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_foo_set_property (GObject * object,
+                        guint property_id,
+                        const GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_BAR_PROPERTY:
+               foo_set_bar (self, g_value_get_int (value));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Foo* f = NULL;
+       Foo* _tmp0_;
+       gint _tmp1_;
+       gint _tmp2_;
+       _tmp0_ = foo_new ();
+       f = _tmp0_;
+       foo_set_bar (f, 42);
+       _tmp1_ = foo_get_bar (f);
+       _tmp2_ = _tmp1_;
+       _vala_assert (_tmp2_ == 23, "f.bar == 23");
+       _g_object_unref0 (f);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/bug783897.c-expected b/tests/objects/bug783897.c-expected
new file mode 100644
index 000000000..ada7bc9cb
--- /dev/null
+++ b/tests/objects/bug783897.c-expected
@@ -0,0 +1,653 @@
+/* objects_bug783897.c generated by valac, the Vala compiler
+ * generated from objects_bug783897.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef enum  {
+       BAZ_VALUE = 42
+} Baz;
+
+#define TYPE_BAZ (baz_get_type ())
+
+#define TYPE_BAR (bar_get_type ())
+typedef struct _Bar Bar;
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+enum  {
+       FOO_SIGNAL_ENUM_SIGNAL,
+       FOO_SIGNAL_SIMPLE_TYPE_SIGNAL,
+       FOO_SIGNAL_STRUCT_SIGNAL,
+       FOO_SIGNAL_CUSTOM_SIGNAL,
+       FOO_SIGNAL_CUSTOM2_SIGNAL,
+       FOO_NUM_SIGNALS
+};
+static guint foo_signals[FOO_NUM_SIGNALS] = {0};
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Bar {
+       gint i;
+};
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType baz_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Bar* bar_dup (const Bar* self);
+VALA_EXTERN void bar_free (Bar* self);
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN void foo_run (Foo* self);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void g_cclosure_user_marshal_VOID__FOO_POINTER_POINTER_POINTER (GClosure * closure,
+                                                                GValue * return_value,
+                                                                guint n_param_values,
+                                                                const GValue * param_values,
+                                                                gpointer invocation_hint,
+                                                                gpointer marshal_data);
+static void g_cclosure_user_marshal_VOID__FOO_ENUM_INT_BOXED (GClosure * closure,
+                                                       GValue * return_value,
+                                                       guint n_param_values,
+                                                       const GValue * param_values,
+                                                       gpointer invocation_hint,
+                                                       gpointer marshal_data);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN void callback_enum (Baz* e);
+static gboolean _baz_equal (const Baz * s1,
+                     const Baz * s2);
+VALA_EXTERN void callback_simple_type (gint* t);
+static gboolean _int_equal (const gint * s1,
+                     const gint * s2);
+VALA_EXTERN void callback_struct (Bar* s);
+VALA_EXTERN void callback_custom (Foo* f,
+                      Baz* e,
+                      gint* t,
+                      Bar* s);
+VALA_EXTERN void callback_custom2 (Foo* f,
+                       Baz e,
+                       gint t,
+                       Bar* s);
+static void _vala_main (void);
+static void _callback_enum_foo_signal_enum (Foo* _sender,
+                                     Baz* e,
+                                     gpointer self);
+static void _callback_simple_type_foo_signal_simple_type (Foo* _sender,
+                                                   gint* t,
+                                                   gpointer self);
+static void _callback_struct_foo_signal_struct (Foo* _sender,
+                                         Bar* s,
+                                         gpointer self);
+static void _callback_custom_foo_signal_custom (Foo* _sender,
+                                         Foo* f,
+                                         Baz* e,
+                                         gint* t,
+                                         Bar* s,
+                                         gpointer self);
+static void _callback_custom2_foo_signal_custom2 (Foo* _sender,
+                                           Foo* f,
+                                           Baz e,
+                                           gint t,
+                                           Bar* s,
+                                           gpointer self);
+
+static GType
+baz_get_type_once (void)
+{
+       static const GEnumValue values[] = {{BAZ_VALUE, "BAZ_VALUE", "value"}, {0, NULL, NULL}};
+       GType baz_type_id;
+       baz_type_id = g_enum_register_static ("Baz", values);
+       return baz_type_id;
+}
+
+GType
+baz_get_type (void)
+{
+       static volatile gsize baz_type_id__volatile = 0;
+       if (g_once_init_enter (&baz_type_id__volatile)) {
+               GType baz_type_id;
+               baz_type_id = baz_get_type_once ();
+               g_once_init_leave (&baz_type_id__volatile, baz_type_id);
+       }
+       return baz_type_id__volatile;
+}
+
+Bar*
+bar_dup (const Bar* self)
+{
+       Bar* dup;
+       dup = g_new0 (Bar, 1);
+       memcpy (dup, self, sizeof (Bar));
+       return dup;
+}
+
+void
+bar_free (Bar* self)
+{
+       g_free (self);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       GType bar_type_id;
+       bar_type_id = g_boxed_type_register_static ("Bar", (GBoxedCopyFunc) bar_dup, (GBoxedFreeFunc) 
bar_free);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+void
+foo_run (Foo* self)
+{
+       Baz _tmp0_;
+       gint _tmp1_;
+       Bar _tmp2_ = {0};
+       Baz _tmp3_;
+       gint _tmp4_;
+       Bar _tmp5_ = {0};
+       Bar _tmp6_ = {0};
+       g_return_if_fail (IS_FOO (self));
+       _tmp0_ = BAZ_VALUE;
+       g_signal_emit (self, foo_signals[FOO_SIGNAL_ENUM_SIGNAL], 0, &_tmp0_);
+       _tmp1_ = 23;
+       g_signal_emit (self, foo_signals[FOO_SIGNAL_SIMPLE_TYPE_SIGNAL], 0, &_tmp1_);
+       _tmp2_.i = 4711;
+       g_signal_emit (self, foo_signals[FOO_SIGNAL_STRUCT_SIGNAL], 0, &_tmp2_);
+       _tmp3_ = BAZ_VALUE;
+       _tmp4_ = 23;
+       _tmp5_.i = 4711;
+       g_signal_emit (self, foo_signals[FOO_SIGNAL_CUSTOM_SIGNAL], 0, self, &_tmp3_, &_tmp4_, &_tmp5_);
+       _tmp6_.i = 4711;
+       g_signal_emit (self, foo_signals[FOO_SIGNAL_CUSTOM2_SIGNAL], 0, self, BAZ_VALUE, 23, &_tmp6_);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+g_cclosure_user_marshal_VOID__FOO_POINTER_POINTER_POINTER (GClosure * closure,
+                                                           GValue * return_value,
+                                                           guint n_param_values,
+                                                           const GValue * param_values,
+                                                           gpointer invocation_hint,
+                                                           gpointer marshal_data)
+{
+       typedef void (*GMarshalFunc_VOID__FOO_POINTER_POINTER_POINTER) (gpointer data1, gpointer arg_1, 
gpointer arg_2, gpointer arg_3, gpointer arg_4, gpointer data2);
+       register GMarshalFunc_VOID__FOO_POINTER_POINTER_POINTER callback;
+       register GCClosure * cc;
+       register gpointer data1;
+       register gpointer data2;
+       cc = (GCClosure *) closure;
+       g_return_if_fail (n_param_values == 5);
+       if (G_CCLOSURE_SWAP_DATA (closure)) {
+               data1 = closure->data;
+               data2 = param_values->data[0].v_pointer;
+       } else {
+               data1 = param_values->data[0].v_pointer;
+               data2 = closure->data;
+       }
+       callback = (GMarshalFunc_VOID__FOO_POINTER_POINTER_POINTER) (marshal_data ? marshal_data : 
cc->callback);
+       callback (data1, value_get_foo (param_values + 1), g_value_get_pointer (param_values + 2), 
g_value_get_pointer (param_values + 3), g_value_get_pointer (param_values + 4), data2);
+}
+
+static void
+g_cclosure_user_marshal_VOID__FOO_ENUM_INT_BOXED (GClosure * closure,
+                                                  GValue * return_value,
+                                                  guint n_param_values,
+                                                  const GValue * param_values,
+                                                  gpointer invocation_hint,
+                                                  gpointer marshal_data)
+{
+       typedef void (*GMarshalFunc_VOID__FOO_ENUM_INT_BOXED) (gpointer data1, gpointer arg_1, gint arg_2, 
gint arg_3, gpointer arg_4, gpointer data2);
+       register GMarshalFunc_VOID__FOO_ENUM_INT_BOXED callback;
+       register GCClosure * cc;
+       register gpointer data1;
+       register gpointer data2;
+       cc = (GCClosure *) closure;
+       g_return_if_fail (n_param_values == 5);
+       if (G_CCLOSURE_SWAP_DATA (closure)) {
+               data1 = closure->data;
+               data2 = param_values->data[0].v_pointer;
+       } else {
+               data1 = param_values->data[0].v_pointer;
+               data2 = closure->data;
+       }
+       callback = (GMarshalFunc_VOID__FOO_ENUM_INT_BOXED) (marshal_data ? marshal_data : cc->callback);
+       callback (data1, value_get_foo (param_values + 1), g_value_get_enum (param_values + 2), 
g_value_get_int (param_values + 3), g_value_get_boxed (param_values + 4), data2);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       foo_signals[FOO_SIGNAL_ENUM_SIGNAL] = g_signal_new ("signal-enum", TYPE_FOO, G_SIGNAL_RUN_LAST, 0, 
NULL, NULL, g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER);
+       foo_signals[FOO_SIGNAL_SIMPLE_TYPE_SIGNAL] = g_signal_new ("signal-simple-type", TYPE_FOO, 
G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER);
+       foo_signals[FOO_SIGNAL_STRUCT_SIGNAL] = g_signal_new ("signal-struct", TYPE_FOO, G_SIGNAL_RUN_LAST, 
0, NULL, NULL, g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER);
+       foo_signals[FOO_SIGNAL_CUSTOM_SIGNAL] = g_signal_new ("signal-custom", TYPE_FOO, G_SIGNAL_RUN_LAST, 
0, NULL, NULL, g_cclosure_user_marshal_VOID__FOO_POINTER_POINTER_POINTER, G_TYPE_NONE, 4, TYPE_FOO, 
G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_POINTER);
+       foo_signals[FOO_SIGNAL_CUSTOM2_SIGNAL] = g_signal_new ("signal-custom2", TYPE_FOO, G_SIGNAL_RUN_LAST, 
0, NULL, NULL, g_cclosure_user_marshal_VOID__FOO_ENUM_INT_BOXED, G_TYPE_NONE, 4, TYPE_FOO, TYPE_BAZ, 
G_TYPE_INT, TYPE_BAR);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static gboolean
+_baz_equal (const Baz * s1,
+            const Baz * s2)
+{
+       if (s1 == s2) {
+               return TRUE;
+       }
+       if (s1 == NULL) {
+               return FALSE;
+       }
+       if (s2 == NULL) {
+               return FALSE;
+       }
+       return (*s1) == (*s2);
+}
+
+void
+callback_enum (Baz* e)
+{
+       Baz _tmp0_;
+       _tmp0_ = BAZ_VALUE;
+       _vala_assert (_baz_equal (e, &_tmp0_) == TRUE, "e == Baz.VALUE");
+}
+
+static gboolean
+_int_equal (const gint * s1,
+            const gint * s2)
+{
+       if (s1 == s2) {
+               return TRUE;
+       }
+       if (s1 == NULL) {
+               return FALSE;
+       }
+       if (s2 == NULL) {
+               return FALSE;
+       }
+       return (*s1) == (*s2);
+}
+
+void
+callback_simple_type (gint* t)
+{
+       gint _tmp0_;
+       _tmp0_ = 23;
+       _vala_assert (_int_equal (t, &_tmp0_) == TRUE, "t == 23");
+}
+
+void
+callback_struct (Bar* s)
+{
+       _vala_assert ((*s).i == 4711, "s.i == 4711");
+}
+
+void
+callback_custom (Foo* f,
+                 Baz* e,
+                 gint* t,
+                 Bar* s)
+{
+       Baz _tmp0_;
+       gint _tmp1_;
+       g_return_if_fail (IS_FOO (f));
+       _tmp0_ = BAZ_VALUE;
+       _vala_assert (_baz_equal (e, &_tmp0_) == TRUE, "e == Baz.VALUE");
+       _tmp1_ = 23;
+       _vala_assert (_int_equal (t, &_tmp1_) == TRUE, "t == 23");
+       _vala_assert ((*s).i == 4711, "s.i == 4711");
+}
+
+void
+callback_custom2 (Foo* f,
+                  Baz e,
+                  gint t,
+                  Bar* s)
+{
+       Bar _tmp0_;
+       g_return_if_fail (IS_FOO (f));
+       g_return_if_fail (s != NULL);
+       _vala_assert (e == BAZ_VALUE, "e == Baz.VALUE");
+       _vala_assert (t == 23, "t == 23");
+       _tmp0_ = *s;
+       _vala_assert (_tmp0_.i == 4711, "s.i == 4711");
+}
+
+static void
+_callback_enum_foo_signal_enum (Foo* _sender,
+                                Baz* e,
+                                gpointer self)
+{
+       callback_enum (e);
+}
+
+static void
+_callback_simple_type_foo_signal_simple_type (Foo* _sender,
+                                              gint* t,
+                                              gpointer self)
+{
+       callback_simple_type (t);
+}
+
+static void
+_callback_struct_foo_signal_struct (Foo* _sender,
+                                    Bar* s,
+                                    gpointer self)
+{
+       callback_struct (s);
+}
+
+static void
+_callback_custom_foo_signal_custom (Foo* _sender,
+                                    Foo* f,
+                                    Baz* e,
+                                    gint* t,
+                                    Bar* s,
+                                    gpointer self)
+{
+       callback_custom (f, e, t, s);
+}
+
+static void
+_callback_custom2_foo_signal_custom2 (Foo* _sender,
+                                      Foo* f,
+                                      Baz e,
+                                      gint t,
+                                      Bar* s,
+                                      gpointer self)
+{
+       callback_custom2 (f, e, t, s);
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       g_signal_connect (foo, "signal-enum", (GCallback) _callback_enum_foo_signal_enum, NULL);
+       g_signal_connect (foo, "signal-simple-type", (GCallback) 
_callback_simple_type_foo_signal_simple_type, NULL);
+       g_signal_connect (foo, "signal-struct", (GCallback) _callback_struct_foo_signal_struct, NULL);
+       g_signal_connect (foo, "signal-custom", (GCallback) _callback_custom_foo_signal_custom, NULL);
+       g_signal_connect (foo, "signal-custom2", (GCallback) _callback_custom2_foo_signal_custom2, NULL);
+       foo_run (foo);
+       _foo_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/bug788964.c-expected b/tests/objects/bug788964.c-expected
new file mode 100644
index 000000000..be66fe795
--- /dev/null
+++ b/tests/objects/bug788964.c-expected
@@ -0,0 +1,342 @@
+/* objects_bug788964.c generated by valac, the Vala compiler
+ * generated from objects_bug788964.vala, do not modify */
+
+#include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+enum  {
+       FOO_LAST_SIGNAL,
+       FOO_NUM_SIGNALS
+};
+static guint foo_signals[FOO_NUM_SIGNALS] = {0};
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+enum  {
+       BAR_0_PROPERTY,
+       BAR_DUMMY_PROPERTY,
+       BAR_LAST_PROPERTY,
+       BAR_NUM_PROPERTIES
+};
+static GParamSpec* bar_properties[BAR_NUM_PROPERTIES];
+#define _g_free0(var) (var = (g_free (var), NULL))
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _Bar {
+       GObject parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       GObjectClass parent_class;
+};
+
+struct _BarPrivate {
+       gchar* _dummy;
+       gchar* _last;
+};
+
+static gpointer foo_parent_class = NULL;
+static gint Bar_private_offset;
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static GType foo_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+VALA_EXTERN const gchar* bar_get_dummy (Bar* self);
+VALA_EXTERN void bar_set_dummy (Bar* self,
+                    const gchar* value);
+VALA_EXTERN const gchar* bar_get_last (Bar* self);
+VALA_EXTERN void bar_set_last (Bar* self,
+                   const gchar* value);
+static void bar_finalize (GObject * obj);
+static GType bar_get_type_once (void);
+static void _vala_bar_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_bar_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec);
+static void _vala_main (void);
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       foo_signals[FOO_LAST_SIGNAL] = g_signal_new ("last", TYPE_FOO, G_SIGNAL_RUN_LAST, 0, NULL, NULL, 
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static inline gpointer
+bar_get_instance_private (Bar* self)
+{
+       return G_STRUCT_MEMBER_P (self, Bar_private_offset);
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar * self = NULL;
+       self = (Bar*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+const gchar*
+bar_get_dummy (Bar* self)
+{
+       const gchar* result;
+       const gchar* _tmp0_;
+       g_return_val_if_fail (IS_BAR (self), NULL);
+       _tmp0_ = self->priv->_dummy;
+       result = _tmp0_;
+       return result;
+}
+
+void
+bar_set_dummy (Bar* self,
+               const gchar* value)
+{
+       gchar* old_value;
+       g_return_if_fail (IS_BAR (self));
+       old_value = bar_get_dummy (self);
+       if (g_strcmp0 (value, old_value) != 0) {
+               gchar* _tmp0_;
+               _tmp0_ = g_strdup (value);
+               _g_free0 (self->priv->_dummy);
+               self->priv->_dummy = _tmp0_;
+               g_object_notify_by_pspec ((GObject *) self, bar_properties[BAR_DUMMY_PROPERTY]);
+       }
+}
+
+const gchar*
+bar_get_last (Bar* self)
+{
+       const gchar* result;
+       const gchar* _tmp0_;
+       g_return_val_if_fail (IS_BAR (self), NULL);
+       _tmp0_ = self->priv->_last;
+       result = _tmp0_;
+       return result;
+}
+
+void
+bar_set_last (Bar* self,
+              const gchar* value)
+{
+       gchar* old_value;
+       g_return_if_fail (IS_BAR (self));
+       old_value = bar_get_last (self);
+       if (g_strcmp0 (value, old_value) != 0) {
+               gchar* _tmp0_;
+               _tmp0_ = g_strdup (value);
+               _g_free0 (self->priv->_last);
+               self->priv->_last = _tmp0_;
+               g_object_notify_by_pspec ((GObject *) self, bar_properties[BAR_LAST_PROPERTY]);
+       }
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Bar_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_bar_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_bar_set_property;
+       G_OBJECT_CLASS (klass)->finalize = bar_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), BAR_DUMMY_PROPERTY, 
bar_properties[BAR_DUMMY_PROPERTY] = g_param_spec_string ("dummy", "dummy", "dummy", NULL, 
G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), BAR_LAST_PROPERTY, 
bar_properties[BAR_LAST_PROPERTY] = g_param_spec_string ("last", "last", "last", NULL, G_PARAM_STATIC_STRINGS 
| G_PARAM_READABLE | G_PARAM_WRITABLE));
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+       self->priv = bar_get_instance_private (self);
+}
+
+static void
+bar_finalize (GObject * obj)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       _g_free0 (self->priv->_dummy);
+       _g_free0 (self->priv->_last);
+       G_OBJECT_CLASS (bar_parent_class)->finalize (obj);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (G_TYPE_OBJECT, "Bar", &g_define_type_info, 0);
+       Bar_private_offset = g_type_add_instance_private (bar_type_id, sizeof (BarPrivate));
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_bar_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_BAR, Bar);
+       switch (property_id) {
+               case BAR_DUMMY_PROPERTY:
+               g_value_set_string (value, bar_get_dummy (self));
+               break;
+               case BAR_LAST_PROPERTY:
+               g_value_set_string (value, bar_get_last (self));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_bar_set_property (GObject * object,
+                        guint property_id,
+                        const GValue * value,
+                        GParamSpec * pspec)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_BAR, Bar);
+       switch (property_id) {
+               case BAR_DUMMY_PROPERTY:
+               bar_set_dummy (self, g_value_get_string (value));
+               break;
+               case BAR_LAST_PROPERTY:
+               bar_set_last (self, g_value_get_string (value));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/bug795521.c-expected b/tests/objects/bug795521.c-expected
new file mode 100644
index 000000000..bf0ed1e47
--- /dev/null
+++ b/tests/objects/bug795521.c-expected
@@ -0,0 +1,466 @@
+/* objects_bug795521.c generated by valac, the Vala compiler
+ * generated from objects_bug795521.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _FooClassPrivate FooClassPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+       gint faz;
+       gint foor;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+       gint baz;
+       gint boor;
+};
+
+struct _FooPrivate {
+       GRecMutex __lock_faz;
+       GRecMutex __lock_foor;
+       gint _foop;
+       GRecMutex __lock_foop;
+};
+
+struct _FooClassPrivate {
+       GRecMutex __lock_baz;
+       GRecMutex __lock_boor;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+VALA_EXTERN gint maz;
+GRecMutex __lock_foo_maz = {0};
+gint maz = 0;
+VALA_EXTERN gint foo_moor;
+GRecMutex __lock_foo_foo_moor = {0};
+gint foo_moor = 0;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+#define FOO_GET_CLASS_PRIVATE(klass) (G_TYPE_CLASS_GET_PRIVATE (klass, TYPE_FOO, FooClassPrivate))
+VALA_EXTERN void foo_use (Foo* self);
+VALA_EXTERN gint foo_get_foop (Foo* self);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+VALA_EXTERN void foo_set_foop (Foo* self,
+                   gint value);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+void
+foo_use (Foo* self)
+{
+       GError* _inner_error0_ = NULL;
+       g_return_if_fail (IS_FOO (self));
+       {
+               g_rec_mutex_lock (&self->priv->__lock_faz);
+               {
+               }
+               __finally0:
+               {
+                       g_rec_mutex_unlock (&self->priv->__lock_faz);
+               }
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+       }
+       {
+               g_rec_mutex_lock (&FOO_GET_CLASS_PRIVATE (FOO_GET_CLASS (self))->__lock_baz);
+               {
+               }
+               __finally1:
+               {
+                       g_rec_mutex_unlock (&FOO_GET_CLASS_PRIVATE (FOO_GET_CLASS (self))->__lock_baz);
+               }
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+       }
+       {
+               g_rec_mutex_lock (&__lock_foo_maz);
+               {
+               }
+               __finally2:
+               {
+                       g_rec_mutex_unlock (&__lock_foo_maz);
+               }
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+       }
+       {
+               g_rec_mutex_lock (&self->priv->__lock_foor);
+               {
+               }
+               __finally3:
+               {
+                       g_rec_mutex_unlock (&self->priv->__lock_foor);
+               }
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+       }
+       {
+               g_rec_mutex_lock (&FOO_GET_CLASS_PRIVATE (FOO_GET_CLASS (self))->__lock_boor);
+               {
+               }
+               __finally4:
+               {
+                       g_rec_mutex_unlock (&FOO_GET_CLASS_PRIVATE (FOO_GET_CLASS (self))->__lock_boor);
+               }
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+       }
+       {
+               g_rec_mutex_lock (&__lock_foo_foo_moor);
+               {
+               }
+               __finally5:
+               {
+                       g_rec_mutex_unlock (&__lock_foo_foo_moor);
+               }
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+       }
+       {
+               gint _tmp0_;
+               _tmp0_ = self->priv->_foop;
+               g_rec_mutex_lock (&self->priv->__lock_foop);
+               {
+               }
+               __finally6:
+               {
+                       gint _tmp1_;
+                       _tmp1_ = self->priv->_foop;
+                       g_rec_mutex_unlock (&self->priv->__lock_foop);
+               }
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+       }
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+gint
+foo_get_foop (Foo* self)
+{
+       gint result;
+       g_return_val_if_fail (IS_FOO (self), 0);
+       result = self->priv->_foop;
+       return result;
+}
+
+void
+foo_set_foop (Foo* self,
+              gint value)
+{
+       g_return_if_fail (IS_FOO (self));
+       self->priv->_foop = value;
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+       g_rec_mutex_init (&FOO_GET_CLASS_PRIVATE (klass)->__lock_baz);
+       g_rec_mutex_init (&__lock_foo_maz);
+       g_rec_mutex_init (&FOO_GET_CLASS_PRIVATE (klass)->__lock_boor);
+       g_rec_mutex_init (&__lock_foo_foo_moor);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+       g_rec_mutex_init (&self->priv->__lock_faz);
+       g_rec_mutex_init (&self->priv->__lock_foor);
+       g_rec_mutex_init (&self->priv->__lock_foop);
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+       g_rec_mutex_clear (&self->priv->__lock_faz);
+       g_rec_mutex_clear (&self->priv->__lock_foor);
+       g_rec_mutex_clear (&self->priv->__lock_foop);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/chainup.c-expected b/tests/objects/chainup.c-expected
new file mode 100644
index 000000000..a99544e1b
--- /dev/null
+++ b/tests/objects/chainup.c-expected
@@ -0,0 +1,564 @@
+/* objects_chainup.c generated by valac, the Vala compiler
+ * generated from objects_chainup.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <stdarg.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO_BASE (foo_base_get_type ())
+#define FOO_BASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO_BASE, FooBase))
+#define FOO_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO_BASE, FooBaseClass))
+#define IS_FOO_BASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO_BASE))
+#define IS_FOO_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO_BASE))
+#define FOO_BASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO_BASE, FooBaseClass))
+
+typedef struct _FooBase FooBase;
+typedef struct _FooBaseClass FooBaseClass;
+typedef struct _FooBasePrivate FooBasePrivate;
+typedef struct _ParamSpecFooBase ParamSpecFooBase;
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+#define _foo_base_unref0(var) ((var == NULL) ? NULL : (var = (foo_base_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _FooBase {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooBasePrivate * priv;
+       gint bar;
+};
+
+struct _FooBaseClass {
+       GTypeClass parent_class;
+       void (*finalize) (FooBase *self);
+};
+
+struct _ParamSpecFooBase {
+       GParamSpec parent_instance;
+};
+
+struct _Foo {
+       FooBase parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       FooBaseClass parent_class;
+};
+
+static gpointer foo_base_parent_class = NULL;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_base_ref (gpointer instance);
+VALA_EXTERN void foo_base_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo_base (const gchar* name,
+                                 const gchar* nick,
+                                 const gchar* blurb,
+                                 GType object_type,
+                                 GParamFlags flags);
+VALA_EXTERN void value_set_foo_base (GValue* value,
+                         gpointer v_object);
+VALA_EXTERN void value_take_foo_base (GValue* value,
+                          gpointer v_object);
+VALA_EXTERN gpointer value_get_foo_base (const GValue* value);
+VALA_EXTERN GType foo_base_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (FooBase, foo_base_unref)
+VALA_EXTERN FooBase* foo_base_new (gint _,
+                       ...);
+VALA_EXTERN FooBase* foo_base_construct (GType object_type,
+                             gint _,
+                             ...);
+VALA_EXTERN FooBase* foo_base_constructv (GType object_type,
+                              gint _,
+                              va_list _vala_va_list);
+VALA_EXTERN FooBase* foo_base_new_baz (gint _,
+                           ...);
+VALA_EXTERN FooBase* foo_base_construct_baz (GType object_type,
+                                 gint _,
+                                 ...);
+VALA_EXTERN FooBase* foo_base_constructv_baz (GType object_type,
+                                  gint _,
+                                  va_list _vala_va_list);
+static void foo_base_finalize (FooBase * obj);
+static GType foo_base_get_type_once (void);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_base_unref)
+VALA_EXTERN Foo* foo_new (gint _,
+              ...);
+VALA_EXTERN Foo* foo_construct (GType object_type,
+                    gint _,
+                    ...);
+VALA_EXTERN Foo* foo_constructv (GType object_type,
+                     gint _,
+                     va_list _vala_va_list);
+VALA_EXTERN Foo* foo_new_baz (gint _,
+                  ...);
+VALA_EXTERN Foo* foo_construct_baz (GType object_type,
+                        gint _,
+                        ...);
+VALA_EXTERN Foo* foo_constructv_baz (GType object_type,
+                         gint _,
+                         va_list _vala_va_list);
+VALA_EXTERN Foo* foo_new_qux (gint _,
+                  ...);
+VALA_EXTERN Foo* foo_construct_qux (GType object_type,
+                        gint _,
+                        ...);
+VALA_EXTERN Foo* foo_constructv_qux (GType object_type,
+                         gint _,
+                         va_list _vala_va_list);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+FooBase*
+foo_base_constructv (GType object_type,
+                     gint _,
+                     va_list _vala_va_list)
+{
+       FooBase* self = NULL;
+       va_list v = {0};
+       self = (FooBase*) g_type_create_instance (object_type);
+       va_copy (v, _vala_va_list);
+       self->bar = va_arg (v, gint);
+       va_end (v);
+       return self;
+}
+
+FooBase*
+foo_base_new (gint _,
+              ...)
+{
+       va_list _vala_va_list_obj;
+       va_start (_vala_va_list_obj, _);
+       return foo_base_constructv (TYPE_FOO_BASE, _, _vala_va_list_obj);
+}
+
+FooBase*
+foo_base_construct (GType object_type,
+                    gint _,
+                    ...)
+{
+       va_list _vala_va_list_obj;
+       va_start (_vala_va_list_obj, _);
+       return foo_base_constructv (object_type, _, _vala_va_list_obj);
+}
+
+FooBase*
+foo_base_constructv_baz (GType object_type,
+                         gint _,
+                         va_list _vala_va_list)
+{
+       FooBase* self = NULL;
+       va_list v = {0};
+       va_copy (v, _vala_va_list);
+       self = (FooBase*) foo_base_constructv (object_type, _, v);
+       va_end (v);
+       return self;
+}
+
+FooBase*
+foo_base_new_baz (gint _,
+                  ...)
+{
+       va_list _vala_va_list_obj;
+       va_start (_vala_va_list_obj, _);
+       return foo_base_constructv_baz (TYPE_FOO_BASE, _, _vala_va_list_obj);
+}
+
+FooBase*
+foo_base_construct_baz (GType object_type,
+                        gint _,
+                        ...)
+{
+       va_list _vala_va_list_obj;
+       va_start (_vala_va_list_obj, _);
+       return foo_base_constructv_baz (object_type, _, _vala_va_list_obj);
+}
+
+static void
+value_foo_base_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_base_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_base_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_base_copy_value (const GValue* src_value,
+                           GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_base_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_base_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_base_collect_value (GValue* value,
+                              guint n_collect_values,
+                              GTypeCValue* collect_values,
+                              guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               FooBase * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_base_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_base_lcopy_value (const GValue* value,
+                            guint n_collect_values,
+                            GTypeCValue* collect_values,
+                            guint collect_flags)
+{
+       FooBase ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_base_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo_base (const gchar* name,
+                     const gchar* nick,
+                     const gchar* blurb,
+                     GType object_type,
+                     GParamFlags flags)
+{
+       ParamSpecFooBase* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO_BASE), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo_base (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO_BASE), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo_base (GValue* value,
+                    gpointer v_object)
+{
+       FooBase * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO_BASE));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO_BASE));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_base_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_base_unref (old);
+       }
+}
+
+void
+value_take_foo_base (GValue* value,
+                     gpointer v_object)
+{
+       FooBase * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO_BASE));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO_BASE));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_base_unref (old);
+       }
+}
+
+static void
+foo_base_class_init (FooBaseClass * klass,
+                     gpointer klass_data)
+{
+       foo_base_parent_class = g_type_class_peek_parent (klass);
+       ((FooBaseClass *) klass)->finalize = foo_base_finalize;
+}
+
+static void
+foo_base_instance_init (FooBase * self,
+                        gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_base_finalize (FooBase * obj)
+{
+       FooBase * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO_BASE, FooBase);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_base_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_base_init, 
value_foo_base_free_value, value_foo_base_copy_value, value_foo_base_peek_pointer, "p", 
value_foo_base_collect_value, "p", value_foo_base_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooBaseClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_base_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(FooBase), 0, (GInstanceInitFunc) foo_base_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_base_type_id;
+       foo_base_type_id = g_type_register_fundamental (g_type_fundamental_next (), "FooBase", 
&g_define_type_info, &g_define_type_fundamental_info, 0);
+       return foo_base_type_id;
+}
+
+GType
+foo_base_get_type (void)
+{
+       static volatile gsize foo_base_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_base_type_id__volatile)) {
+               GType foo_base_type_id;
+               foo_base_type_id = foo_base_get_type_once ();
+               g_once_init_leave (&foo_base_type_id__volatile, foo_base_type_id);
+       }
+       return foo_base_type_id__volatile;
+}
+
+gpointer
+foo_base_ref (gpointer instance)
+{
+       FooBase * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_base_unref (gpointer instance)
+{
+       FooBase * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_BASE_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+Foo*
+foo_constructv (GType object_type,
+                gint _,
+                va_list _vala_va_list)
+{
+       Foo* self = NULL;
+       va_list v = {0};
+       va_copy (v, _vala_va_list);
+       self = (Foo*) foo_base_constructv (object_type, _, v);
+       va_end (v);
+       return self;
+}
+
+Foo*
+foo_new (gint _,
+         ...)
+{
+       va_list _vala_va_list_obj;
+       va_start (_vala_va_list_obj, _);
+       return foo_constructv (TYPE_FOO, _, _vala_va_list_obj);
+}
+
+Foo*
+foo_construct (GType object_type,
+               gint _,
+               ...)
+{
+       va_list _vala_va_list_obj;
+       va_start (_vala_va_list_obj, _);
+       return foo_constructv (object_type, _, _vala_va_list_obj);
+}
+
+Foo*
+foo_constructv_baz (GType object_type,
+                    gint _,
+                    va_list _vala_va_list)
+{
+       Foo* self = NULL;
+       va_list v = {0};
+       va_copy (v, _vala_va_list);
+       self = (Foo*) foo_base_constructv_baz (object_type, _, v);
+       va_end (v);
+       return self;
+}
+
+Foo*
+foo_new_baz (gint _,
+             ...)
+{
+       va_list _vala_va_list_obj;
+       va_start (_vala_va_list_obj, _);
+       return foo_constructv_baz (TYPE_FOO, _, _vala_va_list_obj);
+}
+
+Foo*
+foo_construct_baz (GType object_type,
+                   gint _,
+                   ...)
+{
+       va_list _vala_va_list_obj;
+       va_start (_vala_va_list_obj, _);
+       return foo_constructv_baz (object_type, _, _vala_va_list_obj);
+}
+
+Foo*
+foo_constructv_qux (GType object_type,
+                    gint _,
+                    va_list _vala_va_list)
+{
+       Foo* self = NULL;
+       va_list v = {0};
+       va_copy (v, _vala_va_list);
+       self = (Foo*) foo_constructv_baz (object_type, _, v);
+       va_end (v);
+       return self;
+}
+
+Foo*
+foo_new_qux (gint _,
+             ...)
+{
+       va_list _vala_va_list_obj;
+       va_start (_vala_va_list_obj, _);
+       return foo_constructv_qux (TYPE_FOO, _, _vala_va_list_obj);
+}
+
+Foo*
+foo_construct_qux (GType object_type,
+                   gint _,
+                   ...)
+{
+       va_list _vala_va_list_obj;
+       va_start (_vala_va_list_obj, _);
+       return foo_constructv_qux (object_type, _, _vala_va_list_obj);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (TYPE_FOO_BASE, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       Foo* _tmp1_;
+       Foo* _tmp2_;
+       Foo* _tmp3_;
+       Foo* _tmp4_;
+       Foo* _tmp5_;
+       _tmp0_ = foo_new (0, 10, NULL);
+       foo = _tmp0_;
+       _tmp1_ = foo;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, TYPE_FOO_BASE, FooBase)->bar == 10, "foo.bar == 
10");
+       _tmp2_ = foo_new_baz (0, 20, NULL);
+       _foo_base_unref0 (foo);
+       foo = _tmp2_;
+       _tmp3_ = foo;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, TYPE_FOO_BASE, FooBase)->bar == 20, "foo.bar == 
20");
+       _tmp4_ = foo_new_qux (0, 30, NULL);
+       _foo_base_unref0 (foo);
+       foo = _tmp4_;
+       _tmp5_ = foo;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, TYPE_FOO_BASE, FooBase)->bar == 30, "foo.bar == 
30");
+       _foo_base_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/class-ccode-cprefix.c-expected b/tests/objects/class-ccode-cprefix.c-expected
new file mode 100644
index 000000000..415e71c1f
--- /dev/null
+++ b/tests/objects/class-ccode-cprefix.c-expected
@@ -0,0 +1,398 @@
+/* objects_class_ccode_cprefix.c generated by valac, the Vala compiler
+ * generated from objects_class_ccode_cprefix.vala, do not modify */
+
+#include <glib-object.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+
+#define TYPE_MANAM (manam_get_type ())
+#define MANAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MANAM, Manam))
+#define MANAM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MANAM, ManamClass))
+#define IS_MANAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MANAM))
+#define IS_MANAM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MANAM))
+#define MANAM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MANAM, ManamClass))
+
+typedef struct _Manam Manam;
+typedef struct _ManamClass ManamClass;
+typedef struct _ManamPrivate ManamPrivate;
+typedef struct _ParamSpecManam ParamSpecManam;
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _Manam {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       ManamPrivate * priv;
+};
+
+struct _ManamClass {
+       GTypeClass parent_class;
+       void (*finalize) (Manam *self);
+};
+
+struct _ParamSpecManam {
+       GParamSpec parent_instance;
+};
+
+static gpointer foo_parent_class = NULL;
+static gpointer manam_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* bar_new (void);
+VALA_EXTERN Foo* bar_construct (GType object_type);
+static GObject * bar_constructor (GType type,
+                           guint n_construct_properties,
+                           GObjectConstructParam * construct_properties);
+static void bar_finalize (GObject * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN gpointer baz_ref (gpointer instance);
+VALA_EXTERN void baz_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_manam (const gchar* name,
+                              const gchar* nick,
+                              const gchar* blurb,
+                              GType object_type,
+                              GParamFlags flags);
+VALA_EXTERN void value_set_manam (GValue* value,
+                      gpointer v_object);
+VALA_EXTERN void value_take_manam (GValue* value,
+                       gpointer v_object);
+VALA_EXTERN gpointer value_get_manam (const GValue* value);
+VALA_EXTERN GType manam_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Manam, baz_unref)
+VALA_EXTERN Manam* baz_new (void);
+VALA_EXTERN Manam* baz_construct (GType object_type);
+static void baz_finalize (Manam * obj);
+static GType manam_get_type_once (void);
+static void _vala_main (void);
+
+Foo*
+bar_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+bar_new (void)
+{
+       return bar_construct (TYPE_FOO);
+}
+
+static GObject *
+bar_constructor (GType type,
+                 guint n_construct_properties,
+                 GObjectConstructParam * construct_properties)
+{
+       GObject * obj;
+       GObjectClass * parent_class;
+       Foo * self;
+       parent_class = G_OBJECT_CLASS (foo_parent_class);
+       obj = parent_class->constructor (type, n_construct_properties, construct_properties);
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       return obj;
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       G_OBJECT_CLASS (klass)->constructor = bar_constructor;
+       G_OBJECT_CLASS (klass)->finalize = bar_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static void
+bar_finalize (GObject * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       G_OBJECT_CLASS (foo_parent_class)->finalize (obj);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+Manam*
+baz_construct (GType object_type)
+{
+       Manam* self = NULL;
+       self = (Manam*) g_type_create_instance (object_type);
+       return self;
+}
+
+Manam*
+baz_new (void)
+{
+       return baz_construct (TYPE_MANAM);
+}
+
+static void
+value_manam_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_manam_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               baz_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_manam_copy_value (const GValue* src_value,
+                        GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = baz_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_manam_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_manam_collect_value (GValue* value,
+                           guint n_collect_values,
+                           GTypeCValue* collect_values,
+                           guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Manam * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = baz_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_manam_lcopy_value (const GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       Manam ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = baz_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_manam (const gchar* name,
+                  const gchar* nick,
+                  const gchar* blurb,
+                  GType object_type,
+                  GParamFlags flags)
+{
+       ParamSpecManam* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_MANAM), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_manam (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_MANAM), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_manam (GValue* value,
+                 gpointer v_object)
+{
+       Manam * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_MANAM));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_MANAM));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               baz_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               baz_unref (old);
+       }
+}
+
+void
+value_take_manam (GValue* value,
+                  gpointer v_object)
+{
+       Manam * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_MANAM));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_MANAM));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               baz_unref (old);
+       }
+}
+
+static void
+manam_class_init (ManamClass * klass,
+                  gpointer klass_data)
+{
+       manam_parent_class = g_type_class_peek_parent (klass);
+       ((ManamClass *) klass)->finalize = baz_finalize;
+}
+
+static void
+manam_instance_init (Manam * self,
+                     gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+baz_finalize (Manam * obj)
+{
+       Manam * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_MANAM, Manam);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+manam_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_manam_init, value_manam_free_value, 
value_manam_copy_value, value_manam_peek_pointer, "p", value_manam_collect_value, "p", 
value_manam_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (ManamClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) manam_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Manam), 
0, (GInstanceInitFunc) manam_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType manam_type_id;
+       manam_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Manam", 
&g_define_type_info, &g_define_type_fundamental_info, 0);
+       return manam_type_id;
+}
+
+GType
+manam_get_type (void)
+{
+       static volatile gsize manam_type_id__volatile = 0;
+       if (g_once_init_enter (&manam_type_id__volatile)) {
+               GType manam_type_id;
+               manam_type_id = manam_get_type_once ();
+               g_once_init_leave (&manam_type_id__volatile, manam_type_id);
+       }
+       return manam_type_id__volatile;
+}
+
+gpointer
+baz_ref (gpointer instance)
+{
+       Manam * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+baz_unref (gpointer instance)
+{
+       Manam * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               MANAM_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/class-destroysinstance.c-expected b/tests/objects/class-destroysinstance.c-expected
new file mode 100644
index 000000000..96fc1b9b4
--- /dev/null
+++ b/tests/objects/class-destroysinstance.c-expected
@@ -0,0 +1,142 @@
+/* objects_class_destroysinstance.c generated by valac, the Vala compiler
+ * generated from objects_class_destroysinstance.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+void
+foo_free (Foo* self)
+{
+       g_return_if_fail (IS_FOO (self));
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (self, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 2), 
"this.ref_count == 2");
+       g_object_unref (G_TYPE_CHECK_INSTANCE_CAST (self, G_TYPE_OBJECT, GObject));
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static gpointer
+_g_object_ref0 (gpointer self)
+{
+       return self ? g_object_ref (self) : NULL;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       {
+               Foo* _tmp1_;
+               _tmp1_ = _g_object_ref0 (foo);
+               foo_free (_tmp1_);
+       }
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"foo.ref_count == 1");
+       _g_object_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/class-inner-types.c-expected b/tests/objects/class-inner-types.c-expected
new file mode 100644
index 000000000..a64d44fc4
--- /dev/null
+++ b/tests/objects/class-inner-types.c-expected
@@ -0,0 +1,627 @@
+/* objects_class_inner_types.c generated by valac, the Vala compiler
+ * generated from objects_class_inner_types.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+
+#define FOO_TYPE_BAR (foo_bar_get_type ())
+#define FOO_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FOO_TYPE_BAR, FooBar))
+#define FOO_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FOO_TYPE_BAR, FooBarClass))
+#define FOO_IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FOO_TYPE_BAR))
+#define FOO_IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FOO_TYPE_BAR))
+#define FOO_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FOO_TYPE_BAR, FooBarClass))
+
+typedef struct _FooBar FooBar;
+typedef struct _FooBarClass FooBarClass;
+
+#define FOO_TYPE_IBAR (foo_ibar_get_type ())
+#define FOO_IBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FOO_TYPE_IBAR, FooIBar))
+#define FOO_IS_IBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FOO_TYPE_IBAR))
+#define FOO_IBAR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), FOO_TYPE_IBAR, FooIBarIface))
+
+typedef struct _FooIBar FooIBar;
+typedef struct _FooIBarIface FooIBarIface;
+#define _foo_bar_unref0(var) ((var == NULL) ? NULL : (var = (foo_bar_unref (var), NULL)))
+typedef struct _FooBarPrivate FooBarPrivate;
+typedef struct _FooParamSpecBar FooParamSpecBar;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _FooIBarIface {
+       GTypeInterface parent_iface;
+};
+
+struct _FooBar {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooBarPrivate * priv;
+};
+
+struct _FooBarClass {
+       GTypeClass parent_class;
+       void (*finalize) (FooBar *self);
+};
+
+struct _FooParamSpecBar {
+       GParamSpec parent_instance;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gpointer foo_parent_class = NULL;
+static gpointer foo_bar_parent_class = NULL;
+static FooIBarIface * foo_bar_foo_ibar_parent_iface = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN void foo_bar (Foo* self);
+static gpointer foo_bar_ref (gpointer instance);
+static void foo_bar_unref (gpointer instance);
+static GParamSpec* foo_param_spec_bar (const gchar* name,
+                                const gchar* nick,
+                                const gchar* blurb,
+                                GType object_type,
+                                GParamFlags flags) G_GNUC_UNUSED ;
+static void foo_value_set_bar (GValue* value,
+                        gpointer v_object) G_GNUC_UNUSED ;
+static void foo_value_take_bar (GValue* value,
+                         gpointer v_object) G_GNUC_UNUSED ;
+static gpointer foo_value_get_bar (const GValue* value) G_GNUC_UNUSED ;
+static GType foo_bar_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (FooBar, foo_bar_unref)
+static FooBar* foo_bar_new (void);
+static FooBar* foo_bar_construct (GType object_type);
+static GType foo_ibar_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_bar_finalize (FooBar * obj);
+static GType foo_bar_get_type_once (void);
+static GType foo_ibar_get_type_once (void);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+void
+foo_bar (Foo* self)
+{
+       FooBar* bar = NULL;
+       FooBar* _tmp0_;
+       g_return_if_fail (IS_FOO (self));
+       _tmp0_ = foo_bar_new ();
+       bar = _tmp0_;
+       _vala_assert (FOO_IS_IBAR (bar), "bar is IBar");
+       _foo_bar_unref0 (bar);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static FooBar*
+foo_bar_construct (GType object_type)
+{
+       FooBar* self = NULL;
+       self = (FooBar*) g_type_create_instance (object_type);
+       return self;
+}
+
+static FooBar*
+foo_bar_new (void)
+{
+       return foo_bar_construct (FOO_TYPE_BAR);
+}
+
+static void
+foo_value_bar_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+foo_value_bar_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_bar_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+foo_value_bar_copy_value (const GValue* src_value,
+                          GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_bar_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+foo_value_bar_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+foo_value_bar_collect_value (GValue* value,
+                             guint n_collect_values,
+                             GTypeCValue* collect_values,
+                             guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               FooBar * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_bar_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+foo_value_bar_lcopy_value (const GValue* value,
+                           guint n_collect_values,
+                           GTypeCValue* collect_values,
+                           guint collect_flags)
+{
+       FooBar ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_bar_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+static GParamSpec*
+foo_param_spec_bar (const gchar* name,
+                    const gchar* nick,
+                    const gchar* blurb,
+                    GType object_type,
+                    GParamFlags flags)
+{
+       FooParamSpecBar* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, FOO_TYPE_BAR), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+static gpointer
+foo_value_get_bar (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, FOO_TYPE_BAR), NULL);
+       return value->data[0].v_pointer;
+}
+
+static void
+foo_value_set_bar (GValue* value,
+                   gpointer v_object)
+{
+       FooBar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, FOO_TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, FOO_TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_bar_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_bar_unref (old);
+       }
+}
+
+static void
+foo_value_take_bar (GValue* value,
+                    gpointer v_object)
+{
+       FooBar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, FOO_TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, FOO_TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_bar_unref (old);
+       }
+}
+
+static void
+foo_bar_class_init (FooBarClass * klass,
+                    gpointer klass_data)
+{
+       foo_bar_parent_class = g_type_class_peek_parent (klass);
+       ((FooBarClass *) klass)->finalize = foo_bar_finalize;
+}
+
+static void
+foo_bar_foo_ibar_interface_init (FooIBarIface * iface,
+                                 gpointer iface_data)
+{
+       foo_bar_foo_ibar_parent_iface = g_type_interface_peek_parent (iface);
+}
+
+static void
+foo_bar_instance_init (FooBar * self,
+                       gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_bar_finalize (FooBar * obj)
+{
+       FooBar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, FOO_TYPE_BAR, FooBar);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_bar_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { foo_value_bar_init, 
foo_value_bar_free_value, foo_value_bar_copy_value, foo_value_bar_peek_pointer, "p", 
foo_value_bar_collect_value, "p", foo_value_bar_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooBarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(FooBar), 0, (GInstanceInitFunc) foo_bar_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       static const GInterfaceInfo foo_ibar_info = { (GInterfaceInitFunc) foo_bar_foo_ibar_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       GType foo_bar_type_id;
+       foo_bar_type_id = g_type_register_fundamental (g_type_fundamental_next (), "FooBar", 
&g_define_type_info, &g_define_type_fundamental_info, 0);
+       g_type_add_interface_static (foo_bar_type_id, FOO_TYPE_IBAR, &foo_ibar_info);
+       return foo_bar_type_id;
+}
+
+static GType
+foo_bar_get_type (void)
+{
+       static volatile gsize foo_bar_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_bar_type_id__volatile)) {
+               GType foo_bar_type_id;
+               foo_bar_type_id = foo_bar_get_type_once ();
+               g_once_init_leave (&foo_bar_type_id__volatile, foo_bar_type_id);
+       }
+       return foo_bar_type_id__volatile;
+}
+
+static gpointer
+foo_bar_ref (gpointer instance)
+{
+       FooBar * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+static void
+foo_bar_unref (gpointer instance)
+{
+       FooBar * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_BAR_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+foo_ibar_default_init (FooIBarIface * iface,
+                       gpointer iface_data)
+{
+}
+
+static GType
+foo_ibar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooIBarIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_ibar_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType foo_ibar_type_id;
+       foo_ibar_type_id = g_type_register_static (G_TYPE_INTERFACE, "FooIBar", &g_define_type_info, 0);
+       return foo_ibar_type_id;
+}
+
+static GType
+foo_ibar_get_type (void)
+{
+       static volatile gsize foo_ibar_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_ibar_type_id__volatile)) {
+               GType foo_ibar_type_id;
+               foo_ibar_type_id = foo_ibar_get_type_once ();
+               g_once_init_leave (&foo_ibar_type_id__volatile, foo_ibar_type_id);
+       }
+       return foo_ibar_type_id__volatile;
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       foo_bar (foo);
+       _foo_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/class-new-no-override.c-expected b/tests/objects/class-new-no-override.c-expected
new file mode 100644
index 000000000..370467a68
--- /dev/null
+++ b/tests/objects/class-new-no-override.c-expected
@@ -0,0 +1,220 @@
+/* objects_class_new_no_override.c generated by valac, the Vala compiler
+ * generated from objects_class_new_no_override.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_IFOO (ifoo_get_type ())
+#define IFOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IFOO, IFoo))
+#define IS_IFOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IFOO))
+#define IFOO_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_IFOO, IFooIface))
+
+typedef struct _IFoo IFoo;
+typedef struct _IFooIface IFooIface;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+enum  {
+       BAR_0_PROPERTY,
+       BAR_NUM_PROPERTIES
+};
+static GParamSpec* bar_properties[BAR_NUM_PROPERTIES];
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _IFooIface {
+       GTypeInterface parent_iface;
+       void (*foo) (IFoo* self, gint i);
+};
+
+struct _Bar {
+       GObject parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       GObjectClass parent_class;
+};
+
+static gpointer bar_parent_class = NULL;
+static IFooIface * bar_ifoo_parent_iface = NULL;
+
+VALA_EXTERN GType ifoo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN void ifoo_foo (IFoo* self,
+               gint i);
+static void ifoo_real_foo (IFoo* self,
+                    gint i);
+static GType ifoo_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
+VALA_EXTERN gchar* bar_foo (Bar* self);
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static GType bar_get_type_once (void);
+static void _vala_main (void);
+
+static void
+ifoo_real_foo (IFoo* self,
+               gint i)
+{
+       _vala_assert (i == 42, "i == 42");
+}
+
+void
+ifoo_foo (IFoo* self,
+          gint i)
+{
+       IFooIface* _iface_;
+       g_return_if_fail (IS_IFOO (self));
+       _iface_ = IFOO_GET_INTERFACE (self);
+       if (_iface_->foo) {
+               _iface_->foo (self, i);
+       }
+}
+
+static void
+ifoo_default_init (IFooIface * iface,
+                   gpointer iface_data)
+{
+       iface->foo = ifoo_real_foo;
+}
+
+static GType
+ifoo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (IFooIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) ifoo_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType ifoo_type_id;
+       ifoo_type_id = g_type_register_static (G_TYPE_INTERFACE, "IFoo", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (ifoo_type_id, G_TYPE_OBJECT);
+       return ifoo_type_id;
+}
+
+GType
+ifoo_get_type (void)
+{
+       static volatile gsize ifoo_type_id__volatile = 0;
+       if (g_once_init_enter (&ifoo_type_id__volatile)) {
+               GType ifoo_type_id;
+               ifoo_type_id = ifoo_get_type_once ();
+               g_once_init_leave (&ifoo_type_id__volatile, ifoo_type_id);
+       }
+       return ifoo_type_id__volatile;
+}
+
+gchar*
+bar_foo (Bar* self)
+{
+       gchar* _tmp0_;
+       gchar* result = NULL;
+       g_return_val_if_fail (IS_BAR (self), NULL);
+       _tmp0_ = g_strdup ("bar");
+       result = _tmp0_;
+       return result;
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar * self = NULL;
+       self = (Bar*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+bar_ifoo_interface_init (IFooIface * iface,
+                         gpointer iface_data)
+{
+       bar_ifoo_parent_iface = g_type_interface_peek_parent (iface);
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       static const GInterfaceInfo ifoo_info = { (GInterfaceInitFunc) bar_ifoo_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (G_TYPE_OBJECT, "Bar", &g_define_type_info, 0);
+       g_type_add_interface_static (bar_type_id, TYPE_IFOO, &ifoo_info);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Bar* bar = NULL;
+       Bar* _tmp0_;
+       gchar* _tmp1_;
+       gchar* _tmp2_;
+       _tmp0_ = bar_new ();
+       bar = _tmp0_;
+       _tmp1_ = bar_foo (bar);
+       _tmp2_ = _tmp1_;
+       _vala_assert (g_strcmp0 (_tmp2_, "bar") == 0, "bar.foo () == \"bar\"");
+       _g_free0 (_tmp2_);
+       ifoo_foo (G_TYPE_CHECK_INSTANCE_CAST (bar, TYPE_IFOO, IFoo), 42);
+       _g_object_unref0 (bar);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/class-vfunc-base-access.c-expected 
b/tests/objects/class-vfunc-base-access.c-expected
new file mode 100644
index 000000000..b8961ce6e
--- /dev/null
+++ b/tests/objects/class-vfunc-base-access.c-expected
@@ -0,0 +1,459 @@
+/* objects_class_vfunc_base_access.c generated by valac, the Vala compiler
+ * generated from objects_class_vfunc_base_access.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+enum  {
+       FOO_FOO_SIGNAL,
+       FOO_NUM_SIGNALS
+};
+static guint foo_signals[FOO_NUM_SIGNALS] = {0};
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+       void (*baz) (Foo* self);
+       void (*manam) (Foo* self);
+       void (*foo) (Foo* self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+struct _Bar {
+       Foo parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       FooClass parent_class;
+};
+
+static gpointer foo_parent_class = NULL;
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN void foo_baz (Foo* self);
+VALA_EXTERN void foo_manam (Foo* self);
+static void foo_real_baz (Foo* self);
+static void foo_real_manam (Foo* self);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_real_foo (Foo* self);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, foo_unref)
+VALA_EXTERN void foo_foo (Foo* self);
+static void bar_real_foo (Foo* base);
+static void bar_real_baz (Foo* base);
+static void bar_real_manam (Foo* base);
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static GType bar_get_type_once (void);
+static void _vala_main (void);
+
+static void
+foo_real_baz (Foo* self)
+{
+       g_critical ("Type `%s' does not implement abstract method `foo_baz'", g_type_name 
(G_TYPE_FROM_INSTANCE (self)));
+       return;
+}
+
+void
+foo_baz (Foo* self)
+{
+       FooClass* _klass_;
+       g_return_if_fail (IS_FOO (self));
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->baz) {
+               _klass_->baz (self);
+       }
+}
+
+static void
+foo_real_manam (Foo* self)
+{
+}
+
+void
+foo_manam (Foo* self)
+{
+       FooClass* _klass_;
+       g_return_if_fail (IS_FOO (self));
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->manam) {
+               _klass_->manam (self);
+       }
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+static void
+foo_real_foo (Foo* self)
+{
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       ((FooClass *) klass)->baz = (void (*) (Foo*)) foo_real_baz;
+       ((FooClass *) klass)->manam = (void (*) (Foo*)) foo_real_manam;
+       ((FooClass *) klass)->foo = foo_real_foo;
+       foo_signals[FOO_FOO_SIGNAL] = g_signal_new ("foo", TYPE_FOO, G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET 
(FooClass, foo), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, G_TYPE_FLAG_ABSTRACT);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+bar_real_foo (Foo* base)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAR, Bar);
+       _vala_assert (FOO_CLASS (bar_parent_class)->foo != NULL, "base.foo != null");
+}
+
+static void
+bar_real_baz (Foo* base)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAR, Bar);
+       _vala_assert (FOO_CLASS (bar_parent_class)->baz != NULL, "base.baz != null");
+}
+
+static void
+bar_real_manam (Foo* base)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAR, Bar);
+       _vala_assert (FOO_CLASS (bar_parent_class)->manam != NULL, "base.manam != null");
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar* self = NULL;
+       self = (Bar*) foo_construct (object_type);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->foo = (void (*) (Foo*)) bar_real_foo;
+       ((FooClass *) klass)->baz = (void (*) (Foo*)) bar_real_baz;
+       ((FooClass *) klass)->manam = (void (*) (Foo*)) bar_real_manam;
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (TYPE_FOO, "Bar", &g_define_type_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Bar* bar = NULL;
+       Bar* _tmp0_;
+       _tmp0_ = bar_new ();
+       bar = _tmp0_;
+       g_signal_emit (G_TYPE_CHECK_INSTANCE_CAST (bar, TYPE_FOO, Foo), foo_signals[FOO_FOO_SIGNAL], 0);
+       foo_baz (G_TYPE_CHECK_INSTANCE_CAST (bar, TYPE_FOO, Foo));
+       foo_manam (G_TYPE_CHECK_INSTANCE_CAST (bar, TYPE_FOO, Foo));
+       _foo_unref0 (bar);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/class_only.c-expected b/tests/objects/class_only.c-expected
new file mode 100644
index 000000000..4fd50dd61
--- /dev/null
+++ b/tests/objects/class_only.c-expected
@@ -0,0 +1,291 @@
+/* objects_class_only.c generated by valac, the Vala compiler
+ * generated from objects_class_only.vala, do not modify */
+
+#include <glib-object.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/classes-implicit-implementation.c-expected 
b/tests/objects/classes-implicit-implementation.c-expected
new file mode 100644
index 000000000..bbd01232f
--- /dev/null
+++ b/tests/objects/classes-implicit-implementation.c-expected
@@ -0,0 +1,527 @@
+/* objects_classes_implicit_implementation.c generated by valac, the Vala compiler
+ * generated from objects_classes_implicit_implementation.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_IFOO (ifoo_get_type ())
+#define IFOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IFOO, IFoo))
+#define IS_IFOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IFOO))
+#define IFOO_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_IFOO, IFooIface))
+
+typedef struct _IFoo IFoo;
+typedef struct _IFooIface IFooIface;
+
+#define TYPE_IBAR (ibar_get_type ())
+#define IBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IBAR, IBar))
+#define IS_IBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IBAR))
+#define IBAR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_IBAR, IBarIface))
+
+typedef struct _IBar IBar;
+typedef struct _IBarIface IBarIface;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+enum  {
+       BAR_0_PROPERTY,
+       BAR_NUM_PROPERTIES
+};
+static GParamSpec* bar_properties[BAR_NUM_PROPERTIES];
+
+#define TYPE_BAZ (baz_get_type ())
+#define BAZ(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAZ, Baz))
+#define BAZ_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAZ, BazClass))
+#define IS_BAZ(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAZ))
+#define IS_BAZ_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAZ))
+#define BAZ_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAZ, BazClass))
+
+typedef struct _Baz Baz;
+typedef struct _BazClass BazClass;
+typedef struct _BazPrivate BazPrivate;
+enum  {
+       BAZ_0_PROPERTY,
+       BAZ_NUM_PROPERTIES
+};
+static GParamSpec* baz_properties[BAZ_NUM_PROPERTIES];
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+
+#define TYPE_FAZ (faz_get_type ())
+#define FAZ(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FAZ, Faz))
+#define FAZ_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FAZ, FazClass))
+#define IS_FAZ(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FAZ))
+#define IS_FAZ_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FAZ))
+#define FAZ_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FAZ, FazClass))
+
+typedef struct _Faz Faz;
+typedef struct _FazClass FazClass;
+typedef struct _FazPrivate FazPrivate;
+enum  {
+       FAZ_0_PROPERTY,
+       FAZ_NUM_PROPERTIES
+};
+static GParamSpec* faz_properties[FAZ_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _IFooIface {
+       GTypeInterface parent_iface;
+       gint (*foo) (IFoo* self);
+};
+
+struct _IBarIface {
+       GTypeInterface parent_iface;
+};
+
+struct _Bar {
+       GObject parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       GObjectClass parent_class;
+};
+
+struct _Baz {
+       GObject parent_instance;
+       BazPrivate * priv;
+};
+
+struct _BazClass {
+       GObjectClass parent_class;
+};
+
+struct _Foo {
+       Bar parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       BarClass parent_class;
+};
+
+struct _Faz {
+       Baz parent_instance;
+       FazPrivate * priv;
+};
+
+struct _FazClass {
+       BazClass parent_class;
+};
+
+static gpointer bar_parent_class = NULL;
+static gpointer baz_parent_class = NULL;
+static gpointer foo_parent_class = NULL;
+static IFooIface * foo_ifoo_parent_iface = NULL;
+static gpointer faz_parent_class = NULL;
+static IFooIface * faz_ifoo_parent_iface = NULL;
+static IBarIface * faz_ibar_parent_iface = NULL;
+
+VALA_EXTERN GType ifoo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN gint ifoo_foo (IFoo* self);
+static GType ifoo_get_type_once (void);
+VALA_EXTERN GType ibar_get_type (void) G_GNUC_CONST ;
+static GType ibar_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
+VALA_EXTERN gint bar_foo (Bar* self);
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static GType bar_get_type_once (void);
+VALA_EXTERN GType baz_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Baz, g_object_unref)
+VALA_EXTERN gint baz_foo (Baz* self);
+VALA_EXTERN Baz* baz_new (void);
+VALA_EXTERN Baz* baz_construct (GType object_type);
+static GType baz_get_type_once (void);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+static gint foo_real_foo (IFoo* base);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static GType foo_get_type_once (void);
+VALA_EXTERN GType faz_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Faz, g_object_unref)
+VALA_EXTERN Faz* faz_new (void);
+VALA_EXTERN Faz* faz_construct (GType object_type);
+static GType faz_get_type_once (void);
+static void _vala_main (void);
+
+gint
+ifoo_foo (IFoo* self)
+{
+       IFooIface* _iface_;
+       g_return_val_if_fail (IS_IFOO (self), 0);
+       _iface_ = IFOO_GET_INTERFACE (self);
+       if (_iface_->foo) {
+               return _iface_->foo (self);
+       }
+       return -1;
+}
+
+static void
+ifoo_default_init (IFooIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+ifoo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (IFooIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) ifoo_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType ifoo_type_id;
+       ifoo_type_id = g_type_register_static (G_TYPE_INTERFACE, "IFoo", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (ifoo_type_id, G_TYPE_OBJECT);
+       return ifoo_type_id;
+}
+
+GType
+ifoo_get_type (void)
+{
+       static volatile gsize ifoo_type_id__volatile = 0;
+       if (g_once_init_enter (&ifoo_type_id__volatile)) {
+               GType ifoo_type_id;
+               ifoo_type_id = ifoo_get_type_once ();
+               g_once_init_leave (&ifoo_type_id__volatile, ifoo_type_id);
+       }
+       return ifoo_type_id__volatile;
+}
+
+static void
+ibar_default_init (IBarIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+ibar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (IBarIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) ibar_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType ibar_type_id;
+       ibar_type_id = g_type_register_static (G_TYPE_INTERFACE, "IBar", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (ibar_type_id, G_TYPE_OBJECT);
+       return ibar_type_id;
+}
+
+GType
+ibar_get_type (void)
+{
+       static volatile gsize ibar_type_id__volatile = 0;
+       if (g_once_init_enter (&ibar_type_id__volatile)) {
+               GType ibar_type_id;
+               ibar_type_id = ibar_get_type_once ();
+               g_once_init_leave (&ibar_type_id__volatile, ibar_type_id);
+       }
+       return ibar_type_id__volatile;
+}
+
+gint
+bar_foo (Bar* self)
+{
+       gint result = 0;
+       g_return_val_if_fail (IS_BAR (self), 0);
+       g_assert_not_reached ();
+       result = -1;
+       return result;
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar * self = NULL;
+       self = (Bar*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (G_TYPE_OBJECT, "Bar", &g_define_type_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+gint
+baz_foo (Baz* self)
+{
+       gint result = 0;
+       g_return_val_if_fail (IS_BAZ (self), 0);
+       result = 23;
+       return result;
+}
+
+Baz*
+baz_construct (GType object_type)
+{
+       Baz * self = NULL;
+       self = (Baz*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Baz*
+baz_new (void)
+{
+       return baz_construct (TYPE_BAZ);
+}
+
+static void
+baz_class_init (BazClass * klass,
+                gpointer klass_data)
+{
+       baz_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+baz_instance_init (Baz * self,
+                   gpointer klass)
+{
+}
+
+static GType
+baz_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BazClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) baz_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Baz), 0, 
(GInstanceInitFunc) baz_instance_init, NULL };
+       GType baz_type_id;
+       baz_type_id = g_type_register_static (G_TYPE_OBJECT, "Baz", &g_define_type_info, 0);
+       return baz_type_id;
+}
+
+GType
+baz_get_type (void)
+{
+       static volatile gsize baz_type_id__volatile = 0;
+       if (g_once_init_enter (&baz_type_id__volatile)) {
+               GType baz_type_id;
+               baz_type_id = baz_get_type_once ();
+               g_once_init_leave (&baz_type_id__volatile, baz_type_id);
+       }
+       return baz_type_id__volatile;
+}
+
+static gint
+foo_real_foo (IFoo* base)
+{
+       Foo * self;
+       gint result = 0;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_FOO, Foo);
+       result = 42;
+       return result;
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) bar_construct (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+foo_ifoo_interface_init (IFooIface * iface,
+                         gpointer iface_data)
+{
+       foo_ifoo_parent_iface = g_type_interface_peek_parent (iface);
+       iface->foo = (gint (*) (IFoo*)) foo_real_foo;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       static const GInterfaceInfo ifoo_info = { (GInterfaceInitFunc) foo_ifoo_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (TYPE_BAR, "Foo", &g_define_type_info, 0);
+       g_type_add_interface_static (foo_type_id, TYPE_IFOO, &ifoo_info);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+Faz*
+faz_construct (GType object_type)
+{
+       Faz * self = NULL;
+       self = (Faz*) baz_construct (object_type);
+       return self;
+}
+
+Faz*
+faz_new (void)
+{
+       return faz_construct (TYPE_FAZ);
+}
+
+static void
+faz_class_init (FazClass * klass,
+                gpointer klass_data)
+{
+       faz_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+faz_ifoo_interface_init (IFooIface * iface,
+                         gpointer iface_data)
+{
+       faz_ifoo_parent_iface = g_type_interface_peek_parent (iface);
+       iface->foo = (gint (*) (IFoo*)) baz_foo;
+}
+
+static void
+faz_ibar_interface_init (IBarIface * iface,
+                         gpointer iface_data)
+{
+       faz_ibar_parent_iface = g_type_interface_peek_parent (iface);
+}
+
+static void
+faz_instance_init (Faz * self,
+                   gpointer klass)
+{
+}
+
+static GType
+faz_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FazClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) faz_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Faz), 0, 
(GInstanceInitFunc) faz_instance_init, NULL };
+       static const GInterfaceInfo ifoo_info = { (GInterfaceInitFunc) faz_ifoo_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       static const GInterfaceInfo ibar_info = { (GInterfaceInitFunc) faz_ibar_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       GType faz_type_id;
+       faz_type_id = g_type_register_static (TYPE_BAZ, "Faz", &g_define_type_info, 0);
+       g_type_add_interface_static (faz_type_id, TYPE_IFOO, &ifoo_info);
+       g_type_add_interface_static (faz_type_id, TYPE_IBAR, &ibar_info);
+       return faz_type_id;
+}
+
+GType
+faz_get_type (void)
+{
+       static volatile gsize faz_type_id__volatile = 0;
+       if (g_once_init_enter (&faz_type_id__volatile)) {
+               GType faz_type_id;
+               faz_type_id = faz_get_type_once ();
+               g_once_init_leave (&faz_type_id__volatile, faz_type_id);
+       }
+       return faz_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       Baz* baz = NULL;
+       Baz* _tmp1_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       _vala_assert (ifoo_foo (G_TYPE_CHECK_INSTANCE_CAST (foo, TYPE_IFOO, IFoo)) == 42, "foo.foo () == 42");
+       _tmp1_ = baz_new ();
+       baz = _tmp1_;
+       _vala_assert (baz_foo (baz) == 23, "baz.foo () == 23");
+       _g_object_unref0 (baz);
+       _g_object_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/classes-interfaces-virtuals.c-expected 
b/tests/objects/classes-interfaces-virtuals.c-expected
new file mode 100644
index 000000000..e277df490
--- /dev/null
+++ b/tests/objects/classes-interfaces-virtuals.c-expected
@@ -0,0 +1,407 @@
+/* objects_classes_interfaces_virtuals.c generated by valac, the Vala compiler
+ * generated from objects_classes_interfaces_virtuals.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_IFOO (ifoo_get_type ())
+#define IFOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IFOO, IFoo))
+#define IS_IFOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IFOO))
+#define IFOO_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_IFOO, IFooIface))
+
+typedef struct _IFoo IFoo;
+typedef struct _IFooIface IFooIface;
+
+#define TYPE_IBAR (ibar_get_type ())
+#define IBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IBAR, IBar))
+#define IS_IBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IBAR))
+#define IBAR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_IBAR, IBarIface))
+
+typedef struct _IBar IBar;
+typedef struct _IBarIface IBarIface;
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+enum  {
+       BAR_0_PROPERTY,
+       BAR_NUM_PROPERTIES
+};
+static GParamSpec* bar_properties[BAR_NUM_PROPERTIES];
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _IFooIface {
+       GTypeInterface parent_iface;
+       gint (*foo) (IFoo* self);
+};
+
+struct _IBarIface {
+       GTypeInterface parent_iface;
+       gchar* (*foo) (IBar* self);
+};
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+       gint (*foo) (Foo* self);
+};
+
+struct _Bar {
+       Foo parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       FooClass parent_class;
+};
+
+static gpointer foo_parent_class = NULL;
+static IFooIface * foo_ifoo_parent_iface = NULL;
+static IBarIface * foo_ibar_parent_iface = NULL;
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN GType ifoo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN gint ifoo_foo (IFoo* self);
+static GType ifoo_get_type_once (void);
+VALA_EXTERN GType ibar_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN gchar* ibar_foo (IBar* self);
+static GType ibar_get_type_once (void);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN gint foo_foo (Foo* self);
+static gint foo_real_ifoo_foo (Foo* self);
+static gchar* foo_real_ibar_foo (IBar* base);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static GType foo_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
+static gint bar_real_foo (Foo* base);
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static GType bar_get_type_once (void);
+static void _vala_main (void);
+
+gint
+ifoo_foo (IFoo* self)
+{
+       IFooIface* _iface_;
+       g_return_val_if_fail (IS_IFOO (self), 0);
+       _iface_ = IFOO_GET_INTERFACE (self);
+       if (_iface_->foo) {
+               return _iface_->foo (self);
+       }
+       return -1;
+}
+
+static void
+ifoo_default_init (IFooIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+ifoo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (IFooIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) ifoo_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType ifoo_type_id;
+       ifoo_type_id = g_type_register_static (G_TYPE_INTERFACE, "IFoo", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (ifoo_type_id, G_TYPE_OBJECT);
+       return ifoo_type_id;
+}
+
+GType
+ifoo_get_type (void)
+{
+       static volatile gsize ifoo_type_id__volatile = 0;
+       if (g_once_init_enter (&ifoo_type_id__volatile)) {
+               GType ifoo_type_id;
+               ifoo_type_id = ifoo_get_type_once ();
+               g_once_init_leave (&ifoo_type_id__volatile, ifoo_type_id);
+       }
+       return ifoo_type_id__volatile;
+}
+
+gchar*
+ibar_foo (IBar* self)
+{
+       IBarIface* _iface_;
+       g_return_val_if_fail (IS_IBAR (self), NULL);
+       _iface_ = IBAR_GET_INTERFACE (self);
+       if (_iface_->foo) {
+               return _iface_->foo (self);
+       }
+       return NULL;
+}
+
+static void
+ibar_default_init (IBarIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+ibar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (IBarIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) ibar_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType ibar_type_id;
+       ibar_type_id = g_type_register_static (G_TYPE_INTERFACE, "IBar", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (ibar_type_id, G_TYPE_OBJECT);
+       return ibar_type_id;
+}
+
+GType
+ibar_get_type (void)
+{
+       static volatile gsize ibar_type_id__volatile = 0;
+       if (g_once_init_enter (&ibar_type_id__volatile)) {
+               GType ibar_type_id;
+               ibar_type_id = ibar_get_type_once ();
+               g_once_init_leave (&ibar_type_id__volatile, ibar_type_id);
+       }
+       return ibar_type_id__volatile;
+}
+
+static gint
+foo_real_ifoo_foo (Foo* self)
+{
+       gint result = 0;
+       result = 42;
+       return result;
+}
+
+gint
+foo_foo (Foo* self)
+{
+       FooClass* _klass_;
+       g_return_val_if_fail (IS_FOO (self), 0);
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->foo) {
+               return _klass_->foo (self);
+       }
+       return -1;
+}
+
+static gchar*
+foo_real_ibar_foo (IBar* base)
+{
+       Foo * self;
+       gchar* _tmp0_;
+       gchar* result = NULL;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_FOO, Foo);
+       _tmp0_ = g_strdup ("foo");
+       result = _tmp0_;
+       return result;
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->foo = (gint (*) (Foo*)) foo_real_ifoo_foo;
+}
+
+static void
+foo_ifoo_interface_init (IFooIface * iface,
+                         gpointer iface_data)
+{
+       foo_ifoo_parent_iface = g_type_interface_peek_parent (iface);
+       iface->foo = (gint (*) (IFoo*)) foo_foo;
+}
+
+static void
+foo_ibar_interface_init (IBarIface * iface,
+                         gpointer iface_data)
+{
+       foo_ibar_parent_iface = g_type_interface_peek_parent (iface);
+       iface->foo = (gchar* (*) (IBar*)) foo_real_ibar_foo;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       static const GInterfaceInfo ifoo_info = { (GInterfaceInitFunc) foo_ifoo_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       static const GInterfaceInfo ibar_info = { (GInterfaceInitFunc) foo_ibar_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       g_type_add_interface_static (foo_type_id, TYPE_IFOO, &ifoo_info);
+       g_type_add_interface_static (foo_type_id, TYPE_IBAR, &ibar_info);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static gint
+bar_real_foo (Foo* base)
+{
+       Bar * self;
+       gint result = 0;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAR, Bar);
+       result = 23;
+       return result;
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar * self = NULL;
+       self = (Bar*) foo_construct (object_type);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->foo = (gint (*) (Foo*)) bar_real_foo;
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (TYPE_FOO, "Bar", &g_define_type_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       gchar* _tmp1_;
+       gchar* _tmp2_;
+       Bar* bar = NULL;
+       Bar* _tmp3_;
+       gchar* _tmp4_;
+       gchar* _tmp5_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       _vala_assert (foo_foo (foo) == 42, "foo.foo () == 42");
+       _tmp1_ = ibar_foo (G_TYPE_CHECK_INSTANCE_CAST (foo, TYPE_IBAR, IBar));
+       _tmp2_ = _tmp1_;
+       _vala_assert (g_strcmp0 (_tmp2_, "foo") == 0, "((IBar) foo).foo () == \"foo\"");
+       _g_free0 (_tmp2_);
+       _tmp3_ = bar_new ();
+       bar = _tmp3_;
+       _vala_assert (foo_foo (G_TYPE_CHECK_INSTANCE_CAST (bar, TYPE_FOO, Foo)) == 23, "bar.foo () == 23");
+       _vala_assert (foo_foo (G_TYPE_CHECK_INSTANCE_CAST (bar, TYPE_FOO, Foo)) == 23, "((Foo) bar).foo () == 
23");
+       _vala_assert (ifoo_foo (G_TYPE_CHECK_INSTANCE_CAST (bar, TYPE_IFOO, IFoo)) == 23, "((IFoo) bar).foo 
() == 23");
+       _tmp4_ = ibar_foo (G_TYPE_CHECK_INSTANCE_CAST (bar, TYPE_IBAR, IBar));
+       _tmp5_ = _tmp4_;
+       _vala_assert (g_strcmp0 (_tmp5_, "foo") == 0, "((IBar) bar).foo () == \"foo\"");
+       _g_free0 (_tmp5_);
+       _g_object_unref0 (bar);
+       _g_object_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/classes-interfaces.c-expected b/tests/objects/classes-interfaces.c-expected
new file mode 100644
index 000000000..9cf514654
--- /dev/null
+++ b/tests/objects/classes-interfaces.c-expected
@@ -0,0 +1,375 @@
+/* objects_classes_interfaces.c generated by valac, the Vala compiler
+ * generated from objects_classes_interfaces.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_BASE (base_get_type ())
+#define BASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BASE, Base))
+#define BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BASE, BaseClass))
+#define IS_BASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BASE))
+#define IS_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BASE))
+#define BASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BASE, BaseClass))
+
+typedef struct _Base Base;
+typedef struct _BaseClass BaseClass;
+typedef struct _BasePrivate BasePrivate;
+enum  {
+       BASE_0_PROPERTY,
+       BASE_NUM_PROPERTIES
+};
+static GParamSpec* base_properties[BASE_NUM_PROPERTIES];
+
+#define TYPE_IFOO (ifoo_get_type ())
+#define IFOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IFOO, IFoo))
+#define IS_IFOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IFOO))
+#define IFOO_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_IFOO, IFooIface))
+
+typedef struct _IFoo IFoo;
+typedef struct _IFooIface IFooIface;
+
+#define TYPE_IBAR (ibar_get_type ())
+#define IBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IBAR, IBar))
+#define IS_IBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IBAR))
+#define IBAR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_IBAR, IBarIface))
+
+typedef struct _IBar IBar;
+typedef struct _IBarIface IBarIface;
+
+#define TYPE_MANAM (manam_get_type ())
+#define MANAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MANAM, Manam))
+#define MANAM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MANAM, ManamClass))
+#define IS_MANAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MANAM))
+#define IS_MANAM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MANAM))
+#define MANAM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MANAM, ManamClass))
+
+typedef struct _Manam Manam;
+typedef struct _ManamClass ManamClass;
+typedef struct _ManamPrivate ManamPrivate;
+enum  {
+       MANAM_0_PROPERTY,
+       MANAM_NUM_PROPERTIES
+};
+static GParamSpec* manam_properties[MANAM_NUM_PROPERTIES];
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Base {
+       GObject parent_instance;
+       BasePrivate * priv;
+};
+
+struct _BaseClass {
+       GObjectClass parent_class;
+};
+
+struct _IFooIface {
+       GTypeInterface parent_iface;
+       gchar* (*foo) (IFoo* self);
+};
+
+struct _IBarIface {
+       GTypeInterface parent_iface;
+       gint (*foo) (IBar* self);
+};
+
+struct _Manam {
+       Base parent_instance;
+       ManamPrivate * priv;
+};
+
+struct _ManamClass {
+       BaseClass parent_class;
+};
+
+static gpointer base_parent_class = NULL;
+static gpointer manam_parent_class = NULL;
+static IFooIface * manam_ifoo_parent_iface = NULL;
+static IBarIface * manam_ibar_parent_iface = NULL;
+
+VALA_EXTERN GType base_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Base, g_object_unref)
+VALA_EXTERN void base_foo (Base* self);
+VALA_EXTERN Base* base_new (void);
+VALA_EXTERN Base* base_construct (GType object_type);
+static GType base_get_type_once (void);
+VALA_EXTERN GType ifoo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN gchar* ifoo_foo (IFoo* self);
+static GType ifoo_get_type_once (void);
+VALA_EXTERN GType ibar_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN gint ibar_foo (IBar* self);
+static GType ibar_get_type_once (void);
+VALA_EXTERN GType manam_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Manam, g_object_unref)
+static gint manam_real_ibar_foo (IBar* base);
+static gchar* manam_real_ifoo_foo (IFoo* base);
+VALA_EXTERN Manam* manam_new (void);
+VALA_EXTERN Manam* manam_construct (GType object_type);
+static GType manam_get_type_once (void);
+static void _vala_main (void);
+
+void
+base_foo (Base* self)
+{
+       g_return_if_fail (IS_BASE (self));
+}
+
+Base*
+base_construct (GType object_type)
+{
+       Base * self = NULL;
+       self = (Base*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Base*
+base_new (void)
+{
+       return base_construct (TYPE_BASE);
+}
+
+static void
+base_class_init (BaseClass * klass,
+                 gpointer klass_data)
+{
+       base_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+base_instance_init (Base * self,
+                    gpointer klass)
+{
+}
+
+static GType
+base_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BaseClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) base_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Base), 
0, (GInstanceInitFunc) base_instance_init, NULL };
+       GType base_type_id;
+       base_type_id = g_type_register_static (G_TYPE_OBJECT, "Base", &g_define_type_info, 0);
+       return base_type_id;
+}
+
+GType
+base_get_type (void)
+{
+       static volatile gsize base_type_id__volatile = 0;
+       if (g_once_init_enter (&base_type_id__volatile)) {
+               GType base_type_id;
+               base_type_id = base_get_type_once ();
+               g_once_init_leave (&base_type_id__volatile, base_type_id);
+       }
+       return base_type_id__volatile;
+}
+
+gchar*
+ifoo_foo (IFoo* self)
+{
+       IFooIface* _iface_;
+       g_return_val_if_fail (IS_IFOO (self), NULL);
+       _iface_ = IFOO_GET_INTERFACE (self);
+       if (_iface_->foo) {
+               return _iface_->foo (self);
+       }
+       return NULL;
+}
+
+static void
+ifoo_default_init (IFooIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+ifoo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (IFooIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) ifoo_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType ifoo_type_id;
+       ifoo_type_id = g_type_register_static (G_TYPE_INTERFACE, "IFoo", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (ifoo_type_id, TYPE_BASE);
+       return ifoo_type_id;
+}
+
+GType
+ifoo_get_type (void)
+{
+       static volatile gsize ifoo_type_id__volatile = 0;
+       if (g_once_init_enter (&ifoo_type_id__volatile)) {
+               GType ifoo_type_id;
+               ifoo_type_id = ifoo_get_type_once ();
+               g_once_init_leave (&ifoo_type_id__volatile, ifoo_type_id);
+       }
+       return ifoo_type_id__volatile;
+}
+
+gint
+ibar_foo (IBar* self)
+{
+       IBarIface* _iface_;
+       g_return_val_if_fail (IS_IBAR (self), 0);
+       _iface_ = IBAR_GET_INTERFACE (self);
+       if (_iface_->foo) {
+               return _iface_->foo (self);
+       }
+       return -1;
+}
+
+static void
+ibar_default_init (IBarIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+ibar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (IBarIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) ibar_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType ibar_type_id;
+       ibar_type_id = g_type_register_static (G_TYPE_INTERFACE, "IBar", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (ibar_type_id, TYPE_BASE);
+       return ibar_type_id;
+}
+
+GType
+ibar_get_type (void)
+{
+       static volatile gsize ibar_type_id__volatile = 0;
+       if (g_once_init_enter (&ibar_type_id__volatile)) {
+               GType ibar_type_id;
+               ibar_type_id = ibar_get_type_once ();
+               g_once_init_leave (&ibar_type_id__volatile, ibar_type_id);
+       }
+       return ibar_type_id__volatile;
+}
+
+static gint
+manam_real_ibar_foo (IBar* base)
+{
+       Manam * self;
+       gint result = 0;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_MANAM, Manam);
+       result = 23;
+       return result;
+}
+
+static gchar*
+manam_real_ifoo_foo (IFoo* base)
+{
+       Manam * self;
+       gchar* _tmp0_;
+       gchar* result = NULL;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_MANAM, Manam);
+       _tmp0_ = g_strdup ("foo");
+       result = _tmp0_;
+       return result;
+}
+
+Manam*
+manam_construct (GType object_type)
+{
+       Manam * self = NULL;
+       self = (Manam*) base_construct (object_type);
+       return self;
+}
+
+Manam*
+manam_new (void)
+{
+       return manam_construct (TYPE_MANAM);
+}
+
+static void
+manam_class_init (ManamClass * klass,
+                  gpointer klass_data)
+{
+       manam_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+manam_ifoo_interface_init (IFooIface * iface,
+                           gpointer iface_data)
+{
+       manam_ifoo_parent_iface = g_type_interface_peek_parent (iface);
+       iface->foo = (gchar* (*) (IFoo*)) manam_real_ifoo_foo;
+}
+
+static void
+manam_ibar_interface_init (IBarIface * iface,
+                           gpointer iface_data)
+{
+       manam_ibar_parent_iface = g_type_interface_peek_parent (iface);
+       iface->foo = (gint (*) (IBar*)) manam_real_ibar_foo;
+}
+
+static void
+manam_instance_init (Manam * self,
+                     gpointer klass)
+{
+}
+
+static GType
+manam_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (ManamClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) manam_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Manam), 
0, (GInstanceInitFunc) manam_instance_init, NULL };
+       static const GInterfaceInfo ifoo_info = { (GInterfaceInitFunc) manam_ifoo_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       static const GInterfaceInfo ibar_info = { (GInterfaceInitFunc) manam_ibar_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       GType manam_type_id;
+       manam_type_id = g_type_register_static (TYPE_BASE, "Manam", &g_define_type_info, 0);
+       g_type_add_interface_static (manam_type_id, TYPE_IFOO, &ifoo_info);
+       g_type_add_interface_static (manam_type_id, TYPE_IBAR, &ibar_info);
+       return manam_type_id;
+}
+
+GType
+manam_get_type (void)
+{
+       static volatile gsize manam_type_id__volatile = 0;
+       if (g_once_init_enter (&manam_type_id__volatile)) {
+               GType manam_type_id;
+               manam_type_id = manam_get_type_once ();
+               g_once_init_leave (&manam_type_id__volatile, manam_type_id);
+       }
+       return manam_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Manam* manam = NULL;
+       Manam* _tmp0_;
+       gchar* _tmp1_;
+       gchar* _tmp2_;
+       _tmp0_ = manam_new ();
+       manam = _tmp0_;
+       _tmp1_ = ifoo_foo (G_TYPE_CHECK_INSTANCE_CAST (manam, TYPE_IFOO, IFoo));
+       _tmp2_ = _tmp1_;
+       _vala_assert (g_strcmp0 (_tmp2_, "foo") == 0, "((IFoo) manam).foo () == \"foo\"");
+       _g_free0 (_tmp2_);
+       _vala_assert (ibar_foo (G_TYPE_CHECK_INSTANCE_CAST (manam, TYPE_IBAR, IBar)) == 23, "((IBar) 
manam).foo () == 23");
+       _g_object_unref0 (manam);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/classes.c-expected b/tests/objects/classes.c-expected
new file mode 100644
index 000000000..9aa82b528
--- /dev/null
+++ b/tests/objects/classes.c-expected
@@ -0,0 +1,2020 @@
+/* objects_classes.c generated by valac, the Vala compiler
+ * generated from objects_classes.vala, do not modify */
+
+#include <glib.h>
+#include <stdio.h>
+#include <glib-object.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef struct _CompactClass CompactClass;
+typedef struct _CompactClassWithDestructor CompactClassWithDestructor;
+typedef CompactClass DerivedClass;
+typedef struct _PublicClass PublicClass;
+typedef struct _AbstractClass AbstractClass;
+typedef struct _ClassWithCreationMethod ClassWithCreationMethod;
+typedef struct _ClassWithNamedCreationMethod ClassWithNamedCreationMethod;
+
+#define TYPE_SIMPLE_GTYPE_INSTANCECLASS (simple_gtype_instanceclass_get_type ())
+#define SIMPLE_GTYPE_INSTANCECLASS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SIMPLE_GTYPE_INSTANCECLASS, 
SimpleGTypeInstanceClass))
+#define SIMPLE_GTYPE_INSTANCECLASS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), 
TYPE_SIMPLE_GTYPE_INSTANCECLASS, SimpleGTypeInstanceClassClass))
+#define IS_SIMPLE_GTYPE_INSTANCECLASS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
TYPE_SIMPLE_GTYPE_INSTANCECLASS))
+#define IS_SIMPLE_GTYPE_INSTANCECLASS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), 
TYPE_SIMPLE_GTYPE_INSTANCECLASS))
+#define SIMPLE_GTYPE_INSTANCECLASS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), 
TYPE_SIMPLE_GTYPE_INSTANCECLASS, SimpleGTypeInstanceClassClass))
+
+typedef struct _SimpleGTypeInstanceClass SimpleGTypeInstanceClass;
+typedef struct _SimpleGTypeInstanceClassClass SimpleGTypeInstanceClassClass;
+typedef struct _SimpleGTypeInstanceClassPrivate SimpleGTypeInstanceClassPrivate;
+typedef struct _ParamSpecSimpleGTypeInstanceClass ParamSpecSimpleGTypeInstanceClass;
+
+#define TYPE_DERIVED_GTYPE_INSTANCECLASS (derived_gtype_instanceclass_get_type ())
+#define DERIVED_GTYPE_INSTANCECLASS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
TYPE_DERIVED_GTYPE_INSTANCECLASS, DerivedGTypeInstanceClass))
+#define DERIVED_GTYPE_INSTANCECLASS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), 
TYPE_DERIVED_GTYPE_INSTANCECLASS, DerivedGTypeInstanceClassClass))
+#define IS_DERIVED_GTYPE_INSTANCECLASS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
TYPE_DERIVED_GTYPE_INSTANCECLASS))
+#define IS_DERIVED_GTYPE_INSTANCECLASS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), 
TYPE_DERIVED_GTYPE_INSTANCECLASS))
+#define DERIVED_GTYPE_INSTANCECLASS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), 
TYPE_DERIVED_GTYPE_INSTANCECLASS, DerivedGTypeInstanceClassClass))
+
+typedef struct _DerivedGTypeInstanceClass DerivedGTypeInstanceClass;
+typedef struct _DerivedGTypeInstanceClassClass DerivedGTypeInstanceClassClass;
+typedef struct _DerivedGTypeInstanceClassPrivate DerivedGTypeInstanceClassPrivate;
+
+#define TYPE_PUBLIC_GTYPE_INSTANCECLASS (public_gtype_instanceclass_get_type ())
+#define PUBLIC_GTYPE_INSTANCECLASS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PUBLIC_GTYPE_INSTANCECLASS, 
PublicGTypeInstanceClass))
+#define PUBLIC_GTYPE_INSTANCECLASS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), 
TYPE_PUBLIC_GTYPE_INSTANCECLASS, PublicGTypeInstanceClassClass))
+#define IS_PUBLIC_GTYPE_INSTANCECLASS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
TYPE_PUBLIC_GTYPE_INSTANCECLASS))
+#define IS_PUBLIC_GTYPE_INSTANCECLASS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), 
TYPE_PUBLIC_GTYPE_INSTANCECLASS))
+#define PUBLIC_GTYPE_INSTANCECLASS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), 
TYPE_PUBLIC_GTYPE_INSTANCECLASS, PublicGTypeInstanceClassClass))
+
+typedef struct _PublicGTypeInstanceClass PublicGTypeInstanceClass;
+typedef struct _PublicGTypeInstanceClassClass PublicGTypeInstanceClassClass;
+typedef struct _PublicGTypeInstanceClassPrivate PublicGTypeInstanceClassPrivate;
+typedef struct _ParamSpecPublicGTypeInstanceClass ParamSpecPublicGTypeInstanceClass;
+
+#define TYPE_GTYPE_INSTANCE_CLASS_WITH_CREATION_METHOD (gtype_instance_class_with_creation_method_get_type 
())
+#define GTYPE_INSTANCE_CLASS_WITH_CREATION_METHOD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
TYPE_GTYPE_INSTANCE_CLASS_WITH_CREATION_METHOD, GTypeInstanceClassWithCreationMethod))
+#define GTYPE_INSTANCE_CLASS_WITH_CREATION_METHOD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), 
TYPE_GTYPE_INSTANCE_CLASS_WITH_CREATION_METHOD, GTypeInstanceClassWithCreationMethodClass))
+#define IS_GTYPE_INSTANCE_CLASS_WITH_CREATION_METHOD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
TYPE_GTYPE_INSTANCE_CLASS_WITH_CREATION_METHOD))
+#define IS_GTYPE_INSTANCE_CLASS_WITH_CREATION_METHOD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), 
TYPE_GTYPE_INSTANCE_CLASS_WITH_CREATION_METHOD))
+#define GTYPE_INSTANCE_CLASS_WITH_CREATION_METHOD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), 
TYPE_GTYPE_INSTANCE_CLASS_WITH_CREATION_METHOD, GTypeInstanceClassWithCreationMethodClass))
+
+typedef struct _GTypeInstanceClassWithCreationMethod GTypeInstanceClassWithCreationMethod;
+typedef struct _GTypeInstanceClassWithCreationMethodClass GTypeInstanceClassWithCreationMethodClass;
+typedef struct _GTypeInstanceClassWithCreationMethodPrivate GTypeInstanceClassWithCreationMethodPrivate;
+typedef struct _ParamSpecGTypeInstanceClassWithCreationMethod ParamSpecGTypeInstanceClassWithCreationMethod;
+
+#define TYPE_GTYPE_INSTANCE_CLASS_WITH_NAMED_CREATION_METHOD 
(gtype_instance_class_with_named_creation_method_get_type ())
+#define GTYPE_INSTANCE_CLASS_WITH_NAMED_CREATION_METHOD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
TYPE_GTYPE_INSTANCE_CLASS_WITH_NAMED_CREATION_METHOD, GTypeInstanceClassWithNamedCreationMethod))
+#define GTYPE_INSTANCE_CLASS_WITH_NAMED_CREATION_METHOD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), 
TYPE_GTYPE_INSTANCE_CLASS_WITH_NAMED_CREATION_METHOD, GTypeInstanceClassWithNamedCreationMethodClass))
+#define IS_GTYPE_INSTANCE_CLASS_WITH_NAMED_CREATION_METHOD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
TYPE_GTYPE_INSTANCE_CLASS_WITH_NAMED_CREATION_METHOD))
+#define IS_GTYPE_INSTANCE_CLASS_WITH_NAMED_CREATION_METHOD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), 
TYPE_GTYPE_INSTANCE_CLASS_WITH_NAMED_CREATION_METHOD))
+#define GTYPE_INSTANCE_CLASS_WITH_NAMED_CREATION_METHOD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), 
TYPE_GTYPE_INSTANCE_CLASS_WITH_NAMED_CREATION_METHOD, GTypeInstanceClassWithNamedCreationMethodClass))
+
+typedef struct _GTypeInstanceClassWithNamedCreationMethod GTypeInstanceClassWithNamedCreationMethod;
+typedef struct _GTypeInstanceClassWithNamedCreationMethodClass 
GTypeInstanceClassWithNamedCreationMethodClass;
+typedef struct _GTypeInstanceClassWithNamedCreationMethodPrivate 
GTypeInstanceClassWithNamedCreationMethodPrivate;
+typedef struct _ParamSpecGTypeInstanceClassWithNamedCreationMethod 
ParamSpecGTypeInstanceClassWithNamedCreationMethod;
+
+#define TYPE_SIMPLE_GOBJECTCLASS (simple_gobjectclass_get_type ())
+#define SIMPLE_GOBJECTCLASS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SIMPLE_GOBJECTCLASS, 
SimpleGObjectClass))
+#define SIMPLE_GOBJECTCLASS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SIMPLE_GOBJECTCLASS, 
SimpleGObjectClassClass))
+#define IS_SIMPLE_GOBJECTCLASS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SIMPLE_GOBJECTCLASS))
+#define IS_SIMPLE_GOBJECTCLASS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SIMPLE_GOBJECTCLASS))
+#define SIMPLE_GOBJECTCLASS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SIMPLE_GOBJECTCLASS, 
SimpleGObjectClassClass))
+
+typedef struct _SimpleGObjectClass SimpleGObjectClass;
+typedef struct _SimpleGObjectClassClass SimpleGObjectClassClass;
+typedef struct _SimpleGObjectClassPrivate SimpleGObjectClassPrivate;
+enum  {
+       SIMPLE_GOBJECTCLASS_0_PROPERTY,
+       SIMPLE_GOBJECTCLASS_NUM_PROPERTIES
+};
+static GParamSpec* simple_gobjectclass_properties[SIMPLE_GOBJECTCLASS_NUM_PROPERTIES];
+
+#define TYPE_DERIVED_GOBJECTCLASS (derived_gobjectclass_get_type ())
+#define DERIVED_GOBJECTCLASS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DERIVED_GOBJECTCLASS, 
DerivedGObjectClass))
+#define DERIVED_GOBJECTCLASS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DERIVED_GOBJECTCLASS, 
DerivedGObjectClassClass))
+#define IS_DERIVED_GOBJECTCLASS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DERIVED_GOBJECTCLASS))
+#define IS_DERIVED_GOBJECTCLASS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DERIVED_GOBJECTCLASS))
+#define DERIVED_GOBJECTCLASS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DERIVED_GOBJECTCLASS, 
DerivedGObjectClassClass))
+
+typedef struct _DerivedGObjectClass DerivedGObjectClass;
+typedef struct _DerivedGObjectClassClass DerivedGObjectClassClass;
+typedef struct _DerivedGObjectClassPrivate DerivedGObjectClassPrivate;
+enum  {
+       DERIVED_GOBJECTCLASS_0_PROPERTY,
+       DERIVED_GOBJECTCLASS_NUM_PROPERTIES
+};
+static GParamSpec* derived_gobjectclass_properties[DERIVED_GOBJECTCLASS_NUM_PROPERTIES];
+
+#define TYPE_PUBLIC_GOBJECTCLASS (public_gobjectclass_get_type ())
+#define PUBLIC_GOBJECTCLASS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PUBLIC_GOBJECTCLASS, 
PublicGObjectClass))
+#define PUBLIC_GOBJECTCLASS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PUBLIC_GOBJECTCLASS, 
PublicGObjectClassClass))
+#define IS_PUBLIC_GOBJECTCLASS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PUBLIC_GOBJECTCLASS))
+#define IS_PUBLIC_GOBJECTCLASS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PUBLIC_GOBJECTCLASS))
+#define PUBLIC_GOBJECTCLASS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PUBLIC_GOBJECTCLASS, 
PublicGObjectClassClass))
+
+typedef struct _PublicGObjectClass PublicGObjectClass;
+typedef struct _PublicGObjectClassClass PublicGObjectClassClass;
+typedef struct _PublicGObjectClassPrivate PublicGObjectClassPrivate;
+enum  {
+       PUBLIC_GOBJECTCLASS_0_PROPERTY,
+       PUBLIC_GOBJECTCLASS_NUM_PROPERTIES
+};
+static GParamSpec* public_gobjectclass_properties[PUBLIC_GOBJECTCLASS_NUM_PROPERTIES];
+
+#define TYPE_ABSTRACT_GOBJECTCLASS (abstract_gobjectclass_get_type ())
+#define ABSTRACT_GOBJECTCLASS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_ABSTRACT_GOBJECTCLASS, 
AbstractGObjectClass))
+#define ABSTRACT_GOBJECTCLASS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_ABSTRACT_GOBJECTCLASS, 
AbstractGObjectClassClass))
+#define IS_ABSTRACT_GOBJECTCLASS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_ABSTRACT_GOBJECTCLASS))
+#define IS_ABSTRACT_GOBJECTCLASS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_ABSTRACT_GOBJECTCLASS))
+#define ABSTRACT_GOBJECTCLASS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_ABSTRACT_GOBJECTCLASS, 
AbstractGObjectClassClass))
+
+typedef struct _AbstractGObjectClass AbstractGObjectClass;
+typedef struct _AbstractGObjectClassClass AbstractGObjectClassClass;
+typedef struct _AbstractGObjectClassPrivate AbstractGObjectClassPrivate;
+enum  {
+       ABSTRACT_GOBJECTCLASS_0_PROPERTY,
+       ABSTRACT_GOBJECTCLASS_NUM_PROPERTIES
+};
+static GParamSpec* abstract_gobjectclass_properties[ABSTRACT_GOBJECTCLASS_NUM_PROPERTIES];
+
+#define TYPE_GOBJECT_CLASS_WITH_CREATION_METHOD (gobject_class_with_creation_method_get_type ())
+#define GOBJECT_CLASS_WITH_CREATION_METHOD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
TYPE_GOBJECT_CLASS_WITH_CREATION_METHOD, GObjectClassWithCreationMethod))
+#define GOBJECT_CLASS_WITH_CREATION_METHOD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), 
TYPE_GOBJECT_CLASS_WITH_CREATION_METHOD, GObjectClassWithCreationMethodClass))
+#define IS_GOBJECT_CLASS_WITH_CREATION_METHOD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
TYPE_GOBJECT_CLASS_WITH_CREATION_METHOD))
+#define IS_GOBJECT_CLASS_WITH_CREATION_METHOD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), 
TYPE_GOBJECT_CLASS_WITH_CREATION_METHOD))
+#define GOBJECT_CLASS_WITH_CREATION_METHOD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), 
TYPE_GOBJECT_CLASS_WITH_CREATION_METHOD, GObjectClassWithCreationMethodClass))
+
+typedef struct _GObjectClassWithCreationMethod GObjectClassWithCreationMethod;
+typedef struct _GObjectClassWithCreationMethodClass GObjectClassWithCreationMethodClass;
+typedef struct _GObjectClassWithCreationMethodPrivate GObjectClassWithCreationMethodPrivate;
+enum  {
+       GOBJECT_CLASS_WITH_CREATION_METHOD_0_PROPERTY,
+       GOBJECT_CLASS_WITH_CREATION_METHOD_NUM_PROPERTIES
+};
+static GParamSpec* 
gobject_class_with_creation_method_properties[GOBJECT_CLASS_WITH_CREATION_METHOD_NUM_PROPERTIES];
+
+#define TYPE_GOBJECT_CLASS_WITH_NAMED_CREATION_METHOD (gobject_class_with_named_creation_method_get_type ())
+#define GOBJECT_CLASS_WITH_NAMED_CREATION_METHOD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
TYPE_GOBJECT_CLASS_WITH_NAMED_CREATION_METHOD, GObjectClassWithNamedCreationMethod))
+#define GOBJECT_CLASS_WITH_NAMED_CREATION_METHOD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), 
TYPE_GOBJECT_CLASS_WITH_NAMED_CREATION_METHOD, GObjectClassWithNamedCreationMethodClass))
+#define IS_GOBJECT_CLASS_WITH_NAMED_CREATION_METHOD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
TYPE_GOBJECT_CLASS_WITH_NAMED_CREATION_METHOD))
+#define IS_GOBJECT_CLASS_WITH_NAMED_CREATION_METHOD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), 
TYPE_GOBJECT_CLASS_WITH_NAMED_CREATION_METHOD))
+#define GOBJECT_CLASS_WITH_NAMED_CREATION_METHOD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), 
TYPE_GOBJECT_CLASS_WITH_NAMED_CREATION_METHOD, GObjectClassWithNamedCreationMethodClass))
+
+typedef struct _GObjectClassWithNamedCreationMethod GObjectClassWithNamedCreationMethod;
+typedef struct _GObjectClassWithNamedCreationMethodClass GObjectClassWithNamedCreationMethodClass;
+typedef struct _GObjectClassWithNamedCreationMethodPrivate GObjectClassWithNamedCreationMethodPrivate;
+enum  {
+       GOBJECT_CLASS_WITH_NAMED_CREATION_METHOD_0_PROPERTY,
+       GOBJECT_CLASS_WITH_NAMED_CREATION_METHOD_NUM_PROPERTIES
+};
+static GParamSpec* 
gobject_class_with_named_creation_method_properties[GOBJECT_CLASS_WITH_NAMED_CREATION_METHOD_NUM_PROPERTIES];
+#define _compact_class_with_destructor_free0(var) ((var == NULL) ? NULL : (var = 
(compact_class_with_destructor_free (var), NULL)))
+#define _compactclass_free0(var) ((var == NULL) ? NULL : (var = (compactclass_free (var), NULL)))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _gtype_instance_class_with_named_creation_method_unref0(var) ((var == NULL) ? NULL : (var = 
(gtype_instance_class_with_named_creation_method_unref (var), NULL)))
+#define _gtype_instance_class_with_creation_method_unref0(var) ((var == NULL) ? NULL : (var = 
(gtype_instance_class_with_creation_method_unref (var), NULL)))
+#define _public_gtype_instanceclass_unref0(var) ((var == NULL) ? NULL : (var = 
(public_gtype_instanceclass_unref (var), NULL)))
+#define _simple_gtype_instanceclass_unref0(var) ((var == NULL) ? NULL : (var = 
(simple_gtype_instanceclass_unref (var), NULL)))
+#define _class_with_named_creation_method_free0(var) ((var == NULL) ? NULL : (var = 
(class_with_named_creation_method_free (var), NULL)))
+#define _class_with_creation_method_free0(var) ((var == NULL) ? NULL : (var = 
(class_with_creation_method_free (var), NULL)))
+#define _publicclass_free0(var) ((var == NULL) ? NULL : (var = (publicclass_free (var), NULL)))
+
+struct _CompactClass {
+       gint field;
+};
+
+struct _CompactClassWithDestructor {
+       int dummy;
+};
+
+struct _PublicClass {
+       gint field;
+};
+
+struct _AbstractClass {
+       gint field;
+};
+
+struct _ClassWithCreationMethod {
+       gint field;
+};
+
+struct _ClassWithNamedCreationMethod {
+       gint field;
+};
+
+struct _SimpleGTypeInstanceClass {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       SimpleGTypeInstanceClassPrivate * priv;
+};
+
+struct _SimpleGTypeInstanceClassClass {
+       GTypeClass parent_class;
+       void (*finalize) (SimpleGTypeInstanceClass *self);
+};
+
+struct _ParamSpecSimpleGTypeInstanceClass {
+       GParamSpec parent_instance;
+};
+
+struct _DerivedGTypeInstanceClass {
+       SimpleGTypeInstanceClass parent_instance;
+       DerivedGTypeInstanceClassPrivate * priv;
+};
+
+struct _DerivedGTypeInstanceClassClass {
+       SimpleGTypeInstanceClassClass parent_class;
+};
+
+struct _PublicGTypeInstanceClass {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       PublicGTypeInstanceClassPrivate * priv;
+};
+
+struct _PublicGTypeInstanceClassClass {
+       GTypeClass parent_class;
+       void (*finalize) (PublicGTypeInstanceClass *self);
+};
+
+struct _ParamSpecPublicGTypeInstanceClass {
+       GParamSpec parent_instance;
+};
+
+struct _GTypeInstanceClassWithCreationMethod {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       GTypeInstanceClassWithCreationMethodPrivate * priv;
+};
+
+struct _GTypeInstanceClassWithCreationMethodClass {
+       GTypeClass parent_class;
+       void (*finalize) (GTypeInstanceClassWithCreationMethod *self);
+};
+
+struct _ParamSpecGTypeInstanceClassWithCreationMethod {
+       GParamSpec parent_instance;
+};
+
+struct _GTypeInstanceClassWithNamedCreationMethod {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       GTypeInstanceClassWithNamedCreationMethodPrivate * priv;
+};
+
+struct _GTypeInstanceClassWithNamedCreationMethodClass {
+       GTypeClass parent_class;
+       void (*finalize) (GTypeInstanceClassWithNamedCreationMethod *self);
+};
+
+struct _ParamSpecGTypeInstanceClassWithNamedCreationMethod {
+       GParamSpec parent_instance;
+};
+
+struct _SimpleGObjectClass {
+       GObject parent_instance;
+       SimpleGObjectClassPrivate * priv;
+};
+
+struct _SimpleGObjectClassClass {
+       GObjectClass parent_class;
+};
+
+struct _DerivedGObjectClass {
+       SimpleGObjectClass parent_instance;
+       DerivedGObjectClassPrivate * priv;
+};
+
+struct _DerivedGObjectClassClass {
+       SimpleGObjectClassClass parent_class;
+};
+
+struct _PublicGObjectClass {
+       GObject parent_instance;
+       PublicGObjectClassPrivate * priv;
+};
+
+struct _PublicGObjectClassClass {
+       GObjectClass parent_class;
+};
+
+struct _AbstractGObjectClass {
+       GObject parent_instance;
+       AbstractGObjectClassPrivate * priv;
+};
+
+struct _AbstractGObjectClassClass {
+       GObjectClass parent_class;
+};
+
+struct _GObjectClassWithCreationMethod {
+       GObject parent_instance;
+       GObjectClassWithCreationMethodPrivate * priv;
+};
+
+struct _GObjectClassWithCreationMethodClass {
+       GObjectClass parent_class;
+};
+
+struct _GObjectClassWithNamedCreationMethod {
+       GObject parent_instance;
+       GObjectClassWithNamedCreationMethodPrivate * priv;
+};
+
+struct _GObjectClassWithNamedCreationMethodClass {
+       GObjectClass parent_class;
+};
+
+static gpointer simple_gtype_instanceclass_parent_class = NULL;
+static gpointer derived_gtype_instanceclass_parent_class = NULL;
+static gpointer public_gtype_instanceclass_parent_class = NULL;
+static gpointer gtype_instance_class_with_creation_method_parent_class = NULL;
+static gpointer gtype_instance_class_with_named_creation_method_parent_class = NULL;
+static gpointer simple_gobjectclass_parent_class = NULL;
+static gpointer derived_gobjectclass_parent_class = NULL;
+static gpointer public_gobjectclass_parent_class = NULL;
+static gpointer abstract_gobjectclass_parent_class = NULL;
+static gpointer gobject_class_with_creation_method_parent_class = NULL;
+static gpointer gobject_class_with_named_creation_method_parent_class = NULL;
+
+VALA_EXTERN void compactclass_free (CompactClass * self);
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (CompactClass, compactclass_free)
+static void compactclass_instance_init (CompactClass * self);
+VALA_EXTERN CompactClass* compactclass_new (void);
+VALA_EXTERN void compact_class_with_destructor_free (CompactClassWithDestructor * self);
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (CompactClassWithDestructor, compact_class_with_destructor_free)
+static void compact_class_with_destructor_instance_init (CompactClassWithDestructor * self);
+VALA_EXTERN CompactClassWithDestructor* compact_class_with_destructor_new (void);
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (DerivedClass, compactclass_free)
+static void derivedclass_instance_init (DerivedClass * self);
+VALA_EXTERN DerivedClass* derivedclass_new (void);
+VALA_EXTERN void publicclass_free (PublicClass * self);
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (PublicClass, publicclass_free)
+static void publicclass_instance_init (PublicClass * self);
+VALA_EXTERN PublicClass* publicclass_new (void);
+VALA_EXTERN void abstractclass_free (AbstractClass * self);
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (AbstractClass, abstractclass_free)
+static void abstractclass_instance_init (AbstractClass * self);
+VALA_EXTERN AbstractClass* abstractclass_new (void);
+VALA_EXTERN void class_with_creation_method_free (ClassWithCreationMethod * self);
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClassWithCreationMethod, class_with_creation_method_free)
+static void class_with_creation_method_instance_init (ClassWithCreationMethod * self);
+VALA_EXTERN ClassWithCreationMethod* class_with_creation_method_new (void);
+VALA_EXTERN void class_with_named_creation_method_free (ClassWithNamedCreationMethod * self);
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClassWithNamedCreationMethod, class_with_named_creation_method_free)
+static void class_with_named_creation_method_instance_init (ClassWithNamedCreationMethod * self);
+VALA_EXTERN ClassWithNamedCreationMethod* class_with_named_creation_method_new_named (void);
+VALA_EXTERN ClassWithNamedCreationMethod* class_with_named_creation_method_new (void);
+VALA_EXTERN gpointer simple_gtype_instanceclass_ref (gpointer instance);
+VALA_EXTERN void simple_gtype_instanceclass_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_simple_gtype_instanceclass (const gchar* name,
+                                                   const gchar* nick,
+                                                   const gchar* blurb,
+                                                   GType object_type,
+                                                   GParamFlags flags);
+VALA_EXTERN void value_set_simple_gtype_instanceclass (GValue* value,
+                                           gpointer v_object);
+VALA_EXTERN void value_take_simple_gtype_instanceclass (GValue* value,
+                                            gpointer v_object);
+VALA_EXTERN gpointer value_get_simple_gtype_instanceclass (const GValue* value);
+VALA_EXTERN GType simple_gtype_instanceclass_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (SimpleGTypeInstanceClass, simple_gtype_instanceclass_unref)
+VALA_EXTERN SimpleGTypeInstanceClass* simple_gtype_instanceclass_new (void);
+VALA_EXTERN SimpleGTypeInstanceClass* simple_gtype_instanceclass_construct (GType object_type);
+static void simple_gtype_instanceclass_finalize (SimpleGTypeInstanceClass * obj);
+static GType simple_gtype_instanceclass_get_type_once (void);
+VALA_EXTERN GType derived_gtype_instanceclass_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (DerivedGTypeInstanceClass, simple_gtype_instanceclass_unref)
+VALA_EXTERN DerivedGTypeInstanceClass* derived_gtype_instanceclass_new (void);
+VALA_EXTERN DerivedGTypeInstanceClass* derived_gtype_instanceclass_construct (GType object_type);
+static GType derived_gtype_instanceclass_get_type_once (void);
+VALA_EXTERN gpointer public_gtype_instanceclass_ref (gpointer instance);
+VALA_EXTERN void public_gtype_instanceclass_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_public_gtype_instanceclass (const gchar* name,
+                                                   const gchar* nick,
+                                                   const gchar* blurb,
+                                                   GType object_type,
+                                                   GParamFlags flags);
+VALA_EXTERN void value_set_public_gtype_instanceclass (GValue* value,
+                                           gpointer v_object);
+VALA_EXTERN void value_take_public_gtype_instanceclass (GValue* value,
+                                            gpointer v_object);
+VALA_EXTERN gpointer value_get_public_gtype_instanceclass (const GValue* value);
+VALA_EXTERN GType public_gtype_instanceclass_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (PublicGTypeInstanceClass, public_gtype_instanceclass_unref)
+VALA_EXTERN PublicGTypeInstanceClass* public_gtype_instanceclass_new (void);
+VALA_EXTERN PublicGTypeInstanceClass* public_gtype_instanceclass_construct (GType object_type);
+static void public_gtype_instanceclass_finalize (PublicGTypeInstanceClass * obj);
+static GType public_gtype_instanceclass_get_type_once (void);
+VALA_EXTERN gpointer gtype_instance_class_with_creation_method_ref (gpointer instance);
+VALA_EXTERN void gtype_instance_class_with_creation_method_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_gtype_instance_class_with_creation_method (const gchar* name,
+                                                                  const gchar* nick,
+                                                                  const gchar* blurb,
+                                                                  GType object_type,
+                                                                  GParamFlags flags);
+VALA_EXTERN void value_set_gtype_instance_class_with_creation_method (GValue* value,
+                                                          gpointer v_object);
+VALA_EXTERN void value_take_gtype_instance_class_with_creation_method (GValue* value,
+                                                           gpointer v_object);
+VALA_EXTERN gpointer value_get_gtype_instance_class_with_creation_method (const GValue* value);
+VALA_EXTERN GType gtype_instance_class_with_creation_method_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (GTypeInstanceClassWithCreationMethod, 
gtype_instance_class_with_creation_method_unref)
+VALA_EXTERN GTypeInstanceClassWithCreationMethod* gtype_instance_class_with_creation_method_new (void);
+VALA_EXTERN GTypeInstanceClassWithCreationMethod* gtype_instance_class_with_creation_method_construct (GType 
object_type);
+static void gtype_instance_class_with_creation_method_finalize (GTypeInstanceClassWithCreationMethod * obj);
+static GType gtype_instance_class_with_creation_method_get_type_once (void);
+VALA_EXTERN gpointer gtype_instance_class_with_named_creation_method_ref (gpointer instance);
+VALA_EXTERN void gtype_instance_class_with_named_creation_method_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_gtype_instance_class_with_named_creation_method (const gchar* name,
+                                                                        const gchar* nick,
+                                                                        const gchar* blurb,
+                                                                        GType object_type,
+                                                                        GParamFlags flags);
+VALA_EXTERN void value_set_gtype_instance_class_with_named_creation_method (GValue* value,
+                                                                gpointer v_object);
+VALA_EXTERN void value_take_gtype_instance_class_with_named_creation_method (GValue* value,
+                                                                 gpointer v_object);
+VALA_EXTERN gpointer value_get_gtype_instance_class_with_named_creation_method (const GValue* value);
+VALA_EXTERN GType gtype_instance_class_with_named_creation_method_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (GTypeInstanceClassWithNamedCreationMethod, 
gtype_instance_class_with_named_creation_method_unref)
+VALA_EXTERN GTypeInstanceClassWithNamedCreationMethod* 
gtype_instance_class_with_named_creation_method_new_named (void);
+VALA_EXTERN GTypeInstanceClassWithNamedCreationMethod* 
gtype_instance_class_with_named_creation_method_construct_named (GType object_type);
+VALA_EXTERN GTypeInstanceClassWithNamedCreationMethod* gtype_instance_class_with_named_creation_method_new 
(void);
+VALA_EXTERN GTypeInstanceClassWithNamedCreationMethod* 
gtype_instance_class_with_named_creation_method_construct (GType object_type);
+static void gtype_instance_class_with_named_creation_method_finalize 
(GTypeInstanceClassWithNamedCreationMethod * obj);
+static GType gtype_instance_class_with_named_creation_method_get_type_once (void);
+VALA_EXTERN GType simple_gobjectclass_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (SimpleGObjectClass, g_object_unref)
+VALA_EXTERN SimpleGObjectClass* simple_gobjectclass_new (void);
+VALA_EXTERN SimpleGObjectClass* simple_gobjectclass_construct (GType object_type);
+static GType simple_gobjectclass_get_type_once (void);
+VALA_EXTERN GType derived_gobjectclass_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (DerivedGObjectClass, g_object_unref)
+VALA_EXTERN DerivedGObjectClass* derived_gobjectclass_new (void);
+VALA_EXTERN DerivedGObjectClass* derived_gobjectclass_construct (GType object_type);
+static GType derived_gobjectclass_get_type_once (void);
+VALA_EXTERN GType public_gobjectclass_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (PublicGObjectClass, g_object_unref)
+VALA_EXTERN PublicGObjectClass* public_gobjectclass_new (void);
+VALA_EXTERN PublicGObjectClass* public_gobjectclass_construct (GType object_type);
+static GType public_gobjectclass_get_type_once (void);
+VALA_EXTERN GType abstract_gobjectclass_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (AbstractGObjectClass, g_object_unref)
+VALA_EXTERN AbstractGObjectClass* abstract_gobjectclass_construct (GType object_type);
+static GType abstract_gobjectclass_get_type_once (void);
+VALA_EXTERN GType gobject_class_with_creation_method_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (GObjectClassWithCreationMethod, g_object_unref)
+VALA_EXTERN GObjectClassWithCreationMethod* gobject_class_with_creation_method_new (void);
+VALA_EXTERN GObjectClassWithCreationMethod* gobject_class_with_creation_method_construct (GType object_type);
+static GType gobject_class_with_creation_method_get_type_once (void);
+VALA_EXTERN GType gobject_class_with_named_creation_method_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (GObjectClassWithNamedCreationMethod, g_object_unref)
+VALA_EXTERN GObjectClassWithNamedCreationMethod* gobject_class_with_named_creation_method_new_named (void);
+VALA_EXTERN GObjectClassWithNamedCreationMethod* gobject_class_with_named_creation_method_construct_named 
(GType object_type);
+VALA_EXTERN GObjectClassWithNamedCreationMethod* gobject_class_with_named_creation_method_new (void);
+VALA_EXTERN GObjectClassWithNamedCreationMethod* gobject_class_with_named_creation_method_construct (GType 
object_type);
+static GType gobject_class_with_named_creation_method_get_type_once (void);
+static void _vala_main (void);
+
+CompactClass*
+compactclass_new (void)
+{
+       CompactClass* self;
+       self = g_slice_new0 (CompactClass);
+       compactclass_instance_init (self);
+       return self;
+}
+
+static void
+compactclass_instance_init (CompactClass * self)
+{
+}
+
+void
+compactclass_free (CompactClass * self)
+{
+       g_slice_free (CompactClass, self);
+}
+
+CompactClassWithDestructor*
+compact_class_with_destructor_new (void)
+{
+       CompactClassWithDestructor* self;
+       self = g_slice_new0 (CompactClassWithDestructor);
+       compact_class_with_destructor_instance_init (self);
+       return self;
+}
+
+static void
+compact_class_with_destructor_instance_init (CompactClassWithDestructor * self)
+{
+}
+
+void
+compact_class_with_destructor_free (CompactClassWithDestructor * self)
+{
+       FILE* _tmp0_;
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, "~CompactClassWithDestructor\n");
+       g_slice_free (CompactClassWithDestructor, self);
+}
+
+DerivedClass*
+derivedclass_new (void)
+{
+       DerivedClass* self;
+       self = (DerivedClass*) compactclass_new ();
+       derivedclass_instance_init (self);
+       return self;
+}
+
+static void
+derivedclass_instance_init (DerivedClass * self)
+{
+}
+
+PublicClass*
+publicclass_new (void)
+{
+       PublicClass* self;
+       self = g_slice_new0 (PublicClass);
+       publicclass_instance_init (self);
+       return self;
+}
+
+static void
+publicclass_instance_init (PublicClass * self)
+{
+}
+
+void
+publicclass_free (PublicClass * self)
+{
+       g_slice_free (PublicClass, self);
+}
+
+AbstractClass*
+abstractclass_new (void)
+{
+       AbstractClass* self;
+       self = g_slice_new0 (AbstractClass);
+       abstractclass_instance_init (self);
+       return self;
+}
+
+static void
+abstractclass_instance_init (AbstractClass * self)
+{
+}
+
+void
+abstractclass_free (AbstractClass * self)
+{
+       g_slice_free (AbstractClass, self);
+}
+
+ClassWithCreationMethod*
+class_with_creation_method_new (void)
+{
+       ClassWithCreationMethod* self;
+       FILE* _tmp0_;
+       self = g_slice_new0 (ClassWithCreationMethod);
+       class_with_creation_method_instance_init (self);
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, "ClassWithCreationMethod\n");
+       return self;
+}
+
+static void
+class_with_creation_method_instance_init (ClassWithCreationMethod * self)
+{
+}
+
+void
+class_with_creation_method_free (ClassWithCreationMethod * self)
+{
+       g_slice_free (ClassWithCreationMethod, self);
+}
+
+ClassWithNamedCreationMethod*
+class_with_named_creation_method_new_named (void)
+{
+       ClassWithNamedCreationMethod* self;
+       FILE* _tmp0_;
+       self = g_slice_new0 (ClassWithNamedCreationMethod);
+       class_with_named_creation_method_instance_init (self);
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, "ClassWithNamedCreationMethod\n");
+       return self;
+}
+
+ClassWithNamedCreationMethod*
+class_with_named_creation_method_new (void)
+{
+       ClassWithNamedCreationMethod* self;
+       self = g_slice_new0 (ClassWithNamedCreationMethod);
+       class_with_named_creation_method_instance_init (self);
+       return self;
+}
+
+static void
+class_with_named_creation_method_instance_init (ClassWithNamedCreationMethod * self)
+{
+}
+
+void
+class_with_named_creation_method_free (ClassWithNamedCreationMethod * self)
+{
+       g_slice_free (ClassWithNamedCreationMethod, self);
+}
+
+SimpleGTypeInstanceClass*
+simple_gtype_instanceclass_construct (GType object_type)
+{
+       SimpleGTypeInstanceClass* self = NULL;
+       self = (SimpleGTypeInstanceClass*) g_type_create_instance (object_type);
+       return self;
+}
+
+SimpleGTypeInstanceClass*
+simple_gtype_instanceclass_new (void)
+{
+       return simple_gtype_instanceclass_construct (TYPE_SIMPLE_GTYPE_INSTANCECLASS);
+}
+
+static void
+value_simple_gtype_instanceclass_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_simple_gtype_instanceclass_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               simple_gtype_instanceclass_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_simple_gtype_instanceclass_copy_value (const GValue* src_value,
+                                             GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = simple_gtype_instanceclass_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_simple_gtype_instanceclass_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_simple_gtype_instanceclass_collect_value (GValue* value,
+                                                guint n_collect_values,
+                                                GTypeCValue* collect_values,
+                                                guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               SimpleGTypeInstanceClass * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = simple_gtype_instanceclass_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_simple_gtype_instanceclass_lcopy_value (const GValue* value,
+                                              guint n_collect_values,
+                                              GTypeCValue* collect_values,
+                                              guint collect_flags)
+{
+       SimpleGTypeInstanceClass ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = simple_gtype_instanceclass_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_simple_gtype_instanceclass (const gchar* name,
+                                       const gchar* nick,
+                                       const gchar* blurb,
+                                       GType object_type,
+                                       GParamFlags flags)
+{
+       ParamSpecSimpleGTypeInstanceClass* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_SIMPLE_GTYPE_INSTANCECLASS), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_simple_gtype_instanceclass (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_SIMPLE_GTYPE_INSTANCECLASS), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_simple_gtype_instanceclass (GValue* value,
+                                      gpointer v_object)
+{
+       SimpleGTypeInstanceClass * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_SIMPLE_GTYPE_INSTANCECLASS));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_SIMPLE_GTYPE_INSTANCECLASS));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               simple_gtype_instanceclass_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               simple_gtype_instanceclass_unref (old);
+       }
+}
+
+void
+value_take_simple_gtype_instanceclass (GValue* value,
+                                       gpointer v_object)
+{
+       SimpleGTypeInstanceClass * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_SIMPLE_GTYPE_INSTANCECLASS));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_SIMPLE_GTYPE_INSTANCECLASS));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               simple_gtype_instanceclass_unref (old);
+       }
+}
+
+static void
+simple_gtype_instanceclass_class_init (SimpleGTypeInstanceClassClass * klass,
+                                       gpointer klass_data)
+{
+       simple_gtype_instanceclass_parent_class = g_type_class_peek_parent (klass);
+       ((SimpleGTypeInstanceClassClass *) klass)->finalize = simple_gtype_instanceclass_finalize;
+}
+
+static void
+simple_gtype_instanceclass_instance_init (SimpleGTypeInstanceClass * self,
+                                          gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+simple_gtype_instanceclass_finalize (SimpleGTypeInstanceClass * obj)
+{
+       SimpleGTypeInstanceClass * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_SIMPLE_GTYPE_INSTANCECLASS, SimpleGTypeInstanceClass);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+simple_gtype_instanceclass_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_simple_gtype_instanceclass_init, 
value_simple_gtype_instanceclass_free_value, value_simple_gtype_instanceclass_copy_value, 
value_simple_gtype_instanceclass_peek_pointer, "p", value_simple_gtype_instanceclass_collect_value, "p", 
value_simple_gtype_instanceclass_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (SimpleGTypeInstanceClassClass), (GBaseInitFunc) 
NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) simple_gtype_instanceclass_class_init, (GClassFinalizeFunc) 
NULL, NULL, sizeof (SimpleGTypeInstanceClass), 0, (GInstanceInitFunc) 
simple_gtype_instanceclass_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType simple_gtype_instanceclass_type_id;
+       simple_gtype_instanceclass_type_id = g_type_register_fundamental (g_type_fundamental_next (), 
"SimpleGTypeInstanceClass", &g_define_type_info, &g_define_type_fundamental_info, 0);
+       return simple_gtype_instanceclass_type_id;
+}
+
+GType
+simple_gtype_instanceclass_get_type (void)
+{
+       static volatile gsize simple_gtype_instanceclass_type_id__volatile = 0;
+       if (g_once_init_enter (&simple_gtype_instanceclass_type_id__volatile)) {
+               GType simple_gtype_instanceclass_type_id;
+               simple_gtype_instanceclass_type_id = simple_gtype_instanceclass_get_type_once ();
+               g_once_init_leave (&simple_gtype_instanceclass_type_id__volatile, 
simple_gtype_instanceclass_type_id);
+       }
+       return simple_gtype_instanceclass_type_id__volatile;
+}
+
+gpointer
+simple_gtype_instanceclass_ref (gpointer instance)
+{
+       SimpleGTypeInstanceClass * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+simple_gtype_instanceclass_unref (gpointer instance)
+{
+       SimpleGTypeInstanceClass * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               SIMPLE_GTYPE_INSTANCECLASS_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+DerivedGTypeInstanceClass*
+derived_gtype_instanceclass_construct (GType object_type)
+{
+       DerivedGTypeInstanceClass* self = NULL;
+       self = (DerivedGTypeInstanceClass*) simple_gtype_instanceclass_construct (object_type);
+       return self;
+}
+
+DerivedGTypeInstanceClass*
+derived_gtype_instanceclass_new (void)
+{
+       return derived_gtype_instanceclass_construct (TYPE_DERIVED_GTYPE_INSTANCECLASS);
+}
+
+static void
+derived_gtype_instanceclass_class_init (DerivedGTypeInstanceClassClass * klass,
+                                        gpointer klass_data)
+{
+       derived_gtype_instanceclass_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+derived_gtype_instanceclass_instance_init (DerivedGTypeInstanceClass * self,
+                                           gpointer klass)
+{
+}
+
+static GType
+derived_gtype_instanceclass_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (DerivedGTypeInstanceClassClass), 
(GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) derived_gtype_instanceclass_class_init, 
(GClassFinalizeFunc) NULL, NULL, sizeof (DerivedGTypeInstanceClass), 0, (GInstanceInitFunc) 
derived_gtype_instanceclass_instance_init, NULL };
+       GType derived_gtype_instanceclass_type_id;
+       derived_gtype_instanceclass_type_id = g_type_register_static (TYPE_SIMPLE_GTYPE_INSTANCECLASS, 
"DerivedGTypeInstanceClass", &g_define_type_info, 0);
+       return derived_gtype_instanceclass_type_id;
+}
+
+GType
+derived_gtype_instanceclass_get_type (void)
+{
+       static volatile gsize derived_gtype_instanceclass_type_id__volatile = 0;
+       if (g_once_init_enter (&derived_gtype_instanceclass_type_id__volatile)) {
+               GType derived_gtype_instanceclass_type_id;
+               derived_gtype_instanceclass_type_id = derived_gtype_instanceclass_get_type_once ();
+               g_once_init_leave (&derived_gtype_instanceclass_type_id__volatile, 
derived_gtype_instanceclass_type_id);
+       }
+       return derived_gtype_instanceclass_type_id__volatile;
+}
+
+PublicGTypeInstanceClass*
+public_gtype_instanceclass_construct (GType object_type)
+{
+       PublicGTypeInstanceClass* self = NULL;
+       self = (PublicGTypeInstanceClass*) g_type_create_instance (object_type);
+       return self;
+}
+
+PublicGTypeInstanceClass*
+public_gtype_instanceclass_new (void)
+{
+       return public_gtype_instanceclass_construct (TYPE_PUBLIC_GTYPE_INSTANCECLASS);
+}
+
+static void
+value_public_gtype_instanceclass_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_public_gtype_instanceclass_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               public_gtype_instanceclass_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_public_gtype_instanceclass_copy_value (const GValue* src_value,
+                                             GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = public_gtype_instanceclass_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_public_gtype_instanceclass_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_public_gtype_instanceclass_collect_value (GValue* value,
+                                                guint n_collect_values,
+                                                GTypeCValue* collect_values,
+                                                guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               PublicGTypeInstanceClass * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = public_gtype_instanceclass_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_public_gtype_instanceclass_lcopy_value (const GValue* value,
+                                              guint n_collect_values,
+                                              GTypeCValue* collect_values,
+                                              guint collect_flags)
+{
+       PublicGTypeInstanceClass ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = public_gtype_instanceclass_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_public_gtype_instanceclass (const gchar* name,
+                                       const gchar* nick,
+                                       const gchar* blurb,
+                                       GType object_type,
+                                       GParamFlags flags)
+{
+       ParamSpecPublicGTypeInstanceClass* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_PUBLIC_GTYPE_INSTANCECLASS), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_public_gtype_instanceclass (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_PUBLIC_GTYPE_INSTANCECLASS), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_public_gtype_instanceclass (GValue* value,
+                                      gpointer v_object)
+{
+       PublicGTypeInstanceClass * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_PUBLIC_GTYPE_INSTANCECLASS));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_PUBLIC_GTYPE_INSTANCECLASS));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               public_gtype_instanceclass_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               public_gtype_instanceclass_unref (old);
+       }
+}
+
+void
+value_take_public_gtype_instanceclass (GValue* value,
+                                       gpointer v_object)
+{
+       PublicGTypeInstanceClass * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_PUBLIC_GTYPE_INSTANCECLASS));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_PUBLIC_GTYPE_INSTANCECLASS));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               public_gtype_instanceclass_unref (old);
+       }
+}
+
+static void
+public_gtype_instanceclass_class_init (PublicGTypeInstanceClassClass * klass,
+                                       gpointer klass_data)
+{
+       public_gtype_instanceclass_parent_class = g_type_class_peek_parent (klass);
+       ((PublicGTypeInstanceClassClass *) klass)->finalize = public_gtype_instanceclass_finalize;
+}
+
+static void
+public_gtype_instanceclass_instance_init (PublicGTypeInstanceClass * self,
+                                          gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+public_gtype_instanceclass_finalize (PublicGTypeInstanceClass * obj)
+{
+       PublicGTypeInstanceClass * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_PUBLIC_GTYPE_INSTANCECLASS, PublicGTypeInstanceClass);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+public_gtype_instanceclass_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_public_gtype_instanceclass_init, 
value_public_gtype_instanceclass_free_value, value_public_gtype_instanceclass_copy_value, 
value_public_gtype_instanceclass_peek_pointer, "p", value_public_gtype_instanceclass_collect_value, "p", 
value_public_gtype_instanceclass_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (PublicGTypeInstanceClassClass), (GBaseInitFunc) 
NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) public_gtype_instanceclass_class_init, (GClassFinalizeFunc) 
NULL, NULL, sizeof (PublicGTypeInstanceClass), 0, (GInstanceInitFunc) 
public_gtype_instanceclass_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType public_gtype_instanceclass_type_id;
+       public_gtype_instanceclass_type_id = g_type_register_fundamental (g_type_fundamental_next (), 
"PublicGTypeInstanceClass", &g_define_type_info, &g_define_type_fundamental_info, 0);
+       return public_gtype_instanceclass_type_id;
+}
+
+GType
+public_gtype_instanceclass_get_type (void)
+{
+       static volatile gsize public_gtype_instanceclass_type_id__volatile = 0;
+       if (g_once_init_enter (&public_gtype_instanceclass_type_id__volatile)) {
+               GType public_gtype_instanceclass_type_id;
+               public_gtype_instanceclass_type_id = public_gtype_instanceclass_get_type_once ();
+               g_once_init_leave (&public_gtype_instanceclass_type_id__volatile, 
public_gtype_instanceclass_type_id);
+       }
+       return public_gtype_instanceclass_type_id__volatile;
+}
+
+gpointer
+public_gtype_instanceclass_ref (gpointer instance)
+{
+       PublicGTypeInstanceClass * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+public_gtype_instanceclass_unref (gpointer instance)
+{
+       PublicGTypeInstanceClass * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               PUBLIC_GTYPE_INSTANCECLASS_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+GTypeInstanceClassWithCreationMethod*
+gtype_instance_class_with_creation_method_construct (GType object_type)
+{
+       GTypeInstanceClassWithCreationMethod* self = NULL;
+       FILE* _tmp0_;
+       self = (GTypeInstanceClassWithCreationMethod*) g_type_create_instance (object_type);
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, "GTypeInstanceClassWithCreationMethod\n");
+       return self;
+}
+
+GTypeInstanceClassWithCreationMethod*
+gtype_instance_class_with_creation_method_new (void)
+{
+       return gtype_instance_class_with_creation_method_construct 
(TYPE_GTYPE_INSTANCE_CLASS_WITH_CREATION_METHOD);
+}
+
+static void
+value_gtype_instance_class_with_creation_method_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_gtype_instance_class_with_creation_method_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               gtype_instance_class_with_creation_method_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_gtype_instance_class_with_creation_method_copy_value (const GValue* src_value,
+                                                            GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = gtype_instance_class_with_creation_method_ref 
(src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_gtype_instance_class_with_creation_method_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_gtype_instance_class_with_creation_method_collect_value (GValue* value,
+                                                               guint n_collect_values,
+                                                               GTypeCValue* collect_values,
+                                                               guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               GTypeInstanceClassWithCreationMethod * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = gtype_instance_class_with_creation_method_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_gtype_instance_class_with_creation_method_lcopy_value (const GValue* value,
+                                                             guint n_collect_values,
+                                                             GTypeCValue* collect_values,
+                                                             guint collect_flags)
+{
+       GTypeInstanceClassWithCreationMethod ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = gtype_instance_class_with_creation_method_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_gtype_instance_class_with_creation_method (const gchar* name,
+                                                      const gchar* nick,
+                                                      const gchar* blurb,
+                                                      GType object_type,
+                                                      GParamFlags flags)
+{
+       ParamSpecGTypeInstanceClassWithCreationMethod* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_GTYPE_INSTANCE_CLASS_WITH_CREATION_METHOD), 
NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_gtype_instance_class_with_creation_method (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, 
TYPE_GTYPE_INSTANCE_CLASS_WITH_CREATION_METHOD), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_gtype_instance_class_with_creation_method (GValue* value,
+                                                     gpointer v_object)
+{
+       GTypeInstanceClassWithCreationMethod * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_GTYPE_INSTANCE_CLASS_WITH_CREATION_METHOD));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, 
TYPE_GTYPE_INSTANCE_CLASS_WITH_CREATION_METHOD));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               gtype_instance_class_with_creation_method_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               gtype_instance_class_with_creation_method_unref (old);
+       }
+}
+
+void
+value_take_gtype_instance_class_with_creation_method (GValue* value,
+                                                      gpointer v_object)
+{
+       GTypeInstanceClassWithCreationMethod * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_GTYPE_INSTANCE_CLASS_WITH_CREATION_METHOD));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, 
TYPE_GTYPE_INSTANCE_CLASS_WITH_CREATION_METHOD));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               gtype_instance_class_with_creation_method_unref (old);
+       }
+}
+
+static void
+gtype_instance_class_with_creation_method_class_init (GTypeInstanceClassWithCreationMethodClass * klass,
+                                                      gpointer klass_data)
+{
+       gtype_instance_class_with_creation_method_parent_class = g_type_class_peek_parent (klass);
+       ((GTypeInstanceClassWithCreationMethodClass *) klass)->finalize = 
gtype_instance_class_with_creation_method_finalize;
+}
+
+static void
+gtype_instance_class_with_creation_method_instance_init (GTypeInstanceClassWithCreationMethod * self,
+                                                         gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+gtype_instance_class_with_creation_method_finalize (GTypeInstanceClassWithCreationMethod * obj)
+{
+       GTypeInstanceClassWithCreationMethod * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_GTYPE_INSTANCE_CLASS_WITH_CREATION_METHOD, 
GTypeInstanceClassWithCreationMethod);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+gtype_instance_class_with_creation_method_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { 
value_gtype_instance_class_with_creation_method_init, 
value_gtype_instance_class_with_creation_method_free_value, 
value_gtype_instance_class_with_creation_method_copy_value, 
value_gtype_instance_class_with_creation_method_peek_pointer, "p", 
value_gtype_instance_class_with_creation_method_collect_value, "p", 
value_gtype_instance_class_with_creation_method_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (GTypeInstanceClassWithCreationMethodClass), 
(GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) 
gtype_instance_class_with_creation_method_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(GTypeInstanceClassWithCreationMethod), 0, (GInstanceInitFunc) 
gtype_instance_class_with_creation_method_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType gtype_instance_class_with_creation_method_type_id;
+       gtype_instance_class_with_creation_method_type_id = g_type_register_fundamental 
(g_type_fundamental_next (), "GTypeInstanceClassWithCreationMethod", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return gtype_instance_class_with_creation_method_type_id;
+}
+
+GType
+gtype_instance_class_with_creation_method_get_type (void)
+{
+       static volatile gsize gtype_instance_class_with_creation_method_type_id__volatile = 0;
+       if (g_once_init_enter (&gtype_instance_class_with_creation_method_type_id__volatile)) {
+               GType gtype_instance_class_with_creation_method_type_id;
+               gtype_instance_class_with_creation_method_type_id = 
gtype_instance_class_with_creation_method_get_type_once ();
+               g_once_init_leave (&gtype_instance_class_with_creation_method_type_id__volatile, 
gtype_instance_class_with_creation_method_type_id);
+       }
+       return gtype_instance_class_with_creation_method_type_id__volatile;
+}
+
+gpointer
+gtype_instance_class_with_creation_method_ref (gpointer instance)
+{
+       GTypeInstanceClassWithCreationMethod * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+gtype_instance_class_with_creation_method_unref (gpointer instance)
+{
+       GTypeInstanceClassWithCreationMethod * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               GTYPE_INSTANCE_CLASS_WITH_CREATION_METHOD_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+GTypeInstanceClassWithNamedCreationMethod*
+gtype_instance_class_with_named_creation_method_construct_named (GType object_type)
+{
+       GTypeInstanceClassWithNamedCreationMethod* self = NULL;
+       FILE* _tmp0_;
+       self = (GTypeInstanceClassWithNamedCreationMethod*) g_type_create_instance (object_type);
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, "GTypeInstanceClassWithNamedCreationMethod\n");
+       return self;
+}
+
+GTypeInstanceClassWithNamedCreationMethod*
+gtype_instance_class_with_named_creation_method_new_named (void)
+{
+       return gtype_instance_class_with_named_creation_method_construct_named 
(TYPE_GTYPE_INSTANCE_CLASS_WITH_NAMED_CREATION_METHOD);
+}
+
+GTypeInstanceClassWithNamedCreationMethod*
+gtype_instance_class_with_named_creation_method_construct (GType object_type)
+{
+       GTypeInstanceClassWithNamedCreationMethod* self = NULL;
+       self = (GTypeInstanceClassWithNamedCreationMethod*) g_type_create_instance (object_type);
+       return self;
+}
+
+GTypeInstanceClassWithNamedCreationMethod*
+gtype_instance_class_with_named_creation_method_new (void)
+{
+       return gtype_instance_class_with_named_creation_method_construct 
(TYPE_GTYPE_INSTANCE_CLASS_WITH_NAMED_CREATION_METHOD);
+}
+
+static void
+value_gtype_instance_class_with_named_creation_method_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_gtype_instance_class_with_named_creation_method_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               gtype_instance_class_with_named_creation_method_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_gtype_instance_class_with_named_creation_method_copy_value (const GValue* src_value,
+                                                                  GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = gtype_instance_class_with_named_creation_method_ref 
(src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_gtype_instance_class_with_named_creation_method_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_gtype_instance_class_with_named_creation_method_collect_value (GValue* value,
+                                                                     guint n_collect_values,
+                                                                     GTypeCValue* collect_values,
+                                                                     guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               GTypeInstanceClassWithNamedCreationMethod * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = gtype_instance_class_with_named_creation_method_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_gtype_instance_class_with_named_creation_method_lcopy_value (const GValue* value,
+                                                                   guint n_collect_values,
+                                                                   GTypeCValue* collect_values,
+                                                                   guint collect_flags)
+{
+       GTypeInstanceClassWithNamedCreationMethod ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = gtype_instance_class_with_named_creation_method_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_gtype_instance_class_with_named_creation_method (const gchar* name,
+                                                            const gchar* nick,
+                                                            const gchar* blurb,
+                                                            GType object_type,
+                                                            GParamFlags flags)
+{
+       ParamSpecGTypeInstanceClassWithNamedCreationMethod* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, 
TYPE_GTYPE_INSTANCE_CLASS_WITH_NAMED_CREATION_METHOD), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_gtype_instance_class_with_named_creation_method (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, 
TYPE_GTYPE_INSTANCE_CLASS_WITH_NAMED_CREATION_METHOD), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_gtype_instance_class_with_named_creation_method (GValue* value,
+                                                           gpointer v_object)
+{
+       GTypeInstanceClassWithNamedCreationMethod * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, 
TYPE_GTYPE_INSTANCE_CLASS_WITH_NAMED_CREATION_METHOD));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, 
TYPE_GTYPE_INSTANCE_CLASS_WITH_NAMED_CREATION_METHOD));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               gtype_instance_class_with_named_creation_method_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               gtype_instance_class_with_named_creation_method_unref (old);
+       }
+}
+
+void
+value_take_gtype_instance_class_with_named_creation_method (GValue* value,
+                                                            gpointer v_object)
+{
+       GTypeInstanceClassWithNamedCreationMethod * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, 
TYPE_GTYPE_INSTANCE_CLASS_WITH_NAMED_CREATION_METHOD));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, 
TYPE_GTYPE_INSTANCE_CLASS_WITH_NAMED_CREATION_METHOD));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               gtype_instance_class_with_named_creation_method_unref (old);
+       }
+}
+
+static void
+gtype_instance_class_with_named_creation_method_class_init (GTypeInstanceClassWithNamedCreationMethodClass * 
klass,
+                                                            gpointer klass_data)
+{
+       gtype_instance_class_with_named_creation_method_parent_class = g_type_class_peek_parent (klass);
+       ((GTypeInstanceClassWithNamedCreationMethodClass *) klass)->finalize = 
gtype_instance_class_with_named_creation_method_finalize;
+}
+
+static void
+gtype_instance_class_with_named_creation_method_instance_init (GTypeInstanceClassWithNamedCreationMethod * 
self,
+                                                               gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+gtype_instance_class_with_named_creation_method_finalize (GTypeInstanceClassWithNamedCreationMethod * obj)
+{
+       GTypeInstanceClassWithNamedCreationMethod * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_GTYPE_INSTANCE_CLASS_WITH_NAMED_CREATION_METHOD, 
GTypeInstanceClassWithNamedCreationMethod);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+gtype_instance_class_with_named_creation_method_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { 
value_gtype_instance_class_with_named_creation_method_init, 
value_gtype_instance_class_with_named_creation_method_free_value, 
value_gtype_instance_class_with_named_creation_method_copy_value, 
value_gtype_instance_class_with_named_creation_method_peek_pointer, "p", 
value_gtype_instance_class_with_named_creation_method_collect_value, "p", 
value_gtype_instance_class_with_named_creation_method_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof 
(GTypeInstanceClassWithNamedCreationMethodClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, 
(GClassInitFunc) gtype_instance_class_with_named_creation_method_class_init, (GClassFinalizeFunc) NULL, NULL, 
sizeof (GTypeInstanceClassWithNamedCreationMethod), 0, (GInstanceInitFunc) 
gtype_instance_class_with_named_creation_method_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType gtype_instance_class_with_named_creation_method_type_id;
+       gtype_instance_class_with_named_creation_method_type_id = g_type_register_fundamental 
(g_type_fundamental_next (), "GTypeInstanceClassWithNamedCreationMethod", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return gtype_instance_class_with_named_creation_method_type_id;
+}
+
+GType
+gtype_instance_class_with_named_creation_method_get_type (void)
+{
+       static volatile gsize gtype_instance_class_with_named_creation_method_type_id__volatile = 0;
+       if (g_once_init_enter (&gtype_instance_class_with_named_creation_method_type_id__volatile)) {
+               GType gtype_instance_class_with_named_creation_method_type_id;
+               gtype_instance_class_with_named_creation_method_type_id = 
gtype_instance_class_with_named_creation_method_get_type_once ();
+               g_once_init_leave (&gtype_instance_class_with_named_creation_method_type_id__volatile, 
gtype_instance_class_with_named_creation_method_type_id);
+       }
+       return gtype_instance_class_with_named_creation_method_type_id__volatile;
+}
+
+gpointer
+gtype_instance_class_with_named_creation_method_ref (gpointer instance)
+{
+       GTypeInstanceClassWithNamedCreationMethod * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+gtype_instance_class_with_named_creation_method_unref (gpointer instance)
+{
+       GTypeInstanceClassWithNamedCreationMethod * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               GTYPE_INSTANCE_CLASS_WITH_NAMED_CREATION_METHOD_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+SimpleGObjectClass*
+simple_gobjectclass_construct (GType object_type)
+{
+       SimpleGObjectClass * self = NULL;
+       self = (SimpleGObjectClass*) g_object_new (object_type, NULL);
+       return self;
+}
+
+SimpleGObjectClass*
+simple_gobjectclass_new (void)
+{
+       return simple_gobjectclass_construct (TYPE_SIMPLE_GOBJECTCLASS);
+}
+
+static void
+simple_gobjectclass_class_init (SimpleGObjectClassClass * klass,
+                                gpointer klass_data)
+{
+       simple_gobjectclass_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+simple_gobjectclass_instance_init (SimpleGObjectClass * self,
+                                   gpointer klass)
+{
+}
+
+static GType
+simple_gobjectclass_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (SimpleGObjectClassClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) simple_gobjectclass_class_init, (GClassFinalizeFunc) NULL, NULL, 
sizeof (SimpleGObjectClass), 0, (GInstanceInitFunc) simple_gobjectclass_instance_init, NULL };
+       GType simple_gobjectclass_type_id;
+       simple_gobjectclass_type_id = g_type_register_static (G_TYPE_OBJECT, "SimpleGObjectClass", 
&g_define_type_info, 0);
+       return simple_gobjectclass_type_id;
+}
+
+GType
+simple_gobjectclass_get_type (void)
+{
+       static volatile gsize simple_gobjectclass_type_id__volatile = 0;
+       if (g_once_init_enter (&simple_gobjectclass_type_id__volatile)) {
+               GType simple_gobjectclass_type_id;
+               simple_gobjectclass_type_id = simple_gobjectclass_get_type_once ();
+               g_once_init_leave (&simple_gobjectclass_type_id__volatile, simple_gobjectclass_type_id);
+       }
+       return simple_gobjectclass_type_id__volatile;
+}
+
+DerivedGObjectClass*
+derived_gobjectclass_construct (GType object_type)
+{
+       DerivedGObjectClass * self = NULL;
+       self = (DerivedGObjectClass*) simple_gobjectclass_construct (object_type);
+       return self;
+}
+
+DerivedGObjectClass*
+derived_gobjectclass_new (void)
+{
+       return derived_gobjectclass_construct (TYPE_DERIVED_GOBJECTCLASS);
+}
+
+static void
+derived_gobjectclass_class_init (DerivedGObjectClassClass * klass,
+                                 gpointer klass_data)
+{
+       derived_gobjectclass_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+derived_gobjectclass_instance_init (DerivedGObjectClass * self,
+                                    gpointer klass)
+{
+}
+
+static GType
+derived_gobjectclass_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (DerivedGObjectClassClass), (GBaseInitFunc) 
NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) derived_gobjectclass_class_init, (GClassFinalizeFunc) NULL, 
NULL, sizeof (DerivedGObjectClass), 0, (GInstanceInitFunc) derived_gobjectclass_instance_init, NULL };
+       GType derived_gobjectclass_type_id;
+       derived_gobjectclass_type_id = g_type_register_static (TYPE_SIMPLE_GOBJECTCLASS, 
"DerivedGObjectClass", &g_define_type_info, 0);
+       return derived_gobjectclass_type_id;
+}
+
+GType
+derived_gobjectclass_get_type (void)
+{
+       static volatile gsize derived_gobjectclass_type_id__volatile = 0;
+       if (g_once_init_enter (&derived_gobjectclass_type_id__volatile)) {
+               GType derived_gobjectclass_type_id;
+               derived_gobjectclass_type_id = derived_gobjectclass_get_type_once ();
+               g_once_init_leave (&derived_gobjectclass_type_id__volatile, derived_gobjectclass_type_id);
+       }
+       return derived_gobjectclass_type_id__volatile;
+}
+
+PublicGObjectClass*
+public_gobjectclass_construct (GType object_type)
+{
+       PublicGObjectClass * self = NULL;
+       self = (PublicGObjectClass*) g_object_new (object_type, NULL);
+       return self;
+}
+
+PublicGObjectClass*
+public_gobjectclass_new (void)
+{
+       return public_gobjectclass_construct (TYPE_PUBLIC_GOBJECTCLASS);
+}
+
+static void
+public_gobjectclass_class_init (PublicGObjectClassClass * klass,
+                                gpointer klass_data)
+{
+       public_gobjectclass_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+public_gobjectclass_instance_init (PublicGObjectClass * self,
+                                   gpointer klass)
+{
+}
+
+static GType
+public_gobjectclass_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (PublicGObjectClassClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) public_gobjectclass_class_init, (GClassFinalizeFunc) NULL, NULL, 
sizeof (PublicGObjectClass), 0, (GInstanceInitFunc) public_gobjectclass_instance_init, NULL };
+       GType public_gobjectclass_type_id;
+       public_gobjectclass_type_id = g_type_register_static (G_TYPE_OBJECT, "PublicGObjectClass", 
&g_define_type_info, 0);
+       return public_gobjectclass_type_id;
+}
+
+GType
+public_gobjectclass_get_type (void)
+{
+       static volatile gsize public_gobjectclass_type_id__volatile = 0;
+       if (g_once_init_enter (&public_gobjectclass_type_id__volatile)) {
+               GType public_gobjectclass_type_id;
+               public_gobjectclass_type_id = public_gobjectclass_get_type_once ();
+               g_once_init_leave (&public_gobjectclass_type_id__volatile, public_gobjectclass_type_id);
+       }
+       return public_gobjectclass_type_id__volatile;
+}
+
+AbstractGObjectClass*
+abstract_gobjectclass_construct (GType object_type)
+{
+       AbstractGObjectClass * self = NULL;
+       self = (AbstractGObjectClass*) g_object_new (object_type, NULL);
+       return self;
+}
+
+static void
+abstract_gobjectclass_class_init (AbstractGObjectClassClass * klass,
+                                  gpointer klass_data)
+{
+       abstract_gobjectclass_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+abstract_gobjectclass_instance_init (AbstractGObjectClass * self,
+                                     gpointer klass)
+{
+}
+
+static GType
+abstract_gobjectclass_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (AbstractGObjectClassClass), (GBaseInitFunc) 
NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) abstract_gobjectclass_class_init, (GClassFinalizeFunc) NULL, 
NULL, sizeof (AbstractGObjectClass), 0, (GInstanceInitFunc) abstract_gobjectclass_instance_init, NULL };
+       GType abstract_gobjectclass_type_id;
+       abstract_gobjectclass_type_id = g_type_register_static (G_TYPE_OBJECT, "AbstractGObjectClass", 
&g_define_type_info, G_TYPE_FLAG_ABSTRACT);
+       return abstract_gobjectclass_type_id;
+}
+
+GType
+abstract_gobjectclass_get_type (void)
+{
+       static volatile gsize abstract_gobjectclass_type_id__volatile = 0;
+       if (g_once_init_enter (&abstract_gobjectclass_type_id__volatile)) {
+               GType abstract_gobjectclass_type_id;
+               abstract_gobjectclass_type_id = abstract_gobjectclass_get_type_once ();
+               g_once_init_leave (&abstract_gobjectclass_type_id__volatile, abstract_gobjectclass_type_id);
+       }
+       return abstract_gobjectclass_type_id__volatile;
+}
+
+GObjectClassWithCreationMethod*
+gobject_class_with_creation_method_construct (GType object_type)
+{
+       GObjectClassWithCreationMethod * self = NULL;
+       self = (GObjectClassWithCreationMethod*) g_object_new (object_type, NULL);
+       return self;
+}
+
+GObjectClassWithCreationMethod*
+gobject_class_with_creation_method_new (void)
+{
+       return gobject_class_with_creation_method_construct (TYPE_GOBJECT_CLASS_WITH_CREATION_METHOD);
+}
+
+static void
+gobject_class_with_creation_method_class_init (GObjectClassWithCreationMethodClass * klass,
+                                               gpointer klass_data)
+{
+       gobject_class_with_creation_method_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+gobject_class_with_creation_method_instance_init (GObjectClassWithCreationMethod * self,
+                                                  gpointer klass)
+{
+}
+
+static GType
+gobject_class_with_creation_method_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (GObjectClassWithCreationMethodClass), 
(GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) 
gobject_class_with_creation_method_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(GObjectClassWithCreationMethod), 0, (GInstanceInitFunc) gobject_class_with_creation_method_instance_init, 
NULL };
+       GType gobject_class_with_creation_method_type_id;
+       gobject_class_with_creation_method_type_id = g_type_register_static (G_TYPE_OBJECT, 
"GObjectClassWithCreationMethod", &g_define_type_info, 0);
+       return gobject_class_with_creation_method_type_id;
+}
+
+GType
+gobject_class_with_creation_method_get_type (void)
+{
+       static volatile gsize gobject_class_with_creation_method_type_id__volatile = 0;
+       if (g_once_init_enter (&gobject_class_with_creation_method_type_id__volatile)) {
+               GType gobject_class_with_creation_method_type_id;
+               gobject_class_with_creation_method_type_id = gobject_class_with_creation_method_get_type_once 
();
+               g_once_init_leave (&gobject_class_with_creation_method_type_id__volatile, 
gobject_class_with_creation_method_type_id);
+       }
+       return gobject_class_with_creation_method_type_id__volatile;
+}
+
+GObjectClassWithNamedCreationMethod*
+gobject_class_with_named_creation_method_construct_named (GType object_type)
+{
+       GObjectClassWithNamedCreationMethod * self = NULL;
+       self = (GObjectClassWithNamedCreationMethod*) g_object_new (object_type, NULL);
+       return self;
+}
+
+GObjectClassWithNamedCreationMethod*
+gobject_class_with_named_creation_method_new_named (void)
+{
+       return gobject_class_with_named_creation_method_construct_named 
(TYPE_GOBJECT_CLASS_WITH_NAMED_CREATION_METHOD);
+}
+
+GObjectClassWithNamedCreationMethod*
+gobject_class_with_named_creation_method_construct (GType object_type)
+{
+       GObjectClassWithNamedCreationMethod * self = NULL;
+       self = (GObjectClassWithNamedCreationMethod*) g_object_new (object_type, NULL);
+       return self;
+}
+
+GObjectClassWithNamedCreationMethod*
+gobject_class_with_named_creation_method_new (void)
+{
+       return gobject_class_with_named_creation_method_construct 
(TYPE_GOBJECT_CLASS_WITH_NAMED_CREATION_METHOD);
+}
+
+static void
+gobject_class_with_named_creation_method_class_init (GObjectClassWithNamedCreationMethodClass * klass,
+                                                     gpointer klass_data)
+{
+       gobject_class_with_named_creation_method_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+gobject_class_with_named_creation_method_instance_init (GObjectClassWithNamedCreationMethod * self,
+                                                        gpointer klass)
+{
+}
+
+static GType
+gobject_class_with_named_creation_method_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (GObjectClassWithNamedCreationMethodClass), 
(GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) 
gobject_class_with_named_creation_method_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(GObjectClassWithNamedCreationMethod), 0, (GInstanceInitFunc) 
gobject_class_with_named_creation_method_instance_init, NULL };
+       GType gobject_class_with_named_creation_method_type_id;
+       gobject_class_with_named_creation_method_type_id = g_type_register_static (G_TYPE_OBJECT, 
"GObjectClassWithNamedCreationMethod", &g_define_type_info, 0);
+       return gobject_class_with_named_creation_method_type_id;
+}
+
+GType
+gobject_class_with_named_creation_method_get_type (void)
+{
+       static volatile gsize gobject_class_with_named_creation_method_type_id__volatile = 0;
+       if (g_once_init_enter (&gobject_class_with_named_creation_method_type_id__volatile)) {
+               GType gobject_class_with_named_creation_method_type_id;
+               gobject_class_with_named_creation_method_type_id = 
gobject_class_with_named_creation_method_get_type_once ();
+               g_once_init_leave (&gobject_class_with_named_creation_method_type_id__volatile, 
gobject_class_with_named_creation_method_type_id);
+       }
+       return gobject_class_with_named_creation_method_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       FILE* _tmp0_;
+       FILE* _tmp1_;
+       CompactClass* compact_class = NULL;
+       CompactClass* _tmp2_;
+       FILE* _tmp3_;
+       DerivedClass* derived_class = NULL;
+       DerivedClass* _tmp4_;
+       FILE* _tmp5_;
+       PublicClass* public_class = NULL;
+       PublicClass* _tmp6_;
+       FILE* _tmp7_;
+       ClassWithCreationMethod* class_with_creation_method = NULL;
+       ClassWithCreationMethod* _tmp8_;
+       FILE* _tmp9_;
+       ClassWithNamedCreationMethod* class_with_named_creation_method = NULL;
+       ClassWithNamedCreationMethod* _tmp10_;
+       FILE* _tmp11_;
+       CompactClassWithDestructor* compact_class_with_destructor = NULL;
+       CompactClassWithDestructor* _tmp12_;
+       FILE* _tmp13_;
+       SimpleGTypeInstanceClass* simple_gtypeinstance_class = NULL;
+       SimpleGTypeInstanceClass* _tmp14_;
+       FILE* _tmp15_;
+       DerivedGTypeInstanceClass* derived_gtypeinstance_class = NULL;
+       DerivedGTypeInstanceClass* _tmp16_;
+       FILE* _tmp17_;
+       PublicGTypeInstanceClass* public_gtypeinstance_class = NULL;
+       PublicGTypeInstanceClass* _tmp18_;
+       FILE* _tmp19_;
+       GTypeInstanceClassWithCreationMethod* gtypeinstance_class_with_creation_method = NULL;
+       GTypeInstanceClassWithCreationMethod* _tmp20_;
+       FILE* _tmp21_;
+       GTypeInstanceClassWithNamedCreationMethod* gtypeinstance_class_with_named_creation_method = NULL;
+       GTypeInstanceClassWithNamedCreationMethod* _tmp22_;
+       FILE* _tmp23_;
+       SimpleGObjectClass* simple_gobject_class = NULL;
+       SimpleGObjectClass* _tmp24_;
+       FILE* _tmp25_;
+       DerivedGObjectClass* derived_gobject_class = NULL;
+       DerivedGObjectClass* _tmp26_;
+       FILE* _tmp27_;
+       PublicGObjectClass* public_gobject_class = NULL;
+       PublicGObjectClass* _tmp28_;
+       FILE* _tmp29_;
+       GObjectClassWithCreationMethod* gobject_class_with_creation_method = NULL;
+       GObjectClassWithCreationMethod* _tmp30_;
+       FILE* _tmp31_;
+       GObjectClassWithNamedCreationMethod* gobject_class_with_named_creation_method = NULL;
+       GObjectClassWithNamedCreationMethod* _tmp32_;
+       FILE* _tmp33_;
+       CompactClass* _tmp34_ = NULL;
+       FILE* _tmp35_;
+       CompactClass* _tmp36_;
+       FILE* _tmp37_;
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, "Classes Test:\n");
+       _tmp1_ = stdout;
+       fprintf (_tmp1_, "new CompactClass ()\n");
+       _tmp2_ = compactclass_new ();
+       compact_class = _tmp2_;
+       _tmp3_ = stdout;
+       fprintf (_tmp3_, "new DerivedClass ()\n");
+       _tmp4_ = derivedclass_new ();
+       derived_class = _tmp4_;
+       _tmp5_ = stdout;
+       fprintf (_tmp5_, "new PublicClass ()\n");
+       _tmp6_ = publicclass_new ();
+       public_class = _tmp6_;
+       _tmp7_ = stdout;
+       fprintf (_tmp7_, "new ClassWithCreationMethod ()\n");
+       _tmp8_ = class_with_creation_method_new ();
+       class_with_creation_method = _tmp8_;
+       _tmp9_ = stdout;
+       fprintf (_tmp9_, "new ClassWithNamedCreationMethod ()\n");
+       _tmp10_ = class_with_named_creation_method_new_named ();
+       class_with_named_creation_method = _tmp10_;
+       _tmp11_ = stdout;
+       fprintf (_tmp11_, "new CompactClassWithDestructor ()\n");
+       _tmp12_ = compact_class_with_destructor_new ();
+       compact_class_with_destructor = _tmp12_;
+       _compact_class_with_destructor_free0 (compact_class_with_destructor);
+       compact_class_with_destructor = NULL;
+       _tmp13_ = stdout;
+       fprintf (_tmp13_, "new SimpleGTypeInstanceClass ()\n");
+       _tmp14_ = simple_gtype_instanceclass_new ();
+       simple_gtypeinstance_class = _tmp14_;
+       _tmp15_ = stdout;
+       fprintf (_tmp15_, "new DerivedGTypeInstanceClass ()\n");
+       _tmp16_ = derived_gtype_instanceclass_new ();
+       derived_gtypeinstance_class = _tmp16_;
+       _tmp17_ = stdout;
+       fprintf (_tmp17_, "new PublicGTypeInstanceClass ()\n");
+       _tmp18_ = public_gtype_instanceclass_new ();
+       public_gtypeinstance_class = _tmp18_;
+       _tmp19_ = stdout;
+       fprintf (_tmp19_, "new GTypeInstanceClassWithCreationMethod ()\n");
+       _tmp20_ = gtype_instance_class_with_creation_method_new ();
+       gtypeinstance_class_with_creation_method = _tmp20_;
+       _tmp21_ = stdout;
+       fprintf (_tmp21_, "new GTypeInstanceClassWithNamedCreationMethod ()\n");
+       _tmp22_ = gtype_instance_class_with_named_creation_method_new_named ();
+       gtypeinstance_class_with_named_creation_method = _tmp22_;
+       _tmp23_ = stdout;
+       fprintf (_tmp23_, "new SimpleGObjectClass ()\n");
+       _tmp24_ = simple_gobjectclass_new ();
+       simple_gobject_class = _tmp24_;
+       _tmp25_ = stdout;
+       fprintf (_tmp25_, "new DerivedGObjectClass ()\n");
+       _tmp26_ = derived_gobjectclass_new ();
+       derived_gobject_class = _tmp26_;
+       _tmp27_ = stdout;
+       fprintf (_tmp27_, "new PublicGObjectClass ()\n");
+       _tmp28_ = public_gobjectclass_new ();
+       public_gobject_class = _tmp28_;
+       _tmp29_ = stdout;
+       fprintf (_tmp29_, "new GObjectClassWithCreationMethod ()\n");
+       _tmp30_ = gobject_class_with_creation_method_new ();
+       gobject_class_with_creation_method = _tmp30_;
+       _tmp31_ = stdout;
+       fprintf (_tmp31_, "new GObjectClassWithNamedCreationMethod ()\n");
+       _tmp32_ = gobject_class_with_named_creation_method_new_named ();
+       gobject_class_with_named_creation_method = _tmp32_;
+       _tmp33_ = stdout;
+       fprintf (_tmp33_, "new CompactClass () { field = 1 }\n");
+       _tmp34_ = compactclass_new ();
+       _tmp34_->field = 1;
+       _compactclass_free0 (compact_class);
+       compact_class = _tmp34_;
+       _tmp35_ = stdout;
+       _tmp36_ = compact_class;
+       fprintf (_tmp35_, "compact_class.field = %d\n", _tmp36_->field);
+       _tmp37_ = stdout;
+       fprintf (_tmp37_, ".\n");
+       _g_object_unref0 (gobject_class_with_named_creation_method);
+       _g_object_unref0 (gobject_class_with_creation_method);
+       _g_object_unref0 (public_gobject_class);
+       _g_object_unref0 (derived_gobject_class);
+       _g_object_unref0 (simple_gobject_class);
+       _gtype_instance_class_with_named_creation_method_unref0 
(gtypeinstance_class_with_named_creation_method);
+       _gtype_instance_class_with_creation_method_unref0 (gtypeinstance_class_with_creation_method);
+       _public_gtype_instanceclass_unref0 (public_gtypeinstance_class);
+       _simple_gtype_instanceclass_unref0 (derived_gtypeinstance_class);
+       _simple_gtype_instanceclass_unref0 (simple_gtypeinstance_class);
+       _compact_class_with_destructor_free0 (compact_class_with_destructor);
+       _class_with_named_creation_method_free0 (class_with_named_creation_method);
+       _class_with_creation_method_free0 (class_with_creation_method);
+       _publicclass_free0 (public_class);
+       _compactclass_free0 (derived_class);
+       _compactclass_free0 (compact_class);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/compact-class-custom-ref.c-expected 
b/tests/objects/compact-class-custom-ref.c-expected
new file mode 100644
index 000000000..37762f1df
--- /dev/null
+++ b/tests/objects/compact-class-custom-ref.c-expected
@@ -0,0 +1,107 @@
+/* objects_compact_class_custom_ref.c generated by valac, the Vala compiler
+ * generated from objects_compact_class_custom_ref.vala, do not modify */
+
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef struct _Foo Foo;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       gint ref_count;
+};
+
+VALA_EXTERN void foo_free (Foo * self);
+static void foo_instance_init (Foo * self);
+VALA_EXTERN Foo* foo_ref (Foo* self);
+VALA_EXTERN void foo_unref (Foo* self);
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new (void);
+static void _vala_main (void);
+
+Foo*
+foo_ref (Foo* self)
+{
+       Foo* result = NULL;
+       g_return_val_if_fail (self != NULL, NULL);
+       g_atomic_int_inc ((volatile gint *) (&self->ref_count));
+       result = self;
+       return result;
+}
+
+static gpointer
+_foo_ref0 (gpointer self)
+{
+       return self ? foo_ref (self) : NULL;
+}
+
+void
+foo_unref (Foo* self)
+{
+       gboolean _tmp0_;
+       g_return_if_fail (self != NULL);
+       _tmp0_ = g_atomic_int_dec_and_test ((volatile gint *) (&self->ref_count));
+       if (_tmp0_) {
+               Foo* _tmp1_;
+               _tmp1_ = _foo_ref0 (self);
+               foo_free (_tmp1_);
+       }
+}
+
+Foo*
+foo_new (void)
+{
+       Foo* self;
+       self = g_slice_new0 (Foo);
+       foo_instance_init (self);
+       return self;
+}
+
+static void
+foo_instance_init (Foo * self)
+{
+       self->ref_count = 1;
+}
+
+void
+foo_free (Foo * self)
+{
+       g_slice_free (Foo, self);
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       _vala_assert (foo->ref_count == 1, "foo.ref_count == 1");
+       foo_ref (foo);
+       _vala_assert (foo->ref_count == 2, "foo.ref_count == 2");
+       foo_unref (foo);
+       _vala_assert (foo->ref_count == 1, "foo.ref_count == 1");
+       _foo_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/compact-class-destructor.c-expected 
b/tests/objects/compact-class-destructor.c-expected
new file mode 100644
index 000000000..772e38a97
--- /dev/null
+++ b/tests/objects/compact-class-destructor.c-expected
@@ -0,0 +1,545 @@
+/* objects_compact_class_destructor.c generated by valac, the Vala compiler
+ * generated from objects_compact_class_destructor.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef struct _Foo Foo;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+#define _foo_free0(var) ((var == NULL) ? NULL : (var = (foo_free (var), NULL)))
+typedef struct _ParamSpecBar ParamSpecBar;
+#define _bar_unref0(var) ((var == NULL) ? NULL : (var = (bar_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       int dummy;
+};
+
+struct _Bar {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       GTypeClass parent_class;
+       void (*finalize) (Bar *self);
+};
+
+struct _BarPrivate {
+       Foo* faz;
+};
+
+struct _ParamSpecBar {
+       GParamSpec parent_instance;
+};
+
+static gint Bar_private_offset;
+static gpointer bar_parent_class = NULL;
+VALA_EXTERN Foo* faz;
+Foo* faz = NULL;
+
+VALA_EXTERN void foo_free (Foo * self);
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_free)
+static void foo_instance_init (Foo * self);
+VALA_EXTERN gint foo_destroy (Foo* self);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN void bar (GError** error);
+VALA_EXTERN Foo* get_foo (void);
+VALA_EXTERN gpointer bar_ref (gpointer instance);
+VALA_EXTERN void bar_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_bar (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_bar (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_bar (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_bar (const GValue* value);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, bar_unref)
+VALA_EXTERN void bar_instance_simple (Bar* self);
+VALA_EXTERN void bar_instance_field (Bar* self);
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static void bar_finalize (Bar * obj);
+static GType bar_get_type_once (void);
+VALA_EXTERN void field (void);
+VALA_EXTERN void local (void);
+VALA_EXTERN void parameter (Foo* foo);
+VALA_EXTERN void simple (void);
+VALA_EXTERN void returned (void);
+static void _vala_main (void);
+
+gint
+foo_destroy (Foo* self)
+{
+       gint result = 0;
+       g_return_val_if_fail (self != NULL, 0);
+       g_slice_free1 ((gsize) sizeof (gint), self);
+       result = 42;
+       return result;
+}
+
+Foo*
+foo_new (void)
+{
+       Foo* self;
+       self = g_slice_new0 (Foo);
+       foo_instance_init (self);
+       return self;
+}
+
+static void
+foo_instance_init (Foo * self)
+{
+}
+
+void
+foo_free (Foo * self)
+{
+       g_slice_free (Foo, self);
+}
+
+void
+bar (GError** error)
+{
+}
+
+Foo*
+get_foo (void)
+{
+       Foo* _tmp0_;
+       Foo* result = NULL;
+       _tmp0_ = foo_new ();
+       result = _tmp0_;
+       return result;
+}
+
+static inline gpointer
+bar_get_instance_private (Bar* self)
+{
+       return G_STRUCT_MEMBER_P (self, Bar_private_offset);
+}
+
+void
+bar_instance_simple (Bar* self)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       gint res = 0;
+       Foo* _tmp1_;
+       g_return_if_fail (IS_BAR (self));
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       _tmp1_ = foo;
+       foo = NULL;
+       res = foo_destroy (_tmp1_);
+       _vala_assert (foo == NULL, "foo == null");
+       _vala_assert (res == 42, "res == 42");
+       _foo_free0 (foo);
+}
+
+void
+bar_instance_field (Bar* self)
+{
+       Foo* _tmp0_;
+       gint res = 0;
+       Foo* _tmp1_;
+       Foo* _tmp2_;
+       GError* _inner_error0_ = NULL;
+       g_return_if_fail (IS_BAR (self));
+       bar (&_inner_error0_);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp0_ = foo_new ();
+       _foo_free0 (self->priv->faz);
+       self->priv->faz = _tmp0_;
+       _tmp1_ = self->priv->faz;
+       self->priv->faz = NULL;
+       res = foo_destroy (_tmp1_);
+       _tmp2_ = self->priv->faz;
+       _vala_assert (_tmp2_ == NULL, "faz == null");
+       _vala_assert (res == 42, "res == 42");
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar* self = NULL;
+       self = (Bar*) g_type_create_instance (object_type);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+value_bar_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_bar_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               bar_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_bar_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = bar_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_bar_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_bar_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Bar * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = bar_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_bar_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Bar ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = bar_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_bar (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecBar* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_BAR), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_bar (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_bar (GValue* value,
+               gpointer v_object)
+{
+       Bar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               bar_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_unref (old);
+       }
+}
+
+void
+value_take_bar (GValue* value,
+                gpointer v_object)
+{
+       Bar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_unref (old);
+       }
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       ((BarClass *) klass)->finalize = bar_finalize;
+       g_type_class_adjust_private_offset (klass, &Bar_private_offset);
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+       self->priv = bar_get_instance_private (self);
+       self->ref_count = 1;
+}
+
+static void
+bar_finalize (Bar * obj)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       g_signal_handlers_destroy (self);
+       _foo_free0 (self->priv->faz);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_bar_init, value_bar_free_value, 
value_bar_copy_value, value_bar_peek_pointer, "p", value_bar_collect_value, "p", value_bar_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType bar_type_id;
+       bar_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Bar", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       Bar_private_offset = g_type_add_instance_private (bar_type_id, sizeof (BarPrivate));
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+gpointer
+bar_ref (gpointer instance)
+{
+       Bar * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+bar_unref (gpointer instance)
+{
+       Bar * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               BAR_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+void
+field (void)
+{
+       Foo* _tmp0_;
+       gint res = 0;
+       Foo* _tmp1_;
+       Foo* _tmp2_;
+       GError* _inner_error0_ = NULL;
+       bar (&_inner_error0_);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp0_ = foo_new ();
+       _foo_free0 (faz);
+       faz = _tmp0_;
+       _tmp1_ = faz;
+       faz = NULL;
+       res = foo_destroy (_tmp1_);
+       _tmp2_ = faz;
+       _vala_assert (_tmp2_ == NULL, "faz == null");
+       _vala_assert (res == 42, "res == 42");
+}
+
+void
+local (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       gint res = 0;
+       Foo* _tmp1_;
+       Foo* _tmp2_;
+       GError* _inner_error0_ = NULL;
+       bar (&_inner_error0_);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       _tmp1_ = foo;
+       foo = NULL;
+       res = foo_destroy (_tmp1_);
+       _tmp2_ = foo;
+       _vala_assert (_tmp2_ == NULL, "foo == null");
+       _vala_assert (res == 42, "res == 42");
+       _foo_free0 (foo);
+}
+
+void
+parameter (Foo* foo)
+{
+       gint res = 0;
+       Foo* _tmp0_;
+       GError* _inner_error0_ = NULL;
+       g_return_if_fail (foo != NULL);
+       bar (&_inner_error0_);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _foo_free0 (foo);
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp0_ = foo;
+       foo = NULL;
+       res = foo_destroy (_tmp0_);
+       _vala_assert (foo == NULL, "foo == null");
+       _vala_assert (res == 42, "res == 42");
+       _foo_free0 (foo);
+}
+
+void
+simple (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       gint res = 0;
+       Foo* _tmp1_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       _tmp1_ = foo;
+       foo = NULL;
+       res = foo_destroy (_tmp1_);
+       _vala_assert (foo == NULL, "foo == null");
+       _vala_assert (res == 42, "res == 42");
+       _foo_free0 (foo);
+}
+
+void
+returned (void)
+{
+       gint res = 0;
+       Foo* _tmp0_;
+       GError* _inner_error0_ = NULL;
+       bar (&_inner_error0_);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp0_ = get_foo ();
+       res = foo_destroy (_tmp0_);
+       _vala_assert (res == 42, "res == 42");
+}
+
+static void
+_vala_main (void)
+{
+       Foo* _tmp0_;
+       Bar* bar = NULL;
+       Bar* _tmp1_;
+       simple ();
+       field ();
+       local ();
+       _tmp0_ = foo_new ();
+       parameter (_tmp0_);
+       returned ();
+       _tmp1_ = bar_new ();
+       bar = _tmp1_;
+       bar_instance_simple (bar);
+       bar_instance_field (bar);
+       _bar_unref0 (bar);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/compact-class-refcount.c-expected b/tests/objects/compact-class-refcount.c-expected
new file mode 100644
index 000000000..1d0cf67ee
--- /dev/null
+++ b/tests/objects/compact-class-refcount.c-expected
@@ -0,0 +1,83 @@
+/* objects_compact_class_refcount.c generated by valac, the Vala compiler
+ * generated from objects_compact_class_refcount.vala, do not modify */
+
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef GRegex FooRegex;
+#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
+
+static void foo_regex_instance_init (FooRegex * self);
+VALA_EXTERN FooRegex* foo_regex_new (GError** error);
+static void _vala_main (void);
+
+FooRegex*
+foo_regex_new (GError** error)
+{
+       FooRegex* self;
+       GError* _inner_error0_ = NULL;
+       self = (FooRegex*) g_regex_new ("^:*$", 0, 0, &_inner_error0_);
+       foo_regex_instance_init (self);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               if (_inner_error0_->domain == G_REGEX_ERROR) {
+                       g_propagate_error (error, _inner_error0_);
+                       _g_regex_unref0 (self);
+                       return NULL;
+               } else {
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return NULL;
+               }
+       }
+       return self;
+}
+
+static void
+foo_regex_instance_init (FooRegex * self)
+{
+}
+
+static void
+_vala_main (void)
+{
+       GError* _inner_error0_ = NULL;
+       {
+               FooRegex* foo = NULL;
+               FooRegex* _tmp0_;
+               _tmp0_ = foo_regex_new (&_inner_error0_);
+               foo = _tmp0_;
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       goto __catch0_g_error;
+               }
+               _g_regex_unref0 (foo);
+       }
+       goto __finally0;
+       __catch0_g_error:
+       {
+               g_clear_error (&_inner_error0_);
+       }
+       __finally0:
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/compact-class.c-expected b/tests/objects/compact-class.c-expected
new file mode 100644
index 000000000..4a2ab95f9
--- /dev/null
+++ b/tests/objects/compact-class.c-expected
@@ -0,0 +1,60 @@
+/* objects_compact_class.c generated by valac, the Vala compiler
+ * generated from objects_compact_class.vala, do not modify */
+
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef struct _Foo Foo;
+
+struct _Foo {
+       void* p;
+};
+
+VALA_EXTERN void foo_free (Foo * self);
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_free)
+static void foo_instance_init (Foo * self);
+VALA_EXTERN Foo* foo_new (void);
+static void _vala_main (void);
+
+Foo*
+foo_new (void)
+{
+       Foo* self;
+       self = g_slice_new0 (Foo);
+       foo_instance_init (self);
+       return self;
+}
+
+static void
+foo_instance_init (Foo * self)
+{
+}
+
+void
+foo_free (Foo * self)
+{
+       g_slice_free (Foo, self);
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/constructor-inner-error.c-expected 
b/tests/objects/constructor-inner-error.c-expected
new file mode 100644
index 000000000..8817ee4e6
--- /dev/null
+++ b/tests/objects/constructor-inner-error.c-expected
@@ -0,0 +1,179 @@
+/* objects_constructor_inner_error.c generated by valac, the Vala compiler
+ * generated from objects_constructor_inner_error.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN void bar (GError** error);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (GError** error);
+VALA_EXTERN Foo* foo_construct (GType object_type,
+                    GError** error);
+static GObject * foo_constructor (GType type,
+                           guint n_construct_properties,
+                           GObjectConstructParam * construct_properties);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+void
+bar (GError** error)
+{
+}
+
+Foo*
+foo_construct (GType object_type,
+               GError** error)
+{
+       Foo * self = NULL;
+       GError* _inner_error0_ = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       bar (&_inner_error0_);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_propagate_error (error, _inner_error0_);
+               _g_object_unref0 (self);
+               return NULL;
+       }
+       return self;
+}
+
+Foo*
+foo_new (GError** error)
+{
+       return foo_construct (TYPE_FOO, error);
+}
+
+static GObject *
+foo_constructor (GType type,
+                 guint n_construct_properties,
+                 GObjectConstructParam * construct_properties)
+{
+       GObject * obj;
+       GObjectClass * parent_class;
+       Foo * self;
+       GError* _inner_error0_ = NULL;
+       parent_class = G_OBJECT_CLASS (foo_parent_class);
+       obj = parent_class->constructor (type, n_construct_properties, construct_properties);
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       bar (&_inner_error0_);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+       }
+       return obj;
+}
+
+static void
+foo_base_init (FooClass * klass)
+{
+       GError* _inner_error0_ = NULL;
+       bar (&_inner_error0_);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       GError* _inner_error0_ = NULL;
+       foo_parent_class = g_type_class_peek_parent (klass);
+       G_OBJECT_CLASS (klass)->constructor = foo_constructor;
+       bar (&_inner_error0_);
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+       }
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) foo_base_init, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = foo_new (&_inner_error0_);
+       foo = _tmp0_;
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _g_object_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/constructor-variadic.c-expected b/tests/objects/constructor-variadic.c-expected
new file mode 100644
index 000000000..475b3d634
--- /dev/null
+++ b/tests/objects/constructor-variadic.c-expected
@@ -0,0 +1,411 @@
+/* objects_constructor_variadic.c generated by valac, the Vala compiler
+ * generated from objects_constructor_variadic.vala, do not modify */
+
+#include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+#include <stdarg.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+#define _g_free0(var) (var = (g_free (var), NULL))
+typedef struct _ParamSpecFoo ParamSpecFoo;
+typedef struct _Bar Bar;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _bar_free0(var) ((var == NULL) ? NULL : (var = (bar_free (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+       gchar* s;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+struct _Bar {
+       gchar* s;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new (const gchar* first_arg,
+              ...);
+VALA_EXTERN Foo* foo_construct (GType object_type,
+                    const gchar* first_arg,
+                    ...);
+VALA_EXTERN Foo* foo_constructv (GType object_type,
+                     const gchar* first_arg,
+                     va_list _vala_va_list);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN void bar_free (Bar * self);
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, bar_free)
+static void bar_instance_init (Bar * self);
+VALA_EXTERN Bar* bar_new (const gchar* first_arg,
+              ...);
+static void _vala_main (void);
+
+Foo*
+foo_constructv (GType object_type,
+                const gchar* first_arg,
+                va_list _vala_va_list)
+{
+       Foo* self = NULL;
+       va_list args = {0};
+       gchar* second_arg = NULL;
+       const gchar* _tmp0_;
+       gchar* _tmp1_;
+       gchar* _tmp2_;
+       g_return_val_if_fail (first_arg != NULL, NULL);
+       self = (Foo*) g_type_create_instance (object_type);
+       _vala_assert (g_strcmp0 (first_arg, "foo") == 0, "first_arg == \"foo\"");
+       va_copy (args, _vala_va_list);
+       _tmp0_ = va_arg (args, gchar*);
+       _tmp1_ = g_strdup (_tmp0_);
+       second_arg = _tmp1_;
+       _vala_assert (g_strcmp0 (second_arg, "bar") == 0, "second_arg == \"bar\"");
+       _tmp2_ = g_strconcat (first_arg, second_arg, NULL);
+       _g_free0 (self->s);
+       self->s = _tmp2_;
+       _g_free0 (second_arg);
+       va_end (args);
+       return self;
+}
+
+Foo*
+foo_new (const gchar* first_arg,
+         ...)
+{
+       va_list _vala_va_list_obj;
+       va_start (_vala_va_list_obj, first_arg);
+       return foo_constructv (TYPE_FOO, first_arg, _vala_va_list_obj);
+}
+
+Foo*
+foo_construct (GType object_type,
+               const gchar* first_arg,
+               ...)
+{
+       va_list _vala_va_list_obj;
+       va_start (_vala_va_list_obj, first_arg);
+       return foo_constructv (object_type, first_arg, _vala_va_list_obj);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+       _g_free0 (self->s);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+Bar*
+bar_new (const gchar* first_arg,
+         ...)
+{
+       Bar* self;
+       va_list args = {0};
+       gchar* second_arg = NULL;
+       const gchar* _tmp0_;
+       gchar* _tmp1_;
+       gchar* _tmp2_;
+       g_return_val_if_fail (first_arg != NULL, NULL);
+       self = g_slice_new0 (Bar);
+       bar_instance_init (self);
+       _vala_assert (g_strcmp0 (first_arg, "bar") == 0, "first_arg == \"bar\"");
+       va_start (args, first_arg);
+       _tmp0_ = va_arg (args, gchar*);
+       _tmp1_ = g_strdup (_tmp0_);
+       second_arg = _tmp1_;
+       _vala_assert (g_strcmp0 (second_arg, "foo") == 0, "second_arg == \"foo\"");
+       _tmp2_ = g_strconcat (first_arg, second_arg, NULL);
+       _g_free0 (self->s);
+       self->s = _tmp2_;
+       _g_free0 (second_arg);
+       va_end (args);
+       return self;
+}
+
+static void
+bar_instance_init (Bar * self)
+{
+}
+
+void
+bar_free (Bar * self)
+{
+       _g_free0 (self->s);
+       g_slice_free (Bar, self);
+}
+
+static void
+_vala_main (void)
+{
+       {
+               Foo* foo = NULL;
+               Foo* _tmp0_;
+               const gchar* _tmp1_;
+               _tmp0_ = foo_new ("foo", "bar", NULL);
+               foo = _tmp0_;
+               _tmp1_ = foo->s;
+               _vala_assert (g_strcmp0 (_tmp1_, "foobar") == 0, "foo.s == \"foobar\"");
+               _foo_unref0 (foo);
+       }
+       {
+               Bar* bar = NULL;
+               Bar* _tmp2_;
+               const gchar* _tmp3_;
+               _tmp2_ = bar_new ("bar", "foo", NULL);
+               bar = _tmp2_;
+               _tmp3_ = bar->s;
+               _vala_assert (g_strcmp0 (_tmp3_, "barfoo") == 0, "bar.s == \"barfoo\"");
+               _bar_free0 (bar);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/constructors.c-expected b/tests/objects/constructors.c-expected
new file mode 100644
index 000000000..1f87c9718
--- /dev/null
+++ b/tests/objects/constructors.c-expected
@@ -0,0 +1,472 @@
+/* objects_constructors.c generated by valac, the Vala compiler
+ * generated from objects_constructors.vala, do not modify */
+
+#include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_FOO_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_free0(var) (var = (g_free (var), NULL))
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+enum  {
+       BAR_0_PROPERTY,
+       BAR_NUM_PROPERTIES
+};
+static GParamSpec* bar_properties[BAR_NUM_PROPERTIES];
+
+#define TYPE_MANAM (manam_get_type ())
+#define MANAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MANAM, Manam))
+#define MANAM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MANAM, ManamClass))
+#define IS_MANAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MANAM))
+#define IS_MANAM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MANAM))
+#define MANAM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MANAM, ManamClass))
+
+typedef struct _Manam Manam;
+typedef struct _ManamClass ManamClass;
+typedef struct _ManamPrivate ManamPrivate;
+enum  {
+       MANAM_0_PROPERTY,
+       MANAM_NUM_PROPERTIES
+};
+static GParamSpec* manam_properties[MANAM_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _FooPrivate {
+       gchar* _foo;
+};
+
+struct _Bar {
+       Foo parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       FooClass parent_class;
+};
+
+struct _Manam {
+       Bar parent_instance;
+       ManamPrivate * priv;
+};
+
+struct _ManamClass {
+       BarClass parent_class;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+static gpointer bar_parent_class = NULL;
+static gpointer manam_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new_pro (void);
+VALA_EXTERN Foo* foo_construct_pro (GType object_type);
+static void foo_set_foo (Foo* self,
+                  const gchar* value);
+static Foo* foo_new (void);
+static Foo* foo_construct (GType object_type);
+VALA_EXTERN const gchar* foo_get_foo (Foo* self);
+static void foo_finalize (GObject * obj);
+static GType foo_get_type_once (void);
+static void _vala_foo_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_foo_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
+VALA_EXTERN Bar* bar_new_pro (void);
+VALA_EXTERN Bar* bar_construct_pro (GType object_type);
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static GType bar_get_type_once (void);
+VALA_EXTERN GType manam_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Manam, g_object_unref)
+VALA_EXTERN Manam* manam_new (void);
+VALA_EXTERN Manam* manam_construct (GType object_type);
+static GObject * manam_constructor (GType type,
+                             guint n_construct_properties,
+                             GObjectConstructParam * construct_properties);
+static GType manam_get_type_once (void);
+static void _vala_main (void);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct_pro (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       foo_set_foo (self, "foo.protected");
+       return self;
+}
+
+Foo*
+foo_new_pro (void)
+{
+       return foo_construct_pro (TYPE_FOO);
+}
+
+static Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       foo_set_foo (self, "foo.private");
+       return self;
+}
+
+static Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+const gchar*
+foo_get_foo (Foo* self)
+{
+       const gchar* result;
+       const gchar* _tmp0_;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = self->priv->_foo;
+       result = _tmp0_;
+       return result;
+}
+
+static void
+foo_set_foo (Foo* self,
+             const gchar* value)
+{
+       gchar* old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_foo (self);
+       if (g_strcmp0 (value, old_value) != 0) {
+               gchar* _tmp0_;
+               _tmp0_ = g_strdup (value);
+               _g_free0 (self->priv->_foo);
+               self->priv->_foo = _tmp0_;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_FOO_PROPERTY]);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_foo_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_foo_set_property;
+       G_OBJECT_CLASS (klass)->finalize = foo_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_FOO_PROPERTY, 
foo_properties[FOO_FOO_PROPERTY] = g_param_spec_string ("foo", "foo", "foo", NULL, G_PARAM_STATIC_STRINGS | 
G_PARAM_READABLE));
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+}
+
+static void
+foo_finalize (GObject * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       _g_free0 (self->priv->_foo);
+       G_OBJECT_CLASS (foo_parent_class)->finalize (obj);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_foo_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_FOO_PROPERTY:
+               g_value_set_string (value, foo_get_foo (self));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_foo_set_property (GObject * object,
+                        guint property_id,
+                        const GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_FOO_PROPERTY:
+               foo_set_foo (self, g_value_get_string (value));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+Bar*
+bar_construct_pro (GType object_type)
+{
+       Bar * self = NULL;
+       self = (Bar*) foo_construct_pro (object_type);
+       return self;
+}
+
+Bar*
+bar_new_pro (void)
+{
+       return bar_construct_pro (TYPE_BAR);
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar * self = NULL;
+       self = (Bar*) foo_construct (object_type);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (TYPE_FOO, "Bar", &g_define_type_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+Manam*
+manam_construct (GType object_type)
+{
+       Manam * self = NULL;
+       self = (Manam*) bar_construct (object_type);
+       return self;
+}
+
+Manam*
+manam_new (void)
+{
+       return manam_construct (TYPE_MANAM);
+}
+
+static GObject *
+manam_constructor (GType type,
+                   guint n_construct_properties,
+                   GObjectConstructParam * construct_properties)
+{
+       GObject * obj;
+       GObjectClass * parent_class;
+       Manam * self;
+       gboolean b = FALSE;
+       parent_class = G_OBJECT_CLASS (manam_parent_class);
+       obj = parent_class->constructor (type, n_construct_properties, construct_properties);
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_MANAM, Manam);
+       b = TRUE;
+       if (b) {
+               return obj;
+       }
+       g_assert_not_reached ();
+       return obj;
+}
+
+static void
+manam_class_init (ManamClass * klass,
+                  gpointer klass_data)
+{
+       manam_parent_class = g_type_class_peek_parent (klass);
+       G_OBJECT_CLASS (klass)->constructor = manam_constructor;
+}
+
+static void
+manam_instance_init (Manam * self,
+                     gpointer klass)
+{
+}
+
+static GType
+manam_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (ManamClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) manam_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Manam), 
0, (GInstanceInitFunc) manam_instance_init, NULL };
+       GType manam_type_id;
+       manam_type_id = g_type_register_static (TYPE_BAR, "Manam", &g_define_type_info, 0);
+       return manam_type_id;
+}
+
+GType
+manam_get_type (void)
+{
+       static volatile gsize manam_type_id__volatile = 0;
+       if (g_once_init_enter (&manam_type_id__volatile)) {
+               GType manam_type_id;
+               manam_type_id = manam_get_type_once ();
+               g_once_init_leave (&manam_type_id__volatile, manam_type_id);
+       }
+       return manam_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Bar* bar = NULL;
+       Bar* _tmp0_;
+       Bar* _tmp1_;
+       const gchar* _tmp2_;
+       const gchar* _tmp3_;
+       Bar* _tmp4_;
+       Bar* _tmp5_;
+       const gchar* _tmp6_;
+       const gchar* _tmp7_;
+       Manam* manam = NULL;
+       Manam* _tmp8_;
+       const gchar* _tmp9_;
+       const gchar* _tmp10_;
+       _tmp0_ = bar_new ();
+       _g_object_unref0 (bar);
+       bar = _tmp0_;
+       _tmp1_ = bar;
+       _tmp2_ = foo_get_foo (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, TYPE_FOO, Foo));
+       _tmp3_ = _tmp2_;
+       _vala_assert (g_strcmp0 (_tmp3_, "foo.private") == 0, "bar.foo == \"foo.private\"");
+       _tmp4_ = bar_new_pro ();
+       _g_object_unref0 (bar);
+       bar = _tmp4_;
+       _tmp5_ = bar;
+       _tmp6_ = foo_get_foo (G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, TYPE_FOO, Foo));
+       _tmp7_ = _tmp6_;
+       _vala_assert (g_strcmp0 (_tmp7_, "foo.protected") == 0, "bar.foo == \"foo.protected\"");
+       _tmp8_ = manam_new ();
+       manam = _tmp8_;
+       _tmp9_ = foo_get_foo (G_TYPE_CHECK_INSTANCE_CAST (manam, TYPE_FOO, Foo));
+       _tmp10_ = _tmp9_;
+       _vala_assert (g_strcmp0 (_tmp10_, "foo.private") == 0, "manam.foo == \"foo.private\"");
+       _g_object_unref0 (manam);
+       _g_object_unref0 (bar);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/destructors.c-expected b/tests/objects/destructors.c-expected
new file mode 100644
index 000000000..d71ca00a7
--- /dev/null
+++ b/tests/objects/destructors.c-expected
@@ -0,0 +1,421 @@
+/* objects_destructors.c generated by valac, the Vala compiler
+ * generated from objects_destructors.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _FooClassPrivate FooClassPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_free0(var) (var = (g_free (var), NULL))
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+enum  {
+       BAR_0_PROPERTY,
+       BAR_NUM_PROPERTIES
+};
+static GParamSpec* bar_properties[BAR_NUM_PROPERTIES];
+
+#define TYPE_MANAM (manam_get_type ())
+#define MANAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MANAM, Manam))
+#define MANAM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MANAM, ManamClass))
+#define IS_MANAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MANAM))
+#define IS_MANAM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MANAM))
+#define MANAM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MANAM, ManamClass))
+
+typedef struct _Manam Manam;
+typedef struct _ManamClass ManamClass;
+typedef struct _ManamPrivate ManamPrivate;
+enum  {
+       MANAM_0_PROPERTY,
+       MANAM_NUM_PROPERTIES
+};
+static GParamSpec* manam_properties[MANAM_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _FooClassPrivate {
+       gchar* s;
+};
+
+struct _Bar {
+       GObject parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       GObjectClass parent_class;
+};
+
+struct _BarPrivate {
+       gchar* s;
+};
+
+struct _Manam {
+       GObject parent_instance;
+       ManamPrivate * priv;
+};
+
+struct _ManamClass {
+       GObjectClass parent_class;
+};
+
+static gpointer foo_parent_class = NULL;
+static gint Bar_private_offset;
+static gpointer bar_parent_class = NULL;
+static gpointer manam_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+#define FOO_GET_CLASS_PRIVATE(klass) (G_TYPE_CLASS_GET_PRIVATE (klass, TYPE_FOO, FooClassPrivate))
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_base_finalize (FooClass * klass,
+                        gpointer klass_data);
+static void foo_finalize (GObject * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static GObject * bar_constructor (GType type,
+                           guint n_construct_properties,
+                           GObjectConstructParam * construct_properties);
+static void bar_finalize (GObject * obj);
+static GType bar_get_type_once (void);
+VALA_EXTERN GType manam_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Manam, g_object_unref)
+VALA_EXTERN Manam* manam_new (void);
+VALA_EXTERN Manam* manam_construct (GType object_type);
+static void manam_base_finalize (ManamClass * klass,
+                          gpointer klass_data);
+static void manam_finalize (GObject * obj);
+static GType manam_get_type_once (void);
+static void _vala_main (void);
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+foo_base_init (FooClass * klass)
+{
+       const gchar* _tmp0_;
+       gchar* _tmp1_;
+       _tmp0_ = FOO_GET_CLASS_PRIVATE (klass)->s;
+       _vala_assert (_tmp0_ == NULL, "s == null");
+       _tmp1_ = g_strdup ("foo");
+       _g_free0 (FOO_GET_CLASS_PRIVATE (klass)->s);
+       FOO_GET_CLASS_PRIVATE (klass)->s = _tmp1_;
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       G_OBJECT_CLASS (klass)->finalize = foo_finalize;
+}
+
+static void
+foo_base_finalize (FooClass * klass,
+                   gpointer klass_data)
+{
+       const gchar* _tmp0_;
+       _tmp0_ = FOO_GET_CLASS_PRIVATE (klass)->s;
+       _vala_assert (g_strcmp0 (_tmp0_, "foo") == 0, "s == \"foo\"");
+       _g_free0 (FOO_GET_CLASS_PRIVATE (klass)->s);
+       FOO_GET_CLASS_PRIVATE (klass)->s = NULL;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static void
+foo_finalize (GObject * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       G_OBJECT_CLASS (foo_parent_class)->finalize (obj);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) foo_base_init, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       g_type_add_class_private (foo_type_id, sizeof (FooClassPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static inline gpointer
+bar_get_instance_private (Bar* self)
+{
+       return G_STRUCT_MEMBER_P (self, Bar_private_offset);
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar * self = NULL;
+       self = (Bar*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static GObject *
+bar_constructor (GType type,
+                 guint n_construct_properties,
+                 GObjectConstructParam * construct_properties)
+{
+       GObject * obj;
+       GObjectClass * parent_class;
+       Bar * self;
+       const gchar* _tmp0_;
+       gchar* _tmp1_;
+       parent_class = G_OBJECT_CLASS (bar_parent_class);
+       obj = parent_class->constructor (type, n_construct_properties, construct_properties);
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       _tmp0_ = self->priv->s;
+       _vala_assert (_tmp0_ == NULL, "s == null");
+       _tmp1_ = g_strdup ("bar");
+       _g_free0 (self->priv->s);
+       self->priv->s = _tmp1_;
+       return obj;
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Bar_private_offset);
+       G_OBJECT_CLASS (klass)->constructor = bar_constructor;
+       G_OBJECT_CLASS (klass)->finalize = bar_finalize;
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+       self->priv = bar_get_instance_private (self);
+}
+
+static void
+bar_finalize (GObject * obj)
+{
+       Bar * self;
+       const gchar* _tmp0_;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       _tmp0_ = self->priv->s;
+       _vala_assert (g_strcmp0 (_tmp0_, "bar") == 0, "s == \"bar\"");
+       _g_free0 (self->priv->s);
+       self->priv->s = NULL;
+       _g_free0 (self->priv->s);
+       G_OBJECT_CLASS (bar_parent_class)->finalize (obj);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (G_TYPE_OBJECT, "Bar", &g_define_type_info, 0);
+       Bar_private_offset = g_type_add_instance_private (bar_type_id, sizeof (BarPrivate));
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+Manam*
+manam_construct (GType object_type)
+{
+       Manam * self = NULL;
+       self = (Manam*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Manam*
+manam_new (void)
+{
+       return manam_construct (TYPE_MANAM);
+}
+
+static void
+manam_class_init (ManamClass * klass,
+                  gpointer klass_data)
+{
+       manam_parent_class = g_type_class_peek_parent (klass);
+       G_OBJECT_CLASS (klass)->finalize = manam_finalize;
+}
+
+static void
+manam_base_finalize (ManamClass * klass,
+                     gpointer klass_data)
+{
+       gboolean b = FALSE;
+       b = TRUE;
+       if (b) {
+               goto _return;
+       }
+       g_assert_not_reached ();
+       _return:
+       ;
+}
+
+static void
+manam_instance_init (Manam * self,
+                     gpointer klass)
+{
+}
+
+static void
+manam_finalize (GObject * obj)
+{
+       Manam * self;
+       gboolean b = FALSE;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_MANAM, Manam);
+       b = TRUE;
+       if (b) {
+               goto _return;
+       }
+       g_assert_not_reached ();
+       _return:
+       G_OBJECT_CLASS (manam_parent_class)->finalize (obj);
+}
+
+static GType
+manam_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (ManamClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) manam_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Manam), 
0, (GInstanceInitFunc) manam_instance_init, NULL };
+       GType manam_type_id;
+       manam_type_id = g_type_register_static (G_TYPE_OBJECT, "Manam", &g_define_type_info, 0);
+       return manam_type_id;
+}
+
+GType
+manam_get_type (void)
+{
+       static volatile gsize manam_type_id__volatile = 0;
+       if (g_once_init_enter (&manam_type_id__volatile)) {
+               GType manam_type_id;
+               manam_type_id = manam_get_type_once ();
+               g_once_init_leave (&manam_type_id__volatile, manam_type_id);
+       }
+       return manam_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Bar* bar = NULL;
+       Bar* _tmp0_;
+       Manam* manam = NULL;
+       Manam* _tmp1_;
+       _tmp0_ = bar_new ();
+       bar = _tmp0_;
+       _g_object_unref0 (bar);
+       bar = NULL;
+       _tmp1_ = manam_new ();
+       manam = _tmp1_;
+       _g_object_unref0 (manam);
+       manam = NULL;
+       _g_object_unref0 (manam);
+       _g_object_unref0 (bar);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/dynamic.c-expected b/tests/objects/dynamic.c-expected
new file mode 100644
index 000000000..5447e0aa2
--- /dev/null
+++ b/tests/objects/dynamic.c-expected
@@ -0,0 +1,347 @@
+/* objects_dynamic.c generated by valac, the Vala compiler
+ * generated from objects_dynamic.vala, do not modify */
+
+#include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_PROP_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_free0(var) (var = (g_free (var), NULL))
+enum  {
+       FOO_SIG_SIGNAL,
+       FOO_NUM_SIGNALS
+};
+static guint foo_signals[FOO_NUM_SIGNALS] = {0};
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _FooPrivate {
+       gchar* _prop;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+VALA_EXTERN gboolean success;
+gboolean success = FALSE;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+VALA_EXTERN const gchar* foo_get_prop (Foo* self);
+VALA_EXTERN void foo_set_prop (Foo* self,
+                   const gchar* value);
+static void foo_finalize (GObject * obj);
+static GType foo_get_type_once (void);
+static void _vala_foo_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_foo_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec);
+VALA_EXTERN void sig_cb (void);
+VALA_EXTERN void sig_after_cb (void);
+static void _vala_main (void);
+static inline void _dynamic_set_prop0 (GObject* obj,
+                         const gchar* value);
+static inline gchar* _dynamic_get_prop1 (GObject* obj);
+static void _sig_after_cb_dynamic_sig0_ (GObject* _sender,
+                                  gpointer self);
+gulong _dynamic_sig1_connect_after (gpointer obj,
+                                    const char * signal_name,
+                                    GCallback handler,
+                                    gpointer data);
+static void _sig_cb_dynamic_sig2_ (GObject* _sender,
+                            gpointer self);
+gulong _dynamic_sig3_connect (gpointer obj,
+                              const char * signal_name,
+                              GCallback handler,
+                              gpointer data);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+const gchar*
+foo_get_prop (Foo* self)
+{
+       const gchar* result;
+       const gchar* _tmp0_;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = self->priv->_prop;
+       result = _tmp0_;
+       return result;
+}
+
+void
+foo_set_prop (Foo* self,
+              const gchar* value)
+{
+       gchar* old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_prop (self);
+       if (g_strcmp0 (value, old_value) != 0) {
+               gchar* _tmp0_;
+               _tmp0_ = g_strdup (value);
+               _g_free0 (self->priv->_prop);
+               self->priv->_prop = _tmp0_;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_PROP_PROPERTY]);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_foo_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_foo_set_property;
+       G_OBJECT_CLASS (klass)->finalize = foo_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_PROP_PROPERTY, 
foo_properties[FOO_PROP_PROPERTY] = g_param_spec_string ("prop", "prop", "prop", NULL, G_PARAM_STATIC_STRINGS 
| G_PARAM_READABLE | G_PARAM_WRITABLE));
+       foo_signals[FOO_SIG_SIGNAL] = g_signal_new ("sig", TYPE_FOO, G_SIGNAL_RUN_LAST, 0, NULL, NULL, 
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+}
+
+static void
+foo_finalize (GObject * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       _g_free0 (self->priv->_prop);
+       G_OBJECT_CLASS (foo_parent_class)->finalize (obj);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_foo_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_PROP_PROPERTY:
+               g_value_set_string (value, foo_get_prop (self));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_foo_set_property (GObject * object,
+                        guint property_id,
+                        const GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_PROP_PROPERTY:
+               foo_set_prop (self, g_value_get_string (value));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+void
+sig_cb (void)
+{
+       success = TRUE;
+}
+
+void
+sig_after_cb (void)
+{
+       _vala_assert (success, "success");
+}
+
+static gpointer
+_g_object_ref0 (gpointer self)
+{
+       return self ? g_object_ref (self) : NULL;
+}
+
+static inline void
+_dynamic_set_prop0 (GObject* obj,
+                    const gchar* value)
+{
+       g_object_set (obj, "prop", value, NULL);
+}
+
+static inline gchar*
+_dynamic_get_prop1 (GObject* obj)
+{
+       gchar* result;
+       g_object_get (obj, "prop", &result, NULL);
+       return result;
+}
+
+static void
+_sig_after_cb_dynamic_sig0_ (GObject* _sender,
+                             gpointer self)
+{
+       sig_after_cb ();
+}
+
+gulong
+_dynamic_sig1_connect_after (gpointer obj,
+                             const char * signal_name,
+                             GCallback handler,
+                             gpointer data)
+{
+       return g_signal_connect_after (obj, signal_name, handler, data);
+}
+
+static void
+_sig_cb_dynamic_sig2_ (GObject* _sender,
+                       gpointer self)
+{
+       sig_cb ();
+}
+
+gulong
+_dynamic_sig3_connect (gpointer obj,
+                       const char * signal_name,
+                       GCallback handler,
+                       gpointer data)
+{
+       return g_signal_connect (obj, signal_name, handler, data);
+}
+
+static void
+_vala_main (void)
+{
+       Foo* real = NULL;
+       Foo* _tmp0_;
+       GObject* foo = NULL;
+       GObject* _tmp1_;
+       gchar* s = NULL;
+       gchar* _tmp2_;
+       gchar* _tmp3_;
+       gulong id1 = 0UL;
+       gulong _tmp4_;
+       gulong id2 = 0UL;
+       gulong _tmp5_;
+       _tmp0_ = foo_new ();
+       real = _tmp0_;
+       _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (real, G_TYPE_OBJECT, GObject));
+       foo = _tmp1_;
+       _dynamic_set_prop0 (foo, "foo");
+       _tmp2_ = _dynamic_get_prop1 (foo);
+       _tmp3_ = _tmp2_;
+       s = _tmp3_;
+       _vala_assert (g_strcmp0 (s, "foo") == 0, "s == \"foo\"");
+       success = FALSE;
+       _tmp4_ = _dynamic_sig1_connect_after (foo, "sig", (GCallback) _sig_after_cb_dynamic_sig0_, NULL);
+       id1 = _tmp4_;
+       _tmp5_ = _dynamic_sig3_connect (foo, "sig", (GCallback) _sig_cb_dynamic_sig2_, NULL);
+       id2 = _tmp5_;
+       g_signal_emit (real, foo_signals[FOO_SIG_SIGNAL], 0);
+       _vala_assert (success, "success");
+       success = FALSE;
+       g_signal_handler_disconnect (foo, id1);
+       g_signal_handler_disconnect (foo, id2);
+       g_signal_emit (real, foo_signals[FOO_SIG_SIGNAL], 0);
+       _vala_assert (!success, "!success");
+       _g_free0 (s);
+       _g_object_unref0 (foo);
+       _g_object_unref0 (real);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/fields.c-expected b/tests/objects/fields.c-expected
new file mode 100644
index 000000000..6d7391968
--- /dev/null
+++ b/tests/objects/fields.c-expected
@@ -0,0 +1,1389 @@
+/* objects_fields.c generated by valac, the Vala compiler
+ * generated from objects_fields.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef struct _CompactFoo CompactFoo;
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+#define TYPE_FAZ (faz_get_type ())
+#define FAZ(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FAZ, Faz))
+#define FAZ_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FAZ, FazClass))
+#define IS_FAZ(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FAZ))
+#define IS_FAZ_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FAZ))
+#define FAZ_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FAZ, FazClass))
+
+typedef struct _Faz Faz;
+typedef struct _FazClass FazClass;
+typedef struct _FazPrivate FazPrivate;
+typedef struct _FazClassPrivate FazClassPrivate;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+enum  {
+       BAR_0_PROPERTY,
+       BAR_NUM_PROPERTIES
+};
+static GParamSpec* bar_properties[BAR_NUM_PROPERTIES];
+
+#define TYPE_BAZ (baz_get_type ())
+#define BAZ(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAZ, Baz))
+#define BAZ_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAZ, BazClass))
+#define IS_BAZ(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAZ))
+#define IS_BAZ_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAZ))
+#define BAZ_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAZ, BazClass))
+
+typedef struct _Baz Baz;
+typedef struct _BazClass BazClass;
+typedef struct _BazPrivate BazPrivate;
+typedef struct _BazClassPrivate BazClassPrivate;
+enum  {
+       BAZ_0_PROPERTY,
+       BAZ_NUM_PROPERTIES
+};
+static GParamSpec* baz_properties[BAZ_NUM_PROPERTIES];
+
+#define TYPE_MANAM (manam_get_type ())
+#define MANAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MANAM, Manam))
+#define MANAM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MANAM, ManamClass))
+#define IS_MANAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MANAM))
+#define IS_MANAM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MANAM))
+#define MANAM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MANAM, ManamClass))
+
+typedef struct _Manam Manam;
+typedef struct _ManamClass ManamClass;
+typedef struct _ManamPrivate ManamPrivate;
+typedef struct _ParamSpecManam ParamSpecManam;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _compact_foo_free0(var) ((var == NULL) ? NULL : (var = (compact_foo_free (var), NULL)))
+#define _manam_unref0(var) ((var == NULL) ? NULL : (var = (manam_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _CompactFoo {
+       gint initialized_field;
+};
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+       gint public_base_field;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+       gint public_base_class_field;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+struct _Faz {
+       Foo parent_instance;
+       FazPrivate * priv;
+       gint public_field;
+};
+
+struct _FazClass {
+       FooClass parent_class;
+       gint public_class_field;
+};
+
+struct _FazPrivate {
+       GRecMutex __lock_public_field;
+       gint private_field;
+       GRecMutex __lock_private_field;
+};
+
+struct _FazClassPrivate {
+       GRecMutex __lock_public_class_field;
+       gint private_class_field;
+       GRecMutex __lock_private_class_field;
+};
+
+struct _Bar {
+       GObject parent_instance;
+       BarPrivate * priv;
+       gint public_base_field;
+};
+
+struct _BarClass {
+       GObjectClass parent_class;
+       gint public_base_class_field;
+};
+
+struct _Baz {
+       Bar parent_instance;
+       BazPrivate * priv;
+       gint public_field;
+};
+
+struct _BazClass {
+       BarClass parent_class;
+       gint public_class_field;
+};
+
+struct _BazPrivate {
+       GRecMutex __lock_public_field;
+       gint private_field;
+       GRecMutex __lock_private_field;
+};
+
+struct _BazClassPrivate {
+       GRecMutex __lock_public_class_field;
+       gint private_class_field;
+       GRecMutex __lock_private_class_field;
+};
+
+struct _Manam {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       ManamPrivate * priv;
+       gpointer foo;
+};
+
+struct _ManamClass {
+       GTypeClass parent_class;
+       void (*finalize) (Manam *self);
+};
+
+struct _ManamPrivate {
+       GType t_type;
+       GBoxedCopyFunc t_dup_func;
+       GDestroyNotify t_destroy_func;
+};
+
+struct _ParamSpecManam {
+       GParamSpec parent_instance;
+};
+
+static gint compact_foo_private_static_field;
+static gint compact_foo_private_static_field = 42;
+VALA_EXTERN gint compact_foo_public_static_field;
+gint compact_foo_public_static_field = 4711;
+static gpointer foo_parent_class = NULL;
+static gint Faz_private_offset;
+static gpointer faz_parent_class = NULL;
+VALA_EXTERN gint faz_public_static_field;
+GRecMutex __lock_faz_faz_public_static_field = {0};
+gint faz_public_static_field = 4711;
+static gint faz_private_static_field;
+static GRecMutex __lock_faz_faz_private_static_field = {0};
+static gint faz_private_static_field = 4711;
+static gpointer bar_parent_class = NULL;
+static gint Baz_private_offset;
+static gpointer baz_parent_class = NULL;
+VALA_EXTERN gint baz_public_static_field;
+GRecMutex __lock_baz_baz_public_static_field = {0};
+gint baz_public_static_field = 4711;
+static gint baz_private_static_field;
+static GRecMutex __lock_baz_baz_private_static_field = {0};
+static gint baz_private_static_field = 4711;
+static gint Manam_private_offset;
+static gpointer manam_parent_class = NULL;
+
+VALA_EXTERN void compact_foo_free (CompactFoo * self);
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (CompactFoo, compact_foo_free)
+static void compact_foo_instance_init (CompactFoo * self);
+VALA_EXTERN CompactFoo* compact_foo_new (void);
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN GType faz_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Faz, foo_unref)
+#define FAZ_GET_CLASS_PRIVATE(klass) (G_TYPE_CLASS_GET_PRIVATE (klass, TYPE_FAZ, FazClassPrivate))
+VALA_EXTERN void faz_action (Faz* self);
+VALA_EXTERN void faz_action_class (Faz* self);
+VALA_EXTERN void faz_lock_action (Faz* self);
+VALA_EXTERN void faz_lock_action_class (Faz* self);
+VALA_EXTERN Faz* faz_new (void);
+VALA_EXTERN Faz* faz_construct (GType object_type);
+static void faz_finalize (Foo * obj);
+static GType faz_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static void bar_finalize (GObject * obj);
+static GType bar_get_type_once (void);
+VALA_EXTERN GType baz_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Baz, g_object_unref)
+#define BAZ_GET_CLASS_PRIVATE(klass) (G_TYPE_CLASS_GET_PRIVATE (klass, TYPE_BAZ, BazClassPrivate))
+VALA_EXTERN void baz_action (Baz* self);
+VALA_EXTERN void baz_action_class (Baz* self);
+VALA_EXTERN void baz_lock_action (Baz* self);
+VALA_EXTERN void baz_lock_action_class (Baz* self);
+VALA_EXTERN Baz* baz_new (void);
+VALA_EXTERN Baz* baz_construct (GType object_type);
+static void baz_finalize (GObject * obj);
+static GType baz_get_type_once (void);
+VALA_EXTERN gpointer manam_ref (gpointer instance);
+VALA_EXTERN void manam_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_manam (const gchar* name,
+                              const gchar* nick,
+                              const gchar* blurb,
+                              GType object_type,
+                              GParamFlags flags);
+VALA_EXTERN void value_set_manam (GValue* value,
+                      gpointer v_object);
+VALA_EXTERN void value_take_manam (GValue* value,
+                       gpointer v_object);
+VALA_EXTERN gpointer value_get_manam (const GValue* value);
+VALA_EXTERN GType manam_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Manam, manam_unref)
+VALA_EXTERN Manam* manam_new (GType t_type,
+                  GBoxedCopyFunc t_dup_func,
+                  GDestroyNotify t_destroy_func);
+VALA_EXTERN Manam* manam_construct (GType object_type,
+                        GType t_type,
+                        GBoxedCopyFunc t_dup_func,
+                        GDestroyNotify t_destroy_func);
+static void manam_finalize (Manam * obj);
+static GType manam_get_type_once (void);
+static void _vala_main (void);
+
+CompactFoo*
+compact_foo_new (void)
+{
+       CompactFoo* self;
+       self = g_slice_new0 (CompactFoo);
+       compact_foo_instance_init (self);
+       return self;
+}
+
+static void
+compact_foo_instance_init (CompactFoo * self)
+{
+       self->initialized_field = 23;
+}
+
+void
+compact_foo_free (CompactFoo * self)
+{
+       g_slice_free (CompactFoo, self);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       klass->public_base_class_field = 42;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->public_base_field = 23;
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static inline gpointer
+faz_get_instance_private (Faz* self)
+{
+       return G_STRUCT_MEMBER_P (self, Faz_private_offset);
+}
+
+void
+faz_action (Faz* self)
+{
+       g_return_if_fail (IS_FAZ (self));
+       _vala_assert (self->public_field == 23, "public_field == 23");
+       self->public_field = 32;
+       _vala_assert (self->public_field == 32, "public_field == 32");
+       _vala_assert (self->priv->private_field == 23, "private_field == 23");
+       self->priv->private_field = 32;
+       _vala_assert (self->priv->private_field == 32, "private_field == 32");
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_FOO, Foo)->public_base_field == 23, 
"public_base_field == 23");
+       G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_FOO, Foo)->public_base_field = 32;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_FOO, Foo)->public_base_field == 32, 
"public_base_field == 32");
+}
+
+void
+faz_action_class (Faz* self)
+{
+       g_return_if_fail (IS_FAZ (self));
+       _vala_assert (FAZ_GET_CLASS (self)->public_class_field == 24, "public_class_field == 24");
+       FAZ_GET_CLASS (self)->public_class_field = 42;
+       _vala_assert (FAZ_GET_CLASS (self)->public_class_field == 42, "public_class_field == 42");
+       _vala_assert (FAZ_GET_CLASS_PRIVATE (FAZ_GET_CLASS (self))->private_class_field == 24, 
"private_class_field == 24");
+       FAZ_GET_CLASS_PRIVATE (FAZ_GET_CLASS (self))->private_class_field = 42;
+       _vala_assert (FAZ_GET_CLASS_PRIVATE (FAZ_GET_CLASS (self))->private_class_field == 42, 
"private_class_field == 42");
+       _vala_assert (FOO_GET_CLASS (self)->public_base_class_field == 42, "public_base_class_field == 42");
+       FOO_GET_CLASS (self)->public_base_class_field = 24;
+       _vala_assert (FOO_GET_CLASS (self)->public_base_class_field == 24, "public_base_class_field == 24");
+}
+
+void
+faz_lock_action (Faz* self)
+{
+       GError* _inner_error0_ = NULL;
+       g_return_if_fail (IS_FAZ (self));
+       {
+               g_rec_mutex_lock (&__lock_faz_faz_private_static_field);
+               {
+                       faz_private_static_field = 1147;
+                       _vala_assert (faz_private_static_field == 1147, "private_static_field == 1147");
+               }
+               __finally0:
+               {
+                       g_rec_mutex_unlock (&__lock_faz_faz_private_static_field);
+               }
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+       }
+       {
+               g_rec_mutex_lock (&__lock_faz_faz_public_static_field);
+               {
+                       faz_public_static_field = 1147;
+                       _vala_assert (faz_public_static_field == 1147, "public_static_field == 1147");
+               }
+               __finally1:
+               {
+                       g_rec_mutex_unlock (&__lock_faz_faz_public_static_field);
+               }
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+       }
+       {
+               g_rec_mutex_lock (&self->priv->__lock_private_field);
+               {
+                       self->priv->private_field = 1147;
+                       _vala_assert (self->priv->private_field == 1147, "private_field == 1147");
+               }
+               __finally2:
+               {
+                       g_rec_mutex_unlock (&self->priv->__lock_private_field);
+               }
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+       }
+       {
+               g_rec_mutex_lock (&self->priv->__lock_public_field);
+               {
+                       self->public_field = 1147;
+                       _vala_assert (self->public_field == 1147, "public_field == 1147");
+               }
+               __finally3:
+               {
+                       g_rec_mutex_unlock (&self->priv->__lock_public_field);
+               }
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+       }
+}
+
+void
+faz_lock_action_class (Faz* self)
+{
+       GError* _inner_error0_ = NULL;
+       g_return_if_fail (IS_FAZ (self));
+       {
+               g_rec_mutex_lock (&FAZ_GET_CLASS_PRIVATE (FAZ_GET_CLASS (self))->__lock_private_class_field);
+               {
+                       FAZ_GET_CLASS_PRIVATE (FAZ_GET_CLASS (self))->private_class_field = 1147;
+                       _vala_assert (FAZ_GET_CLASS_PRIVATE (FAZ_GET_CLASS (self))->private_class_field == 
1147, "private_class_field == 1147");
+               }
+               __finally0:
+               {
+                       g_rec_mutex_unlock (&FAZ_GET_CLASS_PRIVATE (FAZ_GET_CLASS 
(self))->__lock_private_class_field);
+               }
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+       }
+       {
+               g_rec_mutex_lock (&FAZ_GET_CLASS_PRIVATE (FAZ_GET_CLASS (self))->__lock_public_class_field);
+               {
+                       FAZ_GET_CLASS (self)->public_class_field = 1147;
+                       _vala_assert (FAZ_GET_CLASS (self)->public_class_field == 1147, "public_class_field 
== 1147");
+               }
+               __finally1:
+               {
+                       g_rec_mutex_unlock (&FAZ_GET_CLASS_PRIVATE (FAZ_GET_CLASS 
(self))->__lock_public_class_field);
+               }
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+       }
+}
+
+Faz*
+faz_construct (GType object_type)
+{
+       Faz* self = NULL;
+       self = (Faz*) foo_construct (object_type);
+       return self;
+}
+
+Faz*
+faz_new (void)
+{
+       return faz_construct (TYPE_FAZ);
+}
+
+static void
+faz_base_init (FazClass * klass)
+{
+       klass->public_class_field = 42;
+       _vala_assert (klass->public_class_field == 42, "public_class_field == 42");
+       klass->public_class_field = 24;
+       _vala_assert (klass->public_class_field == 24, "public_class_field == 24");
+       FAZ_GET_CLASS_PRIVATE (klass)->private_class_field = 42;
+       _vala_assert (FAZ_GET_CLASS_PRIVATE (klass)->private_class_field == 42, "private_class_field == 42");
+       FAZ_GET_CLASS_PRIVATE (klass)->private_class_field = 24;
+       _vala_assert (FAZ_GET_CLASS_PRIVATE (klass)->private_class_field == 24, "private_class_field == 24");
+}
+
+static void
+faz_class_init (FazClass * klass,
+                gpointer klass_data)
+{
+       faz_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = faz_finalize;
+       g_type_class_adjust_private_offset (klass, &Faz_private_offset);
+       g_rec_mutex_init (&FAZ_GET_CLASS_PRIVATE (klass)->__lock_public_class_field);
+       klass->public_class_field = 42;
+       g_rec_mutex_init (&FAZ_GET_CLASS_PRIVATE (klass)->__lock_private_class_field);
+       FAZ_GET_CLASS_PRIVATE (klass)->private_class_field = 42;
+       g_rec_mutex_init (&__lock_faz_faz_public_static_field);
+       g_rec_mutex_init (&__lock_faz_faz_private_static_field);
+       _vala_assert (klass->public_class_field == 42, "public_class_field == 42");
+       klass->public_class_field = 24;
+       _vala_assert (klass->public_class_field == 24, "public_class_field == 24");
+       _vala_assert (FAZ_GET_CLASS_PRIVATE (klass)->private_class_field == 42, "private_class_field == 42");
+       FAZ_GET_CLASS_PRIVATE (klass)->private_class_field = 24;
+       _vala_assert (FAZ_GET_CLASS_PRIVATE (klass)->private_class_field == 24, "private_class_field == 24");
+}
+
+static void
+faz_instance_init (Faz * self,
+                   gpointer klass)
+{
+       self->priv = faz_get_instance_private (self);
+       g_rec_mutex_init (&self->priv->__lock_public_field);
+       self->public_field = 23;
+       g_rec_mutex_init (&self->priv->__lock_private_field);
+       self->priv->private_field = 23;
+}
+
+static void
+faz_finalize (Foo * obj)
+{
+       Faz * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FAZ, Faz);
+       g_rec_mutex_clear (&self->priv->__lock_public_field);
+       g_rec_mutex_clear (&self->priv->__lock_private_field);
+       FOO_CLASS (faz_parent_class)->finalize (obj);
+}
+
+static GType
+faz_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FazClass), (GBaseInitFunc) faz_base_init, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) faz_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Faz), 0, 
(GInstanceInitFunc) faz_instance_init, NULL };
+       GType faz_type_id;
+       faz_type_id = g_type_register_static (TYPE_FOO, "Faz", &g_define_type_info, 0);
+       g_type_add_class_private (faz_type_id, sizeof (FazClassPrivate));
+       Faz_private_offset = g_type_add_instance_private (faz_type_id, sizeof (FazPrivate));
+       return faz_type_id;
+}
+
+GType
+faz_get_type (void)
+{
+       static volatile gsize faz_type_id__volatile = 0;
+       if (g_once_init_enter (&faz_type_id__volatile)) {
+               GType faz_type_id;
+               faz_type_id = faz_get_type_once ();
+               g_once_init_leave (&faz_type_id__volatile, faz_type_id);
+       }
+       return faz_type_id__volatile;
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar * self = NULL;
+       self = (Bar*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       G_OBJECT_CLASS (klass)->finalize = bar_finalize;
+       klass->public_base_class_field = 42;
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+       self->public_base_field = 23;
+}
+
+static void
+bar_finalize (GObject * obj)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       G_OBJECT_CLASS (bar_parent_class)->finalize (obj);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (G_TYPE_OBJECT, "Bar", &g_define_type_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static inline gpointer
+baz_get_instance_private (Baz* self)
+{
+       return G_STRUCT_MEMBER_P (self, Baz_private_offset);
+}
+
+void
+baz_action (Baz* self)
+{
+       g_return_if_fail (IS_BAZ (self));
+       _vala_assert (self->public_field == 23, "public_field == 23");
+       self->public_field = 32;
+       _vala_assert (self->public_field == 32, "public_field == 32");
+       _vala_assert (self->priv->private_field == 23, "private_field == 23");
+       self->priv->private_field = 32;
+       _vala_assert (self->priv->private_field == 32, "private_field == 32");
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_BAR, Bar)->public_base_field == 23, 
"public_base_field == 23");
+       G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_BAR, Bar)->public_base_field = 32;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_BAR, Bar)->public_base_field == 32, 
"public_base_field == 32");
+}
+
+void
+baz_action_class (Baz* self)
+{
+       g_return_if_fail (IS_BAZ (self));
+       _vala_assert (BAZ_GET_CLASS (self)->public_class_field == 24, "public_class_field == 24");
+       BAZ_GET_CLASS (self)->public_class_field = 42;
+       _vala_assert (BAZ_GET_CLASS (self)->public_class_field == 42, "public_class_field == 42");
+       _vala_assert (BAZ_GET_CLASS_PRIVATE (BAZ_GET_CLASS (self))->private_class_field == 24, 
"private_class_field == 24");
+       BAZ_GET_CLASS_PRIVATE (BAZ_GET_CLASS (self))->private_class_field = 42;
+       _vala_assert (BAZ_GET_CLASS_PRIVATE (BAZ_GET_CLASS (self))->private_class_field == 42, 
"private_class_field == 42");
+       _vala_assert (BAR_GET_CLASS (self)->public_base_class_field == 42, "public_base_class_field == 42");
+       BAR_GET_CLASS (self)->public_base_class_field = 24;
+       _vala_assert (BAR_GET_CLASS (self)->public_base_class_field == 24, "public_base_class_field == 24");
+}
+
+void
+baz_lock_action (Baz* self)
+{
+       GError* _inner_error0_ = NULL;
+       g_return_if_fail (IS_BAZ (self));
+       {
+               g_rec_mutex_lock (&__lock_baz_baz_private_static_field);
+               {
+                       baz_private_static_field = 1147;
+                       _vala_assert (baz_private_static_field == 1147, "private_static_field == 1147");
+               }
+               __finally0:
+               {
+                       g_rec_mutex_unlock (&__lock_baz_baz_private_static_field);
+               }
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+       }
+       {
+               g_rec_mutex_lock (&__lock_baz_baz_public_static_field);
+               {
+                       baz_public_static_field = 1147;
+                       _vala_assert (baz_public_static_field == 1147, "public_static_field == 1147");
+               }
+               __finally1:
+               {
+                       g_rec_mutex_unlock (&__lock_baz_baz_public_static_field);
+               }
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+       }
+       {
+               g_rec_mutex_lock (&self->priv->__lock_private_field);
+               {
+                       self->priv->private_field = 1147;
+                       _vala_assert (self->priv->private_field == 1147, "private_field == 1147");
+               }
+               __finally2:
+               {
+                       g_rec_mutex_unlock (&self->priv->__lock_private_field);
+               }
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+       }
+       {
+               g_rec_mutex_lock (&self->priv->__lock_public_field);
+               {
+                       self->public_field = 1147;
+                       _vala_assert (self->public_field == 1147, "public_field == 1147");
+               }
+               __finally3:
+               {
+                       g_rec_mutex_unlock (&self->priv->__lock_public_field);
+               }
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+       }
+}
+
+void
+baz_lock_action_class (Baz* self)
+{
+       GError* _inner_error0_ = NULL;
+       g_return_if_fail (IS_BAZ (self));
+       {
+               g_rec_mutex_lock (&BAZ_GET_CLASS_PRIVATE (BAZ_GET_CLASS (self))->__lock_private_class_field);
+               {
+                       BAZ_GET_CLASS_PRIVATE (BAZ_GET_CLASS (self))->private_class_field = 1147;
+                       _vala_assert (BAZ_GET_CLASS_PRIVATE (BAZ_GET_CLASS (self))->private_class_field == 
1147, "private_class_field == 1147");
+               }
+               __finally0:
+               {
+                       g_rec_mutex_unlock (&BAZ_GET_CLASS_PRIVATE (BAZ_GET_CLASS 
(self))->__lock_private_class_field);
+               }
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+       }
+       {
+               g_rec_mutex_lock (&BAZ_GET_CLASS_PRIVATE (BAZ_GET_CLASS (self))->__lock_public_class_field);
+               {
+                       BAZ_GET_CLASS (self)->public_class_field = 1147;
+                       _vala_assert (BAZ_GET_CLASS (self)->public_class_field == 1147, "public_class_field 
== 1147");
+               }
+               __finally1:
+               {
+                       g_rec_mutex_unlock (&BAZ_GET_CLASS_PRIVATE (BAZ_GET_CLASS 
(self))->__lock_public_class_field);
+               }
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+       }
+}
+
+Baz*
+baz_construct (GType object_type)
+{
+       Baz * self = NULL;
+       self = (Baz*) bar_construct (object_type);
+       return self;
+}
+
+Baz*
+baz_new (void)
+{
+       return baz_construct (TYPE_BAZ);
+}
+
+static void
+baz_base_init (BazClass * klass)
+{
+       g_print ("%i\n", klass->public_class_field);
+       klass->public_class_field = 42;
+       _vala_assert (klass->public_class_field == 42, "public_class_field == 42");
+       klass->public_class_field = 24;
+       _vala_assert (klass->public_class_field == 24, "public_class_field == 24");
+       g_print ("%i\n", BAZ_GET_CLASS_PRIVATE (klass)->private_class_field);
+       BAZ_GET_CLASS_PRIVATE (klass)->private_class_field = 42;
+       _vala_assert (BAZ_GET_CLASS_PRIVATE (klass)->private_class_field == 42, "private_class_field == 42");
+       BAZ_GET_CLASS_PRIVATE (klass)->private_class_field = 24;
+       _vala_assert (BAZ_GET_CLASS_PRIVATE (klass)->private_class_field == 24, "private_class_field == 24");
+}
+
+static void
+baz_class_init (BazClass * klass,
+                gpointer klass_data)
+{
+       baz_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Baz_private_offset);
+       G_OBJECT_CLASS (klass)->finalize = baz_finalize;
+       g_rec_mutex_init (&BAZ_GET_CLASS_PRIVATE (klass)->__lock_public_class_field);
+       klass->public_class_field = 42;
+       g_rec_mutex_init (&BAZ_GET_CLASS_PRIVATE (klass)->__lock_private_class_field);
+       BAZ_GET_CLASS_PRIVATE (klass)->private_class_field = 42;
+       g_rec_mutex_init (&__lock_baz_baz_public_static_field);
+       g_rec_mutex_init (&__lock_baz_baz_private_static_field);
+       _vala_assert (klass->public_class_field == 42, "public_class_field == 42");
+       klass->public_class_field = 24;
+       _vala_assert (klass->public_class_field == 24, "public_class_field == 24");
+       _vala_assert (BAZ_GET_CLASS_PRIVATE (klass)->private_class_field == 42, "private_class_field == 42");
+       BAZ_GET_CLASS_PRIVATE (klass)->private_class_field = 24;
+       _vala_assert (BAZ_GET_CLASS_PRIVATE (klass)->private_class_field == 24, "private_class_field == 24");
+}
+
+static void
+baz_instance_init (Baz * self,
+                   gpointer klass)
+{
+       self->priv = baz_get_instance_private (self);
+       g_rec_mutex_init (&self->priv->__lock_public_field);
+       self->public_field = 23;
+       g_rec_mutex_init (&self->priv->__lock_private_field);
+       self->priv->private_field = 23;
+}
+
+static void
+baz_finalize (GObject * obj)
+{
+       Baz * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAZ, Baz);
+       g_rec_mutex_clear (&self->priv->__lock_public_field);
+       g_rec_mutex_clear (&self->priv->__lock_private_field);
+       G_OBJECT_CLASS (baz_parent_class)->finalize (obj);
+}
+
+static GType
+baz_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BazClass), (GBaseInitFunc) baz_base_init, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) baz_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Baz), 0, 
(GInstanceInitFunc) baz_instance_init, NULL };
+       GType baz_type_id;
+       baz_type_id = g_type_register_static (TYPE_BAR, "Baz", &g_define_type_info, 0);
+       g_type_add_class_private (baz_type_id, sizeof (BazClassPrivate));
+       Baz_private_offset = g_type_add_instance_private (baz_type_id, sizeof (BazPrivate));
+       return baz_type_id;
+}
+
+GType
+baz_get_type (void)
+{
+       static volatile gsize baz_type_id__volatile = 0;
+       if (g_once_init_enter (&baz_type_id__volatile)) {
+               GType baz_type_id;
+               baz_type_id = baz_get_type_once ();
+               g_once_init_leave (&baz_type_id__volatile, baz_type_id);
+       }
+       return baz_type_id__volatile;
+}
+
+static inline gpointer
+manam_get_instance_private (Manam* self)
+{
+       return G_STRUCT_MEMBER_P (self, Manam_private_offset);
+}
+
+Manam*
+manam_construct (GType object_type,
+                 GType t_type,
+                 GBoxedCopyFunc t_dup_func,
+                 GDestroyNotify t_destroy_func)
+{
+       Manam* self = NULL;
+       self = (Manam*) g_type_create_instance (object_type);
+       self->priv->t_type = t_type;
+       self->priv->t_dup_func = t_dup_func;
+       self->priv->t_destroy_func = t_destroy_func;
+       return self;
+}
+
+Manam*
+manam_new (GType t_type,
+           GBoxedCopyFunc t_dup_func,
+           GDestroyNotify t_destroy_func)
+{
+       return manam_construct (TYPE_MANAM, t_type, t_dup_func, t_destroy_func);
+}
+
+static void
+value_manam_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_manam_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               manam_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_manam_copy_value (const GValue* src_value,
+                        GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = manam_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_manam_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_manam_collect_value (GValue* value,
+                           guint n_collect_values,
+                           GTypeCValue* collect_values,
+                           guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Manam * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = manam_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_manam_lcopy_value (const GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       Manam ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = manam_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_manam (const gchar* name,
+                  const gchar* nick,
+                  const gchar* blurb,
+                  GType object_type,
+                  GParamFlags flags)
+{
+       ParamSpecManam* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_MANAM), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_manam (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_MANAM), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_manam (GValue* value,
+                 gpointer v_object)
+{
+       Manam * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_MANAM));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_MANAM));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               manam_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               manam_unref (old);
+       }
+}
+
+void
+value_take_manam (GValue* value,
+                  gpointer v_object)
+{
+       Manam * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_MANAM));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_MANAM));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               manam_unref (old);
+       }
+}
+
+static void
+manam_class_init (ManamClass * klass,
+                  gpointer klass_data)
+{
+       manam_parent_class = g_type_class_peek_parent (klass);
+       ((ManamClass *) klass)->finalize = manam_finalize;
+       g_type_class_adjust_private_offset (klass, &Manam_private_offset);
+}
+
+static void
+manam_instance_init (Manam * self,
+                     gpointer klass)
+{
+       self->priv = manam_get_instance_private (self);
+       self->ref_count = 1;
+}
+
+static void
+manam_finalize (Manam * obj)
+{
+       Manam * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_MANAM, Manam);
+       g_signal_handlers_destroy (self);
+       ((self->foo == NULL) || (self->priv->t_destroy_func == NULL)) ? NULL : (self->foo = 
(self->priv->t_destroy_func (self->foo), NULL));
+}
+
+static GType
+manam_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_manam_init, value_manam_free_value, 
value_manam_copy_value, value_manam_peek_pointer, "p", value_manam_collect_value, "p", 
value_manam_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (ManamClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) manam_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Manam), 
0, (GInstanceInitFunc) manam_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType manam_type_id;
+       manam_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Manam", 
&g_define_type_info, &g_define_type_fundamental_info, 0);
+       Manam_private_offset = g_type_add_instance_private (manam_type_id, sizeof (ManamPrivate));
+       return manam_type_id;
+}
+
+GType
+manam_get_type (void)
+{
+       static volatile gsize manam_type_id__volatile = 0;
+       if (g_once_init_enter (&manam_type_id__volatile)) {
+               GType manam_type_id;
+               manam_type_id = manam_get_type_once ();
+               g_once_init_leave (&manam_type_id__volatile, manam_type_id);
+       }
+       return manam_type_id__volatile;
+}
+
+gpointer
+manam_ref (gpointer instance)
+{
+       Manam * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+manam_unref (gpointer instance)
+{
+       Manam * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               MANAM_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       {
+               Foo* foo = NULL;
+               Foo* _tmp0_;
+               _tmp0_ = foo_new ();
+               foo = _tmp0_;
+               foo->public_base_field = 132;
+               _vala_assert (foo->public_base_field == 132, "foo.public_base_field == 132");
+               FOO_GET_CLASS (foo)->public_base_class_field = 264;
+               _vala_assert (FOO_GET_CLASS (foo)->public_base_class_field == 264, 
"foo.public_base_class_field == 264");
+               FOO_GET_CLASS (foo)->public_base_class_field = 42;
+               _foo_unref0 (foo);
+       }
+       {
+               Faz* faz = NULL;
+               Faz* _tmp1_;
+               _tmp1_ = faz_new ();
+               faz = _tmp1_;
+               faz_action (faz);
+               faz_action_class (faz);
+               faz_lock_action (faz);
+               faz_lock_action_class (faz);
+               faz->public_field = 66;
+               _vala_assert (faz->public_field == 66, "faz.public_field == 66");
+               FAZ_GET_CLASS (faz)->public_class_field = 132;
+               _vala_assert (FAZ_GET_CLASS (faz)->public_class_field == 132, "faz.public_class_field == 
132");
+               FOO_GET_CLASS (faz)->public_base_class_field = 264;
+               _vala_assert (FOO_GET_CLASS (faz)->public_base_class_field == 264, 
"faz.public_base_class_field == 264");
+               _foo_unref0 (faz);
+       }
+       {
+               Bar* bar = NULL;
+               Bar* _tmp2_;
+               _tmp2_ = bar_new ();
+               bar = _tmp2_;
+               bar->public_base_field = 132;
+               _vala_assert (bar->public_base_field == 132, "bar.public_base_field == 132");
+               BAR_GET_CLASS (bar)->public_base_class_field = 264;
+               _vala_assert (BAR_GET_CLASS (bar)->public_base_class_field == 264, 
"bar.public_base_class_field == 264");
+               BAR_GET_CLASS (bar)->public_base_class_field = 42;
+               _g_object_unref0 (bar);
+       }
+       {
+               Baz* baz = NULL;
+               Baz* _tmp3_;
+               _tmp3_ = baz_new ();
+               baz = _tmp3_;
+               baz_action (baz);
+               baz_action_class (baz);
+               baz_lock_action (baz);
+               baz_lock_action_class (baz);
+               baz->public_field = 66;
+               _vala_assert (baz->public_field == 66, "baz.public_field == 66");
+               BAZ_GET_CLASS (baz)->public_class_field = 132;
+               _vala_assert (BAZ_GET_CLASS (baz)->public_class_field == 132, "baz.public_class_field == 
132");
+               BAR_GET_CLASS (baz)->public_base_class_field = 264;
+               _vala_assert (BAR_GET_CLASS (baz)->public_base_class_field == 264, 
"baz.public_base_class_field == 264");
+               _g_object_unref0 (baz);
+       }
+       {
+               CompactFoo* foo = NULL;
+               CompactFoo* _tmp4_;
+               _tmp4_ = compact_foo_new ();
+               foo = _tmp4_;
+               _vala_assert (foo->initialized_field == 23, "foo.initialized_field == 23");
+               _vala_assert (compact_foo_public_static_field == 4711, "foo.public_static_field == 4711");
+               _compact_foo_free0 (foo);
+       }
+       {
+               Manam* manam = NULL;
+               Manam* _tmp5_;
+               _tmp5_ = manam_new (TYPE_BAR, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref);
+               manam = _tmp5_;
+               _g_object_unref0 (manam->foo);
+               manam->foo = NULL;
+               _manam_unref0 (manam);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/generics.c-expected b/tests/objects/generics.c-expected
new file mode 100644
index 000000000..09b90174a
--- /dev/null
+++ b/tests/objects/generics.c-expected
@@ -0,0 +1,35 @@
+/* objects_generics.c generated by valac, the Vala compiler
+ * generated from objects_generics.vala, do not modify */
+
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
+
+static void _vala_main (void);
+
+static gpointer
+_g_hash_table_ref0 (gpointer self)
+{
+       return self ? g_hash_table_ref (self) : NULL;
+}
+
+static void
+_vala_main (void)
+{
+       GHashTable* h = NULL;
+       GHashTable* _tmp0_;
+       _tmp0_ = _g_hash_table_ref0 ((GHashTable*) NULL);
+       h = _tmp0_;
+       _g_hash_table_unref0 (h);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/gobject-class-lifetime.c-expected b/tests/objects/gobject-class-lifetime.c-expected
new file mode 100644
index 000000000..4de1ec2dc
--- /dev/null
+++ b/tests/objects/gobject-class-lifetime.c-expected
@@ -0,0 +1,198 @@
+/* objects_gobject_class_lifetime.c generated by valac, the Vala compiler
+ * generated from objects_gobject_class_lifetime.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+VALA_EXTERN gint pos;
+gint pos = 0;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_real_constructed (GObject* base);
+static void foo_real_dispose (GObject* base);
+static GObject * foo_constructor (GType type,
+                           guint n_construct_properties,
+                           GObjectConstructParam * construct_properties);
+static void foo_finalize (GObject * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       gint _tmp0_;
+       self = (Foo*) g_object_new (object_type, NULL);
+       pos = pos + 1;
+       _tmp0_ = pos;
+       _vala_assert (_tmp0_ == 3, "++pos == 3");
+       g_print ("%i. new\n", pos);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+foo_real_constructed (GObject* base)
+{
+       Foo * self;
+       gint _tmp0_;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_FOO, Foo);
+       pos = pos + 1;
+       _tmp0_ = pos;
+       _vala_assert (_tmp0_ == 2, "++pos == 2");
+       g_print ("%i. constructed\n", pos);
+}
+
+static void
+foo_real_dispose (GObject* base)
+{
+       Foo * self;
+       gint _tmp0_;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_FOO, Foo);
+       pos = pos + 1;
+       _tmp0_ = pos;
+       _vala_assert (_tmp0_ == 4, "++pos == 4");
+       g_print ("%i. dispose\n", pos);
+}
+
+static GObject *
+foo_constructor (GType type,
+                 guint n_construct_properties,
+                 GObjectConstructParam * construct_properties)
+{
+       GObject * obj;
+       GObjectClass * parent_class;
+       Foo * self;
+       gint _tmp0_;
+       parent_class = G_OBJECT_CLASS (foo_parent_class);
+       obj = parent_class->constructor (type, n_construct_properties, construct_properties);
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       pos = pos + 1;
+       _tmp0_ = pos;
+       _vala_assert (_tmp0_ == 1, "++pos == 1");
+       g_print ("%i. constructor\n", pos);
+       return obj;
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((GObjectClass *) klass)->constructed = (void (*) (GObject*)) foo_real_constructed;
+       ((GObjectClass *) klass)->dispose = (void (*) (GObject*)) foo_real_dispose;
+       G_OBJECT_CLASS (klass)->constructor = foo_constructor;
+       G_OBJECT_CLASS (klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static void
+foo_finalize (GObject * obj)
+{
+       Foo * self;
+       gint _tmp0_;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       pos = pos + 1;
+       _tmp0_ = pos;
+       _vala_assert (_tmp0_ == 5, "++pos == 5");
+       g_print ("%i. finalize\n", pos);
+       G_OBJECT_CLASS (foo_parent_class)->finalize (obj);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       pos = 0;
+       {
+               Foo* foo = NULL;
+               Foo* _tmp0_;
+               _tmp0_ = foo_new ();
+               foo = _tmp0_;
+               _g_object_unref0 (foo);
+       }
+       _vala_assert (pos == 5, "pos == 5");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/gsource.c-expected b/tests/objects/gsource.c-expected
new file mode 100644
index 000000000..d711d8d86
--- /dev/null
+++ b/tests/objects/gsource.c-expected
@@ -0,0 +1,234 @@
+/* objects_gsource.c generated by valac, the Vala compiler
+ * generated from objects_gsource.vala, do not modify */
+
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef GSource FooSource;
+typedef struct _BarSource BarSource;
+typedef GSource ManamSource;
+#define _g_source_unref0(var) ((var == NULL) ? NULL : (var = (g_source_unref (var), NULL)))
+
+struct _BarSource {
+       GSource parent_instance;
+       gint custom_timeout;
+};
+
+static void foo_source_instance_init (FooSource * self);
+static void foo_source_finalize (GSource * obj);
+static gboolean foo_source_real_prepare (GSource* base,
+                                  gint* timeout);
+static gboolean foo_source_real_check (GSource* base);
+static gboolean foo_source_real_dispatch (GSource* base,
+                                   GSourceFunc callback,
+                                   gpointer callback_target);
+VALA_EXTERN FooSource* foo_source_new (void);
+static void bar_source_instance_init (BarSource * self);
+static void bar_source_finalize (GSource * obj);
+VALA_EXTERN BarSource* bar_source_new (gint timeout);
+static gboolean bar_source_real_prepare (GSource* base,
+                                  gint* timeout);
+static gboolean bar_source_real_check (GSource* base);
+static gboolean bar_source_real_dispatch (GSource* base,
+                                   GSourceFunc callback,
+                                   gpointer callback_target);
+static void manam_source_instance_init (ManamSource * self);
+static void manam_source_finalize (GSource * obj);
+static gboolean manam_source_real_dispatch (GSource* base,
+                                     GSourceFunc callback,
+                                     gpointer callback_target);
+VALA_EXTERN ManamSource* manam_source_new (void);
+static void _vala_main (void);
+
+static gboolean
+foo_source_real_prepare (GSource* base,
+                         gint* timeout)
+{
+       FooSource * self;
+       gint _vala_timeout = 0;
+       gboolean result = FALSE;
+       self = (FooSource*) base;
+       _vala_timeout = 1000;
+       result = FALSE;
+       if (timeout) {
+               *timeout = _vala_timeout;
+       }
+       return result;
+}
+
+static gboolean
+foo_source_real_check (GSource* base)
+{
+       FooSource * self;
+       gboolean result = FALSE;
+       self = (FooSource*) base;
+       result = FALSE;
+       return result;
+}
+
+static gboolean
+foo_source_real_dispatch (GSource* base,
+                          GSourceFunc callback,
+                          gpointer callback_target)
+{
+       FooSource * self;
+       gboolean result = FALSE;
+       self = (FooSource*) base;
+       result = FALSE;
+       return result;
+}
+
+FooSource*
+foo_source_new (void)
+{
+       FooSource* self;
+       static const GSourceFuncs _source_funcs = { foo_source_real_prepare, foo_source_real_check, 
foo_source_real_dispatch, foo_source_finalize};
+       self = (FooSource*) g_source_new ((GSourceFuncs *) (&_source_funcs), sizeof (FooSource));
+       foo_source_instance_init (self);
+       return self;
+}
+
+static void
+foo_source_instance_init (FooSource * self)
+{
+}
+
+static void
+foo_source_finalize (GSource * obj)
+{
+       FooSource * self;
+       self = (FooSource *) obj;
+}
+
+BarSource*
+bar_source_new (gint timeout)
+{
+       BarSource* self;
+       static const GSourceFuncs _source_funcs = { bar_source_real_prepare, bar_source_real_check, 
bar_source_real_dispatch, bar_source_finalize};
+       self = (BarSource*) g_source_new ((GSourceFuncs *) (&_source_funcs), sizeof (BarSource));
+       bar_source_instance_init (self);
+       self->custom_timeout = timeout;
+       return self;
+}
+
+static gboolean
+bar_source_real_prepare (GSource* base,
+                         gint* timeout)
+{
+       BarSource * self;
+       gint _vala_timeout = 0;
+       gboolean result = FALSE;
+       self = (BarSource*) base;
+       _vala_timeout = self->custom_timeout;
+       result = FALSE;
+       if (timeout) {
+               *timeout = _vala_timeout;
+       }
+       return result;
+}
+
+static gboolean
+bar_source_real_check (GSource* base)
+{
+       BarSource * self;
+       gboolean result = FALSE;
+       self = (BarSource*) base;
+       result = FALSE;
+       return result;
+}
+
+static gboolean
+bar_source_real_dispatch (GSource* base,
+                          GSourceFunc callback,
+                          gpointer callback_target)
+{
+       BarSource * self;
+       gboolean result = FALSE;
+       self = (BarSource*) base;
+       result = FALSE;
+       return result;
+}
+
+static void
+bar_source_instance_init (BarSource * self)
+{
+}
+
+static void
+bar_source_finalize (GSource * obj)
+{
+       BarSource * self;
+       self = (BarSource *) obj;
+}
+
+static gboolean
+manam_source_real_dispatch (GSource* base,
+                            GSourceFunc callback,
+                            gpointer callback_target)
+{
+       ManamSource * self;
+       gboolean result = FALSE;
+       self = (ManamSource*) base;
+       result = FALSE;
+       return result;
+}
+
+ManamSource*
+manam_source_new (void)
+{
+       ManamSource* self;
+       static const GSourceFuncs _source_funcs = { NULL, NULL, manam_source_real_dispatch, 
manam_source_finalize};
+       self = (ManamSource*) g_source_new ((GSourceFuncs *) (&_source_funcs), sizeof (ManamSource));
+       manam_source_instance_init (self);
+       return self;
+}
+
+static void
+manam_source_instance_init (ManamSource * self)
+{
+}
+
+static void
+manam_source_finalize (GSource * obj)
+{
+       ManamSource * self;
+       self = (ManamSource *) obj;
+}
+
+static void
+_vala_main (void)
+{
+       FooSource* foo = NULL;
+       FooSource* _tmp0_;
+       BarSource* bar = NULL;
+       BarSource* _tmp1_;
+       ManamSource* manam = NULL;
+       ManamSource* _tmp2_;
+       _tmp0_ = foo_source_new ();
+       foo = _tmp0_;
+       _tmp1_ = bar_source_new (1000);
+       bar = _tmp1_;
+       _tmp2_ = manam_source_new ();
+       manam = _tmp2_;
+       _g_source_unref0 (manam);
+       _g_source_unref0 (bar);
+       _g_source_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/gtype-class-lifetime.c-expected b/tests/objects/gtype-class-lifetime.c-expected
new file mode 100644
index 000000000..09fd79de5
--- /dev/null
+++ b/tests/objects/gtype-class-lifetime.c-expected
@@ -0,0 +1,318 @@
+/* objects_gtype_class_lifetime.c generated by valac, the Vala compiler
+ * generated from objects_gtype_class_lifetime.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+VALA_EXTERN gint pos;
+gint pos = 0;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       gint _tmp0_;
+       self = (Foo*) g_type_create_instance (object_type);
+       pos = pos + 1;
+       _tmp0_ = pos;
+       _vala_assert (_tmp0_ == 1, "++pos == 1");
+       g_print ("%i. new\n", pos);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       gint _tmp0_;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+       pos = pos + 1;
+       _tmp0_ = pos;
+       _vala_assert (_tmp0_ == 2, "++pos == 2");
+       g_print ("%i. finalize\n", pos);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       pos = 0;
+       {
+               Foo* foo = NULL;
+               Foo* _tmp0_;
+               _tmp0_ = foo_new ();
+               foo = _tmp0_;
+               _foo_unref0 (foo);
+       }
+       _vala_assert (pos == 2, "pos == 2");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/initially-unowned.c-expected b/tests/objects/initially-unowned.c-expected
new file mode 100644
index 000000000..26bfe54ec
--- /dev/null
+++ b/tests/objects/initially-unowned.c-expected
@@ -0,0 +1,235 @@
+/* objects_initially_unowned.c generated by valac, the Vala compiler
+ * generated from objects_initially_unowned.vala, do not modify */
+
+#include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_FOO_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _FooPrivate {
+       gchar* _foo;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+VALA_EXTERN const gchar* foo_get_foo (Foo* self);
+static void foo_set_foo (Foo* self,
+                  const gchar* value);
+static void foo_finalize (GObject * obj);
+static GType foo_get_type_once (void);
+static void _vala_foo_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_foo_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec);
+static void _vala_main (void);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+const gchar*
+foo_get_foo (Foo* self)
+{
+       const gchar* result;
+       const gchar* _tmp0_;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = self->priv->_foo;
+       result = _tmp0_;
+       return result;
+}
+
+static void
+foo_set_foo (Foo* self,
+             const gchar* value)
+{
+       gchar* old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_foo (self);
+       if (g_strcmp0 (value, old_value) != 0) {
+               gchar* _tmp0_;
+               _tmp0_ = g_strdup (value);
+               _g_free0 (self->priv->_foo);
+               self->priv->_foo = _tmp0_;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_FOO_PROPERTY]);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_foo_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_foo_set_property;
+       G_OBJECT_CLASS (klass)->finalize = foo_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_FOO_PROPERTY, 
foo_properties[FOO_FOO_PROPERTY] = g_param_spec_string ("foo", "foo", "foo", NULL, G_PARAM_STATIC_STRINGS | 
G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+}
+
+static void
+foo_finalize (GObject * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       _g_free0 (self->priv->_foo);
+       G_OBJECT_CLASS (foo_parent_class)->finalize (obj);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_foo_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_FOO_PROPERTY:
+               g_value_set_string (value, foo_get_foo (self));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_foo_set_property (GObject * object,
+                        guint property_id,
+                        const GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_FOO_PROPERTY:
+               foo_set_foo (self, g_value_get_string (value));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       GObject* _tmp0_;
+       GObject* _tmp1_;
+       const gchar* _tmp2_;
+       const gchar* _tmp3_;
+       _tmp0_ = g_object_new (TYPE_FOO, "foo", "foo.initially", NULL);
+       _tmp1_ = G_IS_INITIALLY_UNOWNED (_tmp0_) ? g_object_ref_sink (_tmp0_) : _tmp0_;
+       _g_object_unref0 (foo);
+       foo = G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, TYPE_FOO, Foo);
+       _tmp2_ = foo_get_foo (foo);
+       _tmp3_ = _tmp2_;
+       _vala_assert (g_strcmp0 (_tmp3_, "foo.initially") == 0, "foo.foo == \"foo.initially\"");
+       _g_object_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/instance-comparison.c-expected b/tests/objects/instance-comparison.c-expected
new file mode 100644
index 000000000..9238e1667
--- /dev/null
+++ b/tests/objects/instance-comparison.c-expected
@@ -0,0 +1,451 @@
+/* objects_instance_comparison.c generated by valac, the Vala compiler
+ * generated from objects_instance_comparison.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_IFOO (ifoo_get_type ())
+#define IFOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IFOO, IFoo))
+#define IS_IFOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IFOO))
+#define IFOO_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_IFOO, IFooIface))
+
+typedef struct _IFoo IFoo;
+typedef struct _IFooIface IFooIface;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+enum  {
+       BAR_0_PROPERTY,
+       BAR_NUM_PROPERTIES
+};
+static GParamSpec* bar_properties[BAR_NUM_PROPERTIES];
+
+#define TYPE_MANAM (manam_get_type ())
+#define MANAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MANAM, Manam))
+#define MANAM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MANAM, ManamClass))
+#define IS_MANAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MANAM))
+#define IS_MANAM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MANAM))
+#define MANAM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MANAM, ManamClass))
+
+typedef struct _Manam Manam;
+typedef struct _ManamClass ManamClass;
+typedef struct _ManamPrivate ManamPrivate;
+enum  {
+       MANAM_0_PROPERTY,
+       MANAM_NUM_PROPERTIES
+};
+static GParamSpec* manam_properties[MANAM_NUM_PROPERTIES];
+
+#define TYPE_IFAZ (ifaz_get_type ())
+#define IFAZ(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IFAZ, IFaz))
+#define IS_IFAZ(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IFAZ))
+#define IFAZ_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_IFAZ, IFazIface))
+
+typedef struct _IFaz IFaz;
+typedef struct _IFazIface IFazIface;
+
+#define TYPE_BAZ (baz_get_type ())
+#define BAZ(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAZ, Baz))
+#define BAZ_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAZ, BazClass))
+#define IS_BAZ(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAZ))
+#define IS_BAZ_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAZ))
+#define BAZ_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAZ, BazClass))
+
+typedef struct _Baz Baz;
+typedef struct _BazClass BazClass;
+typedef struct _BazPrivate BazPrivate;
+enum  {
+       BAZ_0_PROPERTY,
+       BAZ_NUM_PROPERTIES
+};
+static GParamSpec* baz_properties[BAZ_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+
+struct _IFooIface {
+       GTypeInterface parent_iface;
+};
+
+struct _Bar {
+       GObject parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       GObjectClass parent_class;
+};
+
+struct _Manam {
+       Bar parent_instance;
+       ManamPrivate * priv;
+};
+
+struct _ManamClass {
+       BarClass parent_class;
+};
+
+struct _IFazIface {
+       GTypeInterface parent_iface;
+};
+
+struct _Baz {
+       GObject parent_instance;
+       BazPrivate * priv;
+};
+
+struct _BazClass {
+       GObjectClass parent_class;
+};
+
+static gpointer bar_parent_class = NULL;
+static IFooIface * bar_ifoo_parent_iface = NULL;
+static gpointer manam_parent_class = NULL;
+static gpointer baz_parent_class = NULL;
+static IFooIface * baz_ifoo_parent_iface = NULL;
+static IFazIface * baz_ifaz_parent_iface = NULL;
+
+VALA_EXTERN GType ifoo_get_type (void) G_GNUC_CONST ;
+static GType ifoo_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static GType bar_get_type_once (void);
+VALA_EXTERN GType manam_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Manam, g_object_unref)
+VALA_EXTERN Manam* manam_new (void);
+VALA_EXTERN Manam* manam_construct (GType object_type);
+static GType manam_get_type_once (void);
+VALA_EXTERN GType ifaz_get_type (void) G_GNUC_CONST ;
+static GType ifaz_get_type_once (void);
+VALA_EXTERN GType baz_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Baz, g_object_unref)
+VALA_EXTERN Baz* baz_new (void);
+VALA_EXTERN Baz* baz_construct (GType object_type);
+static GType baz_get_type_once (void);
+static void _vala_main (void);
+
+static void
+ifoo_default_init (IFooIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+ifoo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (IFooIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) ifoo_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType ifoo_type_id;
+       ifoo_type_id = g_type_register_static (G_TYPE_INTERFACE, "IFoo", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (ifoo_type_id, G_TYPE_OBJECT);
+       return ifoo_type_id;
+}
+
+GType
+ifoo_get_type (void)
+{
+       static volatile gsize ifoo_type_id__volatile = 0;
+       if (g_once_init_enter (&ifoo_type_id__volatile)) {
+               GType ifoo_type_id;
+               ifoo_type_id = ifoo_get_type_once ();
+               g_once_init_leave (&ifoo_type_id__volatile, ifoo_type_id);
+       }
+       return ifoo_type_id__volatile;
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar * self = NULL;
+       self = (Bar*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+bar_ifoo_interface_init (IFooIface * iface,
+                         gpointer iface_data)
+{
+       bar_ifoo_parent_iface = g_type_interface_peek_parent (iface);
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       static const GInterfaceInfo ifoo_info = { (GInterfaceInitFunc) bar_ifoo_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (G_TYPE_OBJECT, "Bar", &g_define_type_info, 0);
+       g_type_add_interface_static (bar_type_id, TYPE_IFOO, &ifoo_info);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+Manam*
+manam_construct (GType object_type)
+{
+       Manam * self = NULL;
+       self = (Manam*) bar_construct (object_type);
+       return self;
+}
+
+Manam*
+manam_new (void)
+{
+       return manam_construct (TYPE_MANAM);
+}
+
+static void
+manam_class_init (ManamClass * klass,
+                  gpointer klass_data)
+{
+       manam_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+manam_instance_init (Manam * self,
+                     gpointer klass)
+{
+}
+
+static GType
+manam_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (ManamClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) manam_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Manam), 
0, (GInstanceInitFunc) manam_instance_init, NULL };
+       GType manam_type_id;
+       manam_type_id = g_type_register_static (TYPE_BAR, "Manam", &g_define_type_info, 0);
+       return manam_type_id;
+}
+
+GType
+manam_get_type (void)
+{
+       static volatile gsize manam_type_id__volatile = 0;
+       if (g_once_init_enter (&manam_type_id__volatile)) {
+               GType manam_type_id;
+               manam_type_id = manam_get_type_once ();
+               g_once_init_leave (&manam_type_id__volatile, manam_type_id);
+       }
+       return manam_type_id__volatile;
+}
+
+static void
+ifaz_default_init (IFazIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+ifaz_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (IFazIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) ifaz_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType ifaz_type_id;
+       ifaz_type_id = g_type_register_static (G_TYPE_INTERFACE, "IFaz", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (ifaz_type_id, G_TYPE_OBJECT);
+       g_type_interface_add_prerequisite (ifaz_type_id, TYPE_IFOO);
+       return ifaz_type_id;
+}
+
+GType
+ifaz_get_type (void)
+{
+       static volatile gsize ifaz_type_id__volatile = 0;
+       if (g_once_init_enter (&ifaz_type_id__volatile)) {
+               GType ifaz_type_id;
+               ifaz_type_id = ifaz_get_type_once ();
+               g_once_init_leave (&ifaz_type_id__volatile, ifaz_type_id);
+       }
+       return ifaz_type_id__volatile;
+}
+
+Baz*
+baz_construct (GType object_type)
+{
+       Baz * self = NULL;
+       self = (Baz*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Baz*
+baz_new (void)
+{
+       return baz_construct (TYPE_BAZ);
+}
+
+static void
+baz_class_init (BazClass * klass,
+                gpointer klass_data)
+{
+       baz_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+baz_ifoo_interface_init (IFooIface * iface,
+                         gpointer iface_data)
+{
+       baz_ifoo_parent_iface = g_type_interface_peek_parent (iface);
+}
+
+static void
+baz_ifaz_interface_init (IFazIface * iface,
+                         gpointer iface_data)
+{
+       baz_ifaz_parent_iface = g_type_interface_peek_parent (iface);
+}
+
+static void
+baz_instance_init (Baz * self,
+                   gpointer klass)
+{
+}
+
+static GType
+baz_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BazClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) baz_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Baz), 0, 
(GInstanceInitFunc) baz_instance_init, NULL };
+       static const GInterfaceInfo ifoo_info = { (GInterfaceInitFunc) baz_ifoo_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       static const GInterfaceInfo ifaz_info = { (GInterfaceInitFunc) baz_ifaz_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       GType baz_type_id;
+       baz_type_id = g_type_register_static (G_TYPE_OBJECT, "Baz", &g_define_type_info, 0);
+       g_type_add_interface_static (baz_type_id, TYPE_IFOO, &ifoo_info);
+       g_type_add_interface_static (baz_type_id, TYPE_IFAZ, &ifaz_info);
+       return baz_type_id;
+}
+
+GType
+baz_get_type (void)
+{
+       static volatile gsize baz_type_id__volatile = 0;
+       if (g_once_init_enter (&baz_type_id__volatile)) {
+               GType baz_type_id;
+               baz_type_id = baz_get_type_once ();
+               g_once_init_leave (&baz_type_id__volatile, baz_type_id);
+       }
+       return baz_type_id__volatile;
+}
+
+static gpointer
+_g_object_ref0 (gpointer self)
+{
+       return self ? g_object_ref (self) : NULL;
+}
+
+static void
+_vala_main (void)
+{
+       {
+               Bar* bar = NULL;
+               Bar* _tmp0_;
+               IFoo* foo = NULL;
+               IFoo* _tmp1_;
+               _tmp0_ = bar_new ();
+               bar = _tmp0_;
+               _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (bar, TYPE_IFOO, IFoo));
+               foo = _tmp1_;
+               if (foo != G_TYPE_CHECK_INSTANCE_CAST (bar, TYPE_IFOO, IFoo)) {
+                       g_assert_not_reached ();
+               } else {
+                       if (foo == G_TYPE_CHECK_INSTANCE_CAST (bar, TYPE_IFOO, IFoo)) {
+                       } else {
+                               g_assert_not_reached ();
+                       }
+               }
+               _g_object_unref0 (foo);
+               _g_object_unref0 (bar);
+       }
+       {
+               IFaz* faz = NULL;
+               Baz* _tmp2_;
+               IFoo* foo = NULL;
+               IFoo* _tmp3_;
+               _tmp2_ = baz_new ();
+               faz = G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, TYPE_IFAZ, IFaz);
+               _tmp3_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (faz, TYPE_IFOO, IFoo));
+               foo = _tmp3_;
+               if (G_TYPE_CHECK_INSTANCE_CAST (faz, TYPE_IFOO, IFoo) != foo) {
+                       g_assert_not_reached ();
+               } else {
+                       if (foo == G_TYPE_CHECK_INSTANCE_CAST (faz, TYPE_IFOO, IFoo)) {
+                       } else {
+                               g_assert_not_reached ();
+                       }
+               }
+               _g_object_unref0 (foo);
+               _g_object_unref0 (faz);
+       }
+       {
+               Manam* manam = NULL;
+               Manam* _tmp4_;
+               Bar* bar = NULL;
+               Bar* _tmp5_;
+               _tmp4_ = manam_new ();
+               manam = _tmp4_;
+               _tmp5_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (manam, TYPE_BAR, Bar));
+               bar = _tmp5_;
+               if (G_TYPE_CHECK_INSTANCE_CAST (manam, TYPE_BAR, Bar) != bar) {
+                       g_assert_not_reached ();
+               } else {
+                       if (G_TYPE_CHECK_INSTANCE_CAST (manam, TYPE_BAR, Bar) == bar) {
+                       } else {
+                               g_assert_not_reached ();
+                       }
+               }
+               _g_object_unref0 (bar);
+               _g_object_unref0 (manam);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/interface-abstract-async-override.c-expected 
b/tests/objects/interface-abstract-async-override.c-expected
new file mode 100644
index 000000000..af4f79c49
--- /dev/null
+++ b/tests/objects/interface-abstract-async-override.c-expected
@@ -0,0 +1,322 @@
+/* objects_interface_abstract_async_override.c generated by valac, the Vala compiler
+ * generated from objects_interface_abstract_async_override.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_IFOO (ifoo_get_type ())
+#define IFOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IFOO, IFoo))
+#define IS_IFOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IFOO))
+#define IFOO_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_IFOO, IFooIface))
+
+typedef struct _IFoo IFoo;
+typedef struct _IFooIface IFooIface;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+enum  {
+       BAR_0_PROPERTY,
+       BAR_NUM_PROPERTIES
+};
+static GParamSpec* bar_properties[BAR_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+typedef struct _BarFooData BarFooData;
+#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _IFooIface {
+       GTypeInterface parent_iface;
+       void (*foo) (IFoo* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+       gint (*foo_finish) (IFoo* self, GAsyncResult* _res_);
+};
+
+struct _Bar {
+       GObject parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       GObjectClass parent_class;
+};
+
+struct _BarFooData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Bar* self;
+       gint result;
+};
+
+static gpointer bar_parent_class = NULL;
+static IFooIface * bar_ifoo_parent_iface = NULL;
+VALA_EXTERN GMainLoop* loop;
+GMainLoop* loop = NULL;
+
+VALA_EXTERN GType ifoo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN void ifoo_foo (IFoo* self,
+               GAsyncReadyCallback _callback_,
+               gpointer _user_data_);
+VALA_EXTERN gint ifoo_foo_finish (IFoo* self,
+                      GAsyncResult* _res_);
+static GType ifoo_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
+static void bar_real_foo_data_free (gpointer _data);
+static void bar_real_foo (IFoo* base,
+                   GAsyncReadyCallback _callback_,
+                   gpointer _user_data_);
+static gboolean bar_real_foo_co (BarFooData* _data_);
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static GType bar_get_type_once (void);
+static void _vala_main (void);
+static void __lambda4_ (GObject* o,
+                 GAsyncResult* r);
+static void ___lambda4__gasync_ready_callback (GObject* source_object,
+                                        GAsyncResult* res,
+                                        gpointer self);
+
+void
+ifoo_foo (IFoo* self,
+          GAsyncReadyCallback _callback_,
+          gpointer _user_data_)
+{
+       IFooIface* _iface_;
+       _iface_ = IFOO_GET_INTERFACE (self);
+       if (_iface_->foo) {
+               _iface_->foo (self, _callback_, _user_data_);
+       }
+}
+
+gint
+ifoo_foo_finish (IFoo* self,
+                 GAsyncResult* _res_)
+{
+       IFooIface* _iface_;
+       _iface_ = IFOO_GET_INTERFACE (self);
+       if (_iface_->foo_finish) {
+               return _iface_->foo_finish (self, _res_);
+       }
+       return -1;
+}
+
+static void
+ifoo_default_init (IFooIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+ifoo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (IFooIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) ifoo_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType ifoo_type_id;
+       ifoo_type_id = g_type_register_static (G_TYPE_INTERFACE, "IFoo", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (ifoo_type_id, G_TYPE_OBJECT);
+       return ifoo_type_id;
+}
+
+GType
+ifoo_get_type (void)
+{
+       static volatile gsize ifoo_type_id__volatile = 0;
+       if (g_once_init_enter (&ifoo_type_id__volatile)) {
+               GType ifoo_type_id;
+               ifoo_type_id = ifoo_get_type_once ();
+               g_once_init_leave (&ifoo_type_id__volatile, ifoo_type_id);
+       }
+       return ifoo_type_id__volatile;
+}
+
+static void
+bar_real_foo_data_free (gpointer _data)
+{
+       BarFooData* _data_;
+       _data_ = _data;
+       _g_object_unref0 (_data_->self);
+       g_slice_free (BarFooData, _data_);
+}
+
+static gpointer
+_g_object_ref0 (gpointer self)
+{
+       return self ? g_object_ref (self) : NULL;
+}
+
+static void
+bar_real_foo (IFoo* base,
+              GAsyncReadyCallback _callback_,
+              gpointer _user_data_)
+{
+       Bar * self;
+       BarFooData* _data_;
+       Bar* _tmp0_;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAR, Bar);
+       _data_ = g_slice_new0 (BarFooData);
+       _data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, bar_real_foo_data_free);
+       _tmp0_ = _g_object_ref0 (self);
+       _data_->self = _tmp0_;
+       bar_real_foo_co (_data_);
+}
+
+static gint
+bar_foo_finish (IFoo* base,
+                GAsyncResult* _res_)
+{
+       gint result;
+       BarFooData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+       result = _data_->result;
+       return result;
+}
+
+static gboolean
+bar_real_foo_co (BarFooData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->result = 42;
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar * self = NULL;
+       self = (Bar*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+bar_ifoo_interface_init (IFooIface * iface,
+                         gpointer iface_data)
+{
+       bar_ifoo_parent_iface = g_type_interface_peek_parent (iface);
+       iface->foo = (void (*) (IFoo*, GAsyncReadyCallback, gpointer)) bar_real_foo;
+       iface->foo_finish = (gint (*) (IFoo*, GAsyncResult*)) bar_foo_finish;
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       static const GInterfaceInfo ifoo_info = { (GInterfaceInitFunc) bar_ifoo_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (G_TYPE_OBJECT, "Bar", &g_define_type_info, 0);
+       g_type_add_interface_static (bar_type_id, TYPE_IFOO, &ifoo_info);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+__lambda4_ (GObject* o,
+            GAsyncResult* r)
+{
+       GMainLoop* _tmp0_;
+       g_return_if_fail ((o == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (o, G_TYPE_OBJECT));
+       g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (r, g_async_result_get_type ()));
+       _vala_assert (ifoo_foo_finish (G_TYPE_CHECK_INSTANCE_CAST (o, TYPE_IFOO, IFoo), r) == 42, "((IFoo) 
o).foo.end (r) == 42");
+       _tmp0_ = loop;
+       g_main_loop_quit (_tmp0_);
+}
+
+static void
+___lambda4__gasync_ready_callback (GObject* source_object,
+                                   GAsyncResult* res,
+                                   gpointer self)
+{
+       __lambda4_ (source_object, res);
+}
+
+static void
+_vala_main (void)
+{
+       GMainLoop* _tmp0_;
+       IFoo* bar = NULL;
+       Bar* _tmp1_;
+       GMainLoop* _tmp2_;
+       _tmp0_ = g_main_loop_new (NULL, FALSE);
+       _g_main_loop_unref0 (loop);
+       loop = _tmp0_;
+       _tmp1_ = bar_new ();
+       bar = G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, TYPE_IFOO, IFoo);
+       ifoo_foo (bar, ___lambda4__gasync_ready_callback, NULL);
+       _tmp2_ = loop;
+       g_main_loop_run (_tmp2_);
+       _g_object_unref0 (bar);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/interface-async-base-access.c-expected 
b/tests/objects/interface-async-base-access.c-expected
new file mode 100644
index 000000000..57aecbda8
--- /dev/null
+++ b/tests/objects/interface-async-base-access.c-expected
@@ -0,0 +1,631 @@
+/* objects_interface_async_base_access.c generated by valac, the Vala compiler
+ * generated from objects_interface_async_base_access.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_IFOO (ifoo_get_type ())
+#define IFOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IFOO, IFoo))
+#define IS_IFOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IFOO))
+#define IFOO_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_IFOO, IFooIface))
+
+typedef struct _IFoo IFoo;
+typedef struct _IFooIface IFooIface;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+#define _bar_unref0(var) ((var == NULL) ? NULL : (var = (bar_unref (var), NULL)))
+typedef struct _BarFooData BarFooData;
+typedef struct _ParamSpecBar ParamSpecBar;
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _FooBarData FooBarData;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _IFooIface {
+       GTypeInterface parent_iface;
+       void (*foo) (IFoo* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
+       void (*foo_finish) (IFoo* self, GAsyncResult* _res_);
+};
+
+struct _Bar {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       GTypeClass parent_class;
+       void (*finalize) (Bar *self);
+};
+
+struct _BarFooData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Bar* self;
+};
+
+struct _ParamSpecBar {
+       GParamSpec parent_instance;
+};
+
+struct _Foo {
+       Bar parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       BarClass parent_class;
+};
+
+struct _FooBarData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Foo* self;
+};
+
+static gpointer bar_parent_class = NULL;
+VALA_EXTERN gboolean reached;
+static IFooIface * bar_ifoo_parent_iface = NULL;
+static gpointer foo_parent_class = NULL;
+gboolean reached = FALSE;
+
+VALA_EXTERN GType ifoo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN void ifoo_foo (IFoo* self,
+               GAsyncReadyCallback _callback_,
+               gpointer _user_data_);
+VALA_EXTERN void ifoo_foo_finish (IFoo* self,
+                      GAsyncResult* _res_);
+static GType ifoo_get_type_once (void);
+VALA_EXTERN gpointer bar_ref (gpointer instance);
+VALA_EXTERN void bar_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_bar (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_bar (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_bar (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_bar (const GValue* value);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, bar_unref)
+static void bar_real_foo_data_free (gpointer _data);
+static void bar_real_foo (IFoo* base,
+                   GAsyncReadyCallback _callback_,
+                   gpointer _user_data_);
+static gboolean bar_real_foo_co (BarFooData* _data_);
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static void bar_finalize (Bar * obj);
+static GType bar_get_type_once (void);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, bar_unref)
+static void foo_bar_data_free (gpointer _data);
+VALA_EXTERN void foo_bar (Foo* self,
+              GAsyncReadyCallback _callback_,
+              gpointer _user_data_);
+VALA_EXTERN void foo_bar_finish (Foo* self,
+                     GAsyncResult* _res_);
+static gboolean foo_bar_co (FooBarData* _data_);
+static void foo_bar_ready (GObject* source_object,
+                    GAsyncResult* _res_,
+                    gpointer _user_data_);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+void
+ifoo_foo (IFoo* self,
+          GAsyncReadyCallback _callback_,
+          gpointer _user_data_)
+{
+       IFooIface* _iface_;
+       _iface_ = IFOO_GET_INTERFACE (self);
+       if (_iface_->foo) {
+               _iface_->foo (self, _callback_, _user_data_);
+       }
+}
+
+void
+ifoo_foo_finish (IFoo* self,
+                 GAsyncResult* _res_)
+{
+       IFooIface* _iface_;
+       _iface_ = IFOO_GET_INTERFACE (self);
+       if (_iface_->foo_finish) {
+               _iface_->foo_finish (self, _res_);
+       }
+}
+
+static void
+ifoo_default_init (IFooIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+ifoo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (IFooIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) ifoo_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType ifoo_type_id;
+       ifoo_type_id = g_type_register_static (G_TYPE_INTERFACE, "IFoo", &g_define_type_info, 0);
+       return ifoo_type_id;
+}
+
+GType
+ifoo_get_type (void)
+{
+       static volatile gsize ifoo_type_id__volatile = 0;
+       if (g_once_init_enter (&ifoo_type_id__volatile)) {
+               GType ifoo_type_id;
+               ifoo_type_id = ifoo_get_type_once ();
+               g_once_init_leave (&ifoo_type_id__volatile, ifoo_type_id);
+       }
+       return ifoo_type_id__volatile;
+}
+
+static void
+bar_real_foo_data_free (gpointer _data)
+{
+       BarFooData* _data_;
+       _data_ = _data;
+       _bar_unref0 (_data_->self);
+       g_slice_free (BarFooData, _data_);
+}
+
+static gpointer
+_bar_ref0 (gpointer self)
+{
+       return self ? bar_ref (self) : NULL;
+}
+
+static void
+bar_real_foo (IFoo* base,
+              GAsyncReadyCallback _callback_,
+              gpointer _user_data_)
+{
+       Bar * self;
+       BarFooData* _data_;
+       Bar* _tmp0_;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAR, Bar);
+       _data_ = g_slice_new0 (BarFooData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, bar_real_foo_data_free);
+       _tmp0_ = _bar_ref0 (self);
+       _data_->self = _tmp0_;
+       bar_real_foo_co (_data_);
+}
+
+static void
+bar_foo_finish (IFoo* base,
+                GAsyncResult* _res_)
+{
+       BarFooData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static gboolean
+bar_real_foo_co (BarFooData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       reached = TRUE;
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar* self = NULL;
+       self = (Bar*) g_type_create_instance (object_type);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+value_bar_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_bar_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               bar_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_bar_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = bar_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_bar_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_bar_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Bar * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = bar_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_bar_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Bar ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = bar_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_bar (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecBar* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_BAR), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_bar (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_bar (GValue* value,
+               gpointer v_object)
+{
+       Bar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               bar_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_unref (old);
+       }
+}
+
+void
+value_take_bar (GValue* value,
+                gpointer v_object)
+{
+       Bar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_unref (old);
+       }
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       ((BarClass *) klass)->finalize = bar_finalize;
+}
+
+static void
+bar_ifoo_interface_init (IFooIface * iface,
+                         gpointer iface_data)
+{
+       bar_ifoo_parent_iface = g_type_interface_peek_parent (iface);
+       iface->foo = (void (*) (IFoo*, GAsyncReadyCallback, gpointer)) bar_real_foo;
+       iface->foo_finish = (void (*) (IFoo*, GAsyncResult*)) bar_foo_finish;
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+bar_finalize (Bar * obj)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_bar_init, value_bar_free_value, 
value_bar_copy_value, value_bar_peek_pointer, "p", value_bar_collect_value, "p", value_bar_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       static const GInterfaceInfo ifoo_info = { (GInterfaceInitFunc) bar_ifoo_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       GType bar_type_id;
+       bar_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Bar", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       g_type_add_interface_static (bar_type_id, TYPE_IFOO, &ifoo_info);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+gpointer
+bar_ref (gpointer instance)
+{
+       Bar * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+bar_unref (gpointer instance)
+{
+       Bar * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               BAR_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+foo_bar_data_free (gpointer _data)
+{
+       FooBarData* _data_;
+       _data_ = _data;
+       _bar_unref0 (_data_->self);
+       g_slice_free (FooBarData, _data_);
+}
+
+void
+foo_bar (Foo* self,
+         GAsyncReadyCallback _callback_,
+         gpointer _user_data_)
+{
+       FooBarData* _data_;
+       Foo* _tmp0_;
+       g_return_if_fail (IS_FOO (self));
+       _data_ = g_slice_new0 (FooBarData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, foo_bar_data_free);
+       _tmp0_ = _bar_ref0 (self);
+       _data_->self = _tmp0_;
+       foo_bar_co (_data_);
+}
+
+void
+foo_bar_finish (Foo* self,
+                GAsyncResult* _res_)
+{
+       FooBarData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static void
+foo_bar_ready (GObject* source_object,
+               GAsyncResult* _res_,
+               gpointer _user_data_)
+{
+       FooBarData* _data_;
+       _data_ = _user_data_;
+       _data_->_source_object_ = source_object;
+       _data_->_res_ = _res_;
+       foo_bar_co (_data_);
+}
+
+static gboolean
+foo_bar_co (FooBarData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               case 1:
+               goto _state_1;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->_state_ = 1;
+       IFOO_GET_INTERFACE (_data_->self)->foo (G_TYPE_CHECK_INSTANCE_CAST (G_TYPE_CHECK_INSTANCE_CAST 
(_data_->self, TYPE_BAR, Bar), TYPE_IFOO, IFoo), foo_bar_ready, _data_);
+       return FALSE;
+       _state_1:
+       IFOO_GET_INTERFACE (_data_->self)->foo_finish (G_TYPE_CHECK_INSTANCE_CAST (G_TYPE_CHECK_INSTANCE_CAST 
(_data_->self, TYPE_BAR, Bar), TYPE_IFOO, IFoo), _data_->_res_);
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) bar_construct (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (TYPE_BAR, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       _vala_assert (IS_IFOO (foo), "foo is IFoo");
+       foo_bar (foo, NULL, NULL);
+       _vala_assert (reached, "reached");
+       _bar_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/interface-async-captured-generic.c-expected 
b/tests/objects/interface-async-captured-generic.c-expected
new file mode 100644
index 000000000..1db37f741
--- /dev/null
+++ b/tests/objects/interface-async-captured-generic.c-expected
@@ -0,0 +1,299 @@
+/* objects_interface_async_captured_generic.c generated by valac, the Vala compiler
+ * generated from objects_interface_async_captured_generic.vala, do not modify */
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_IFOO (ifoo_get_type ())
+#define IFOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IFOO, IFoo))
+#define IS_IFOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IFOO))
+#define IFOO_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_IFOO, IFooIface))
+
+typedef struct _IFoo IFoo;
+typedef struct _IFooIface IFooIface;
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+typedef struct _IfooBarData IfooBarData;
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _IFooIface {
+       GTypeInterface parent_iface;
+       GType (*get_g_type) (IFoo* self);
+       GBoxedCopyFunc (*get_g_dup_func) (IFoo* self);
+       GDestroyNotify (*get_g_destroy_func) (IFoo* self);
+};
+
+struct _IfooBarData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       IFoo* self;
+       gpointer g;
+       gpointer _tmp0_;
+};
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+static gpointer foo_parent_class = NULL;
+static IFooIface * foo_ifoo_parent_iface = NULL;
+
+VALA_EXTERN GType ifoo_get_type (void) G_GNUC_CONST ;
+static void ifoo_bar_data_free (gpointer _data);
+VALA_EXTERN void ifoo_bar (IFoo* self,
+               gpointer g,
+               GAsyncReadyCallback _callback_,
+               gpointer _user_data_);
+VALA_EXTERN void ifoo_bar_finish (IFoo* self,
+                      GAsyncResult* _res_);
+static gboolean ifoo_bar_co (IfooBarData* _data_);
+VALA_EXTERN void ifoo_baz (IFoo* self,
+               gpointer g);
+static GType ifoo_get_type_once (void);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+static void
+ifoo_bar_data_free (gpointer _data)
+{
+       IfooBarData* _data_;
+       _data_ = _data;
+       ((_data_->g == NULL) || (IFOO_GET_INTERFACE (_data_->self)->get_g_destroy_func (_data_->self) == 
NULL)) ? NULL : (_data_->g = (IFOO_GET_INTERFACE (_data_->self)->get_g_destroy_func (_data_->self) 
(_data_->g), NULL));
+       _g_object_unref0 (_data_->self);
+       g_slice_free (IfooBarData, _data_);
+}
+
+static gpointer
+_g_object_ref0 (gpointer self)
+{
+       return self ? g_object_ref (self) : NULL;
+}
+
+void
+ifoo_bar (IFoo* self,
+          gpointer g,
+          GAsyncReadyCallback _callback_,
+          gpointer _user_data_)
+{
+       IfooBarData* _data_;
+       IFoo* _tmp0_;
+       _data_ = g_slice_new0 (IfooBarData);
+       _data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, ifoo_bar_data_free);
+       _tmp0_ = _g_object_ref0 (self);
+       _data_->self = _tmp0_;
+       ((_data_->g == NULL) || (IFOO_GET_INTERFACE (_data_->self)->get_g_destroy_func (_data_->self) == 
NULL)) ? NULL : (_data_->g = (IFOO_GET_INTERFACE (_data_->self)->get_g_destroy_func (_data_->self) 
(_data_->g), NULL));
+       _data_->g = g;
+       ifoo_bar_co (_data_);
+}
+
+void
+ifoo_bar_finish (IFoo* self,
+                 GAsyncResult* _res_)
+{
+       IfooBarData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static gboolean
+ifoo_bar_co (IfooBarData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _vala_assert (IFOO_GET_INTERFACE (_data_->self)->get_g_type (_data_->self) == G_TYPE_STRING, "typeof 
(G) == typeof (string)");
+       _vala_assert (g_strcmp0 (_data_->g, "foo") == 0, "g == \"foo\"");
+       _data_->_tmp0_ = ((_data_->g != NULL) && (IFOO_GET_INTERFACE (_data_->self)->get_g_dup_func 
(_data_->self) != NULL)) ? IFOO_GET_INTERFACE (_data_->self)->get_g_dup_func (_data_->self) ((gpointer) 
_data_->g) : ((gpointer) _data_->g);
+       ifoo_baz (_data_->self, _data_->_tmp0_);
+       ((_data_->g == NULL) || (IFOO_GET_INTERFACE (_data_->self)->get_g_destroy_func (_data_->self) == 
NULL)) ? NULL : (_data_->g = (IFOO_GET_INTERFACE (_data_->self)->get_g_destroy_func (_data_->self) 
(_data_->g), NULL));
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+void
+ifoo_baz (IFoo* self,
+          gpointer g)
+{
+       _vala_assert (g_strcmp0 (g, "foo") == 0, "g == \"foo\"");
+       ((g == NULL) || (IFOO_GET_INTERFACE (self)->get_g_destroy_func (self) == NULL)) ? NULL : (g = 
(IFOO_GET_INTERFACE (self)->get_g_destroy_func (self) (g), NULL));
+}
+
+static void
+ifoo_default_init (IFooIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+ifoo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (IFooIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) ifoo_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType ifoo_type_id;
+       ifoo_type_id = g_type_register_static (G_TYPE_INTERFACE, "IFoo", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (ifoo_type_id, G_TYPE_OBJECT);
+       return ifoo_type_id;
+}
+
+GType
+ifoo_get_type (void)
+{
+       static volatile gsize ifoo_type_id__volatile = 0;
+       if (g_once_init_enter (&ifoo_type_id__volatile)) {
+               GType ifoo_type_id;
+               ifoo_type_id = ifoo_get_type_once ();
+               g_once_init_leave (&ifoo_type_id__volatile, ifoo_type_id);
+       }
+       return ifoo_type_id__volatile;
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+}
+
+static GType
+foo_ifoo_get_g_type (Foo* self)
+{
+       return G_TYPE_STRING;
+}
+
+static GBoxedCopyFunc
+foo_ifoo_get_g_dup_func (Foo* self)
+{
+       return g_strdup;
+}
+
+static GDestroyNotify
+foo_ifoo_get_g_destroy_func (Foo* self)
+{
+       return g_free;
+}
+
+static void
+foo_ifoo_interface_init (IFooIface * iface,
+                         gpointer iface_data)
+{
+       foo_ifoo_parent_iface = g_type_interface_peek_parent (iface);
+       iface->get_g_type = (GType (*) (IFoo *)) foo_ifoo_get_g_type;
+       iface->get_g_dup_func = (GBoxedCopyFunc (*) (IFoo *)) foo_ifoo_get_g_dup_func;
+       iface->get_g_destroy_func = (GDestroyNotify (*) (IFoo *)) foo_ifoo_get_g_destroy_func;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       static const GInterfaceInfo ifoo_info = { (GInterfaceInitFunc) foo_ifoo_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       g_type_add_interface_static (foo_type_id, TYPE_IFOO, &ifoo_info);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       gchar* _tmp1_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       _tmp1_ = g_strdup ("foo");
+       ifoo_bar (G_TYPE_CHECK_INSTANCE_CAST (foo, TYPE_IFOO, IFoo), _tmp1_, NULL, NULL);
+       _g_object_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/interface-base-access.c-expected b/tests/objects/interface-base-access.c-expected
new file mode 100644
index 000000000..aef85f1b9
--- /dev/null
+++ b/tests/objects/interface-base-access.c-expected
@@ -0,0 +1,463 @@
+/* objects_interface_base_access.c generated by valac, the Vala compiler
+ * generated from objects_interface_base_access.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_IFOO (ifoo_get_type ())
+#define IFOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IFOO, IFoo))
+#define IS_IFOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IFOO))
+#define IFOO_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_IFOO, IFooIface))
+
+typedef struct _IFoo IFoo;
+typedef struct _IFooIface IFooIface;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+typedef struct _ParamSpecBar ParamSpecBar;
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+#define _bar_unref0(var) ((var == NULL) ? NULL : (var = (bar_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _IFooIface {
+       GTypeInterface parent_iface;
+       void (*foo) (IFoo* self);
+};
+
+struct _Bar {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       GTypeClass parent_class;
+       void (*finalize) (Bar *self);
+};
+
+struct _ParamSpecBar {
+       GParamSpec parent_instance;
+};
+
+struct _Foo {
+       Bar parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       BarClass parent_class;
+};
+
+static gpointer bar_parent_class = NULL;
+VALA_EXTERN gboolean reached;
+static IFooIface * bar_ifoo_parent_iface = NULL;
+static gpointer foo_parent_class = NULL;
+gboolean reached = FALSE;
+
+VALA_EXTERN GType ifoo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN void ifoo_foo (IFoo* self);
+static GType ifoo_get_type_once (void);
+VALA_EXTERN gpointer bar_ref (gpointer instance);
+VALA_EXTERN void bar_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_bar (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_bar (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_bar (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_bar (const GValue* value);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, bar_unref)
+static void bar_real_foo (IFoo* base);
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static void bar_finalize (Bar * obj);
+static GType bar_get_type_once (void);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, bar_unref)
+VALA_EXTERN void foo_bar (Foo* self);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+void
+ifoo_foo (IFoo* self)
+{
+       IFooIface* _iface_;
+       g_return_if_fail (IS_IFOO (self));
+       _iface_ = IFOO_GET_INTERFACE (self);
+       if (_iface_->foo) {
+               _iface_->foo (self);
+       }
+}
+
+static void
+ifoo_default_init (IFooIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+ifoo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (IFooIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) ifoo_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType ifoo_type_id;
+       ifoo_type_id = g_type_register_static (G_TYPE_INTERFACE, "IFoo", &g_define_type_info, 0);
+       return ifoo_type_id;
+}
+
+GType
+ifoo_get_type (void)
+{
+       static volatile gsize ifoo_type_id__volatile = 0;
+       if (g_once_init_enter (&ifoo_type_id__volatile)) {
+               GType ifoo_type_id;
+               ifoo_type_id = ifoo_get_type_once ();
+               g_once_init_leave (&ifoo_type_id__volatile, ifoo_type_id);
+       }
+       return ifoo_type_id__volatile;
+}
+
+static void
+bar_real_foo (IFoo* base)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAR, Bar);
+       reached = TRUE;
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar* self = NULL;
+       self = (Bar*) g_type_create_instance (object_type);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+value_bar_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_bar_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               bar_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_bar_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = bar_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_bar_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_bar_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Bar * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = bar_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_bar_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Bar ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = bar_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_bar (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecBar* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_BAR), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_bar (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_bar (GValue* value,
+               gpointer v_object)
+{
+       Bar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               bar_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_unref (old);
+       }
+}
+
+void
+value_take_bar (GValue* value,
+                gpointer v_object)
+{
+       Bar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_unref (old);
+       }
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       ((BarClass *) klass)->finalize = bar_finalize;
+}
+
+static void
+bar_ifoo_interface_init (IFooIface * iface,
+                         gpointer iface_data)
+{
+       bar_ifoo_parent_iface = g_type_interface_peek_parent (iface);
+       iface->foo = (void (*) (IFoo*)) bar_real_foo;
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+bar_finalize (Bar * obj)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_bar_init, value_bar_free_value, 
value_bar_copy_value, value_bar_peek_pointer, "p", value_bar_collect_value, "p", value_bar_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       static const GInterfaceInfo ifoo_info = { (GInterfaceInitFunc) bar_ifoo_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       GType bar_type_id;
+       bar_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Bar", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       g_type_add_interface_static (bar_type_id, TYPE_IFOO, &ifoo_info);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+gpointer
+bar_ref (gpointer instance)
+{
+       Bar * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+bar_unref (gpointer instance)
+{
+       Bar * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               BAR_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+void
+foo_bar (Foo* self)
+{
+       g_return_if_fail (IS_FOO (self));
+       IFOO_GET_INTERFACE (self)->foo (G_TYPE_CHECK_INSTANCE_CAST (G_TYPE_CHECK_INSTANCE_CAST (self, 
TYPE_BAR, Bar), TYPE_IFOO, IFoo));
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) bar_construct (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (TYPE_BAR, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       _vala_assert (IS_IFOO (foo), "foo is IFoo");
+       foo_bar (foo);
+       _vala_assert (reached, "reached");
+       _bar_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/interface-generics.c-expected b/tests/objects/interface-generics.c-expected
new file mode 100644
index 000000000..bbff3c659
--- /dev/null
+++ b/tests/objects/interface-generics.c-expected
@@ -0,0 +1,282 @@
+/* objects_interface_generics.c generated by valac, the Vala compiler
+ * generated from objects_interface_generics.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_IFOO (ifoo_get_type ())
+#define IFOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IFOO, IFoo))
+#define IS_IFOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IFOO))
+#define IFOO_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_IFOO, IFooIface))
+
+typedef struct _IFoo IFoo;
+typedef struct _IFooIface IFooIface;
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_G_TYPE,
+       FOO_G_DUP_FUNC,
+       FOO_G_DESTROY_FUNC,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+
+struct _IFooIface {
+       GTypeInterface parent_iface;
+       gpointer (*get) (IFoo* self);
+};
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _FooPrivate {
+       GType g_type;
+       GBoxedCopyFunc g_dup_func;
+       GDestroyNotify g_destroy_func;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+static IFooIface * foo_ifoo_parent_iface = NULL;
+
+VALA_EXTERN GType ifoo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN gpointer ifoo_get (IFoo* self);
+static GType ifoo_get_type_once (void);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+static gpointer foo_real_get (IFoo* base);
+VALA_EXTERN Foo* foo_new (GType g_type,
+              GBoxedCopyFunc g_dup_func,
+              GDestroyNotify g_destroy_func);
+VALA_EXTERN Foo* foo_construct (GType object_type,
+                    GType g_type,
+                    GBoxedCopyFunc g_dup_func,
+                    GDestroyNotify g_destroy_func);
+static GType foo_get_type_once (void);
+static void _vala_foo_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_foo_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec);
+static void _vala_main (void);
+
+gpointer
+ifoo_get (IFoo* self)
+{
+       IFooIface* _iface_;
+       g_return_val_if_fail (IS_IFOO (self), NULL);
+       _iface_ = IFOO_GET_INTERFACE (self);
+       if (_iface_->get) {
+               return _iface_->get (self);
+       }
+       return NULL;
+}
+
+static void
+ifoo_default_init (IFooIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+ifoo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (IFooIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) ifoo_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType ifoo_type_id;
+       ifoo_type_id = g_type_register_static (G_TYPE_INTERFACE, "IFoo", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (ifoo_type_id, G_TYPE_OBJECT);
+       return ifoo_type_id;
+}
+
+GType
+ifoo_get_type (void)
+{
+       static volatile gsize ifoo_type_id__volatile = 0;
+       if (g_once_init_enter (&ifoo_type_id__volatile)) {
+               GType ifoo_type_id;
+               ifoo_type_id = ifoo_get_type_once ();
+               g_once_init_leave (&ifoo_type_id__volatile, ifoo_type_id);
+       }
+       return ifoo_type_id__volatile;
+}
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+static gpointer
+foo_real_get (IFoo* base)
+{
+       Foo * self;
+       gpointer result = NULL;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_FOO, Foo);
+       result = NULL;
+       return result;
+}
+
+Foo*
+foo_construct (GType object_type,
+               GType g_type,
+               GBoxedCopyFunc g_dup_func,
+               GDestroyNotify g_destroy_func)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       self->priv->g_type = g_type;
+       self->priv->g_dup_func = g_dup_func;
+       self->priv->g_destroy_func = g_destroy_func;
+       return self;
+}
+
+Foo*
+foo_new (GType g_type,
+         GBoxedCopyFunc g_dup_func,
+         GDestroyNotify g_destroy_func)
+{
+       return foo_construct (TYPE_FOO, g_type, g_dup_func, g_destroy_func);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_foo_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_foo_set_property;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_G_TYPE, g_param_spec_gtype ("g-type", 
"type", "type", G_TYPE_NONE, G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_G_DUP_FUNC, g_param_spec_pointer 
("g-dup-func", "dup func", "dup func", G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_G_DESTROY_FUNC, g_param_spec_pointer 
("g-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | 
G_PARAM_CONSTRUCT_ONLY));
+}
+
+static void
+foo_ifoo_interface_init (IFooIface * iface,
+                         gpointer iface_data)
+{
+       foo_ifoo_parent_iface = g_type_interface_peek_parent (iface);
+       iface->get = (gpointer (*) (IFoo*)) foo_real_get;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       static const GInterfaceInfo ifoo_info = { (GInterfaceInitFunc) foo_ifoo_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       g_type_add_interface_static (foo_type_id, TYPE_IFOO, &ifoo_info);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_foo_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_G_TYPE:
+               g_value_set_gtype (value, self->priv->g_type);
+               break;
+               case FOO_G_DUP_FUNC:
+               g_value_set_pointer (value, self->priv->g_dup_func);
+               break;
+               case FOO_G_DESTROY_FUNC:
+               g_value_set_pointer (value, self->priv->g_destroy_func);
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_foo_set_property (GObject * object,
+                        guint property_id,
+                        const GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_G_TYPE:
+               self->priv->g_type = g_value_get_gtype (value);
+               break;
+               case FOO_G_DUP_FUNC:
+               self->priv->g_dup_func = g_value_get_pointer (value);
+               break;
+               case FOO_G_DESTROY_FUNC:
+               self->priv->g_destroy_func = g_value_get_pointer (value);
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/interface-inner-types.c-expected b/tests/objects/interface-inner-types.c-expected
new file mode 100644
index 000000000..759d24f72
--- /dev/null
+++ b/tests/objects/interface-inner-types.c-expected
@@ -0,0 +1,677 @@
+/* objects_interface_inner_types.c generated by valac, the Vala compiler
+ * generated from objects_interface_inner_types.vala, do not modify */
+
+#include <glib-object.h>
+#include <gobject/gvaluecollector.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_IFOO (ifoo_get_type ())
+#define IFOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IFOO, IFoo))
+#define IS_IFOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IFOO))
+#define IFOO_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_IFOO, IFooIface))
+
+typedef struct _IFoo IFoo;
+typedef struct _IFooIface IFooIface;
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+#define IFOO_TYPE_BAR (ifoo_bar_get_type ())
+#define IFOO_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), IFOO_TYPE_BAR, IFooBar))
+#define IFOO_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), IFOO_TYPE_BAR, IFooBarClass))
+#define IFOO_IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IFOO_TYPE_BAR))
+#define IFOO_IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), IFOO_TYPE_BAR))
+#define IFOO_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), IFOO_TYPE_BAR, IFooBarClass))
+
+typedef struct _IFooBar IFooBar;
+typedef struct _IFooBarClass IFooBarClass;
+
+#define IFOO_TYPE_IBAR (ifoo_ibar_get_type ())
+#define IFOO_IBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), IFOO_TYPE_IBAR, IFooIBar))
+#define IFOO_IS_IBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IFOO_TYPE_IBAR))
+#define IFOO_IBAR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), IFOO_TYPE_IBAR, IFooIBarIface))
+
+typedef struct _IFooIBar IFooIBar;
+typedef struct _IFooIBarIface IFooIBarIface;
+#define _ifoo_bar_unref0(var) ((var == NULL) ? NULL : (var = (ifoo_bar_unref (var), NULL)))
+typedef struct _IFooBarPrivate IFooBarPrivate;
+typedef struct _IFooParamSpecBar IFooParamSpecBar;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _IFooIface {
+       GTypeInterface parent_iface;
+};
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+struct _IFooIBarIface {
+       GTypeInterface parent_iface;
+};
+
+struct _IFooBar {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       IFooBarPrivate * priv;
+};
+
+struct _IFooBarClass {
+       GTypeClass parent_class;
+       void (*finalize) (IFooBar *self);
+};
+
+struct _IFooParamSpecBar {
+       GParamSpec parent_instance;
+};
+
+static gpointer foo_parent_class = NULL;
+static IFooIface * foo_ifoo_parent_iface = NULL;
+static gpointer ifoo_bar_parent_class = NULL;
+static IFooIBarIface * ifoo_bar_ifoo_ibar_parent_iface = NULL;
+
+VALA_EXTERN GType ifoo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN void ifoo_bar (IFoo* self);
+static gpointer ifoo_bar_ref (gpointer instance);
+static void ifoo_bar_unref (gpointer instance);
+static GParamSpec* ifoo_param_spec_bar (const gchar* name,
+                                 const gchar* nick,
+                                 const gchar* blurb,
+                                 GType object_type,
+                                 GParamFlags flags) G_GNUC_UNUSED ;
+static void ifoo_value_set_bar (GValue* value,
+                         gpointer v_object) G_GNUC_UNUSED ;
+static void ifoo_value_take_bar (GValue* value,
+                          gpointer v_object) G_GNUC_UNUSED ;
+static gpointer ifoo_value_get_bar (const GValue* value) G_GNUC_UNUSED ;
+static GType ifoo_bar_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (IFooBar, ifoo_bar_unref)
+static IFooBar* ifoo_bar_new (void);
+static IFooBar* ifoo_bar_construct (GType object_type);
+static GType ifoo_ibar_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
+static void ifoo_bar_finalize (IFooBar * obj);
+static GType ifoo_bar_get_type_once (void);
+static GType ifoo_ibar_get_type_once (void);
+static GType ifoo_get_type_once (void);
+static void _vala_main (void);
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_ifoo_interface_init (IFooIface * iface,
+                         gpointer iface_data)
+{
+       foo_ifoo_parent_iface = g_type_interface_peek_parent (iface);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       static const GInterfaceInfo ifoo_info = { (GInterfaceInitFunc) foo_ifoo_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       g_type_add_interface_static (foo_type_id, TYPE_IFOO, &ifoo_info);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+void
+ifoo_bar (IFoo* self)
+{
+       IFooBar* bar = NULL;
+       IFooBar* _tmp0_;
+       _tmp0_ = ifoo_bar_new ();
+       bar = _tmp0_;
+       _vala_assert (IFOO_IS_IBAR (bar), "bar is IBar");
+       _ifoo_bar_unref0 (bar);
+}
+
+static IFooBar*
+ifoo_bar_construct (GType object_type)
+{
+       IFooBar* self = NULL;
+       self = (IFooBar*) g_type_create_instance (object_type);
+       return self;
+}
+
+static IFooBar*
+ifoo_bar_new (void)
+{
+       return ifoo_bar_construct (IFOO_TYPE_BAR);
+}
+
+static void
+ifoo_value_bar_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+ifoo_value_bar_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               ifoo_bar_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+ifoo_value_bar_copy_value (const GValue* src_value,
+                           GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = ifoo_bar_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+ifoo_value_bar_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+ifoo_value_bar_collect_value (GValue* value,
+                              guint n_collect_values,
+                              GTypeCValue* collect_values,
+                              guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               IFooBar * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = ifoo_bar_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+ifoo_value_bar_lcopy_value (const GValue* value,
+                            guint n_collect_values,
+                            GTypeCValue* collect_values,
+                            guint collect_flags)
+{
+       IFooBar ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = ifoo_bar_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+static GParamSpec*
+ifoo_param_spec_bar (const gchar* name,
+                     const gchar* nick,
+                     const gchar* blurb,
+                     GType object_type,
+                     GParamFlags flags)
+{
+       IFooParamSpecBar* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, IFOO_TYPE_BAR), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+static gpointer
+ifoo_value_get_bar (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, IFOO_TYPE_BAR), NULL);
+       return value->data[0].v_pointer;
+}
+
+static void
+ifoo_value_set_bar (GValue* value,
+                    gpointer v_object)
+{
+       IFooBar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, IFOO_TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, IFOO_TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               ifoo_bar_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               ifoo_bar_unref (old);
+       }
+}
+
+static void
+ifoo_value_take_bar (GValue* value,
+                     gpointer v_object)
+{
+       IFooBar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, IFOO_TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, IFOO_TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               ifoo_bar_unref (old);
+       }
+}
+
+static void
+ifoo_bar_class_init (IFooBarClass * klass,
+                     gpointer klass_data)
+{
+       ifoo_bar_parent_class = g_type_class_peek_parent (klass);
+       ((IFooBarClass *) klass)->finalize = ifoo_bar_finalize;
+}
+
+static void
+ifoo_bar_ifoo_ibar_interface_init (IFooIBarIface * iface,
+                                   gpointer iface_data)
+{
+       ifoo_bar_ifoo_ibar_parent_iface = g_type_interface_peek_parent (iface);
+}
+
+static void
+ifoo_bar_instance_init (IFooBar * self,
+                        gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+ifoo_bar_finalize (IFooBar * obj)
+{
+       IFooBar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, IFOO_TYPE_BAR, IFooBar);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+ifoo_bar_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { ifoo_value_bar_init, 
ifoo_value_bar_free_value, ifoo_value_bar_copy_value, ifoo_value_bar_peek_pointer, "p", 
ifoo_value_bar_collect_value, "p", ifoo_value_bar_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (IFooBarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) ifoo_bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(IFooBar), 0, (GInstanceInitFunc) ifoo_bar_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       static const GInterfaceInfo ifoo_ibar_info = { (GInterfaceInitFunc) 
ifoo_bar_ifoo_ibar_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
+       GType ifoo_bar_type_id;
+       ifoo_bar_type_id = g_type_register_fundamental (g_type_fundamental_next (), "IFooBar", 
&g_define_type_info, &g_define_type_fundamental_info, 0);
+       g_type_add_interface_static (ifoo_bar_type_id, IFOO_TYPE_IBAR, &ifoo_ibar_info);
+       return ifoo_bar_type_id;
+}
+
+static GType
+ifoo_bar_get_type (void)
+{
+       static volatile gsize ifoo_bar_type_id__volatile = 0;
+       if (g_once_init_enter (&ifoo_bar_type_id__volatile)) {
+               GType ifoo_bar_type_id;
+               ifoo_bar_type_id = ifoo_bar_get_type_once ();
+               g_once_init_leave (&ifoo_bar_type_id__volatile, ifoo_bar_type_id);
+       }
+       return ifoo_bar_type_id__volatile;
+}
+
+static gpointer
+ifoo_bar_ref (gpointer instance)
+{
+       IFooBar * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+static void
+ifoo_bar_unref (gpointer instance)
+{
+       IFooBar * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               IFOO_BAR_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+ifoo_ibar_default_init (IFooIBarIface * iface,
+                        gpointer iface_data)
+{
+}
+
+static GType
+ifoo_ibar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (IFooIBarIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) ifoo_ibar_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType ifoo_ibar_type_id;
+       ifoo_ibar_type_id = g_type_register_static (G_TYPE_INTERFACE, "IFooIBar", &g_define_type_info, 0);
+       return ifoo_ibar_type_id;
+}
+
+static GType
+ifoo_ibar_get_type (void)
+{
+       static volatile gsize ifoo_ibar_type_id__volatile = 0;
+       if (g_once_init_enter (&ifoo_ibar_type_id__volatile)) {
+               GType ifoo_ibar_type_id;
+               ifoo_ibar_type_id = ifoo_ibar_get_type_once ();
+               g_once_init_leave (&ifoo_ibar_type_id__volatile, ifoo_ibar_type_id);
+       }
+       return ifoo_ibar_type_id__volatile;
+}
+
+static void
+ifoo_default_init (IFooIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+ifoo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (IFooIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) ifoo_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType ifoo_type_id;
+       ifoo_type_id = g_type_register_static (G_TYPE_INTERFACE, "IFoo", &g_define_type_info, 0);
+       return ifoo_type_id;
+}
+
+GType
+ifoo_get_type (void)
+{
+       static volatile gsize ifoo_type_id__volatile = 0;
+       if (g_once_init_enter (&ifoo_type_id__volatile)) {
+               GType ifoo_type_id;
+               ifoo_type_id = ifoo_get_type_once ();
+               g_once_init_leave (&ifoo_type_id__volatile, ifoo_type_id);
+       }
+       return ifoo_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       ifoo_bar (G_TYPE_CHECK_INSTANCE_CAST (foo, TYPE_IFOO, IFoo));
+       _foo_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/interface-property-base-access.c-expected 
b/tests/objects/interface-property-base-access.c-expected
new file mode 100644
index 000000000..70a5f08a3
--- /dev/null
+++ b/tests/objects/interface-property-base-access.c-expected
@@ -0,0 +1,680 @@
+/* objects_interface_property_base_access.c generated by valac, the Vala compiler
+ * generated from objects_interface_property_base_access.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+#include <stdlib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_MANAM (manam_get_type ())
+typedef struct _Manam Manam;
+
+#define TYPE_IFOO (ifoo_get_type ())
+#define IFOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IFOO, IFoo))
+#define IS_IFOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IFOO))
+#define IFOO_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_IFOO, IFooIface))
+
+typedef struct _IFoo IFoo;
+typedef struct _IFooIface IFooIface;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+#define _g_free0(var) (var = (g_free (var), NULL))
+typedef struct _ParamSpecBar ParamSpecBar;
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+#define _bar_unref0(var) ((var == NULL) ? NULL : (var = (bar_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Manam {
+       gint i;
+};
+
+struct _IFooIface {
+       GTypeInterface parent_iface;
+       const gchar* (*get_foo) (IFoo* self);
+       void (*set_foo) (IFoo* self, const gchar* value);
+       void (*get_manam) (IFoo* self, Manam * result);
+       void (*set_manam) (IFoo* self, Manam * value);
+};
+
+struct _Bar {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       GTypeClass parent_class;
+       void (*finalize) (Bar *self);
+};
+
+struct _BarPrivate {
+       gchar* _foo;
+       Manam _manam;
+};
+
+struct _ParamSpecBar {
+       GParamSpec parent_instance;
+};
+
+struct _Foo {
+       Bar parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       BarClass parent_class;
+};
+
+static gint Bar_private_offset;
+static gpointer bar_parent_class = NULL;
+static IFooIface * bar_ifoo_parent_iface = NULL;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType manam_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Manam* manam_dup (const Manam* self);
+VALA_EXTERN void manam_free (Manam* self);
+VALA_EXTERN GType ifoo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN const gchar* ifoo_get_foo (IFoo* self);
+VALA_EXTERN void ifoo_set_foo (IFoo* self,
+                   const gchar* value);
+VALA_EXTERN void ifoo_get_manam (IFoo* self,
+                     Manam * result);
+VALA_EXTERN void ifoo_set_manam (IFoo* self,
+                     Manam * value);
+static GType ifoo_get_type_once (void);
+VALA_EXTERN gpointer bar_ref (gpointer instance);
+VALA_EXTERN void bar_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_bar (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_bar (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_bar (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_bar (const GValue* value);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, bar_unref)
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static void bar_finalize (Bar * obj);
+static GType bar_get_type_once (void);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, bar_unref)
+VALA_EXTERN gchar* foo_bar (Foo* self,
+                const gchar* s);
+VALA_EXTERN void foo_baz (Foo* self,
+              Manam* m,
+              Manam* result);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+static gboolean _manam_equal (const Manam * s1,
+                       const Manam * s2);
+
+Manam*
+manam_dup (const Manam* self)
+{
+       Manam* dup;
+       dup = g_new0 (Manam, 1);
+       memcpy (dup, self, sizeof (Manam));
+       return dup;
+}
+
+void
+manam_free (Manam* self)
+{
+       g_free (self);
+}
+
+static GType
+manam_get_type_once (void)
+{
+       GType manam_type_id;
+       manam_type_id = g_boxed_type_register_static ("Manam", (GBoxedCopyFunc) manam_dup, (GBoxedFreeFunc) 
manam_free);
+       return manam_type_id;
+}
+
+GType
+manam_get_type (void)
+{
+       static volatile gsize manam_type_id__volatile = 0;
+       if (g_once_init_enter (&manam_type_id__volatile)) {
+               GType manam_type_id;
+               manam_type_id = manam_get_type_once ();
+               g_once_init_leave (&manam_type_id__volatile, manam_type_id);
+       }
+       return manam_type_id__volatile;
+}
+
+const gchar*
+ifoo_get_foo (IFoo* self)
+{
+       IFooIface* _iface_;
+       g_return_val_if_fail (IS_IFOO (self), NULL);
+       _iface_ = IFOO_GET_INTERFACE (self);
+       if (_iface_->get_foo) {
+               return _iface_->get_foo (self);
+       }
+       return NULL;
+}
+
+void
+ifoo_set_foo (IFoo* self,
+              const gchar* value)
+{
+       IFooIface* _iface_;
+       g_return_if_fail (IS_IFOO (self));
+       _iface_ = IFOO_GET_INTERFACE (self);
+       if (_iface_->set_foo) {
+               _iface_->set_foo (self, value);
+       }
+}
+
+void
+ifoo_get_manam (IFoo* self,
+                Manam * result)
+{
+       IFooIface* _iface_;
+       g_return_if_fail (IS_IFOO (self));
+       _iface_ = IFOO_GET_INTERFACE (self);
+       if (_iface_->get_manam) {
+               _iface_->get_manam (self, result);
+       }
+       return;
+}
+
+void
+ifoo_set_manam (IFoo* self,
+                Manam * value)
+{
+       IFooIface* _iface_;
+       g_return_if_fail (IS_IFOO (self));
+       _iface_ = IFOO_GET_INTERFACE (self);
+       if (_iface_->set_manam) {
+               _iface_->set_manam (self, value);
+       }
+}
+
+static void
+ifoo_default_init (IFooIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+ifoo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (IFooIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) ifoo_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType ifoo_type_id;
+       ifoo_type_id = g_type_register_static (G_TYPE_INTERFACE, "IFoo", &g_define_type_info, 0);
+       return ifoo_type_id;
+}
+
+GType
+ifoo_get_type (void)
+{
+       static volatile gsize ifoo_type_id__volatile = 0;
+       if (g_once_init_enter (&ifoo_type_id__volatile)) {
+               GType ifoo_type_id;
+               ifoo_type_id = ifoo_get_type_once ();
+               g_once_init_leave (&ifoo_type_id__volatile, ifoo_type_id);
+       }
+       return ifoo_type_id__volatile;
+}
+
+static inline gpointer
+bar_get_instance_private (Bar* self)
+{
+       return G_STRUCT_MEMBER_P (self, Bar_private_offset);
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar* self = NULL;
+       self = (Bar*) g_type_create_instance (object_type);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static const gchar*
+bar_real_get_foo (IFoo* base)
+{
+       const gchar* result;
+       Bar* self;
+       const gchar* _tmp0_;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAR, Bar);
+       _tmp0_ = self->priv->_foo;
+       result = _tmp0_;
+       return result;
+}
+
+static void
+bar_real_set_foo (IFoo* base,
+                  const gchar* value)
+{
+       Bar* self;
+       gchar* _tmp0_;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAR, Bar);
+       _tmp0_ = g_strdup (value);
+       _g_free0 (self->priv->_foo);
+       self->priv->_foo = _tmp0_;
+}
+
+static void
+bar_real_get_manam (IFoo* base,
+                    Manam * result)
+{
+       Bar* self;
+       Manam _tmp0_;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAR, Bar);
+       _tmp0_ = self->priv->_manam;
+       *result = _tmp0_;
+       return;
+}
+
+static void
+bar_real_set_manam (IFoo* base,
+                    Manam * value)
+{
+       Bar* self;
+       Manam _tmp0_;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAR, Bar);
+       _tmp0_ = *value;
+       self->priv->_manam = _tmp0_;
+}
+
+static void
+value_bar_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_bar_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               bar_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_bar_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = bar_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_bar_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_bar_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Bar * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = bar_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_bar_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Bar ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = bar_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_bar (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecBar* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_BAR), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_bar (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_bar (GValue* value,
+               gpointer v_object)
+{
+       Bar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               bar_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_unref (old);
+       }
+}
+
+void
+value_take_bar (GValue* value,
+                gpointer v_object)
+{
+       Bar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_unref (old);
+       }
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       ((BarClass *) klass)->finalize = bar_finalize;
+       g_type_class_adjust_private_offset (klass, &Bar_private_offset);
+}
+
+static void
+bar_ifoo_interface_init (IFooIface * iface,
+                         gpointer iface_data)
+{
+       bar_ifoo_parent_iface = g_type_interface_peek_parent (iface);
+       iface->get_foo = bar_real_get_foo;
+       iface->set_foo = bar_real_set_foo;
+       iface->get_manam = bar_real_get_manam;
+       iface->set_manam = bar_real_set_manam;
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+       self->priv = bar_get_instance_private (self);
+       self->ref_count = 1;
+}
+
+static void
+bar_finalize (Bar * obj)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       g_signal_handlers_destroy (self);
+       _g_free0 (self->priv->_foo);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_bar_init, value_bar_free_value, 
value_bar_copy_value, value_bar_peek_pointer, "p", value_bar_collect_value, "p", value_bar_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       static const GInterfaceInfo ifoo_info = { (GInterfaceInitFunc) bar_ifoo_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       GType bar_type_id;
+       bar_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Bar", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       g_type_add_interface_static (bar_type_id, TYPE_IFOO, &ifoo_info);
+       Bar_private_offset = g_type_add_instance_private (bar_type_id, sizeof (BarPrivate));
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+gpointer
+bar_ref (gpointer instance)
+{
+       Bar * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+bar_unref (gpointer instance)
+{
+       Bar * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               BAR_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+gchar*
+foo_bar (Foo* self,
+         const gchar* s)
+{
+       const gchar* _tmp0_;
+       gchar* _tmp1_;
+       gchar* result = NULL;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       g_return_val_if_fail (s != NULL, NULL);
+       IFOO_GET_INTERFACE (self)->set_foo (G_TYPE_CHECK_INSTANCE_CAST (G_TYPE_CHECK_INSTANCE_CAST (self, 
TYPE_BAR, Bar), TYPE_IFOO, IFoo), s);
+       _tmp0_ = IFOO_GET_INTERFACE (self)->get_foo (G_TYPE_CHECK_INSTANCE_CAST (G_TYPE_CHECK_INSTANCE_CAST 
(self, TYPE_BAR, Bar), TYPE_IFOO, IFoo));
+       _tmp1_ = g_strdup (_tmp0_);
+       result = _tmp1_;
+       return result;
+}
+
+void
+foo_baz (Foo* self,
+         Manam* m,
+         Manam* result)
+{
+       Manam _tmp0_;
+       Manam _tmp1_;
+       Manam _tmp2_;
+       g_return_if_fail (IS_FOO (self));
+       g_return_if_fail (m != NULL);
+       _tmp0_ = *m;
+       IFOO_GET_INTERFACE (self)->set_manam (G_TYPE_CHECK_INSTANCE_CAST (G_TYPE_CHECK_INSTANCE_CAST (self, 
TYPE_BAR, Bar), TYPE_IFOO, IFoo), &_tmp0_);
+       IFOO_GET_INTERFACE (self)->get_manam (G_TYPE_CHECK_INSTANCE_CAST (G_TYPE_CHECK_INSTANCE_CAST (self, 
TYPE_BAR, Bar), TYPE_IFOO, IFoo), &_tmp1_);
+       _tmp2_ = _tmp1_;
+       *result = _tmp2_;
+       return;
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) bar_construct (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (TYPE_BAR, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static gboolean
+_manam_equal (const Manam * s1,
+              const Manam * s2)
+{
+       if (s1 == s2) {
+               return TRUE;
+       }
+       if (s1 == NULL) {
+               return FALSE;
+       }
+       if (s2 == NULL) {
+               return FALSE;
+       }
+       if (s1->i != s2->i) {
+               return FALSE;
+       }
+       return TRUE;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       gchar* _tmp1_;
+       gchar* _tmp2_;
+       Manam manam = {0};
+       Manam _tmp3_ = {0};
+       Manam _tmp4_;
+       Manam _tmp5_ = {0};
+       Manam _tmp6_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       _vala_assert (IS_IFOO (foo), "foo is IFoo");
+       _tmp1_ = foo_bar (foo, "foo");
+       _tmp2_ = _tmp1_;
+       _vala_assert (g_strcmp0 (_tmp2_, "foo") == 0, "foo.bar (\"foo\") == \"foo\"");
+       _g_free0 (_tmp2_);
+       _tmp3_.i = 42;
+       manam = _tmp3_;
+       _tmp4_ = manam;
+       foo_baz (foo, &_tmp4_, &_tmp5_);
+       _tmp6_ = manam;
+       _vala_assert (_manam_equal (&_tmp5_, &_tmp6_) == TRUE, "foo.baz (manam) == manam");
+       _bar_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/interface-property-base-impl.c-expected 
b/tests/objects/interface-property-base-impl.c-expected
new file mode 100644
index 000000000..02657c92d
--- /dev/null
+++ b/tests/objects/interface-property-base-impl.c-expected
@@ -0,0 +1,396 @@
+/* objects_interface_property_base_impl.c generated by valac, the Vala compiler
+ * generated from objects_interface_property_base_impl.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_IFOO (ifoo_get_type ())
+#define IFOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IFOO, IFoo))
+#define IS_IFOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IFOO))
+#define IFOO_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_IFOO, IFooIface))
+
+typedef struct _IFoo IFoo;
+typedef struct _IFooIface IFooIface;
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_PROP_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+enum  {
+       BAR_0_PROPERTY,
+       BAR_NUM_PROPERTIES
+};
+static GParamSpec* bar_properties[BAR_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _IFooIface {
+       GTypeInterface parent_iface;
+       gint (*get_prop) (IFoo* self);
+       void (*set_prop) (IFoo* self, gint value);
+};
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _FooPrivate {
+       gint _prop;
+};
+
+struct _Bar {
+       Foo parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       FooClass parent_class;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+static IFooIface * foo_ifoo_parent_iface = NULL;
+static gpointer bar_parent_class = NULL;
+static IFooIface * bar_ifoo_parent_iface = NULL;
+
+VALA_EXTERN GType ifoo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN gint ifoo_get_prop (IFoo* self);
+VALA_EXTERN void ifoo_set_prop (IFoo* self,
+                    gint value);
+static GType ifoo_get_type_once (void);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (GObject * obj);
+static GType foo_get_type_once (void);
+static void _vala_foo_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_foo_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static GType bar_get_type_once (void);
+static void _vala_main (void);
+
+gint
+ifoo_get_prop (IFoo* self)
+{
+       IFooIface* _iface_;
+       g_return_val_if_fail (IS_IFOO (self), 0);
+       _iface_ = IFOO_GET_INTERFACE (self);
+       if (_iface_->get_prop) {
+               return _iface_->get_prop (self);
+       }
+       return -1;
+}
+
+void
+ifoo_set_prop (IFoo* self,
+               gint value)
+{
+       IFooIface* _iface_;
+       g_return_if_fail (IS_IFOO (self));
+       _iface_ = IFOO_GET_INTERFACE (self);
+       if (_iface_->set_prop) {
+               _iface_->set_prop (self, value);
+       }
+}
+
+static void
+ifoo_default_init (IFooIface * iface,
+                   gpointer iface_data)
+{
+       g_object_interface_install_property (iface, g_param_spec_int ("prop", "prop", "prop", G_MININT, 
G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+}
+
+static GType
+ifoo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (IFooIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) ifoo_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType ifoo_type_id;
+       ifoo_type_id = g_type_register_static (G_TYPE_INTERFACE, "IFoo", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (ifoo_type_id, G_TYPE_OBJECT);
+       return ifoo_type_id;
+}
+
+GType
+ifoo_get_type (void)
+{
+       static volatile gsize ifoo_type_id__volatile = 0;
+       if (g_once_init_enter (&ifoo_type_id__volatile)) {
+               GType ifoo_type_id;
+               ifoo_type_id = ifoo_get_type_once ();
+               g_once_init_leave (&ifoo_type_id__volatile, ifoo_type_id);
+       }
+       return ifoo_type_id__volatile;
+}
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static gint
+foo_real_get_prop (IFoo* base)
+{
+       gint result;
+       Foo* self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_FOO, Foo);
+       result = self->priv->_prop;
+       return result;
+}
+
+static void
+foo_real_set_prop (IFoo* base,
+                   gint value)
+{
+       Foo* self;
+       gint old_value;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_FOO, Foo);
+       old_value = foo_real_get_prop (base);
+       if (old_value != value) {
+               self->priv->_prop = value;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_PROP_PROPERTY]);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_foo_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_foo_set_property;
+       G_OBJECT_CLASS (klass)->finalize = foo_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_PROP_PROPERTY, 
foo_properties[FOO_PROP_PROPERTY] = g_param_spec_int ("prop", "prop", "prop", G_MININT, G_MAXINT, 0, 
G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+}
+
+static void
+foo_ifoo_interface_init (IFooIface * iface,
+                         gpointer iface_data)
+{
+       foo_ifoo_parent_iface = g_type_interface_peek_parent (iface);
+       iface->get_prop = foo_real_get_prop;
+       iface->set_prop = foo_real_set_prop;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+}
+
+static void
+foo_finalize (GObject * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       G_OBJECT_CLASS (foo_parent_class)->finalize (obj);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       static const GInterfaceInfo ifoo_info = { (GInterfaceInitFunc) foo_ifoo_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       g_type_add_interface_static (foo_type_id, TYPE_IFOO, &ifoo_info);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_foo_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_PROP_PROPERTY:
+               g_value_set_int (value, ifoo_get_prop (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_IFOO, IFoo)));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_foo_set_property (GObject * object,
+                        guint property_id,
+                        const GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_PROP_PROPERTY:
+               ifoo_set_prop (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_IFOO, IFoo), g_value_get_int (value));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar * self = NULL;
+       self = (Bar*) foo_construct (object_type);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+bar_ifoo_interface_init (IFooIface * iface,
+                         gpointer iface_data)
+{
+       bar_ifoo_parent_iface = g_type_interface_peek_parent (iface);
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       static const GInterfaceInfo ifoo_info = { (GInterfaceInitFunc) bar_ifoo_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (TYPE_FOO, "Bar", &g_define_type_info, 0);
+       g_type_add_interface_static (bar_type_id, TYPE_IFOO, &ifoo_info);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       IFoo* bar = NULL;
+       Bar* _tmp0_;
+       gint _tmp1_;
+       gint _tmp2_;
+       _tmp0_ = bar_new ();
+       bar = G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, TYPE_IFOO, IFoo);
+       ifoo_set_prop (bar, 42);
+       _tmp1_ = ifoo_get_prop (bar);
+       _tmp2_ = _tmp1_;
+       _vala_assert (_tmp2_ == 42, "bar.prop == 42");
+       _g_object_unref0 (bar);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/interface-property-delegate.c-expected 
b/tests/objects/interface-property-delegate.c-expected
new file mode 100644
index 000000000..f4ef3912d
--- /dev/null
+++ b/tests/objects/interface-property-delegate.c-expected
@@ -0,0 +1,727 @@
+/* objects_interface_property_delegate.c generated by valac, the Vala compiler
+ * generated from objects_interface_property_delegate.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef void (*FooFunc) (gpointer user_data);
+
+#define TYPE_IFOO (ifoo_get_type ())
+#define IFOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IFOO, IFoo))
+#define IS_IFOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IFOO))
+#define IFOO_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_IFOO, IFooIface))
+
+typedef struct _IFoo IFoo;
+typedef struct _IFooIface IFooIface;
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+typedef struct _ParamSpecBar ParamSpecBar;
+#define _bar_unref0(var) ((var == NULL) ? NULL : (var = (bar_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _IFooIface {
+       GTypeInterface parent_iface;
+       FooFunc (*get_prop) (IFoo* self, gpointer* result_target);
+       void (*set_prop) (IFoo* self, FooFunc value, gpointer value_target);
+};
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _FooPrivate {
+       FooFunc _prop;
+       gpointer _prop_target;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+struct _Bar {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       BarPrivate * priv;
+       gboolean reached;
+};
+
+struct _BarClass {
+       GTypeClass parent_class;
+       void (*finalize) (Bar *self);
+};
+
+struct _ParamSpecBar {
+       GParamSpec parent_instance;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+static IFooIface * foo_ifoo_parent_iface = NULL;
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN GType ifoo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN FooFunc ifoo_get_prop (IFoo* self,
+                       gpointer* result_target);
+VALA_EXTERN void ifoo_set_prop (IFoo* self,
+                    FooFunc value,
+                    gpointer value_target);
+static GType ifoo_get_type_once (void);
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN gpointer bar_ref (gpointer instance);
+VALA_EXTERN void bar_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_bar (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_bar (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_bar (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_bar (const GValue* value);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, bar_unref)
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static void bar_bar (Bar* self);
+static void _bar_bar_foo_func (gpointer self);
+static void bar_finalize (Bar * obj);
+static GType bar_get_type_once (void);
+static void _vala_main (void);
+
+FooFunc
+ifoo_get_prop (IFoo* self,
+               gpointer* result_target)
+{
+       IFooIface* _iface_;
+       g_return_val_if_fail (IS_IFOO (self), NULL);
+       _iface_ = IFOO_GET_INTERFACE (self);
+       if (_iface_->get_prop) {
+               return _iface_->get_prop (self, result_target);
+       }
+       return NULL;
+}
+
+void
+ifoo_set_prop (IFoo* self,
+               FooFunc value,
+               gpointer value_target)
+{
+       IFooIface* _iface_;
+       g_return_if_fail (IS_IFOO (self));
+       _iface_ = IFOO_GET_INTERFACE (self);
+       if (_iface_->set_prop) {
+               _iface_->set_prop (self, value, value_target);
+       }
+}
+
+static void
+ifoo_default_init (IFooIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+ifoo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (IFooIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) ifoo_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType ifoo_type_id;
+       ifoo_type_id = g_type_register_static (G_TYPE_INTERFACE, "IFoo", &g_define_type_info, 0);
+       return ifoo_type_id;
+}
+
+GType
+ifoo_get_type (void)
+{
+       static volatile gsize ifoo_type_id__volatile = 0;
+       if (g_once_init_enter (&ifoo_type_id__volatile)) {
+               GType ifoo_type_id;
+               ifoo_type_id = ifoo_get_type_once ();
+               g_once_init_leave (&ifoo_type_id__volatile, ifoo_type_id);
+       }
+       return ifoo_type_id__volatile;
+}
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static FooFunc
+foo_real_get_prop (IFoo* base,
+                   gpointer* result_target)
+{
+       FooFunc result;
+       Foo* self;
+       FooFunc _tmp0_;
+       gpointer _tmp0__target;
+       FooFunc _tmp1_;
+       gpointer _tmp1__target;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_FOO, Foo);
+       _tmp0_ = self->priv->_prop;
+       _tmp0__target = self->priv->_prop_target;
+       _tmp1_ = _tmp0_;
+       _tmp1__target = _tmp0__target;
+       *result_target = _tmp1__target;
+       result = _tmp1_;
+       return result;
+}
+
+static void
+foo_real_set_prop (IFoo* base,
+                   FooFunc value,
+                   gpointer value_target)
+{
+       Foo* self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_FOO, Foo);
+       self->priv->_prop = value;
+       self->priv->_prop_target = value_target;
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+}
+
+static void
+foo_ifoo_interface_init (IFooIface * iface,
+                         gpointer iface_data)
+{
+       foo_ifoo_parent_iface = g_type_interface_peek_parent (iface);
+       iface->get_prop = foo_real_get_prop;
+       iface->set_prop = foo_real_set_prop;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       static const GInterfaceInfo ifoo_info = { (GInterfaceInitFunc) foo_ifoo_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       g_type_add_interface_static (foo_type_id, TYPE_IFOO, &ifoo_info);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_bar_bar_foo_func (gpointer self)
+{
+       bar_bar ((Bar*) self);
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar* self = NULL;
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       FooFunc _tmp1_ = NULL;
+       gpointer _tmp1__target = NULL;
+       FooFunc _tmp2_;
+       gpointer _tmp2__target;
+       self = (Bar*) g_type_create_instance (object_type);
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       ifoo_set_prop (G_TYPE_CHECK_INSTANCE_CAST (foo, TYPE_IFOO, IFoo), _bar_bar_foo_func, self);
+       _tmp1_ = ifoo_get_prop (G_TYPE_CHECK_INSTANCE_CAST (foo, TYPE_IFOO, IFoo), &_tmp1__target);
+       _tmp2_ = _tmp1_;
+       _tmp2__target = _tmp1__target;
+       _tmp2_ (_tmp2__target);
+       _foo_unref0 (foo);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+bar_bar (Bar* self)
+{
+       g_return_if_fail (IS_BAR (self));
+       self->reached = TRUE;
+}
+
+static void
+value_bar_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_bar_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               bar_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_bar_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = bar_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_bar_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_bar_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Bar * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = bar_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_bar_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Bar ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = bar_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_bar (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecBar* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_BAR), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_bar (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_bar (GValue* value,
+               gpointer v_object)
+{
+       Bar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               bar_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_unref (old);
+       }
+}
+
+void
+value_take_bar (GValue* value,
+                gpointer v_object)
+{
+       Bar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_unref (old);
+       }
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       ((BarClass *) klass)->finalize = bar_finalize;
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+bar_finalize (Bar * obj)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_bar_init, value_bar_free_value, 
value_bar_copy_value, value_bar_peek_pointer, "p", value_bar_collect_value, "p", value_bar_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType bar_type_id;
+       bar_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Bar", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+gpointer
+bar_ref (gpointer instance)
+{
+       Bar * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+bar_unref (gpointer instance)
+{
+       Bar * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               BAR_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Bar* bar = NULL;
+       Bar* _tmp0_;
+       _tmp0_ = bar_new ();
+       bar = _tmp0_;
+       _vala_assert (bar->reached, "bar.reached");
+       _bar_unref0 (bar);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/interface-property-override.c-expected 
b/tests/objects/interface-property-override.c-expected
new file mode 100644
index 000000000..d380c2ad8
--- /dev/null
+++ b/tests/objects/interface-property-override.c-expected
@@ -0,0 +1,682 @@
+/* objects_interface_property_override.c generated by valac, the Vala compiler
+ * generated from objects_interface_property_override.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_IFOO (ifoo_get_type ())
+#define IFOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IFOO, IFoo))
+#define IS_IFOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IFOO))
+#define IFOO_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_IFOO, IFooIface))
+
+typedef struct _IFoo IFoo;
+typedef struct _IFooIface IFooIface;
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+#define TYPE_IBAR (ibar_get_type ())
+#define IBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IBAR, IBar))
+#define IS_IBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IBAR))
+#define IBAR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_IBAR, IBarIface))
+
+typedef struct _IBar IBar;
+typedef struct _IBarIface IBarIface;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+enum  {
+       BAR_0_PROPERTY,
+       BAR_NUM_PROPERTIES
+};
+static GParamSpec* bar_properties[BAR_NUM_PROPERTIES];
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _IFooIface {
+       GTypeInterface parent_iface;
+       gint (*get_bar) (IFoo* self);
+       void (*set_bar) (IFoo* self, gint value);
+};
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+struct _IBarIface {
+       GTypeInterface parent_iface;
+       gint (*get_foo) (IBar* self);
+       void (*set_foo) (IBar* self, gint value);
+};
+
+struct _Bar {
+       GObject parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       GObjectClass parent_class;
+};
+
+static gpointer foo_parent_class = NULL;
+static IFooIface * foo_ifoo_parent_iface = NULL;
+static gpointer bar_parent_class = NULL;
+static IBarIface * bar_ibar_parent_iface = NULL;
+
+VALA_EXTERN GType ifoo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN gint ifoo_get_bar (IFoo* self);
+VALA_EXTERN void ifoo_set_bar (IFoo* self,
+                   gint value);
+static GType ifoo_get_type_once (void);
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN GType ibar_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN gint ibar_get_foo (IBar* self);
+VALA_EXTERN void ibar_set_foo (IBar* self,
+                   gint value);
+static GType ibar_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static GType bar_get_type_once (void);
+static void _vala_bar_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_bar_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec);
+static void _vala_main (void);
+
+gint
+ifoo_get_bar (IFoo* self)
+{
+       IFooIface* _iface_;
+       g_return_val_if_fail (IS_IFOO (self), 0);
+       _iface_ = IFOO_GET_INTERFACE (self);
+       if (_iface_->get_bar) {
+               return _iface_->get_bar (self);
+       }
+       return -1;
+}
+
+static gint
+ifoo_real_get_bar (IFoo* base)
+{
+       IFoo* self;
+       self = base;
+       g_assert_not_reached ();
+}
+
+void
+ifoo_set_bar (IFoo* self,
+              gint value)
+{
+       IFooIface* _iface_;
+       g_return_if_fail (IS_IFOO (self));
+       _iface_ = IFOO_GET_INTERFACE (self);
+       if (_iface_->set_bar) {
+               _iface_->set_bar (self, value);
+       }
+}
+
+static void
+ifoo_real_set_bar (IFoo* base,
+                   gint value)
+{
+       IFoo* self;
+       self = base;
+       g_assert_not_reached ();
+}
+
+static void
+ifoo_default_init (IFooIface * iface,
+                   gpointer iface_data)
+{
+       iface->get_bar = ifoo_real_get_bar;
+       iface->set_bar = ifoo_real_set_bar;
+}
+
+static GType
+ifoo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (IFooIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) ifoo_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType ifoo_type_id;
+       ifoo_type_id = g_type_register_static (G_TYPE_INTERFACE, "IFoo", &g_define_type_info, 0);
+       return ifoo_type_id;
+}
+
+GType
+ifoo_get_type (void)
+{
+       static volatile gsize ifoo_type_id__volatile = 0;
+       if (g_once_init_enter (&ifoo_type_id__volatile)) {
+               GType ifoo_type_id;
+               ifoo_type_id = ifoo_get_type_once ();
+               g_once_init_leave (&ifoo_type_id__volatile, ifoo_type_id);
+       }
+       return ifoo_type_id__volatile;
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static gint
+foo_real_get_bar (IFoo* base)
+{
+       gint result;
+       Foo* self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_FOO, Foo);
+       result = 42;
+       return result;
+}
+
+static void
+foo_real_set_bar (IFoo* base,
+                  gint value)
+{
+       Foo* self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_FOO, Foo);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_ifoo_interface_init (IFooIface * iface,
+                         gpointer iface_data)
+{
+       foo_ifoo_parent_iface = g_type_interface_peek_parent (iface);
+       iface->get_bar = foo_real_get_bar;
+       iface->set_bar = foo_real_set_bar;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       static const GInterfaceInfo ifoo_info = { (GInterfaceInitFunc) foo_ifoo_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       g_type_add_interface_static (foo_type_id, TYPE_IFOO, &ifoo_info);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+gint
+ibar_get_foo (IBar* self)
+{
+       IBarIface* _iface_;
+       g_return_val_if_fail (IS_IBAR (self), 0);
+       _iface_ = IBAR_GET_INTERFACE (self);
+       if (_iface_->get_foo) {
+               return _iface_->get_foo (self);
+       }
+       return -1;
+}
+
+static gint
+ibar_real_get_foo (IBar* base)
+{
+       IBar* self;
+       self = base;
+       g_assert_not_reached ();
+}
+
+void
+ibar_set_foo (IBar* self,
+              gint value)
+{
+       IBarIface* _iface_;
+       g_return_if_fail (IS_IBAR (self));
+       _iface_ = IBAR_GET_INTERFACE (self);
+       if (_iface_->set_foo) {
+               _iface_->set_foo (self, value);
+       }
+}
+
+static void
+ibar_real_set_foo (IBar* base,
+                   gint value)
+{
+       IBar* self;
+       self = base;
+       g_assert_not_reached ();
+}
+
+static void
+ibar_default_init (IBarIface * iface,
+                   gpointer iface_data)
+{
+       iface->get_foo = ibar_real_get_foo;
+       iface->set_foo = ibar_real_set_foo;
+}
+
+static GType
+ibar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (IBarIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) ibar_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType ibar_type_id;
+       ibar_type_id = g_type_register_static (G_TYPE_INTERFACE, "IBar", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (ibar_type_id, G_TYPE_OBJECT);
+       return ibar_type_id;
+}
+
+GType
+ibar_get_type (void)
+{
+       static volatile gsize ibar_type_id__volatile = 0;
+       if (g_once_init_enter (&ibar_type_id__volatile)) {
+               GType ibar_type_id;
+               ibar_type_id = ibar_get_type_once ();
+               g_once_init_leave (&ibar_type_id__volatile, ibar_type_id);
+       }
+       return ibar_type_id__volatile;
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar * self = NULL;
+       self = (Bar*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static gint
+bar_real_get_foo (IBar* base)
+{
+       gint result;
+       Bar* self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAR, Bar);
+       result = 23;
+       return result;
+}
+
+static void
+bar_real_set_foo (IBar* base,
+                  gint value)
+{
+       Bar* self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAR, Bar);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       G_OBJECT_CLASS (klass)->get_property = _vala_bar_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_bar_set_property;
+}
+
+static void
+bar_ibar_interface_init (IBarIface * iface,
+                         gpointer iface_data)
+{
+       bar_ibar_parent_iface = g_type_interface_peek_parent (iface);
+       iface->get_foo = bar_real_get_foo;
+       iface->set_foo = bar_real_set_foo;
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       static const GInterfaceInfo ibar_info = { (GInterfaceInitFunc) bar_ibar_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (G_TYPE_OBJECT, "Bar", &g_define_type_info, 0);
+       g_type_add_interface_static (bar_type_id, TYPE_IBAR, &ibar_info);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_bar_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_BAR, Bar);
+       switch (property_id) {
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_bar_set_property (GObject * object,
+                        guint property_id,
+                        const GValue * value,
+                        GParamSpec * pspec)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_BAR, Bar);
+       switch (property_id) {
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_main (void)
+{
+       {
+               Foo* foo = NULL;
+               Foo* _tmp0_;
+               gint _tmp1_;
+               gint _tmp2_;
+               _tmp0_ = foo_new ();
+               foo = _tmp0_;
+               ifoo_set_bar (G_TYPE_CHECK_INSTANCE_CAST (foo, TYPE_IFOO, IFoo), 0);
+               _tmp1_ = ifoo_get_bar (G_TYPE_CHECK_INSTANCE_CAST (foo, TYPE_IFOO, IFoo));
+               _tmp2_ = _tmp1_;
+               _vala_assert (_tmp2_ == 42, "foo.bar == 42");
+               _foo_unref0 (foo);
+       }
+       {
+               Bar* bar = NULL;
+               Bar* _tmp3_;
+               gint _tmp4_;
+               gint _tmp5_;
+               _tmp3_ = bar_new ();
+               bar = _tmp3_;
+               ibar_set_foo (G_TYPE_CHECK_INSTANCE_CAST (bar, TYPE_IBAR, IBar), 0);
+               _tmp4_ = ibar_get_foo (G_TYPE_CHECK_INSTANCE_CAST (bar, TYPE_IBAR, IBar));
+               _tmp5_ = _tmp4_;
+               _vala_assert (_tmp5_ == 23, "bar.foo == 23");
+               _g_object_unref0 (bar);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/interface-virtual-override.c-expected 
b/tests/objects/interface-virtual-override.c-expected
new file mode 100644
index 000000000..3590ce8c3
--- /dev/null
+++ b/tests/objects/interface-virtual-override.c-expected
@@ -0,0 +1,208 @@
+/* objects_interface_virtual_override.c generated by valac, the Vala compiler
+ * generated from objects_interface_virtual_override.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_IFOO (ifoo_get_type ())
+#define IFOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IFOO, IFoo))
+#define IS_IFOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IFOO))
+#define IFOO_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_IFOO, IFooIface))
+
+typedef struct _IFoo IFoo;
+typedef struct _IFooIface IFooIface;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+enum  {
+       BAR_0_PROPERTY,
+       BAR_NUM_PROPERTIES
+};
+static GParamSpec* bar_properties[BAR_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _IFooIface {
+       GTypeInterface parent_iface;
+       gint (*foo) (IFoo* self);
+};
+
+struct _Bar {
+       GObject parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       GObjectClass parent_class;
+};
+
+static gpointer bar_parent_class = NULL;
+static IFooIface * bar_ifoo_parent_iface = NULL;
+
+VALA_EXTERN GType ifoo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN gint ifoo_foo (IFoo* self);
+static gint ifoo_real_foo (IFoo* self);
+static GType ifoo_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
+static gint bar_real_foo (IFoo* base);
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static GType bar_get_type_once (void);
+static void _vala_main (void);
+
+static gint
+ifoo_real_foo (IFoo* self)
+{
+       g_assert_not_reached ();
+}
+
+gint
+ifoo_foo (IFoo* self)
+{
+       IFooIface* _iface_;
+       g_return_val_if_fail (IS_IFOO (self), 0);
+       _iface_ = IFOO_GET_INTERFACE (self);
+       if (_iface_->foo) {
+               return _iface_->foo (self);
+       }
+       return -1;
+}
+
+static void
+ifoo_default_init (IFooIface * iface,
+                   gpointer iface_data)
+{
+       iface->foo = ifoo_real_foo;
+}
+
+static GType
+ifoo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (IFooIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) ifoo_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType ifoo_type_id;
+       ifoo_type_id = g_type_register_static (G_TYPE_INTERFACE, "IFoo", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (ifoo_type_id, G_TYPE_OBJECT);
+       return ifoo_type_id;
+}
+
+GType
+ifoo_get_type (void)
+{
+       static volatile gsize ifoo_type_id__volatile = 0;
+       if (g_once_init_enter (&ifoo_type_id__volatile)) {
+               GType ifoo_type_id;
+               ifoo_type_id = ifoo_get_type_once ();
+               g_once_init_leave (&ifoo_type_id__volatile, ifoo_type_id);
+       }
+       return ifoo_type_id__volatile;
+}
+
+static gint
+bar_real_foo (IFoo* base)
+{
+       Bar * self;
+       gint result = 0;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAR, Bar);
+       result = 42;
+       return result;
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar * self = NULL;
+       self = (Bar*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+bar_ifoo_interface_init (IFooIface * iface,
+                         gpointer iface_data)
+{
+       bar_ifoo_parent_iface = g_type_interface_peek_parent (iface);
+       iface->foo = (gint (*) (IFoo*)) bar_real_foo;
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       static const GInterfaceInfo ifoo_info = { (GInterfaceInitFunc) bar_ifoo_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (G_TYPE_OBJECT, "Bar", &g_define_type_info, 0);
+       g_type_add_interface_static (bar_type_id, TYPE_IFOO, &ifoo_info);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Bar* bar = NULL;
+       Bar* _tmp0_;
+       _tmp0_ = bar_new ();
+       bar = _tmp0_;
+       _vala_assert (ifoo_foo (G_TYPE_CHECK_INSTANCE_CAST (bar, TYPE_IFOO, IFoo)) == 42, "bar.foo () == 42");
+       _g_object_unref0 (bar);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/interface_only.c-expected b/tests/objects/interface_only.c-expected
new file mode 100644
index 000000000..4dd4bc6bd
--- /dev/null
+++ b/tests/objects/interface_only.c-expected
@@ -0,0 +1,71 @@
+/* objects_interface_only.c generated by valac, the Vala compiler
+ * generated from objects_interface_only.vala, do not modify */
+
+#include <glib-object.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define FOO_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_FOO, FooIface))
+
+typedef struct _Foo Foo;
+typedef struct _FooIface FooIface;
+
+struct _FooIface {
+       GTypeInterface parent_iface;
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+static void
+foo_default_init (FooIface * iface,
+                  gpointer iface_data)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_INTERFACE, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/interfaces.c-expected b/tests/objects/interfaces.c-expected
new file mode 100644
index 000000000..d328b8d18
--- /dev/null
+++ b/tests/objects/interfaces.c-expected
@@ -0,0 +1,392 @@
+/* objects_interfaces.c generated by valac, the Vala compiler
+ * generated from objects_interfaces.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <stdio.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define MAMAN_TYPE_IBAZ (maman_ibaz_get_type ())
+#define MAMAN_IBAZ(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_IBAZ, MamanIbaz))
+#define MAMAN_IS_IBAZ(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_IBAZ))
+#define MAMAN_IBAZ_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), MAMAN_TYPE_IBAZ, 
MamanIbazIface))
+
+typedef struct _MamanIbaz MamanIbaz;
+typedef struct _MamanIbazIface MamanIbazIface;
+
+#define MAMAN_TYPE_BAZ (maman_baz_get_type ())
+#define MAMAN_BAZ(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_BAZ, MamanBaz))
+#define MAMAN_BAZ_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAMAN_TYPE_BAZ, MamanBazClass))
+#define MAMAN_IS_BAZ(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_BAZ))
+#define MAMAN_IS_BAZ_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAMAN_TYPE_BAZ))
+#define MAMAN_BAZ_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAMAN_TYPE_BAZ, MamanBazClass))
+
+typedef struct _MamanBaz MamanBaz;
+typedef struct _MamanBazClass MamanBazClass;
+typedef struct _MamanBazPrivate MamanBazPrivate;
+enum  {
+       MAMAN_BAZ_0_PROPERTY,
+       MAMAN_BAZ_NUM_PROPERTIES
+};
+static GParamSpec* maman_baz_properties[MAMAN_BAZ_NUM_PROPERTIES];
+
+#define MAMAN_TYPE_SUB_BAZ (maman_sub_baz_get_type ())
+#define MAMAN_SUB_BAZ(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_SUB_BAZ, MamanSubBaz))
+#define MAMAN_SUB_BAZ_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAMAN_TYPE_SUB_BAZ, MamanSubBazClass))
+#define MAMAN_IS_SUB_BAZ(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_SUB_BAZ))
+#define MAMAN_IS_SUB_BAZ_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAMAN_TYPE_SUB_BAZ))
+#define MAMAN_SUB_BAZ_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAMAN_TYPE_SUB_BAZ, 
MamanSubBazClass))
+
+typedef struct _MamanSubBaz MamanSubBaz;
+typedef struct _MamanSubBazClass MamanSubBazClass;
+typedef struct _MamanSubBazPrivate MamanSubBazPrivate;
+enum  {
+       MAMAN_SUB_BAZ_0_PROPERTY,
+       MAMAN_SUB_BAZ_NUM_PROPERTIES
+};
+static GParamSpec* maman_sub_baz_properties[MAMAN_SUB_BAZ_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+
+struct _MamanIbazIface {
+       GTypeInterface parent_iface;
+       void (*do_action) (MamanIbaz* self);
+       void (*do_virtual_action) (MamanIbaz* self);
+};
+
+struct _MamanBaz {
+       GObject parent_instance;
+       MamanBazPrivate * priv;
+};
+
+struct _MamanBazClass {
+       GObjectClass parent_class;
+       void (*do_virtual_action) (MamanBaz* self);
+};
+
+struct _MamanSubBaz {
+       MamanBaz parent_instance;
+       MamanSubBazPrivate * priv;
+};
+
+struct _MamanSubBazClass {
+       MamanBazClass parent_class;
+};
+
+static gpointer maman_baz_parent_class = NULL;
+static MamanIbazIface * maman_baz_maman_ibaz_parent_iface = NULL;
+static gpointer maman_sub_baz_parent_class = NULL;
+
+VALA_EXTERN GType maman_ibaz_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN void maman_ibaz_do_action (MamanIbaz* self);
+VALA_EXTERN void maman_ibaz_do_virtual_action (MamanIbaz* self);
+VALA_EXTERN void maman_ibaz_protected_mixin_1 (MamanIbaz* self);
+VALA_EXTERN void maman_ibaz_protected_mixin_2 (MamanIbaz* self);
+VALA_EXTERN void maman_ibaz_public_mixin (MamanIbaz* self);
+static GType maman_ibaz_get_type_once (void);
+VALA_EXTERN GType maman_baz_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MamanBaz, g_object_unref)
+VALA_EXTERN void maman_baz_do_virtual_action (MamanBaz* self);
+static void maman_baz_real_do_action (MamanIbaz* base);
+static void maman_baz_real_do_virtual_action (MamanBaz* self);
+VALA_EXTERN void maman_baz_do_mixin (MamanBaz* self);
+VALA_EXTERN MamanBaz* maman_baz_new (void);
+VALA_EXTERN MamanBaz* maman_baz_construct (GType object_type);
+static GType maman_baz_get_type_once (void);
+VALA_EXTERN GType maman_sub_baz_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MamanSubBaz, g_object_unref)
+static void maman_sub_baz_real_do_virtual_action (MamanBaz* base);
+VALA_EXTERN gint maman_sub_baz_main_func (void);
+VALA_EXTERN MamanSubBaz* maman_sub_baz_new (void);
+VALA_EXTERN MamanSubBaz* maman_sub_baz_construct (GType object_type);
+static GType maman_sub_baz_get_type_once (void);
+static void _vala_main (void);
+
+void
+maman_ibaz_do_action (MamanIbaz* self)
+{
+       MamanIbazIface* _iface_;
+       g_return_if_fail (MAMAN_IS_IBAZ (self));
+       _iface_ = MAMAN_IBAZ_GET_INTERFACE (self);
+       if (_iface_->do_action) {
+               _iface_->do_action (self);
+       }
+}
+
+void
+maman_ibaz_do_virtual_action (MamanIbaz* self)
+{
+       MamanIbazIface* _iface_;
+       g_return_if_fail (MAMAN_IS_IBAZ (self));
+       _iface_ = MAMAN_IBAZ_GET_INTERFACE (self);
+       if (_iface_->do_virtual_action) {
+               _iface_->do_virtual_action (self);
+       }
+}
+
+void
+maman_ibaz_protected_mixin_1 (MamanIbaz* self)
+{
+       FILE* _tmp0_;
+       _tmp0_ = stdout;
+       fputs ("protected_mixin_1\n", _tmp0_);
+       maman_ibaz_protected_mixin_2 (self);
+}
+
+void
+maman_ibaz_protected_mixin_2 (MamanIbaz* self)
+{
+       FILE* _tmp0_;
+       _tmp0_ = stdout;
+       fputs ("protected_mixin_2\n", _tmp0_);
+}
+
+void
+maman_ibaz_public_mixin (MamanIbaz* self)
+{
+       maman_ibaz_protected_mixin_1 (self);
+       maman_ibaz_protected_mixin_2 (self);
+}
+
+static void
+maman_ibaz_default_init (MamanIbazIface * iface,
+                         gpointer iface_data)
+{
+}
+
+static GType
+maman_ibaz_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (MamanIbazIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_ibaz_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType maman_ibaz_type_id;
+       maman_ibaz_type_id = g_type_register_static (G_TYPE_INTERFACE, "MamanIbaz", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (maman_ibaz_type_id, G_TYPE_OBJECT);
+       return maman_ibaz_type_id;
+}
+
+GType
+maman_ibaz_get_type (void)
+{
+       static volatile gsize maman_ibaz_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_ibaz_type_id__volatile)) {
+               GType maman_ibaz_type_id;
+               maman_ibaz_type_id = maman_ibaz_get_type_once ();
+               g_once_init_leave (&maman_ibaz_type_id__volatile, maman_ibaz_type_id);
+       }
+       return maman_ibaz_type_id__volatile;
+}
+
+static void
+maman_baz_real_do_action (MamanIbaz* base)
+{
+       MamanBaz * self;
+       FILE* _tmp0_;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, MAMAN_TYPE_BAZ, MamanBaz);
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, " 2");
+}
+
+static void
+maman_baz_real_do_virtual_action (MamanBaz* self)
+{
+       FILE* _tmp0_;
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, " 4");
+}
+
+void
+maman_baz_do_virtual_action (MamanBaz* self)
+{
+       MamanBazClass* _klass_;
+       g_return_if_fail (MAMAN_IS_BAZ (self));
+       _klass_ = MAMAN_BAZ_GET_CLASS (self);
+       if (_klass_->do_virtual_action) {
+               _klass_->do_virtual_action (self);
+       }
+}
+
+void
+maman_baz_do_mixin (MamanBaz* self)
+{
+       g_return_if_fail (MAMAN_IS_BAZ (self));
+       maman_ibaz_public_mixin (G_TYPE_CHECK_INSTANCE_CAST (self, MAMAN_TYPE_IBAZ, MamanIbaz));
+}
+
+MamanBaz*
+maman_baz_construct (GType object_type)
+{
+       MamanBaz * self = NULL;
+       self = (MamanBaz*) g_object_new (object_type, NULL);
+       return self;
+}
+
+MamanBaz*
+maman_baz_new (void)
+{
+       return maman_baz_construct (MAMAN_TYPE_BAZ);
+}
+
+static void
+maman_baz_class_init (MamanBazClass * klass,
+                      gpointer klass_data)
+{
+       maman_baz_parent_class = g_type_class_peek_parent (klass);
+       ((MamanBazClass *) klass)->do_virtual_action = (void (*) (MamanBaz*)) 
maman_baz_real_do_virtual_action;
+}
+
+static void
+maman_baz_maman_ibaz_interface_init (MamanIbazIface * iface,
+                                     gpointer iface_data)
+{
+       maman_baz_maman_ibaz_parent_iface = g_type_interface_peek_parent (iface);
+       iface->do_action = (void (*) (MamanIbaz*)) maman_baz_real_do_action;
+       iface->do_virtual_action = (void (*) (MamanIbaz*)) maman_baz_do_virtual_action;
+}
+
+static void
+maman_baz_instance_init (MamanBaz * self,
+                         gpointer klass)
+{
+}
+
+static GType
+maman_baz_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (MamanBazClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_baz_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(MamanBaz), 0, (GInstanceInitFunc) maman_baz_instance_init, NULL };
+       static const GInterfaceInfo maman_ibaz_info = { (GInterfaceInitFunc) 
maman_baz_maman_ibaz_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
+       GType maman_baz_type_id;
+       maman_baz_type_id = g_type_register_static (G_TYPE_OBJECT, "MamanBaz", &g_define_type_info, 0);
+       g_type_add_interface_static (maman_baz_type_id, MAMAN_TYPE_IBAZ, &maman_ibaz_info);
+       return maman_baz_type_id;
+}
+
+GType
+maman_baz_get_type (void)
+{
+       static volatile gsize maman_baz_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_baz_type_id__volatile)) {
+               GType maman_baz_type_id;
+               maman_baz_type_id = maman_baz_get_type_once ();
+               g_once_init_leave (&maman_baz_type_id__volatile, maman_baz_type_id);
+       }
+       return maman_baz_type_id__volatile;
+}
+
+static void
+maman_sub_baz_real_do_virtual_action (MamanBaz* base)
+{
+       MamanSubBaz * self;
+       FILE* _tmp0_;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, MAMAN_TYPE_SUB_BAZ, MamanSubBaz);
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, " 6");
+}
+
+gint
+maman_sub_baz_main_func (void)
+{
+       FILE* _tmp0_;
+       MamanIbaz* ibaz = NULL;
+       MamanBaz* _tmp1_;
+       FILE* _tmp2_;
+       FILE* _tmp3_;
+       MamanIbaz* subbaz = NULL;
+       MamanSubBaz* _tmp4_;
+       FILE* _tmp5_;
+       gint result = 0;
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, "Interface Test: 1");
+       _tmp1_ = maman_baz_new ();
+       ibaz = G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, MAMAN_TYPE_IBAZ, MamanIbaz);
+       maman_ibaz_do_action (ibaz);
+       maman_ibaz_public_mixin (ibaz);
+       maman_baz_do_mixin (MAMAN_IS_BAZ (ibaz) ? ((MamanBaz*) ibaz) : NULL);
+       _tmp2_ = stdout;
+       fprintf (_tmp2_, " 3");
+       maman_ibaz_do_virtual_action (ibaz);
+       _tmp3_ = stdout;
+       fprintf (_tmp3_, " 5");
+       _tmp4_ = maman_sub_baz_new ();
+       subbaz = G_TYPE_CHECK_INSTANCE_CAST (_tmp4_, MAMAN_TYPE_IBAZ, MamanIbaz);
+       maman_ibaz_do_virtual_action (subbaz);
+       _tmp5_ = stdout;
+       fprintf (_tmp5_, " 7\n");
+       maman_ibaz_public_mixin (subbaz);
+       maman_ibaz_public_mixin (G_TYPE_CHECK_INSTANCE_CAST (MAMAN_IS_BAZ (subbaz) ? ((MamanBaz*) subbaz) : 
NULL, MAMAN_TYPE_IBAZ, MamanIbaz));
+       result = 0;
+       _g_object_unref0 (subbaz);
+       _g_object_unref0 (ibaz);
+       return result;
+}
+
+MamanSubBaz*
+maman_sub_baz_construct (GType object_type)
+{
+       MamanSubBaz * self = NULL;
+       self = (MamanSubBaz*) maman_baz_construct (object_type);
+       return self;
+}
+
+MamanSubBaz*
+maman_sub_baz_new (void)
+{
+       return maman_sub_baz_construct (MAMAN_TYPE_SUB_BAZ);
+}
+
+static void
+maman_sub_baz_class_init (MamanSubBazClass * klass,
+                          gpointer klass_data)
+{
+       maman_sub_baz_parent_class = g_type_class_peek_parent (klass);
+       ((MamanBazClass *) klass)->do_virtual_action = (void (*) (MamanBaz*)) 
maman_sub_baz_real_do_virtual_action;
+}
+
+static void
+maman_sub_baz_instance_init (MamanSubBaz * self,
+                             gpointer klass)
+{
+}
+
+static GType
+maman_sub_baz_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (MamanSubBazClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_sub_baz_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(MamanSubBaz), 0, (GInstanceInitFunc) maman_sub_baz_instance_init, NULL };
+       GType maman_sub_baz_type_id;
+       maman_sub_baz_type_id = g_type_register_static (MAMAN_TYPE_BAZ, "MamanSubBaz", &g_define_type_info, 
0);
+       return maman_sub_baz_type_id;
+}
+
+GType
+maman_sub_baz_get_type (void)
+{
+       static volatile gsize maman_sub_baz_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_sub_baz_type_id__volatile)) {
+               GType maman_sub_baz_type_id;
+               maman_sub_baz_type_id = maman_sub_baz_get_type_once ();
+               g_once_init_leave (&maman_sub_baz_type_id__volatile, maman_sub_baz_type_id);
+       }
+       return maman_sub_baz_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       maman_sub_baz_main_func ();
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/member-initializer-base-properties.c-expected 
b/tests/objects/member-initializer-base-properties.c-expected
new file mode 100644
index 000000000..78d89f198
--- /dev/null
+++ b/tests/objects/member-initializer-base-properties.c-expected
@@ -0,0 +1,612 @@
+/* objects_member_initializer_base_properties.c generated by valac, the Vala compiler
+ * generated from objects_member_initializer_base_properties.vala, do not modify */
+
+#include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_IFOO (ifoo_get_type ())
+#define IFOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IFOO, IFoo))
+#define IS_IFOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IFOO))
+#define IFOO_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_IFOO, IFooIface))
+
+typedef struct _IFoo IFoo;
+typedef struct _IFooIface IFooIface;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+#define _g_free0(var) (var = (g_free (var), NULL))
+typedef struct _ParamSpecBar ParamSpecBar;
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+#define _bar_unref0(var) ((var == NULL) ? NULL : (var = (bar_unref (var), NULL)))
+
+struct _IFooIface {
+       GTypeInterface parent_iface;
+       const gchar* (*get_prop) (IFoo* self);
+       void (*set_prop) (IFoo* self, const gchar* value);
+};
+
+struct _Bar {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       GTypeClass parent_class;
+       void (*finalize) (Bar *self);
+       const gchar* (*get_prop_v) (Bar* self);
+       void (*set_prop_v) (Bar* self, const gchar* value);
+};
+
+struct _BarPrivate {
+       gchar* _prop_v;
+};
+
+struct _ParamSpecBar {
+       GParamSpec parent_instance;
+};
+
+struct _Foo {
+       Bar parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       BarClass parent_class;
+};
+
+struct _FooPrivate {
+       gchar* _prop;
+       gchar* _prop_v;
+};
+
+static gint Bar_private_offset;
+static gpointer bar_parent_class = NULL;
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+static IFooIface * foo_ifoo_parent_iface = NULL;
+
+VALA_EXTERN GType ifoo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN const gchar* ifoo_get_prop (IFoo* self);
+VALA_EXTERN void ifoo_set_prop (IFoo* self,
+                    const gchar* value);
+static GType ifoo_get_type_once (void);
+VALA_EXTERN gpointer bar_ref (gpointer instance);
+VALA_EXTERN void bar_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_bar (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_bar (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_bar (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_bar (const GValue* value);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, bar_unref)
+VALA_EXTERN const gchar* bar_get_prop_v (Bar* self);
+VALA_EXTERN void bar_set_prop_v (Bar* self,
+                     const gchar* value);
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static void bar_finalize (Bar * obj);
+static GType bar_get_type_once (void);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, bar_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Bar * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+const gchar*
+ifoo_get_prop (IFoo* self)
+{
+       IFooIface* _iface_;
+       g_return_val_if_fail (IS_IFOO (self), NULL);
+       _iface_ = IFOO_GET_INTERFACE (self);
+       if (_iface_->get_prop) {
+               return _iface_->get_prop (self);
+       }
+       return NULL;
+}
+
+void
+ifoo_set_prop (IFoo* self,
+               const gchar* value)
+{
+       IFooIface* _iface_;
+       g_return_if_fail (IS_IFOO (self));
+       _iface_ = IFOO_GET_INTERFACE (self);
+       if (_iface_->set_prop) {
+               _iface_->set_prop (self, value);
+       }
+}
+
+static void
+ifoo_default_init (IFooIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+ifoo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (IFooIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) ifoo_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType ifoo_type_id;
+       ifoo_type_id = g_type_register_static (G_TYPE_INTERFACE, "IFoo", &g_define_type_info, 0);
+       return ifoo_type_id;
+}
+
+GType
+ifoo_get_type (void)
+{
+       static volatile gsize ifoo_type_id__volatile = 0;
+       if (g_once_init_enter (&ifoo_type_id__volatile)) {
+               GType ifoo_type_id;
+               ifoo_type_id = ifoo_get_type_once ();
+               g_once_init_leave (&ifoo_type_id__volatile, ifoo_type_id);
+       }
+       return ifoo_type_id__volatile;
+}
+
+static inline gpointer
+bar_get_instance_private (Bar* self)
+{
+       return G_STRUCT_MEMBER_P (self, Bar_private_offset);
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar* self = NULL;
+       self = (Bar*) g_type_create_instance (object_type);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+const gchar*
+bar_get_prop_v (Bar* self)
+{
+       BarClass* _klass_;
+       g_return_val_if_fail (IS_BAR (self), NULL);
+       _klass_ = BAR_GET_CLASS (self);
+       if (_klass_->get_prop_v) {
+               return _klass_->get_prop_v (self);
+       }
+       return NULL;
+}
+
+static const gchar*
+bar_real_get_prop_v (Bar* base)
+{
+       const gchar* result;
+       Bar* self;
+       const gchar* _tmp0_;
+       self = base;
+       _tmp0_ = self->priv->_prop_v;
+       result = _tmp0_;
+       return result;
+}
+
+void
+bar_set_prop_v (Bar* self,
+                const gchar* value)
+{
+       BarClass* _klass_;
+       g_return_if_fail (IS_BAR (self));
+       _klass_ = BAR_GET_CLASS (self);
+       if (_klass_->set_prop_v) {
+               _klass_->set_prop_v (self, value);
+       }
+}
+
+static void
+bar_real_set_prop_v (Bar* base,
+                     const gchar* value)
+{
+       Bar* self;
+       gchar* _tmp0_;
+       self = base;
+       _tmp0_ = g_strdup (value);
+       _g_free0 (self->priv->_prop_v);
+       self->priv->_prop_v = _tmp0_;
+}
+
+static void
+value_bar_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_bar_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               bar_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_bar_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = bar_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_bar_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_bar_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Bar * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = bar_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_bar_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Bar ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = bar_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_bar (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecBar* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_BAR), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_bar (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_bar (GValue* value,
+               gpointer v_object)
+{
+       Bar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               bar_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_unref (old);
+       }
+}
+
+void
+value_take_bar (GValue* value,
+                gpointer v_object)
+{
+       Bar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_unref (old);
+       }
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       ((BarClass *) klass)->finalize = bar_finalize;
+       g_type_class_adjust_private_offset (klass, &Bar_private_offset);
+       BAR_CLASS (klass)->get_prop_v = bar_real_get_prop_v;
+       BAR_CLASS (klass)->set_prop_v = bar_real_set_prop_v;
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+       self->priv = bar_get_instance_private (self);
+       self->ref_count = 1;
+}
+
+static void
+bar_finalize (Bar * obj)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       g_signal_handlers_destroy (self);
+       _g_free0 (self->priv->_prop_v);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_bar_init, value_bar_free_value, 
value_bar_copy_value, value_bar_peek_pointer, "p", value_bar_collect_value, "p", value_bar_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType bar_type_id;
+       bar_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Bar", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       Bar_private_offset = g_type_add_instance_private (bar_type_id, sizeof (BarPrivate));
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+gpointer
+bar_ref (gpointer instance)
+{
+       Bar * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+bar_unref (gpointer instance)
+{
+       Bar * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               BAR_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) bar_construct (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static const gchar*
+foo_real_get_prop (IFoo* base)
+{
+       const gchar* result;
+       Foo* self;
+       const gchar* _tmp0_;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_FOO, Foo);
+       _tmp0_ = self->priv->_prop;
+       result = _tmp0_;
+       return result;
+}
+
+static void
+foo_real_set_prop (IFoo* base,
+                   const gchar* value)
+{
+       Foo* self;
+       gchar* _tmp0_;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_FOO, Foo);
+       _tmp0_ = g_strdup (value);
+       _g_free0 (self->priv->_prop);
+       self->priv->_prop = _tmp0_;
+}
+
+static const gchar*
+foo_real_get_prop_v (Bar* base)
+{
+       const gchar* result;
+       Foo* self;
+       const gchar* _tmp0_;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_FOO, Foo);
+       _tmp0_ = self->priv->_prop_v;
+       result = _tmp0_;
+       return result;
+}
+
+static void
+foo_real_set_prop_v (Bar* base,
+                     const gchar* value)
+{
+       Foo* self;
+       gchar* _tmp0_;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_FOO, Foo);
+       _tmp0_ = g_strdup (value);
+       _g_free0 (self->priv->_prop_v);
+       self->priv->_prop_v = _tmp0_;
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((BarClass *) klass)->finalize = foo_finalize;
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+       BAR_CLASS (klass)->get_prop_v = foo_real_get_prop_v;
+       BAR_CLASS (klass)->set_prop_v = foo_real_set_prop_v;
+}
+
+static void
+foo_ifoo_interface_init (IFooIface * iface,
+                         gpointer iface_data)
+{
+       foo_ifoo_parent_iface = g_type_interface_peek_parent (iface);
+       iface->get_prop = foo_real_get_prop;
+       iface->set_prop = foo_real_set_prop;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+}
+
+static void
+foo_finalize (Bar * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       _g_free0 (self->priv->_prop);
+       _g_free0 (self->priv->_prop_v);
+       BAR_CLASS (foo_parent_class)->finalize (obj);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       static const GInterfaceInfo ifoo_info = { (GInterfaceInitFunc) foo_ifoo_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (TYPE_BAR, "Foo", &g_define_type_info, 0);
+       g_type_add_interface_static (foo_type_id, TYPE_IFOO, &ifoo_info);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       gchar* _tmp0_;
+       gchar* _tmp1_;
+       Foo* _tmp2_ = NULL;
+       _tmp0_ = g_strdup ("bar");
+       _tmp1_ = g_strdup ("bar");
+       _tmp2_ = foo_new ();
+       ifoo_set_prop (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, TYPE_IFOO, IFoo), _tmp0_);
+       _g_free0 (_tmp0_);
+       bar_set_prop_v (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, TYPE_BAR, Bar), _tmp1_);
+       _g_free0 (_tmp1_);
+       foo = _tmp2_;
+       _bar_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/member-initializer-chained-2.c-expected 
b/tests/objects/member-initializer-chained-2.c-expected
new file mode 100644
index 000000000..4edfc82ba
--- /dev/null
+++ b/tests/objects/member-initializer-chained-2.c-expected
@@ -0,0 +1,467 @@
+/* objects_member_initializer_chained_2.c generated by valac, the Vala compiler
+ * generated from objects_member_initializer_chained_2.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+typedef struct _ParamSpecBar ParamSpecBar;
+#define _bar_unref0(var) ((var == NULL) ? NULL : (var = (bar_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _Bar {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       BarPrivate * priv;
+       Foo* a;
+       Foo* c;
+};
+
+struct _BarClass {
+       GTypeClass parent_class;
+       void (*finalize) (Bar *self);
+};
+
+struct _BarPrivate {
+       Foo* _b;
+};
+
+struct _ParamSpecBar {
+       GParamSpec parent_instance;
+};
+
+static gpointer foo_parent_class = NULL;
+static gint Bar_private_offset;
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static GType foo_get_type_once (void);
+VALA_EXTERN gpointer bar_ref (gpointer instance);
+VALA_EXTERN void bar_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_bar (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_bar (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_bar (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_bar (const GValue* value);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, bar_unref)
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+VALA_EXTERN Foo* bar_get_b (Bar* self);
+VALA_EXTERN void bar_set_b (Bar* self,
+                Foo* value);
+static void bar_finalize (Bar * obj);
+static GType bar_get_type_once (void);
+static void _vala_main (void);
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static inline gpointer
+bar_get_instance_private (Bar* self)
+{
+       return G_STRUCT_MEMBER_P (self, Bar_private_offset);
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar* self = NULL;
+       self = (Bar*) g_type_create_instance (object_type);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+Foo*
+bar_get_b (Bar* self)
+{
+       Foo* result;
+       Foo* _tmp0_;
+       g_return_val_if_fail (IS_BAR (self), NULL);
+       _tmp0_ = self->priv->_b;
+       result = _tmp0_;
+       return result;
+}
+
+static gpointer
+_g_object_ref0 (gpointer self)
+{
+       return self ? g_object_ref (self) : NULL;
+}
+
+void
+bar_set_b (Bar* self,
+           Foo* value)
+{
+       Foo* _tmp0_;
+       g_return_if_fail (IS_BAR (self));
+       _tmp0_ = _g_object_ref0 (value);
+       _g_object_unref0 (self->priv->_b);
+       self->priv->_b = _tmp0_;
+}
+
+static void
+value_bar_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_bar_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               bar_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_bar_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = bar_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_bar_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_bar_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Bar * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = bar_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_bar_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Bar ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = bar_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_bar (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecBar* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_BAR), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_bar (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_bar (GValue* value,
+               gpointer v_object)
+{
+       Bar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               bar_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_unref (old);
+       }
+}
+
+void
+value_take_bar (GValue* value,
+                gpointer v_object)
+{
+       Bar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_unref (old);
+       }
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       ((BarClass *) klass)->finalize = bar_finalize;
+       g_type_class_adjust_private_offset (klass, &Bar_private_offset);
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+       self->priv = bar_get_instance_private (self);
+       self->ref_count = 1;
+}
+
+static void
+bar_finalize (Bar * obj)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       g_signal_handlers_destroy (self);
+       _g_object_unref0 (self->a);
+       _g_object_unref0 (self->priv->_b);
+       _g_object_unref0 (self->c);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_bar_init, value_bar_free_value, 
value_bar_copy_value, value_bar_peek_pointer, "p", value_bar_collect_value, "p", value_bar_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType bar_type_id;
+       bar_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Bar", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       Bar_private_offset = g_type_add_instance_private (bar_type_id, sizeof (BarPrivate));
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+gpointer
+bar_ref (gpointer instance)
+{
+       Bar * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+bar_unref (gpointer instance)
+{
+       Bar * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               BAR_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Foo* _tmp0_ = NULL;
+       Foo* _tmp1_;
+       Bar* bar = NULL;
+       Foo* _tmp2_;
+       Foo* _tmp3_;
+       Foo* _tmp4_;
+       Bar* _tmp5_ = NULL;
+       Foo* _tmp6_;
+       Foo* _tmp7_;
+       Foo* _tmp8_;
+       Foo* _tmp9_;
+       Foo* _tmp10_;
+       Foo* _tmp11_;
+       Foo* _tmp12_;
+       _tmp1_ = foo_new ();
+       _tmp0_ = _tmp1_;
+       _tmp2_ = _g_object_ref0 (_tmp0_);
+       _tmp3_ = _g_object_ref0 (_tmp0_);
+       _tmp4_ = _g_object_ref0 (_tmp0_);
+       _tmp5_ = bar_new ();
+       _g_object_unref0 (_tmp5_->c);
+       _tmp5_->c = _tmp2_;
+       bar_set_b (_tmp5_, _tmp3_);
+       _g_object_unref0 (_tmp3_);
+       _g_object_unref0 (_tmp5_->a);
+       _tmp5_->a = _tmp4_;
+       bar = _tmp5_;
+       _tmp6_ = bar->a;
+       _vala_assert (_tmp6_ != NULL, "bar.a != null");
+       _tmp7_ = bar->a;
+       _tmp8_ = bar_get_b (bar);
+       _tmp9_ = _tmp8_;
+       _vala_assert (_tmp7_ == _tmp9_, "bar.a == bar.b");
+       _tmp10_ = bar->a;
+       _tmp11_ = bar->c;
+       _vala_assert (_tmp10_ == _tmp11_, "bar.a == bar.c");
+       _tmp12_ = bar->a;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp12_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 4), 
"bar.a.ref_count == 4");
+       _bar_unref0 (bar);
+       _g_object_unref0 (_tmp0_);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/member-initializer-chained.c-expected 
b/tests/objects/member-initializer-chained.c-expected
new file mode 100644
index 000000000..c4cb0f9dd
--- /dev/null
+++ b/tests/objects/member-initializer-chained.c-expected
@@ -0,0 +1,511 @@
+/* objects_member_initializer_chained.c generated by valac, the Vala compiler
+ * generated from objects_member_initializer_chained.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+       gint x;
+       gint z;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _FooPrivate {
+       gint _y;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+struct _Bar {
+       Foo parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       FooClass parent_class;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+static gpointer bar_parent_class = NULL;
+VALA_EXTERN gint i;
+gint i = 67;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+VALA_EXTERN gint foo_get_y (Foo* self);
+VALA_EXTERN void foo_set_y (Foo* self,
+                gint value);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, foo_unref)
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static GType bar_get_type_once (void);
+VALA_EXTERN gint get_int (void);
+static void _vala_main (void);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+gint
+foo_get_y (Foo* self)
+{
+       gint result;
+       g_return_val_if_fail (IS_FOO (self), 0);
+       result = self->priv->_y;
+       return result;
+}
+
+void
+foo_set_y (Foo* self,
+           gint value)
+{
+       g_return_if_fail (IS_FOO (self));
+       self->priv->_y = value;
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar* self = NULL;
+       gint _tmp11_;
+       gint _tmp12_;
+       self = (Bar*) foo_construct (object_type);
+       G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_FOO, Foo)->x = 4711;
+       foo_set_y (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_FOO, Foo), 4711);
+       G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_FOO, Foo)->z = 4711;
+       {
+               gint _tmp0_ = 0;
+               Foo* foo = NULL;
+               Foo* _tmp1_ = NULL;
+               gint _tmp2_;
+               gint _tmp3_;
+               gint _tmp4_;
+               gint _tmp5_;
+               _tmp0_ = 23;
+               _tmp1_ = foo_new ();
+               _tmp1_->z = _tmp0_;
+               foo_set_y (_tmp1_, _tmp0_);
+               _tmp1_->x = _tmp0_;
+               foo = _tmp1_;
+               _vala_assert (foo->x == 23, "foo.x == 23");
+               _tmp2_ = foo_get_y (foo);
+               _tmp3_ = _tmp2_;
+               _vala_assert (_tmp3_ == 23, "foo.y == 23");
+               _tmp4_ = foo_get_y (foo);
+               _tmp5_ = _tmp4_;
+               _vala_assert (_tmp5_ == 23, "foo.y == 23");
+               _foo_unref0 (foo);
+       }
+       {
+               Foo* foo2 = NULL;
+               gint _tmp6_;
+               gint _tmp7_;
+               Foo* _tmp8_ = NULL;
+               gint _tmp9_;
+               gint _tmp10_;
+               _tmp6_ = foo_get_y (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_FOO, Foo));
+               _tmp7_ = _tmp6_;
+               _tmp8_ = foo_new ();
+               _tmp8_->z = 42;
+               foo_set_y (_tmp8_, G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_FOO, Foo)->z);
+               _tmp8_->x = _tmp7_;
+               foo2 = _tmp8_;
+               _vala_assert (foo2->x == 4711, "foo2.x == 4711");
+               _tmp9_ = foo_get_y (foo2);
+               _tmp10_ = _tmp9_;
+               _vala_assert (_tmp10_ == 4711, "foo2.y == 4711");
+               _vala_assert (foo2->z == 42, "foo2.z == 42");
+               _foo_unref0 (foo2);
+       }
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_FOO, Foo)->x == 4711, "x == 4711");
+       _tmp11_ = foo_get_y (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_FOO, Foo));
+       _tmp12_ = _tmp11_;
+       _vala_assert (_tmp12_ == 4711, "y == 4711");
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_FOO, Foo)->z == 4711, "z == 4711");
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (TYPE_FOO, "Bar", &g_define_type_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+gint
+get_int (void)
+{
+       gint _tmp0_;
+       gint result = 0;
+       _tmp0_ = i;
+       i = _tmp0_ + 1;
+       result = _tmp0_;
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       {
+               gint _tmp0_ = 0;
+               Bar* bar = NULL;
+               Bar* _tmp1_ = NULL;
+               gint _tmp2_;
+               gint _tmp3_;
+               _tmp0_ = get_int ();
+               _tmp1_ = bar_new ();
+               G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, TYPE_FOO, Foo)->z = _tmp0_;
+               foo_set_y (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, TYPE_FOO, Foo), _tmp0_);
+               G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, TYPE_FOO, Foo)->x = _tmp0_;
+               bar = _tmp1_;
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (bar, TYPE_FOO, Foo)->x == 67, "bar.x == 67");
+               _tmp2_ = foo_get_y (G_TYPE_CHECK_INSTANCE_CAST (bar, TYPE_FOO, Foo));
+               _tmp3_ = _tmp2_;
+               _vala_assert (_tmp3_ == 67, "bar.y == 67");
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (bar, TYPE_FOO, Foo)->z == 67, "bar.z == 67");
+               _foo_unref0 (bar);
+       }
+       {
+               Bar* bar = NULL;
+               Bar* _tmp4_ = NULL;
+               gint _tmp5_;
+               gint _tmp6_;
+               _tmp4_ = bar_new ();
+               G_TYPE_CHECK_INSTANCE_CAST (_tmp4_, TYPE_FOO, Foo)->x = 23;
+               foo_set_y (G_TYPE_CHECK_INSTANCE_CAST (_tmp4_, TYPE_FOO, Foo), 42);
+               G_TYPE_CHECK_INSTANCE_CAST (_tmp4_, TYPE_FOO, Foo)->z = 67;
+               bar = _tmp4_;
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (bar, TYPE_FOO, Foo)->x == 23, "bar.x == 23");
+               _tmp5_ = foo_get_y (G_TYPE_CHECK_INSTANCE_CAST (bar, TYPE_FOO, Foo));
+               _tmp6_ = _tmp5_;
+               _vala_assert (_tmp6_ == 42, "bar.y == 42");
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (bar, TYPE_FOO, Foo)->z == 67, "bar.z == 67");
+               _foo_unref0 (bar);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/member-initializer-property-owned-setter.c-expected 
b/tests/objects/member-initializer-property-owned-setter.c-expected
new file mode 100644
index 000000000..4e92d709c
--- /dev/null
+++ b/tests/objects/member-initializer-property-owned-setter.c-expected
@@ -0,0 +1,482 @@
+/* objects_member_initializer_property_owned_setter.c generated by valac, the Vala compiler
+ * generated from objects_member_initializer_property_owned_setter.vala, do not modify */
+
+#include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+enum  {
+       BAR_0_PROPERTY,
+       BAR_NUM_PROPERTIES
+};
+static GParamSpec* bar_properties[BAR_NUM_PROPERTIES];
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_FAZ_PROPERTY,
+       FOO_BAR_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Bar {
+       GObject parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       GObjectClass parent_class;
+};
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _FooPrivate {
+       gchar** _faz;
+       gint _faz_length1;
+       gint __faz_size_;
+       Bar* _bar;
+};
+
+static gpointer bar_parent_class = NULL;
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static GType bar_get_type_once (void);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+VALA_EXTERN gchar** foo_get_faz (Foo* self,
+                     gint* result_length1);
+VALA_EXTERN void foo_set_faz (Foo* self,
+                  gchar** value,
+                  gint value_length1);
+VALA_EXTERN Bar* foo_get_bar (Foo* self);
+VALA_EXTERN void foo_set_bar (Foo* self,
+                  Bar* value);
+static void foo_finalize (GObject * obj);
+static GType foo_get_type_once (void);
+static void _vala_foo_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_foo_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec);
+static void _vala_main (void);
+static gchar** _vala_array_dup1 (gchar** self,
+                          gssize length);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar * self = NULL;
+       self = (Bar*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (G_TYPE_OBJECT, "Bar", &g_define_type_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+gchar**
+foo_get_faz (Foo* self,
+             gint* result_length1)
+{
+       gchar** result;
+       gchar** _tmp0_;
+       gint _tmp0__length1;
+       gchar** _tmp1_;
+       gint _tmp1__length1;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = self->priv->_faz;
+       _tmp0__length1 = self->priv->_faz_length1;
+       _tmp1_ = _tmp0_;
+       _tmp1__length1 = _tmp0__length1;
+       if (result_length1) {
+               *result_length1 = _tmp1__length1;
+       }
+       result = _tmp1_;
+       return result;
+}
+
+void
+foo_set_faz (Foo* self,
+             gchar** value,
+             gint value_length1)
+{
+       gchar** old_value;
+       gint old_value_length;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_faz (self, &old_value_length);
+       if (old_value != value) {
+               gchar** _tmp0_;
+               gint _tmp0__length1;
+               _tmp0_ = value;
+               _tmp0__length1 = value_length1;
+               value = NULL;
+               value_length1 = 0;
+               self->priv->_faz = (_vala_array_free (self->priv->_faz, self->priv->_faz_length1, 
(GDestroyNotify) g_free), NULL);
+               self->priv->_faz = _tmp0_;
+               self->priv->_faz_length1 = _tmp0__length1;
+               self->priv->__faz_size_ = self->priv->_faz_length1;
+               value = (_vala_array_free (value, value_length1, (GDestroyNotify) g_free), NULL);
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_FAZ_PROPERTY]);
+       }
+}
+
+Bar*
+foo_get_bar (Foo* self)
+{
+       Bar* result;
+       Bar* _tmp0_;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = self->priv->_bar;
+       result = _tmp0_;
+       return result;
+}
+
+void
+foo_set_bar (Foo* self,
+             Bar* value)
+{
+       Bar* old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_bar (self);
+       if (old_value != value) {
+               Bar* _tmp0_;
+               _tmp0_ = value;
+               value = NULL;
+               _g_object_unref0 (self->priv->_bar);
+               self->priv->_bar = _tmp0_;
+               _g_object_unref0 (value);
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_BAR_PROPERTY]);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_foo_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_foo_set_property;
+       G_OBJECT_CLASS (klass)->finalize = foo_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_FAZ_PROPERTY, 
foo_properties[FOO_FAZ_PROPERTY] = g_param_spec_boxed ("faz", "faz", "faz", G_TYPE_STRV, 
G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_BAR_PROPERTY, 
foo_properties[FOO_BAR_PROPERTY] = g_param_spec_object ("bar", "bar", "bar", TYPE_BAR, G_PARAM_STATIC_STRINGS 
| G_PARAM_READABLE | G_PARAM_WRITABLE));
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+}
+
+static void
+foo_finalize (GObject * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       self->priv->_faz = (_vala_array_free (self->priv->_faz, self->priv->_faz_length1, (GDestroyNotify) 
g_free), NULL);
+       _g_object_unref0 (self->priv->_bar);
+       G_OBJECT_CLASS (foo_parent_class)->finalize (obj);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_foo_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_FAZ_PROPERTY:
+               {
+                       int length;
+                       g_value_set_boxed (value, foo_get_faz (self, &length));
+               }
+               break;
+               case FOO_BAR_PROPERTY:
+               g_value_set_object (value, foo_get_bar (self));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_foo_set_property (GObject * object,
+                        guint property_id,
+                        const GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_FAZ_PROPERTY:
+               {
+                       gpointer boxed;
+                       boxed = g_value_get_boxed (value);
+                       foo_set_faz (self, boxed, (boxed == NULL) ? 0 : g_strv_length (boxed));
+               }
+               break;
+               case FOO_BAR_PROPERTY:
+               foo_set_bar (self, g_value_get_object (value));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static gchar**
+_vala_array_dup1 (gchar** self,
+                  gssize length)
+{
+       if (length >= 0) {
+               gchar** result;
+               gssize i;
+               result = g_new0 (gchar*, length + 1);
+               for (i = 0; i < length; i++) {
+                       gchar* _tmp0_;
+                       _tmp0_ = g_strdup (self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+static gpointer
+_g_object_ref0 (gpointer self)
+{
+       return self ? g_object_ref (self) : NULL;
+}
+
+static void
+_vala_main (void)
+{
+       gchar** sa = NULL;
+       gchar* _tmp0_;
+       gchar* _tmp1_;
+       gchar** _tmp2_;
+       gint sa_length1;
+       gint _sa_size_;
+       Bar* o = NULL;
+       Bar* _tmp3_;
+       Foo* foo = NULL;
+       gchar** _tmp4_;
+       gint _tmp4__length1;
+       Bar* _tmp5_;
+       Foo* _tmp6_ = NULL;
+       gchar** _tmp7_;
+       gint _tmp7__length1;
+       gint _tmp8_ = 0;
+       gchar** _tmp9_;
+       gint _tmp9__length1;
+       const gchar* _tmp10_;
+       Bar* _tmp11_;
+       Bar* _tmp12_;
+       const gchar* _tmp13_;
+       _tmp0_ = g_strdup ("foo");
+       _tmp1_ = g_strdup ("bar");
+       _tmp2_ = g_new0 (gchar*, 2 + 1);
+       _tmp2_[0] = _tmp0_;
+       _tmp2_[1] = _tmp1_;
+       sa = _tmp2_;
+       sa_length1 = 2;
+       _sa_size_ = sa_length1;
+       _tmp3_ = bar_new ();
+       o = _tmp3_;
+       _tmp4_ = (sa != NULL) ? _vala_array_dup1 (sa, sa_length1) : sa;
+       _tmp4__length1 = sa_length1;
+       _tmp5_ = _g_object_ref0 (o);
+       _tmp6_ = foo_new ();
+       foo_set_faz (_tmp6_, _tmp4_, _tmp4__length1);
+       foo_set_bar (_tmp6_, _tmp5_);
+       foo = _tmp6_;
+       _tmp7_ = foo_get_faz (foo, &_tmp8_);
+       _tmp7__length1 = _tmp8_;
+       _tmp9_ = _tmp7_;
+       _tmp9__length1 = _tmp7__length1;
+       _tmp10_ = _tmp9_[1];
+       _vala_assert (g_strcmp0 (_tmp10_, "bar") == 0, "foo.faz[1] == \"bar\"");
+       _tmp11_ = foo_get_bar (foo);
+       _tmp12_ = _tmp11_;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp12_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 2), 
"foo.bar.ref_count == 2");
+       _tmp13_ = sa[0];
+       _vala_assert (g_strcmp0 (_tmp13_, "foo") == 0, "sa[0] == \"foo\"");
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (o, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 2), 
"o.ref_count == 2");
+       _g_object_unref0 (foo);
+       _g_object_unref0 (o);
+       sa = (_vala_array_free (sa, sa_length1, (GDestroyNotify) g_free), NULL);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/objects/member-initializer-property.c-expected 
b/tests/objects/member-initializer-property.c-expected
new file mode 100644
index 000000000..c8ced0af6
--- /dev/null
+++ b/tests/objects/member-initializer-property.c-expected
@@ -0,0 +1,682 @@
+/* objects_member_initializer_property.c generated by valac, the Vala compiler
+ * generated from objects_member_initializer_property.vala, do not modify */
+
+#include <glib-object.h>
+#include <gobject/gvaluecollector.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_BAZ (baz_get_type ())
+#define BAZ(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAZ, Baz))
+#define BAZ_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAZ, BazClass))
+#define IS_BAZ(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAZ))
+#define IS_BAZ_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAZ))
+#define BAZ_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAZ, BazClass))
+
+typedef struct _Baz Baz;
+typedef struct _BazClass BazClass;
+typedef struct _BazPrivate BazPrivate;
+typedef struct _ParamSpecBaz ParamSpecBaz;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+#define _baz_unref0(var) ((var == NULL) ? NULL : (var = (baz_unref (var), NULL)))
+typedef struct _ParamSpecFoo ParamSpecFoo;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+
+struct _Baz {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       BazPrivate * priv;
+};
+
+struct _BazClass {
+       GTypeClass parent_class;
+       void (*finalize) (Baz *self);
+};
+
+struct _ParamSpecBaz {
+       GParamSpec parent_instance;
+};
+
+struct _Bar {
+       Baz parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       BazClass parent_class;
+};
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _FooPrivate {
+       Baz* _baz;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gpointer baz_parent_class = NULL;
+static gpointer bar_parent_class = NULL;
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer baz_ref (gpointer instance);
+VALA_EXTERN void baz_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_baz (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_baz (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_baz (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_baz (const GValue* value);
+VALA_EXTERN GType baz_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Baz, baz_unref)
+VALA_EXTERN Baz* baz_new (void);
+VALA_EXTERN Baz* baz_construct (GType object_type);
+static void baz_finalize (Baz * obj);
+static GType baz_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, baz_unref)
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static GType bar_get_type_once (void);
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+VALA_EXTERN Baz* foo_get_baz (Foo* self);
+VALA_EXTERN void foo_set_baz (Foo* self,
+                  Baz* value);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+Baz*
+baz_construct (GType object_type)
+{
+       Baz* self = NULL;
+       self = (Baz*) g_type_create_instance (object_type);
+       return self;
+}
+
+Baz*
+baz_new (void)
+{
+       return baz_construct (TYPE_BAZ);
+}
+
+static void
+value_baz_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_baz_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               baz_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_baz_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = baz_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_baz_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_baz_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Baz * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = baz_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_baz_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Baz ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = baz_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_baz (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecBaz* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_BAZ), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_baz (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAZ), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_baz (GValue* value,
+               gpointer v_object)
+{
+       Baz * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAZ));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAZ));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               baz_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               baz_unref (old);
+       }
+}
+
+void
+value_take_baz (GValue* value,
+                gpointer v_object)
+{
+       Baz * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAZ));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAZ));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               baz_unref (old);
+       }
+}
+
+static void
+baz_class_init (BazClass * klass,
+                gpointer klass_data)
+{
+       baz_parent_class = g_type_class_peek_parent (klass);
+       ((BazClass *) klass)->finalize = baz_finalize;
+}
+
+static void
+baz_instance_init (Baz * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+baz_finalize (Baz * obj)
+{
+       Baz * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAZ, Baz);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+baz_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_baz_init, value_baz_free_value, 
value_baz_copy_value, value_baz_peek_pointer, "p", value_baz_collect_value, "p", value_baz_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (BazClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) baz_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Baz), 0, 
(GInstanceInitFunc) baz_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType baz_type_id;
+       baz_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Baz", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return baz_type_id;
+}
+
+GType
+baz_get_type (void)
+{
+       static volatile gsize baz_type_id__volatile = 0;
+       if (g_once_init_enter (&baz_type_id__volatile)) {
+               GType baz_type_id;
+               baz_type_id = baz_get_type_once ();
+               g_once_init_leave (&baz_type_id__volatile, baz_type_id);
+       }
+       return baz_type_id__volatile;
+}
+
+gpointer
+baz_ref (gpointer instance)
+{
+       Baz * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+baz_unref (gpointer instance)
+{
+       Baz * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               BAZ_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar* self = NULL;
+       self = (Bar*) baz_construct (object_type);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (TYPE_BAZ, "Bar", &g_define_type_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+Baz*
+foo_get_baz (Foo* self)
+{
+       Baz* result;
+       Baz* _tmp0_;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = self->priv->_baz;
+       result = _tmp0_;
+       return result;
+}
+
+static gpointer
+_baz_ref0 (gpointer self)
+{
+       return self ? baz_ref (self) : NULL;
+}
+
+void
+foo_set_baz (Foo* self,
+             Baz* value)
+{
+       Baz* _tmp0_;
+       g_return_if_fail (IS_FOO (self));
+       _tmp0_ = _baz_ref0 (value);
+       _baz_unref0 (self->priv->_baz);
+       self->priv->_baz = _tmp0_;
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+       _baz_unref0 (self->priv->_baz);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Bar* _tmp0_;
+       Foo* _tmp1_ = NULL;
+       _tmp0_ = bar_new ();
+       _tmp1_ = foo_new ();
+       foo_set_baz (_tmp1_, G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, TYPE_BAZ, Baz));
+       _baz_unref0 (_tmp0_);
+       foo = _tmp1_;
+       _foo_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/methods.c-expected b/tests/objects/methods.c-expected
new file mode 100644
index 000000000..121ad8979
--- /dev/null
+++ b/tests/objects/methods.c-expected
@@ -0,0 +1,1744 @@
+/* objects_methods.c generated by valac, the Vala compiler
+ * generated from objects_methods.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define MAMAN_TYPE_BAR (maman_bar_get_type ())
+#define MAMAN_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_BAR, MamanBar))
+#define MAMAN_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAMAN_TYPE_BAR, MamanBarClass))
+#define MAMAN_IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_BAR))
+#define MAMAN_IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAMAN_TYPE_BAR))
+#define MAMAN_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAMAN_TYPE_BAR, MamanBarClass))
+
+typedef struct _MamanBar MamanBar;
+typedef struct _MamanBarClass MamanBarClass;
+typedef struct _MamanBarPrivate MamanBarPrivate;
+enum  {
+       MAMAN_BAR_0_PROPERTY,
+       MAMAN_BAR_NUM_PROPERTIES
+};
+static GParamSpec* maman_bar_properties[MAMAN_BAR_NUM_PROPERTIES];
+
+#define MAMAN_TYPE_SUB_BAR (maman_sub_bar_get_type ())
+#define MAMAN_SUB_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_SUB_BAR, MamanSubBar))
+#define MAMAN_SUB_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAMAN_TYPE_SUB_BAR, MamanSubBarClass))
+#define MAMAN_IS_SUB_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_SUB_BAR))
+#define MAMAN_IS_SUB_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAMAN_TYPE_SUB_BAR))
+#define MAMAN_SUB_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAMAN_TYPE_SUB_BAR, 
MamanSubBarClass))
+
+typedef struct _MamanSubBar MamanSubBar;
+typedef struct _MamanSubBarClass MamanSubBarClass;
+typedef struct _MamanSubBarPrivate MamanSubBarPrivate;
+enum  {
+       MAMAN_SUB_BAR_0_PROPERTY,
+       MAMAN_SUB_BAR_NUM_PROPERTIES
+};
+static GParamSpec* maman_sub_bar_properties[MAMAN_SUB_BAR_NUM_PROPERTIES];
+#define _g_free0(var) (var = (g_free (var), NULL))
+
+#define MAMAN_TYPE_FOO_BAR (maman_foo_bar_get_type ())
+#define MAMAN_FOO_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_FOO_BAR, MamanFooBar))
+#define MAMAN_FOO_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAMAN_TYPE_FOO_BAR, MamanFooBarClass))
+#define MAMAN_IS_FOO_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_FOO_BAR))
+#define MAMAN_IS_FOO_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAMAN_TYPE_FOO_BAR))
+#define MAMAN_FOO_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAMAN_TYPE_FOO_BAR, 
MamanFooBarClass))
+
+typedef struct _MamanFooBar MamanFooBar;
+typedef struct _MamanFooBarClass MamanFooBarClass;
+
+#define MAMAN_TYPE_SUB_FOO_BAR (maman_sub_foo_bar_get_type ())
+#define MAMAN_SUB_FOO_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_SUB_FOO_BAR, MamanSubFooBar))
+#define MAMAN_SUB_FOO_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAMAN_TYPE_SUB_FOO_BAR, 
MamanSubFooBarClass))
+#define MAMAN_IS_SUB_FOO_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_SUB_FOO_BAR))
+#define MAMAN_IS_SUB_FOO_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAMAN_TYPE_SUB_FOO_BAR))
+#define MAMAN_SUB_FOO_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAMAN_TYPE_SUB_FOO_BAR, 
MamanSubFooBarClass))
+
+typedef struct _MamanSubFooBar MamanSubFooBar;
+typedef struct _MamanSubFooBarClass MamanSubFooBarClass;
+
+#define MAMAN_TYPE_FOO (maman_foo_get_type ())
+#define MAMAN_FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_FOO, MamanFoo))
+#define MAMAN_IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_FOO))
+#define MAMAN_FOO_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), MAMAN_TYPE_FOO, MamanFooIface))
+
+typedef struct _MamanFoo MamanFoo;
+typedef struct _MamanFooIface MamanFooIface;
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+typedef struct _MamanFooBarPrivate MamanFooBarPrivate;
+enum  {
+       MAMAN_FOO_BAR_0_PROPERTY,
+       MAMAN_FOO_BAR_NUM_PROPERTIES
+};
+static GParamSpec* maman_foo_bar_properties[MAMAN_FOO_BAR_NUM_PROPERTIES];
+typedef struct _MamanSubFooBarPrivate MamanSubFooBarPrivate;
+enum  {
+       MAMAN_SUB_FOO_BAR_0_PROPERTY,
+       MAMAN_SUB_FOO_BAR_NUM_PROPERTIES
+};
+static GParamSpec* maman_sub_foo_bar_properties[MAMAN_SUB_FOO_BAR_NUM_PROPERTIES];
+
+#define MAMAN_TYPE_ABSTRACT_BASE (maman_abstract_base_get_type ())
+#define MAMAN_ABSTRACT_BASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_ABSTRACT_BASE, 
MamanAbstractBase))
+#define MAMAN_ABSTRACT_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAMAN_TYPE_ABSTRACT_BASE, 
MamanAbstractBaseClass))
+#define MAMAN_IS_ABSTRACT_BASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_ABSTRACT_BASE))
+#define MAMAN_IS_ABSTRACT_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAMAN_TYPE_ABSTRACT_BASE))
+#define MAMAN_ABSTRACT_BASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAMAN_TYPE_ABSTRACT_BASE, 
MamanAbstractBaseClass))
+
+typedef struct _MamanAbstractBase MamanAbstractBase;
+typedef struct _MamanAbstractBaseClass MamanAbstractBaseClass;
+typedef struct _MamanAbstractBasePrivate MamanAbstractBasePrivate;
+enum  {
+       MAMAN_ABSTRACT_BASE_0_PROPERTY,
+       MAMAN_ABSTRACT_BASE_NUM_PROPERTIES
+};
+static GParamSpec* maman_abstract_base_properties[MAMAN_ABSTRACT_BASE_NUM_PROPERTIES];
+
+#define MAMAN_TYPE_ABSTRACT_DERIVED (maman_abstract_derived_get_type ())
+#define MAMAN_ABSTRACT_DERIVED(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_ABSTRACT_DERIVED, 
MamanAbstractDerived))
+#define MAMAN_ABSTRACT_DERIVED_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAMAN_TYPE_ABSTRACT_DERIVED, 
MamanAbstractDerivedClass))
+#define MAMAN_IS_ABSTRACT_DERIVED(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_ABSTRACT_DERIVED))
+#define MAMAN_IS_ABSTRACT_DERIVED_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), 
MAMAN_TYPE_ABSTRACT_DERIVED))
+#define MAMAN_ABSTRACT_DERIVED_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), 
MAMAN_TYPE_ABSTRACT_DERIVED, MamanAbstractDerivedClass))
+
+typedef struct _MamanAbstractDerived MamanAbstractDerived;
+typedef struct _MamanAbstractDerivedClass MamanAbstractDerivedClass;
+typedef struct _MamanAbstractDerivedPrivate MamanAbstractDerivedPrivate;
+enum  {
+       MAMAN_ABSTRACT_DERIVED_0_PROPERTY,
+       MAMAN_ABSTRACT_DERIVED_NUM_PROPERTIES
+};
+static GParamSpec* maman_abstract_derived_properties[MAMAN_ABSTRACT_DERIVED_NUM_PROPERTIES];
+
+#define MAMAN_TYPE_DEEP_DERIVED (maman_deep_derived_get_type ())
+#define MAMAN_DEEP_DERIVED(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_DEEP_DERIVED, 
MamanDeepDerived))
+#define MAMAN_DEEP_DERIVED_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAMAN_TYPE_DEEP_DERIVED, 
MamanDeepDerivedClass))
+#define MAMAN_IS_DEEP_DERIVED(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_DEEP_DERIVED))
+#define MAMAN_IS_DEEP_DERIVED_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAMAN_TYPE_DEEP_DERIVED))
+#define MAMAN_DEEP_DERIVED_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAMAN_TYPE_DEEP_DERIVED, 
MamanDeepDerivedClass))
+
+typedef struct _MamanDeepDerived MamanDeepDerived;
+typedef struct _MamanDeepDerivedClass MamanDeepDerivedClass;
+typedef struct _MamanDeepDerivedPrivate MamanDeepDerivedPrivate;
+enum  {
+       MAMAN_DEEP_DERIVED_0_PROPERTY,
+       MAMAN_DEEP_DERIVED_NUM_PROPERTIES
+};
+static GParamSpec* maman_deep_derived_properties[MAMAN_DEEP_DERIVED_NUM_PROPERTIES];
+
+#define MAMAN_BASE_ACCESS_TYPE_IFOO (maman_base_access_ifoo_get_type ())
+#define MAMAN_BASE_ACCESS_IFOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_BASE_ACCESS_TYPE_IFOO, 
MamanBaseAccessIFoo))
+#define MAMAN_BASE_ACCESS_IS_IFOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_BASE_ACCESS_TYPE_IFOO))
+#define MAMAN_BASE_ACCESS_IFOO_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), 
MAMAN_BASE_ACCESS_TYPE_IFOO, MamanBaseAccessIFooIface))
+
+typedef struct _MamanBaseAccessIFoo MamanBaseAccessIFoo;
+typedef struct _MamanBaseAccessIFooIface MamanBaseAccessIFooIface;
+
+#define MAMAN_BASE_ACCESS_TYPE_FOO (maman_base_access_foo_get_type ())
+#define MAMAN_BASE_ACCESS_FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_BASE_ACCESS_TYPE_FOO, 
MamanBaseAccessFoo))
+#define MAMAN_BASE_ACCESS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAMAN_BASE_ACCESS_TYPE_FOO, 
MamanBaseAccessFooClass))
+#define MAMAN_BASE_ACCESS_IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_BASE_ACCESS_TYPE_FOO))
+#define MAMAN_BASE_ACCESS_IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAMAN_BASE_ACCESS_TYPE_FOO))
+#define MAMAN_BASE_ACCESS_FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAMAN_BASE_ACCESS_TYPE_FOO, 
MamanBaseAccessFooClass))
+
+typedef struct _MamanBaseAccessFoo MamanBaseAccessFoo;
+typedef struct _MamanBaseAccessFooClass MamanBaseAccessFooClass;
+typedef struct _MamanBaseAccessFooPrivate MamanBaseAccessFooPrivate;
+enum  {
+       MAMAN_BASE_ACCESS_FOO_0_PROPERTY,
+       MAMAN_BASE_ACCESS_FOO_NUM_PROPERTIES
+};
+static GParamSpec* maman_base_access_foo_properties[MAMAN_BASE_ACCESS_FOO_NUM_PROPERTIES];
+
+#define MAMAN_BASE_ACCESS_TYPE_BAR (maman_base_access_bar_get_type ())
+#define MAMAN_BASE_ACCESS_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_BASE_ACCESS_TYPE_BAR, 
MamanBaseAccessBar))
+#define MAMAN_BASE_ACCESS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAMAN_BASE_ACCESS_TYPE_BAR, 
MamanBaseAccessBarClass))
+#define MAMAN_BASE_ACCESS_IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_BASE_ACCESS_TYPE_BAR))
+#define MAMAN_BASE_ACCESS_IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAMAN_BASE_ACCESS_TYPE_BAR))
+#define MAMAN_BASE_ACCESS_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAMAN_BASE_ACCESS_TYPE_BAR, 
MamanBaseAccessBarClass))
+
+typedef struct _MamanBaseAccessBar MamanBaseAccessBar;
+typedef struct _MamanBaseAccessBarClass MamanBaseAccessBarClass;
+typedef struct _MamanBaseAccessBarPrivate MamanBaseAccessBarPrivate;
+enum  {
+       MAMAN_BASE_ACCESS_BAR_0_PROPERTY,
+       MAMAN_BASE_ACCESS_BAR_NUM_PROPERTIES
+};
+static GParamSpec* maman_base_access_bar_properties[MAMAN_BASE_ACCESS_BAR_NUM_PROPERTIES];
+
+#define MAMAN_BASE_ACCESS_TYPE_FOO_BAR (maman_base_access_foo_bar_get_type ())
+#define MAMAN_BASE_ACCESS_FOO_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_BASE_ACCESS_TYPE_FOO_BAR, 
MamanBaseAccessFooBar))
+#define MAMAN_BASE_ACCESS_FOO_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), 
MAMAN_BASE_ACCESS_TYPE_FOO_BAR, MamanBaseAccessFooBarClass))
+#define MAMAN_BASE_ACCESS_IS_FOO_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
MAMAN_BASE_ACCESS_TYPE_FOO_BAR))
+#define MAMAN_BASE_ACCESS_IS_FOO_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), 
MAMAN_BASE_ACCESS_TYPE_FOO_BAR))
+#define MAMAN_BASE_ACCESS_FOO_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), 
MAMAN_BASE_ACCESS_TYPE_FOO_BAR, MamanBaseAccessFooBarClass))
+
+typedef struct _MamanBaseAccessFooBar MamanBaseAccessFooBar;
+typedef struct _MamanBaseAccessFooBarClass MamanBaseAccessFooBarClass;
+typedef struct _MamanBaseAccessFooBarPrivate MamanBaseAccessFooBarPrivate;
+enum  {
+       MAMAN_BASE_ACCESS_FOO_BAR_0_PROPERTY,
+       MAMAN_BASE_ACCESS_FOO_BAR_NUM_PROPERTIES
+};
+static GParamSpec* maman_base_access_foo_bar_properties[MAMAN_BASE_ACCESS_FOO_BAR_NUM_PROPERTIES];
+
+#define MAMAN_TYPE_CLASS_TEST (maman_class_test_get_type ())
+#define MAMAN_CLASS_TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_CLASS_TEST, MamanClassTest))
+#define MAMAN_CLASS_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAMAN_TYPE_CLASS_TEST, 
MamanClassTestClass))
+#define MAMAN_IS_CLASS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_CLASS_TEST))
+#define MAMAN_IS_CLASS_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAMAN_TYPE_CLASS_TEST))
+#define MAMAN_CLASS_TEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAMAN_TYPE_CLASS_TEST, 
MamanClassTestClass))
+
+typedef struct _MamanClassTest MamanClassTest;
+typedef struct _MamanClassTestClass MamanClassTestClass;
+typedef struct _MamanClassTestPrivate MamanClassTestPrivate;
+#define _maman_class_test_unref0(var) ((var == NULL) ? NULL : (var = (maman_class_test_unref (var), NULL)))
+typedef struct _MamanParamSpecClassTest MamanParamSpecClassTest;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _MamanBar {
+       GObject parent_instance;
+       MamanBarPrivate * priv;
+};
+
+struct _MamanBarClass {
+       GObjectClass parent_class;
+       void (*do_virtual_action) (MamanBar* self);
+};
+
+struct _MamanSubBar {
+       MamanBar parent_instance;
+       MamanSubBarPrivate * priv;
+};
+
+struct _MamanSubBarClass {
+       MamanBarClass parent_class;
+};
+
+struct _MamanFooIface {
+       GTypeInterface parent_iface;
+};
+
+struct _MamanFooBar {
+       GObject parent_instance;
+       MamanFooBarPrivate * priv;
+};
+
+struct _MamanFooBarClass {
+       GObjectClass parent_class;
+};
+
+struct _MamanSubFooBar {
+       MamanFooBar parent_instance;
+       MamanSubFooBarPrivate * priv;
+};
+
+struct _MamanSubFooBarClass {
+       MamanFooBarClass parent_class;
+};
+
+struct _MamanAbstractBase {
+       GObject parent_instance;
+       MamanAbstractBasePrivate * priv;
+};
+
+struct _MamanAbstractBaseClass {
+       GObjectClass parent_class;
+       void (*foo) (MamanAbstractBase* self);
+};
+
+struct _MamanAbstractDerived {
+       MamanAbstractBase parent_instance;
+       MamanAbstractDerivedPrivate * priv;
+};
+
+struct _MamanAbstractDerivedClass {
+       MamanAbstractBaseClass parent_class;
+};
+
+struct _MamanDeepDerived {
+       MamanAbstractDerived parent_instance;
+       MamanDeepDerivedPrivate * priv;
+};
+
+struct _MamanDeepDerivedClass {
+       MamanAbstractDerivedClass parent_class;
+};
+
+struct _MamanBaseAccessIFooIface {
+       GTypeInterface parent_iface;
+       gint (*interface_method) (MamanBaseAccessIFoo* self);
+       gint (*virtual_interface_method) (MamanBaseAccessIFoo* self);
+};
+
+struct _MamanBaseAccessFoo {
+       GObject parent_instance;
+       MamanBaseAccessFooPrivate * priv;
+};
+
+struct _MamanBaseAccessFooClass {
+       GObjectClass parent_class;
+       gint (*virtual_method) (MamanBaseAccessFoo* self);
+       gint (*virtual_interface_method) (MamanBaseAccessFoo* self);
+};
+
+struct _MamanBaseAccessBar {
+       MamanBaseAccessFoo parent_instance;
+       MamanBaseAccessBarPrivate * priv;
+};
+
+struct _MamanBaseAccessBarClass {
+       MamanBaseAccessFooClass parent_class;
+};
+
+struct _MamanBaseAccessFooBar {
+       MamanBaseAccessFoo parent_instance;
+       MamanBaseAccessFooBarPrivate * priv;
+};
+
+struct _MamanBaseAccessFooBarClass {
+       MamanBaseAccessFooClass parent_class;
+};
+
+struct _MamanClassTest {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       MamanClassTestPrivate * priv;
+};
+
+struct _MamanClassTestClass {
+       GTypeClass parent_class;
+       void (*finalize) (MamanClassTest *self);
+};
+
+struct _MamanParamSpecClassTest {
+       GParamSpec parent_instance;
+};
+
+static gpointer maman_bar_parent_class = NULL;
+static gpointer maman_sub_bar_parent_class = NULL;
+static gpointer maman_foo_bar_parent_class = NULL;
+static gpointer maman_sub_foo_bar_parent_class = NULL;
+static MamanFooIface * maman_sub_foo_bar_maman_foo_parent_iface = NULL;
+static gpointer maman_abstract_base_parent_class = NULL;
+static gpointer maman_abstract_derived_parent_class = NULL;
+static gpointer maman_deep_derived_parent_class = NULL;
+static gpointer maman_base_access_foo_parent_class = NULL;
+static MamanBaseAccessIFooIface * maman_base_access_foo_maman_base_access_ifoo_parent_iface = NULL;
+static gpointer maman_base_access_bar_parent_class = NULL;
+static gpointer maman_base_access_foo_bar_parent_class = NULL;
+static MamanBaseAccessIFooIface * maman_base_access_foo_bar_maman_base_access_ifoo_parent_iface = NULL;
+static gpointer maman_class_test_parent_class = NULL;
+
+VALA_EXTERN GType maman_bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MamanBar, g_object_unref)
+VALA_EXTERN void maman_bar_do_virtual_action (MamanBar* self);
+VALA_EXTERN void maman_bar_do_action (MamanBar* self);
+VALA_EXTERN void maman_bar_do_static_action (void);
+static void maman_bar_real_do_virtual_action (MamanBar* self);
+VALA_EXTERN MamanBar* maman_bar_new (void);
+VALA_EXTERN MamanBar* maman_bar_construct (GType object_type);
+static GType maman_bar_get_type_once (void);
+VALA_EXTERN GType maman_sub_bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MamanSubBar, g_object_unref)
+static void maman_sub_bar_real_do_virtual_action (MamanBar* base);
+static void maman_sub_bar_accept_ref_string (gchar* * str);
+static void maman_sub_bar_test_classes_methods_ref_parameters (void);
+static gint maman_sub_bar_main (void);
+VALA_EXTERN MamanSubBar* maman_sub_bar_new (void);
+VALA_EXTERN MamanSubBar* maman_sub_bar_construct (GType object_type);
+VALA_EXTERN GType maman_foo_bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MamanFooBar, g_object_unref)
+VALA_EXTERN GType maman_sub_foo_bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MamanSubFooBar, g_object_unref)
+VALA_EXTERN MamanSubFooBar* maman_sub_foo_bar_new (void);
+VALA_EXTERN MamanSubFooBar* maman_sub_foo_bar_construct (GType object_type);
+VALA_EXTERN GType maman_foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN void maman_foo_do_action (MamanFoo* self);
+VALA_EXTERN void maman_base_access_test (void);
+VALA_EXTERN void test_out (gchar* * bar);
+VALA_EXTERN void test_out_weak (const gchar* * bar);
+VALA_EXTERN void test_ref (gchar* * bar);
+VALA_EXTERN void test_ref_weak (const gchar* * bar);
+VALA_EXTERN void test_out_array_no_length (gchar*** bar);
+VALA_EXTERN void maman_class_test_run_test (void);
+static GType maman_sub_bar_get_type_once (void);
+static GType maman_foo_get_type_once (void);
+VALA_EXTERN void maman_foo_bar_do_action (MamanFooBar* self);
+VALA_EXTERN MamanFooBar* maman_foo_bar_new (void);
+VALA_EXTERN MamanFooBar* maman_foo_bar_construct (GType object_type);
+static GType maman_foo_bar_get_type_once (void);
+static GType maman_sub_foo_bar_get_type_once (void);
+VALA_EXTERN GType maman_abstract_base_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MamanAbstractBase, g_object_unref)
+VALA_EXTERN void maman_abstract_base_foo (MamanAbstractBase* self);
+static void maman_abstract_base_real_foo (MamanAbstractBase* self);
+VALA_EXTERN MamanAbstractBase* maman_abstract_base_construct (GType object_type);
+static GType maman_abstract_base_get_type_once (void);
+VALA_EXTERN GType maman_abstract_derived_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MamanAbstractDerived, g_object_unref)
+static void maman_abstract_derived_real_foo (MamanAbstractBase* base);
+VALA_EXTERN MamanAbstractDerived* maman_abstract_derived_construct (GType object_type);
+static GType maman_abstract_derived_get_type_once (void);
+VALA_EXTERN GType maman_deep_derived_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MamanDeepDerived, g_object_unref)
+VALA_EXTERN MamanDeepDerived* maman_deep_derived_new (void);
+VALA_EXTERN MamanDeepDerived* maman_deep_derived_construct (GType object_type);
+static GType maman_deep_derived_get_type_once (void);
+VALA_EXTERN GType maman_base_access_ifoo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN gint maman_base_access_ifoo_interface_method (MamanBaseAccessIFoo* self);
+VALA_EXTERN gint maman_base_access_ifoo_virtual_interface_method (MamanBaseAccessIFoo* self);
+static GType maman_base_access_ifoo_get_type_once (void);
+VALA_EXTERN GType maman_base_access_foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MamanBaseAccessFoo, g_object_unref)
+VALA_EXTERN gint maman_base_access_foo_virtual_method (MamanBaseAccessFoo* self);
+VALA_EXTERN gint maman_base_access_foo_virtual_interface_method (MamanBaseAccessFoo* self);
+static gint maman_base_access_foo_real_virtual_method (MamanBaseAccessFoo* self);
+static gint maman_base_access_foo_real_interface_method (MamanBaseAccessIFoo* base);
+static gint maman_base_access_foo_real_virtual_interface_method (MamanBaseAccessFoo* self);
+VALA_EXTERN MamanBaseAccessFoo* maman_base_access_foo_new (void);
+VALA_EXTERN MamanBaseAccessFoo* maman_base_access_foo_construct (GType object_type);
+static GType maman_base_access_foo_get_type_once (void);
+VALA_EXTERN GType maman_base_access_bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MamanBaseAccessBar, g_object_unref)
+static gint maman_base_access_bar_real_virtual_method (MamanBaseAccessFoo* base);
+static gint maman_base_access_bar_real_virtual_interface_method (MamanBaseAccessFoo* base);
+VALA_EXTERN MamanBaseAccessBar* maman_base_access_bar_new (void);
+VALA_EXTERN MamanBaseAccessBar* maman_base_access_bar_construct (GType object_type);
+static GType maman_base_access_bar_get_type_once (void);
+VALA_EXTERN GType maman_base_access_foo_bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MamanBaseAccessFooBar, g_object_unref)
+static gint maman_base_access_foo_bar_real_interface_method (MamanBaseAccessIFoo* base);
+static gint maman_base_access_foo_bar_real_virtual_interface_method (MamanBaseAccessIFoo* base);
+VALA_EXTERN MamanBaseAccessFooBar* maman_base_access_foo_bar_new (void);
+VALA_EXTERN MamanBaseAccessFooBar* maman_base_access_foo_bar_construct (GType object_type);
+static GType maman_base_access_foo_bar_get_type_once (void);
+VALA_EXTERN gpointer maman_class_test_ref (gpointer instance);
+VALA_EXTERN void maman_class_test_unref (gpointer instance);
+VALA_EXTERN GParamSpec* maman_param_spec_class_test (const gchar* name,
+                                         const gchar* nick,
+                                         const gchar* blurb,
+                                         GType object_type,
+                                         GParamFlags flags);
+VALA_EXTERN void maman_value_set_class_test (GValue* value,
+                                 gpointer v_object);
+VALA_EXTERN void maman_value_take_class_test (GValue* value,
+                                  gpointer v_object);
+VALA_EXTERN gpointer maman_value_get_class_test (const GValue* value);
+VALA_EXTERN GType maman_class_test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MamanClassTest, maman_class_test_unref)
+VALA_EXTERN void maman_class_test_class_method (MamanClassTestClass* klass);
+VALA_EXTERN void maman_class_test_instance_method (MamanClassTest* self);
+VALA_EXTERN MamanClassTest* maman_class_test_new (void);
+VALA_EXTERN MamanClassTest* maman_class_test_construct (GType object_type);
+static void maman_class_test_finalize (MamanClassTest * obj);
+static GType maman_class_test_get_type_once (void);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+void
+maman_bar_do_action (MamanBar* self)
+{
+       FILE* _tmp0_;
+       g_return_if_fail (MAMAN_IS_BAR (self));
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, " 2");
+}
+
+void
+maman_bar_do_static_action (void)
+{
+       FILE* _tmp0_;
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, " 2");
+}
+
+static void
+maman_bar_real_do_virtual_action (MamanBar* self)
+{
+       FILE* _tmp0_;
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, " BAD");
+}
+
+void
+maman_bar_do_virtual_action (MamanBar* self)
+{
+       MamanBarClass* _klass_;
+       g_return_if_fail (MAMAN_IS_BAR (self));
+       _klass_ = MAMAN_BAR_GET_CLASS (self);
+       if (_klass_->do_virtual_action) {
+               _klass_->do_virtual_action (self);
+       }
+}
+
+MamanBar*
+maman_bar_construct (GType object_type)
+{
+       MamanBar * self = NULL;
+       self = (MamanBar*) g_object_new (object_type, NULL);
+       return self;
+}
+
+MamanBar*
+maman_bar_new (void)
+{
+       return maman_bar_construct (MAMAN_TYPE_BAR);
+}
+
+static void
+maman_bar_class_init (MamanBarClass * klass,
+                      gpointer klass_data)
+{
+       maman_bar_parent_class = g_type_class_peek_parent (klass);
+       ((MamanBarClass *) klass)->do_virtual_action = (void (*) (MamanBar*)) 
maman_bar_real_do_virtual_action;
+}
+
+static void
+maman_bar_instance_init (MamanBar * self,
+                         gpointer klass)
+{
+}
+
+static GType
+maman_bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (MamanBarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(MamanBar), 0, (GInstanceInitFunc) maman_bar_instance_init, NULL };
+       GType maman_bar_type_id;
+       maman_bar_type_id = g_type_register_static (G_TYPE_OBJECT, "MamanBar", &g_define_type_info, 0);
+       return maman_bar_type_id;
+}
+
+GType
+maman_bar_get_type (void)
+{
+       static volatile gsize maman_bar_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_bar_type_id__volatile)) {
+               GType maman_bar_type_id;
+               maman_bar_type_id = maman_bar_get_type_once ();
+               g_once_init_leave (&maman_bar_type_id__volatile, maman_bar_type_id);
+       }
+       return maman_bar_type_id__volatile;
+}
+
+static void
+maman_sub_bar_real_do_virtual_action (MamanBar* base)
+{
+       MamanSubBar * self;
+       FILE* _tmp0_;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, MAMAN_TYPE_SUB_BAR, MamanSubBar);
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, " 2");
+}
+
+static void
+maman_sub_bar_accept_ref_string (gchar* * str)
+{
+       g_return_if_fail (*str != NULL);
+}
+
+static void
+maman_sub_bar_test_classes_methods_ref_parameters (void)
+{
+       gchar* str = NULL;
+       gchar* _tmp0_;
+       _tmp0_ = g_strdup ("hello");
+       str = _tmp0_;
+       maman_sub_bar_accept_ref_string (&str);
+       _g_free0 (str);
+}
+
+static gint
+maman_sub_bar_main (void)
+{
+       FILE* _tmp0_;
+       MamanSubBar* bar = NULL;
+       MamanSubBar* _tmp1_;
+       MamanSubBar* _tmp2_;
+       FILE* _tmp3_;
+       FILE* _tmp4_;
+       FILE* _tmp5_;
+       FILE* _tmp6_;
+       MamanSubBar* _tmp7_;
+       FILE* _tmp8_;
+       FILE* _tmp9_;
+       MamanSubFooBar* foobar = NULL;
+       MamanSubFooBar* _tmp10_;
+       MamanSubFooBar* _tmp11_;
+       FILE* _tmp12_;
+       gchar* str = NULL;
+       gchar* str2 = NULL;
+       const gchar* weak_str = NULL;
+       gchar** array = NULL;
+       gint array_length1 = 0;
+       gint _array_size_ = 0;
+       gchar* _tmp13_ = NULL;
+       const gchar* _tmp14_;
+       const gchar* _tmp15_ = NULL;
+       const gchar* _tmp16_;
+       const gchar* _tmp17_ = NULL;
+       gchar* _tmp18_;
+       const gchar* _tmp19_;
+       const gchar* _tmp20_;
+       const gchar* _tmp21_;
+       gchar** _tmp22_ = NULL;
+       gchar** _tmp23_;
+       gint _tmp23__length1;
+       const gchar* _tmp24_;
+       gchar** _tmp25_;
+       gint _tmp25__length1;
+       const gchar* _tmp26_;
+       gchar** _tmp27_;
+       gint _tmp27__length1;
+       gchar** _tmp28_;
+       gint _tmp28__length1;
+       gint result = 0;
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, "Inheritance Test: 1");
+       _tmp1_ = maman_sub_bar_new ();
+       bar = _tmp1_;
+       _tmp2_ = bar;
+       maman_bar_do_action (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, MAMAN_TYPE_BAR, MamanBar));
+       _tmp3_ = stdout;
+       fprintf (_tmp3_, " 3\n");
+       _tmp4_ = stdout;
+       fprintf (_tmp4_, "Static Inheritance Test: 1");
+       maman_bar_do_static_action ();
+       _tmp5_ = stdout;
+       fprintf (_tmp5_, " 3\n");
+       _tmp6_ = stdout;
+       fprintf (_tmp6_, "Virtual Method Test: 1");
+       _tmp7_ = bar;
+       maman_bar_do_virtual_action (G_TYPE_CHECK_INSTANCE_CAST (_tmp7_, MAMAN_TYPE_BAR, MamanBar));
+       _tmp8_ = stdout;
+       fprintf (_tmp8_, " 3\n");
+       _tmp9_ = stdout;
+       fprintf (_tmp9_, "Interface Inheritance Test: 1");
+       _tmp10_ = maman_sub_foo_bar_new ();
+       foobar = _tmp10_;
+       _tmp11_ = foobar;
+       maman_foo_do_action (G_TYPE_CHECK_INSTANCE_CAST (_tmp11_, MAMAN_TYPE_FOO, MamanFoo));
+       _tmp12_ = stdout;
+       fprintf (_tmp12_, " 3\n");
+       maman_sub_bar_test_classes_methods_ref_parameters ();
+       maman_base_access_test ();
+       test_out (&_tmp13_);
+       _g_free0 (str);
+       str = _tmp13_;
+       _tmp14_ = str;
+       _vala_assert (g_strcmp0 (_tmp14_, "hello") == 0, "str == \"hello\"");
+       test_out_weak (&_tmp15_);
+       weak_str = _tmp15_;
+       _tmp16_ = weak_str;
+       _vala_assert (g_strcmp0 (_tmp16_, "hello") == 0, "weak_str == \"hello\"");
+       test_out_weak (&_tmp17_);
+       _g_free0 (str2);
+       _tmp18_ = g_strdup (_tmp17_);
+       str2 = _tmp18_;
+       _tmp19_ = str2;
+       _vala_assert (g_strcmp0 (_tmp19_, "hello") == 0, "str2 == \"hello\"");
+       test_ref (&str);
+       _tmp20_ = str;
+       _vala_assert (g_strcmp0 (_tmp20_, "world") == 0, "str == \"world\"");
+       test_ref_weak (&weak_str);
+       _tmp21_ = weak_str;
+       _vala_assert (g_strcmp0 (_tmp21_, "world") == 0, "weak_str == \"world\"");
+       test_out_array_no_length (&_tmp22_);
+       array = (_vala_array_free (array, array_length1, (GDestroyNotify) g_free), NULL);
+       array = _tmp22_;
+       array_length1 = -1;
+       _array_size_ = array_length1;
+       _tmp23_ = array;
+       _tmp23__length1 = array_length1;
+       _tmp24_ = _tmp23_[0];
+       _vala_assert (g_strcmp0 (_tmp24_, "hello") == 0, "array[0] == \"hello\"");
+       _tmp25_ = array;
+       _tmp25__length1 = array_length1;
+       _tmp26_ = _tmp25_[1];
+       _vala_assert (g_strcmp0 (_tmp26_, "world") == 0, "array[1] == \"world\"");
+       _tmp27_ = array;
+       _tmp27__length1 = array_length1;
+       _vala_assert (_tmp27__length1 < 0, "array.length < 0");
+       _tmp28_ = array;
+       _tmp28__length1 = array_length1;
+       if (_tmp28__length1 == -1) {
+               gchar** _tmp29_;
+               gint _tmp29__length1;
+               _tmp29_ = array;
+               _tmp29__length1 = array_length1;
+               array_length1 = (gint) g_strv_length (_tmp29_);
+       }
+       maman_class_test_run_test ();
+       result = 0;
+       array = (_vala_array_free (array, array_length1, (GDestroyNotify) g_free), NULL);
+       _g_free0 (str2);
+       _g_free0 (str);
+       _g_object_unref0 (foobar);
+       _g_object_unref0 (bar);
+       return result;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       return maman_sub_bar_main ();
+}
+
+MamanSubBar*
+maman_sub_bar_construct (GType object_type)
+{
+       MamanSubBar * self = NULL;
+       self = (MamanSubBar*) maman_bar_construct (object_type);
+       return self;
+}
+
+MamanSubBar*
+maman_sub_bar_new (void)
+{
+       return maman_sub_bar_construct (MAMAN_TYPE_SUB_BAR);
+}
+
+static void
+maman_sub_bar_class_init (MamanSubBarClass * klass,
+                          gpointer klass_data)
+{
+       maman_sub_bar_parent_class = g_type_class_peek_parent (klass);
+       ((MamanBarClass *) klass)->do_virtual_action = (void (*) (MamanBar*)) 
maman_sub_bar_real_do_virtual_action;
+}
+
+static void
+maman_sub_bar_instance_init (MamanSubBar * self,
+                             gpointer klass)
+{
+}
+
+static GType
+maman_sub_bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (MamanSubBarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_sub_bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(MamanSubBar), 0, (GInstanceInitFunc) maman_sub_bar_instance_init, NULL };
+       GType maman_sub_bar_type_id;
+       maman_sub_bar_type_id = g_type_register_static (MAMAN_TYPE_BAR, "MamanSubBar", &g_define_type_info, 
0);
+       return maman_sub_bar_type_id;
+}
+
+GType
+maman_sub_bar_get_type (void)
+{
+       static volatile gsize maman_sub_bar_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_sub_bar_type_id__volatile)) {
+               GType maman_sub_bar_type_id;
+               maman_sub_bar_type_id = maman_sub_bar_get_type_once ();
+               g_once_init_leave (&maman_sub_bar_type_id__volatile, maman_sub_bar_type_id);
+       }
+       return maman_sub_bar_type_id__volatile;
+}
+
+void
+maman_foo_do_action (MamanFoo* self)
+{
+       FILE* _tmp0_;
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, " 2");
+}
+
+static void
+maman_foo_default_init (MamanFooIface * iface,
+                        gpointer iface_data)
+{
+}
+
+static GType
+maman_foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (MamanFooIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_foo_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType maman_foo_type_id;
+       maman_foo_type_id = g_type_register_static (G_TYPE_INTERFACE, "MamanFoo", &g_define_type_info, 0);
+       return maman_foo_type_id;
+}
+
+GType
+maman_foo_get_type (void)
+{
+       static volatile gsize maman_foo_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_foo_type_id__volatile)) {
+               GType maman_foo_type_id;
+               maman_foo_type_id = maman_foo_get_type_once ();
+               g_once_init_leave (&maman_foo_type_id__volatile, maman_foo_type_id);
+       }
+       return maman_foo_type_id__volatile;
+}
+
+void
+maman_foo_bar_do_action (MamanFooBar* self)
+{
+       FILE* _tmp0_;
+       g_return_if_fail (MAMAN_IS_FOO_BAR (self));
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, " BAD");
+}
+
+MamanFooBar*
+maman_foo_bar_construct (GType object_type)
+{
+       MamanFooBar * self = NULL;
+       self = (MamanFooBar*) g_object_new (object_type, NULL);
+       return self;
+}
+
+MamanFooBar*
+maman_foo_bar_new (void)
+{
+       return maman_foo_bar_construct (MAMAN_TYPE_FOO_BAR);
+}
+
+static void
+maman_foo_bar_class_init (MamanFooBarClass * klass,
+                          gpointer klass_data)
+{
+       maman_foo_bar_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+maman_foo_bar_instance_init (MamanFooBar * self,
+                             gpointer klass)
+{
+}
+
+static GType
+maman_foo_bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (MamanFooBarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_foo_bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(MamanFooBar), 0, (GInstanceInitFunc) maman_foo_bar_instance_init, NULL };
+       GType maman_foo_bar_type_id;
+       maman_foo_bar_type_id = g_type_register_static (G_TYPE_OBJECT, "MamanFooBar", &g_define_type_info, 0);
+       return maman_foo_bar_type_id;
+}
+
+GType
+maman_foo_bar_get_type (void)
+{
+       static volatile gsize maman_foo_bar_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_foo_bar_type_id__volatile)) {
+               GType maman_foo_bar_type_id;
+               maman_foo_bar_type_id = maman_foo_bar_get_type_once ();
+               g_once_init_leave (&maman_foo_bar_type_id__volatile, maman_foo_bar_type_id);
+       }
+       return maman_foo_bar_type_id__volatile;
+}
+
+MamanSubFooBar*
+maman_sub_foo_bar_construct (GType object_type)
+{
+       MamanSubFooBar * self = NULL;
+       self = (MamanSubFooBar*) maman_foo_bar_construct (object_type);
+       return self;
+}
+
+MamanSubFooBar*
+maman_sub_foo_bar_new (void)
+{
+       return maman_sub_foo_bar_construct (MAMAN_TYPE_SUB_FOO_BAR);
+}
+
+static void
+maman_sub_foo_bar_class_init (MamanSubFooBarClass * klass,
+                              gpointer klass_data)
+{
+       maman_sub_foo_bar_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+maman_sub_foo_bar_maman_foo_interface_init (MamanFooIface * iface,
+                                            gpointer iface_data)
+{
+       maman_sub_foo_bar_maman_foo_parent_iface = g_type_interface_peek_parent (iface);
+}
+
+static void
+maman_sub_foo_bar_instance_init (MamanSubFooBar * self,
+                                 gpointer klass)
+{
+}
+
+static GType
+maman_sub_foo_bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (MamanSubFooBarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_sub_foo_bar_class_init, (GClassFinalizeFunc) NULL, NULL, 
sizeof (MamanSubFooBar), 0, (GInstanceInitFunc) maman_sub_foo_bar_instance_init, NULL };
+       static const GInterfaceInfo maman_foo_info = { (GInterfaceInitFunc) 
maman_sub_foo_bar_maman_foo_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
+       GType maman_sub_foo_bar_type_id;
+       maman_sub_foo_bar_type_id = g_type_register_static (MAMAN_TYPE_FOO_BAR, "MamanSubFooBar", 
&g_define_type_info, 0);
+       g_type_add_interface_static (maman_sub_foo_bar_type_id, MAMAN_TYPE_FOO, &maman_foo_info);
+       return maman_sub_foo_bar_type_id;
+}
+
+GType
+maman_sub_foo_bar_get_type (void)
+{
+       static volatile gsize maman_sub_foo_bar_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_sub_foo_bar_type_id__volatile)) {
+               GType maman_sub_foo_bar_type_id;
+               maman_sub_foo_bar_type_id = maman_sub_foo_bar_get_type_once ();
+               g_once_init_leave (&maman_sub_foo_bar_type_id__volatile, maman_sub_foo_bar_type_id);
+       }
+       return maman_sub_foo_bar_type_id__volatile;
+}
+
+static void
+maman_abstract_base_real_foo (MamanAbstractBase* self)
+{
+       g_critical ("Type `%s' does not implement abstract method `maman_abstract_base_foo'", g_type_name 
(G_TYPE_FROM_INSTANCE (self)));
+       return;
+}
+
+void
+maman_abstract_base_foo (MamanAbstractBase* self)
+{
+       MamanAbstractBaseClass* _klass_;
+       g_return_if_fail (MAMAN_IS_ABSTRACT_BASE (self));
+       _klass_ = MAMAN_ABSTRACT_BASE_GET_CLASS (self);
+       if (_klass_->foo) {
+               _klass_->foo (self);
+       }
+}
+
+MamanAbstractBase*
+maman_abstract_base_construct (GType object_type)
+{
+       MamanAbstractBase * self = NULL;
+       self = (MamanAbstractBase*) g_object_new (object_type, NULL);
+       return self;
+}
+
+static void
+maman_abstract_base_class_init (MamanAbstractBaseClass * klass,
+                                gpointer klass_data)
+{
+       maman_abstract_base_parent_class = g_type_class_peek_parent (klass);
+       ((MamanAbstractBaseClass *) klass)->foo = (void (*) (MamanAbstractBase*)) 
maman_abstract_base_real_foo;
+}
+
+static void
+maman_abstract_base_instance_init (MamanAbstractBase * self,
+                                   gpointer klass)
+{
+}
+
+static GType
+maman_abstract_base_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (MamanAbstractBaseClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_abstract_base_class_init, (GClassFinalizeFunc) NULL, NULL, 
sizeof (MamanAbstractBase), 0, (GInstanceInitFunc) maman_abstract_base_instance_init, NULL };
+       GType maman_abstract_base_type_id;
+       maman_abstract_base_type_id = g_type_register_static (G_TYPE_OBJECT, "MamanAbstractBase", 
&g_define_type_info, G_TYPE_FLAG_ABSTRACT);
+       return maman_abstract_base_type_id;
+}
+
+GType
+maman_abstract_base_get_type (void)
+{
+       static volatile gsize maman_abstract_base_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_abstract_base_type_id__volatile)) {
+               GType maman_abstract_base_type_id;
+               maman_abstract_base_type_id = maman_abstract_base_get_type_once ();
+               g_once_init_leave (&maman_abstract_base_type_id__volatile, maman_abstract_base_type_id);
+       }
+       return maman_abstract_base_type_id__volatile;
+}
+
+static void
+maman_abstract_derived_real_foo (MamanAbstractBase* base)
+{
+       MamanAbstractDerived * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, MAMAN_TYPE_ABSTRACT_DERIVED, MamanAbstractDerived);
+}
+
+MamanAbstractDerived*
+maman_abstract_derived_construct (GType object_type)
+{
+       MamanAbstractDerived * self = NULL;
+       self = (MamanAbstractDerived*) maman_abstract_base_construct (object_type);
+       return self;
+}
+
+static void
+maman_abstract_derived_class_init (MamanAbstractDerivedClass * klass,
+                                   gpointer klass_data)
+{
+       maman_abstract_derived_parent_class = g_type_class_peek_parent (klass);
+       ((MamanAbstractBaseClass *) klass)->foo = (void (*) (MamanAbstractBase*)) 
maman_abstract_derived_real_foo;
+}
+
+static void
+maman_abstract_derived_instance_init (MamanAbstractDerived * self,
+                                      gpointer klass)
+{
+}
+
+static GType
+maman_abstract_derived_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (MamanAbstractDerivedClass), (GBaseInitFunc) 
NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_abstract_derived_class_init, (GClassFinalizeFunc) 
NULL, NULL, sizeof (MamanAbstractDerived), 0, (GInstanceInitFunc) maman_abstract_derived_instance_init, NULL 
};
+       GType maman_abstract_derived_type_id;
+       maman_abstract_derived_type_id = g_type_register_static (MAMAN_TYPE_ABSTRACT_BASE, 
"MamanAbstractDerived", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
+       return maman_abstract_derived_type_id;
+}
+
+GType
+maman_abstract_derived_get_type (void)
+{
+       static volatile gsize maman_abstract_derived_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_abstract_derived_type_id__volatile)) {
+               GType maman_abstract_derived_type_id;
+               maman_abstract_derived_type_id = maman_abstract_derived_get_type_once ();
+               g_once_init_leave (&maman_abstract_derived_type_id__volatile, maman_abstract_derived_type_id);
+       }
+       return maman_abstract_derived_type_id__volatile;
+}
+
+MamanDeepDerived*
+maman_deep_derived_construct (GType object_type)
+{
+       MamanDeepDerived * self = NULL;
+       self = (MamanDeepDerived*) maman_abstract_derived_construct (object_type);
+       return self;
+}
+
+MamanDeepDerived*
+maman_deep_derived_new (void)
+{
+       return maman_deep_derived_construct (MAMAN_TYPE_DEEP_DERIVED);
+}
+
+static void
+maman_deep_derived_class_init (MamanDeepDerivedClass * klass,
+                               gpointer klass_data)
+{
+       maman_deep_derived_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+maman_deep_derived_instance_init (MamanDeepDerived * self,
+                                  gpointer klass)
+{
+}
+
+static GType
+maman_deep_derived_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (MamanDeepDerivedClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_deep_derived_class_init, (GClassFinalizeFunc) NULL, NULL, 
sizeof (MamanDeepDerived), 0, (GInstanceInitFunc) maman_deep_derived_instance_init, NULL };
+       GType maman_deep_derived_type_id;
+       maman_deep_derived_type_id = g_type_register_static (MAMAN_TYPE_ABSTRACT_DERIVED, "MamanDeepDerived", 
&g_define_type_info, 0);
+       return maman_deep_derived_type_id;
+}
+
+GType
+maman_deep_derived_get_type (void)
+{
+       static volatile gsize maman_deep_derived_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_deep_derived_type_id__volatile)) {
+               GType maman_deep_derived_type_id;
+               maman_deep_derived_type_id = maman_deep_derived_get_type_once ();
+               g_once_init_leave (&maman_deep_derived_type_id__volatile, maman_deep_derived_type_id);
+       }
+       return maman_deep_derived_type_id__volatile;
+}
+
+gint
+maman_base_access_ifoo_interface_method (MamanBaseAccessIFoo* self)
+{
+       MamanBaseAccessIFooIface* _iface_;
+       g_return_val_if_fail (MAMAN_BASE_ACCESS_IS_IFOO (self), 0);
+       _iface_ = MAMAN_BASE_ACCESS_IFOO_GET_INTERFACE (self);
+       if (_iface_->interface_method) {
+               return _iface_->interface_method (self);
+       }
+       return -1;
+}
+
+gint
+maman_base_access_ifoo_virtual_interface_method (MamanBaseAccessIFoo* self)
+{
+       MamanBaseAccessIFooIface* _iface_;
+       g_return_val_if_fail (MAMAN_BASE_ACCESS_IS_IFOO (self), 0);
+       _iface_ = MAMAN_BASE_ACCESS_IFOO_GET_INTERFACE (self);
+       if (_iface_->virtual_interface_method) {
+               return _iface_->virtual_interface_method (self);
+       }
+       return -1;
+}
+
+static void
+maman_base_access_ifoo_default_init (MamanBaseAccessIFooIface * iface,
+                                     gpointer iface_data)
+{
+}
+
+static GType
+maman_base_access_ifoo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (MamanBaseAccessIFooIface), (GBaseInitFunc) 
NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_base_access_ifoo_default_init, (GClassFinalizeFunc) 
NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
+       GType maman_base_access_ifoo_type_id;
+       maman_base_access_ifoo_type_id = g_type_register_static (G_TYPE_INTERFACE, "MamanBaseAccessIFoo", 
&g_define_type_info, 0);
+       g_type_interface_add_prerequisite (maman_base_access_ifoo_type_id, G_TYPE_OBJECT);
+       return maman_base_access_ifoo_type_id;
+}
+
+GType
+maman_base_access_ifoo_get_type (void)
+{
+       static volatile gsize maman_base_access_ifoo_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_base_access_ifoo_type_id__volatile)) {
+               GType maman_base_access_ifoo_type_id;
+               maman_base_access_ifoo_type_id = maman_base_access_ifoo_get_type_once ();
+               g_once_init_leave (&maman_base_access_ifoo_type_id__volatile, maman_base_access_ifoo_type_id);
+       }
+       return maman_base_access_ifoo_type_id__volatile;
+}
+
+static gint
+maman_base_access_foo_real_virtual_method (MamanBaseAccessFoo* self)
+{
+       gint result = 0;
+       result = 1;
+       return result;
+}
+
+gint
+maman_base_access_foo_virtual_method (MamanBaseAccessFoo* self)
+{
+       MamanBaseAccessFooClass* _klass_;
+       g_return_val_if_fail (MAMAN_BASE_ACCESS_IS_FOO (self), 0);
+       _klass_ = MAMAN_BASE_ACCESS_FOO_GET_CLASS (self);
+       if (_klass_->virtual_method) {
+               return _klass_->virtual_method (self);
+       }
+       return -1;
+}
+
+static gint
+maman_base_access_foo_real_interface_method (MamanBaseAccessIFoo* base)
+{
+       MamanBaseAccessFoo * self;
+       gint result = 0;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, MAMAN_BASE_ACCESS_TYPE_FOO, MamanBaseAccessFoo);
+       result = 2;
+       return result;
+}
+
+static gint
+maman_base_access_foo_real_virtual_interface_method (MamanBaseAccessFoo* self)
+{
+       gint result = 0;
+       result = 3;
+       return result;
+}
+
+gint
+maman_base_access_foo_virtual_interface_method (MamanBaseAccessFoo* self)
+{
+       MamanBaseAccessFooClass* _klass_;
+       g_return_val_if_fail (MAMAN_BASE_ACCESS_IS_FOO (self), 0);
+       _klass_ = MAMAN_BASE_ACCESS_FOO_GET_CLASS (self);
+       if (_klass_->virtual_interface_method) {
+               return _klass_->virtual_interface_method (self);
+       }
+       return -1;
+}
+
+MamanBaseAccessFoo*
+maman_base_access_foo_construct (GType object_type)
+{
+       MamanBaseAccessFoo * self = NULL;
+       self = (MamanBaseAccessFoo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+MamanBaseAccessFoo*
+maman_base_access_foo_new (void)
+{
+       return maman_base_access_foo_construct (MAMAN_BASE_ACCESS_TYPE_FOO);
+}
+
+static void
+maman_base_access_foo_class_init (MamanBaseAccessFooClass * klass,
+                                  gpointer klass_data)
+{
+       maman_base_access_foo_parent_class = g_type_class_peek_parent (klass);
+       ((MamanBaseAccessFooClass *) klass)->virtual_method = (gint (*) (MamanBaseAccessFoo*)) 
maman_base_access_foo_real_virtual_method;
+       ((MamanBaseAccessFooClass *) klass)->virtual_interface_method = (gint (*) (MamanBaseAccessFoo*)) 
maman_base_access_foo_real_virtual_interface_method;
+}
+
+static void
+maman_base_access_foo_maman_base_access_ifoo_interface_init (MamanBaseAccessIFooIface * iface,
+                                                             gpointer iface_data)
+{
+       maman_base_access_foo_maman_base_access_ifoo_parent_iface = g_type_interface_peek_parent (iface);
+       iface->interface_method = (gint (*) (MamanBaseAccessIFoo*)) 
maman_base_access_foo_real_interface_method;
+       iface->virtual_interface_method = (gint (*) (MamanBaseAccessIFoo*)) 
maman_base_access_foo_virtual_interface_method;
+}
+
+static void
+maman_base_access_foo_instance_init (MamanBaseAccessFoo * self,
+                                     gpointer klass)
+{
+}
+
+static GType
+maman_base_access_foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (MamanBaseAccessFooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_base_access_foo_class_init, (GClassFinalizeFunc) NULL, NULL, 
sizeof (MamanBaseAccessFoo), 0, (GInstanceInitFunc) maman_base_access_foo_instance_init, NULL };
+       static const GInterfaceInfo maman_base_access_ifoo_info = { (GInterfaceInitFunc) 
maman_base_access_foo_maman_base_access_ifoo_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
+       GType maman_base_access_foo_type_id;
+       maman_base_access_foo_type_id = g_type_register_static (G_TYPE_OBJECT, "MamanBaseAccessFoo", 
&g_define_type_info, 0);
+       g_type_add_interface_static (maman_base_access_foo_type_id, MAMAN_BASE_ACCESS_TYPE_IFOO, 
&maman_base_access_ifoo_info);
+       return maman_base_access_foo_type_id;
+}
+
+GType
+maman_base_access_foo_get_type (void)
+{
+       static volatile gsize maman_base_access_foo_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_base_access_foo_type_id__volatile)) {
+               GType maman_base_access_foo_type_id;
+               maman_base_access_foo_type_id = maman_base_access_foo_get_type_once ();
+               g_once_init_leave (&maman_base_access_foo_type_id__volatile, maman_base_access_foo_type_id);
+       }
+       return maman_base_access_foo_type_id__volatile;
+}
+
+static gint
+maman_base_access_bar_real_virtual_method (MamanBaseAccessFoo* base)
+{
+       MamanBaseAccessBar * self;
+       gint result = 0;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, MAMAN_BASE_ACCESS_TYPE_BAR, MamanBaseAccessBar);
+       result = (MAMAN_BASE_ACCESS_FOO_CLASS (maman_base_access_bar_parent_class)->virtual_method 
(G_TYPE_CHECK_INSTANCE_CAST (self, MAMAN_BASE_ACCESS_TYPE_FOO, MamanBaseAccessFoo)) * 10) + 4;
+       return result;
+}
+
+static gint
+maman_base_access_bar_real_virtual_interface_method (MamanBaseAccessFoo* base)
+{
+       MamanBaseAccessBar * self;
+       gint result = 0;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, MAMAN_BASE_ACCESS_TYPE_BAR, MamanBaseAccessBar);
+       result = (MAMAN_BASE_ACCESS_FOO_CLASS (maman_base_access_bar_parent_class)->virtual_interface_method 
(G_TYPE_CHECK_INSTANCE_CAST (self, MAMAN_BASE_ACCESS_TYPE_FOO, MamanBaseAccessFoo)) * 10) + 5;
+       return result;
+}
+
+MamanBaseAccessBar*
+maman_base_access_bar_construct (GType object_type)
+{
+       MamanBaseAccessBar * self = NULL;
+       self = (MamanBaseAccessBar*) maman_base_access_foo_construct (object_type);
+       return self;
+}
+
+MamanBaseAccessBar*
+maman_base_access_bar_new (void)
+{
+       return maman_base_access_bar_construct (MAMAN_BASE_ACCESS_TYPE_BAR);
+}
+
+static void
+maman_base_access_bar_class_init (MamanBaseAccessBarClass * klass,
+                                  gpointer klass_data)
+{
+       maman_base_access_bar_parent_class = g_type_class_peek_parent (klass);
+       ((MamanBaseAccessFooClass *) klass)->virtual_method = (gint (*) (MamanBaseAccessFoo*)) 
maman_base_access_bar_real_virtual_method;
+       ((MamanBaseAccessFooClass *) klass)->virtual_interface_method = (gint (*) (MamanBaseAccessFoo*)) 
maman_base_access_bar_real_virtual_interface_method;
+}
+
+static void
+maman_base_access_bar_instance_init (MamanBaseAccessBar * self,
+                                     gpointer klass)
+{
+}
+
+static GType
+maman_base_access_bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (MamanBaseAccessBarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_base_access_bar_class_init, (GClassFinalizeFunc) NULL, NULL, 
sizeof (MamanBaseAccessBar), 0, (GInstanceInitFunc) maman_base_access_bar_instance_init, NULL };
+       GType maman_base_access_bar_type_id;
+       maman_base_access_bar_type_id = g_type_register_static (MAMAN_BASE_ACCESS_TYPE_FOO, 
"MamanBaseAccessBar", &g_define_type_info, 0);
+       return maman_base_access_bar_type_id;
+}
+
+GType
+maman_base_access_bar_get_type (void)
+{
+       static volatile gsize maman_base_access_bar_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_base_access_bar_type_id__volatile)) {
+               GType maman_base_access_bar_type_id;
+               maman_base_access_bar_type_id = maman_base_access_bar_get_type_once ();
+               g_once_init_leave (&maman_base_access_bar_type_id__volatile, maman_base_access_bar_type_id);
+       }
+       return maman_base_access_bar_type_id__volatile;
+}
+
+static gint
+maman_base_access_foo_bar_real_interface_method (MamanBaseAccessIFoo* base)
+{
+       MamanBaseAccessFooBar * self;
+       gint result = 0;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, MAMAN_BASE_ACCESS_TYPE_FOO_BAR, MamanBaseAccessFooBar);
+       result = (maman_base_access_foo_bar_maman_base_access_ifoo_parent_iface->interface_method 
(G_TYPE_CHECK_INSTANCE_CAST (G_TYPE_CHECK_INSTANCE_CAST (self, MAMAN_BASE_ACCESS_TYPE_FOO, 
MamanBaseAccessFoo), MAMAN_BASE_ACCESS_TYPE_IFOO, MamanBaseAccessIFoo)) * 10) + 6;
+       return result;
+}
+
+static gint
+maman_base_access_foo_bar_real_virtual_interface_method (MamanBaseAccessIFoo* base)
+{
+       MamanBaseAccessFooBar * self;
+       gint result = 0;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, MAMAN_BASE_ACCESS_TYPE_FOO_BAR, MamanBaseAccessFooBar);
+       result = -1;
+       return result;
+}
+
+MamanBaseAccessFooBar*
+maman_base_access_foo_bar_construct (GType object_type)
+{
+       MamanBaseAccessFooBar * self = NULL;
+       self = (MamanBaseAccessFooBar*) maman_base_access_foo_construct (object_type);
+       return self;
+}
+
+MamanBaseAccessFooBar*
+maman_base_access_foo_bar_new (void)
+{
+       return maman_base_access_foo_bar_construct (MAMAN_BASE_ACCESS_TYPE_FOO_BAR);
+}
+
+static void
+maman_base_access_foo_bar_class_init (MamanBaseAccessFooBarClass * klass,
+                                      gpointer klass_data)
+{
+       maman_base_access_foo_bar_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+maman_base_access_foo_bar_maman_base_access_ifoo_interface_init (MamanBaseAccessIFooIface * iface,
+                                                                 gpointer iface_data)
+{
+       maman_base_access_foo_bar_maman_base_access_ifoo_parent_iface = g_type_interface_peek_parent (iface);
+       iface->interface_method = (gint (*) (MamanBaseAccessIFoo*)) 
maman_base_access_foo_bar_real_interface_method;
+       iface->virtual_interface_method = (gint (*) (MamanBaseAccessIFoo*)) 
maman_base_access_foo_bar_real_virtual_interface_method;
+}
+
+static void
+maman_base_access_foo_bar_instance_init (MamanBaseAccessFooBar * self,
+                                         gpointer klass)
+{
+}
+
+static GType
+maman_base_access_foo_bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (MamanBaseAccessFooBarClass), (GBaseInitFunc) 
NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_base_access_foo_bar_class_init, (GClassFinalizeFunc) 
NULL, NULL, sizeof (MamanBaseAccessFooBar), 0, (GInstanceInitFunc) maman_base_access_foo_bar_instance_init, 
NULL };
+       static const GInterfaceInfo maman_base_access_ifoo_info = { (GInterfaceInitFunc) 
maman_base_access_foo_bar_maman_base_access_ifoo_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
+       GType maman_base_access_foo_bar_type_id;
+       maman_base_access_foo_bar_type_id = g_type_register_static (MAMAN_BASE_ACCESS_TYPE_FOO, 
"MamanBaseAccessFooBar", &g_define_type_info, 0);
+       g_type_add_interface_static (maman_base_access_foo_bar_type_id, MAMAN_BASE_ACCESS_TYPE_IFOO, 
&maman_base_access_ifoo_info);
+       return maman_base_access_foo_bar_type_id;
+}
+
+GType
+maman_base_access_foo_bar_get_type (void)
+{
+       static volatile gsize maman_base_access_foo_bar_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_base_access_foo_bar_type_id__volatile)) {
+               GType maman_base_access_foo_bar_type_id;
+               maman_base_access_foo_bar_type_id = maman_base_access_foo_bar_get_type_once ();
+               g_once_init_leave (&maman_base_access_foo_bar_type_id__volatile, 
maman_base_access_foo_bar_type_id);
+       }
+       return maman_base_access_foo_bar_type_id__volatile;
+}
+
+void
+maman_base_access_test (void)
+{
+       MamanBaseAccessBar* bar = NULL;
+       MamanBaseAccessBar* _tmp0_;
+       MamanBaseAccessFooBar* foobar = NULL;
+       MamanBaseAccessFooBar* _tmp1_;
+       _tmp0_ = maman_base_access_bar_new ();
+       bar = _tmp0_;
+       _tmp1_ = maman_base_access_foo_bar_new ();
+       foobar = _tmp1_;
+       _vala_assert (maman_base_access_foo_virtual_method (G_TYPE_CHECK_INSTANCE_CAST (bar, 
MAMAN_BASE_ACCESS_TYPE_FOO, MamanBaseAccessFoo)) == 14, "bar.virtual_method () == 14");
+       _vala_assert (maman_base_access_foo_virtual_interface_method (G_TYPE_CHECK_INSTANCE_CAST (bar, 
MAMAN_BASE_ACCESS_TYPE_FOO, MamanBaseAccessFoo)) == 35, "bar.virtual_interface_method () == 35");
+       _vala_assert (maman_base_access_ifoo_interface_method (G_TYPE_CHECK_INSTANCE_CAST (foobar, 
MAMAN_BASE_ACCESS_TYPE_IFOO, MamanBaseAccessIFoo)) == 26, "foobar.interface_method () == 26");
+       _g_object_unref0 (foobar);
+       _g_object_unref0 (bar);
+}
+
+void
+test_out (gchar* * bar)
+{
+       gchar* _vala_bar = NULL;
+       gchar* _tmp0_;
+       _tmp0_ = g_strdup ("hello");
+       _g_free0 (_vala_bar);
+       _vala_bar = _tmp0_;
+       if (bar) {
+               *bar = _vala_bar;
+       } else {
+               _g_free0 (_vala_bar);
+       }
+}
+
+void
+test_out_weak (const gchar* * bar)
+{
+       const gchar* _vala_bar = NULL;
+       _vala_bar = "hello";
+       if (bar) {
+               *bar = _vala_bar;
+       }
+}
+
+void
+test_ref (gchar* * bar)
+{
+       gchar* _tmp0_;
+       g_return_if_fail (*bar != NULL);
+       _vala_assert (g_strcmp0 (*bar, "hello") == 0, "bar == \"hello\"");
+       _tmp0_ = g_strdup ("world");
+       _g_free0 (*bar);
+       *bar = _tmp0_;
+}
+
+void
+test_ref_weak (const gchar* * bar)
+{
+       g_return_if_fail (*bar != NULL);
+       _vala_assert (g_strcmp0 (*bar, "hello") == 0, "bar == \"hello\"");
+       *bar = "world";
+}
+
+void
+test_out_array_no_length (gchar*** bar)
+{
+       gchar** _vala_bar = NULL;
+       gint _vala_bar_length1 = 0;
+       gchar* _tmp0_;
+       gchar* _tmp1_;
+       gchar** _tmp2_;
+       _tmp0_ = g_strdup ("hello");
+       _tmp1_ = g_strdup ("world");
+       _tmp2_ = g_new0 (gchar*, 2 + 1);
+       _tmp2_[0] = _tmp0_;
+       _tmp2_[1] = _tmp1_;
+       _vala_bar = (g_free (_vala_bar), NULL);
+       _vala_bar = _tmp2_;
+       if (bar) {
+               *bar = _vala_bar;
+       } else {
+               _vala_bar = (g_free (_vala_bar), NULL);
+       }
+}
+
+void
+maman_class_test_class_method (MamanClassTestClass* klass)
+{
+       FILE* _tmp0_;
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, " OK\n");
+}
+
+void
+maman_class_test_instance_method (MamanClassTest* self)
+{
+       FILE* _tmp0_;
+       g_return_if_fail (MAMAN_IS_CLASS_TEST (self));
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, "Access class method in instance method:");
+       maman_class_test_class_method (MAMAN_CLASS_TEST_GET_CLASS (self));
+}
+
+void
+maman_class_test_run_test (void)
+{
+       MamanClassTest* c = NULL;
+       MamanClassTest* _tmp0_;
+       FILE* _tmp1_;
+       _tmp0_ = maman_class_test_new ();
+       c = _tmp0_;
+       _tmp1_ = stdout;
+       fprintf (_tmp1_, "Access class method by member access:");
+       maman_class_test_class_method (MAMAN_CLASS_TEST_GET_CLASS (c));
+       maman_class_test_instance_method (c);
+       _maman_class_test_unref0 (c);
+}
+
+MamanClassTest*
+maman_class_test_construct (GType object_type)
+{
+       MamanClassTest* self = NULL;
+       self = (MamanClassTest*) g_type_create_instance (object_type);
+       return self;
+}
+
+MamanClassTest*
+maman_class_test_new (void)
+{
+       return maman_class_test_construct (MAMAN_TYPE_CLASS_TEST);
+}
+
+static void
+maman_value_class_test_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+maman_value_class_test_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               maman_class_test_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+maman_value_class_test_copy_value (const GValue* src_value,
+                                   GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = maman_class_test_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+maman_value_class_test_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+maman_value_class_test_collect_value (GValue* value,
+                                      guint n_collect_values,
+                                      GTypeCValue* collect_values,
+                                      guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               MamanClassTest * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = maman_class_test_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+maman_value_class_test_lcopy_value (const GValue* value,
+                                    guint n_collect_values,
+                                    GTypeCValue* collect_values,
+                                    guint collect_flags)
+{
+       MamanClassTest ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = maman_class_test_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+maman_param_spec_class_test (const gchar* name,
+                             const gchar* nick,
+                             const gchar* blurb,
+                             GType object_type,
+                             GParamFlags flags)
+{
+       MamanParamSpecClassTest* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, MAMAN_TYPE_CLASS_TEST), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+maman_value_get_class_test (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, MAMAN_TYPE_CLASS_TEST), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+maman_value_set_class_test (GValue* value,
+                            gpointer v_object)
+{
+       MamanClassTest * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, MAMAN_TYPE_CLASS_TEST));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, MAMAN_TYPE_CLASS_TEST));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               maman_class_test_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               maman_class_test_unref (old);
+       }
+}
+
+void
+maman_value_take_class_test (GValue* value,
+                             gpointer v_object)
+{
+       MamanClassTest * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, MAMAN_TYPE_CLASS_TEST));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, MAMAN_TYPE_CLASS_TEST));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               maman_class_test_unref (old);
+       }
+}
+
+static void
+maman_class_test_base_init (MamanClassTestClass * klass)
+{
+       FILE* _tmp0_;
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, "Access class method in class constructor:");
+       maman_class_test_class_method (klass);
+}
+
+static void
+maman_class_test_class_init (MamanClassTestClass * klass,
+                             gpointer klass_data)
+{
+       FILE* _tmp0_;
+       maman_class_test_parent_class = g_type_class_peek_parent (klass);
+       ((MamanClassTestClass *) klass)->finalize = maman_class_test_finalize;
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, "Access class method in static constructor:");
+       maman_class_test_class_method (klass);
+}
+
+static void
+maman_class_test_instance_init (MamanClassTest * self,
+                                gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+maman_class_test_finalize (MamanClassTest * obj)
+{
+       MamanClassTest * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, MAMAN_TYPE_CLASS_TEST, MamanClassTest);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+maman_class_test_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { maman_value_class_test_init, 
maman_value_class_test_free_value, maman_value_class_test_copy_value, maman_value_class_test_peek_pointer, 
"p", maman_value_class_test_collect_value, "p", maman_value_class_test_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (MamanClassTestClass), (GBaseInitFunc) 
maman_class_test_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_class_test_class_init, 
(GClassFinalizeFunc) NULL, NULL, sizeof (MamanClassTest), 0, (GInstanceInitFunc) 
maman_class_test_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType maman_class_test_type_id;
+       maman_class_test_type_id = g_type_register_fundamental (g_type_fundamental_next (), "MamanClassTest", 
&g_define_type_info, &g_define_type_fundamental_info, 0);
+       return maman_class_test_type_id;
+}
+
+GType
+maman_class_test_get_type (void)
+{
+       static volatile gsize maman_class_test_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_class_test_type_id__volatile)) {
+               GType maman_class_test_type_id;
+               maman_class_test_type_id = maman_class_test_get_type_once ();
+               g_once_init_leave (&maman_class_test_type_id__volatile, maman_class_test_type_id);
+       }
+       return maman_class_test_type_id__volatile;
+}
+
+gpointer
+maman_class_test_ref (gpointer instance)
+{
+       MamanClassTest * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+maman_class_test_unref (gpointer instance)
+{
+       MamanClassTest * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               MAMAN_CLASS_TEST_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/objects/paramspec.c-expected b/tests/objects/paramspec.c-expected
new file mode 100644
index 000000000..70a32fa27
--- /dev/null
+++ b/tests/objects/paramspec.c-expected
@@ -0,0 +1,2096 @@
+/* objects_paramspec.c generated by valac, the Vala compiler
+ * generated from objects_paramspec.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+#include <float.h>
+#include <math.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef enum  {
+       FOO_ENUM_FOO = 0,
+       FOO_ENUM_BAR = 42
+} FooEnum;
+
+#define TYPE_FOO_ENUM (foo_enum_get_type ())
+typedef enum  {
+       FOO_FLAG_FOO = 0,
+       FOO_FLAG_BAR = 23
+} FooFlag;
+
+#define TYPE_FOO_FLAG (foo_flag_get_type ())
+
+#define TYPE_FOO_STRUCT (foo_struct_get_type ())
+typedef struct _FooStruct FooStruct;
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_BOOL_PROP_PROPERTY,
+       FOO_BOOL_PROP2_PROPERTY,
+       FOO_CHAR_PROP_PROPERTY,
+       FOO_CHAR_PROP2_PROPERTY,
+       FOO_DOUBLE_PROP_PROPERTY,
+       FOO_DOUBLE_PROP2_PROPERTY,
+       FOO_ENUM_PROP_PROPERTY,
+       FOO_ENUM_PROP2_PROPERTY,
+       FOO_FLAG_PROP_PROPERTY,
+       FOO_FLAG_PROP2_PROPERTY,
+       FOO_FLOAT_PROP_PROPERTY,
+       FOO_FLOAT_PROP2_PROPERTY,
+       FOO_INT_PROP_PROPERTY,
+       FOO_INT_PROP2_PROPERTY,
+       FOO_INT64_PROP_PROPERTY,
+       FOO_INT64_PROP2_PROPERTY,
+       FOO_LONG_PROP_PROPERTY,
+       FOO_LONG_PROP2_PROPERTY,
+       FOO_OBJECT_PROP_PROPERTY,
+       FOO_PARAM_PROP_PROPERTY,
+       FOO_POINTER_PROP_PROPERTY,
+       FOO_STRING_PROP_PROPERTY,
+       FOO_STRING_PROP2_PROPERTY,
+       FOO_UCHAR_PROP_PROPERTY,
+       FOO_UCHAR_PROP2_PROPERTY,
+       FOO_UINT_PROP_PROPERTY,
+       FOO_UINT_PROP2_PROPERTY,
+       FOO_UINT64_PROP_PROPERTY,
+       FOO_UINT64_PROP2_PROPERTY,
+       FOO_ULONG_PROP_PROPERTY,
+       FOO_ULONG_PROP2_PROPERTY,
+       FOO_UNICHAR_PROP_PROPERTY,
+       FOO_GTYPE_PROP_PROPERTY,
+       FOO_GTYPE_PROP2_PROPERTY,
+       FOO_VARIANT_PROP_PROPERTY,
+       FOO_VARIANT_PROP2_PROPERTY,
+       FOO_STRUCT_PROP_PROPERTY,
+       FOO_STRUCT_PROP2_PROPERTY,
+       FOO_STRV_PROP_PROPERTY,
+       FOO_STRV_PROP2_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _g_param_spec_unref0(var) ((var == NULL) ? NULL : (var = (g_param_spec_unref (var), NULL)))
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _FooStruct {
+       gint i;
+};
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _FooPrivate {
+       gboolean _bool_prop;
+       gboolean _bool_prop2;
+       gchar _char_prop;
+       gchar _char_prop2;
+       gdouble _double_prop;
+       gdouble _double_prop2;
+       FooEnum _enum_prop;
+       FooEnum _enum_prop2;
+       FooFlag _flag_prop;
+       FooFlag _flag_prop2;
+       gfloat _float_prop;
+       gfloat _float_prop2;
+       gint _int_prop;
+       gint _int_prop2;
+       gint64 _int64_prop;
+       gint64 _int64_prop2;
+       glong _long_prop;
+       glong _long_prop2;
+       GObject* _object_prop;
+       GParamSpec* _param_prop;
+       void* _pointer_prop;
+       gchar* _string_prop;
+       gchar* _string_prop2;
+       guchar _uchar_prop;
+       guchar _uchar_prop2;
+       guint _uint_prop;
+       guint _uint_prop2;
+       guint64 _uint64_prop;
+       guint64 _uint64_prop2;
+       gulong _ulong_prop;
+       gulong _ulong_prop2;
+       gunichar _unichar_prop;
+       GType _gtype_prop;
+       GType _gtype_prop2;
+       GVariant* _variant_prop;
+       GVariant* _variant_prop2;
+       FooStruct _struct_prop;
+       FooStruct _struct_prop2;
+       gchar** _strv_prop;
+       gint _strv_prop_length1;
+       gint __strv_prop_size_;
+       gchar** _strv_prop2;
+       gint _strv_prop2_length1;
+       gint __strv_prop2_size_;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType foo_enum_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN GType foo_flag_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN GType foo_struct_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN FooStruct* foo_struct_dup (const FooStruct* self);
+VALA_EXTERN void foo_struct_free (FooStruct* self);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+VALA_EXTERN gboolean foo_get_bool_prop (Foo* self);
+VALA_EXTERN void foo_set_bool_prop (Foo* self,
+                        gboolean value);
+VALA_EXTERN gboolean foo_get_bool_prop2 (Foo* self);
+VALA_EXTERN void foo_set_bool_prop2 (Foo* self,
+                         gboolean value);
+VALA_EXTERN gchar foo_get_char_prop (Foo* self);
+VALA_EXTERN void foo_set_char_prop (Foo* self,
+                        gchar value);
+VALA_EXTERN gchar foo_get_char_prop2 (Foo* self);
+VALA_EXTERN void foo_set_char_prop2 (Foo* self,
+                         gchar value);
+VALA_EXTERN gdouble foo_get_double_prop (Foo* self);
+VALA_EXTERN void foo_set_double_prop (Foo* self,
+                          gdouble value);
+VALA_EXTERN gdouble foo_get_double_prop2 (Foo* self);
+VALA_EXTERN void foo_set_double_prop2 (Foo* self,
+                           gdouble value);
+VALA_EXTERN FooEnum foo_get_enum_prop (Foo* self);
+VALA_EXTERN void foo_set_enum_prop (Foo* self,
+                        FooEnum value);
+VALA_EXTERN FooEnum foo_get_enum_prop2 (Foo* self);
+VALA_EXTERN void foo_set_enum_prop2 (Foo* self,
+                         FooEnum value);
+VALA_EXTERN FooFlag foo_get_flag_prop (Foo* self);
+VALA_EXTERN void foo_set_flag_prop (Foo* self,
+                        FooFlag value);
+VALA_EXTERN FooFlag foo_get_flag_prop2 (Foo* self);
+VALA_EXTERN void foo_set_flag_prop2 (Foo* self,
+                         FooFlag value);
+VALA_EXTERN gfloat foo_get_float_prop (Foo* self);
+VALA_EXTERN void foo_set_float_prop (Foo* self,
+                         gfloat value);
+VALA_EXTERN gfloat foo_get_float_prop2 (Foo* self);
+VALA_EXTERN void foo_set_float_prop2 (Foo* self,
+                          gfloat value);
+VALA_EXTERN gint foo_get_int_prop (Foo* self);
+VALA_EXTERN void foo_set_int_prop (Foo* self,
+                       gint value);
+VALA_EXTERN gint foo_get_int_prop2 (Foo* self);
+VALA_EXTERN void foo_set_int_prop2 (Foo* self,
+                        gint value);
+VALA_EXTERN gint64 foo_get_int64_prop (Foo* self);
+VALA_EXTERN void foo_set_int64_prop (Foo* self,
+                         gint64 value);
+VALA_EXTERN gint64 foo_get_int64_prop2 (Foo* self);
+VALA_EXTERN void foo_set_int64_prop2 (Foo* self,
+                          gint64 value);
+VALA_EXTERN glong foo_get_long_prop (Foo* self);
+VALA_EXTERN void foo_set_long_prop (Foo* self,
+                        glong value);
+VALA_EXTERN glong foo_get_long_prop2 (Foo* self);
+VALA_EXTERN void foo_set_long_prop2 (Foo* self,
+                         glong value);
+VALA_EXTERN GObject* foo_get_object_prop (Foo* self);
+VALA_EXTERN void foo_set_object_prop (Foo* self,
+                          GObject* value);
+VALA_EXTERN GParamSpec* foo_get_param_prop (Foo* self);
+VALA_EXTERN void foo_set_param_prop (Foo* self,
+                         GParamSpec* value);
+VALA_EXTERN void* foo_get_pointer_prop (Foo* self);
+VALA_EXTERN void foo_set_pointer_prop (Foo* self,
+                           void* value);
+VALA_EXTERN const gchar* foo_get_string_prop (Foo* self);
+VALA_EXTERN void foo_set_string_prop (Foo* self,
+                          const gchar* value);
+VALA_EXTERN const gchar* foo_get_string_prop2 (Foo* self);
+VALA_EXTERN void foo_set_string_prop2 (Foo* self,
+                           const gchar* value);
+VALA_EXTERN guchar foo_get_uchar_prop (Foo* self);
+VALA_EXTERN void foo_set_uchar_prop (Foo* self,
+                         guchar value);
+VALA_EXTERN guchar foo_get_uchar_prop2 (Foo* self);
+VALA_EXTERN void foo_set_uchar_prop2 (Foo* self,
+                          guchar value);
+VALA_EXTERN guint foo_get_uint_prop (Foo* self);
+VALA_EXTERN void foo_set_uint_prop (Foo* self,
+                        guint value);
+VALA_EXTERN guint foo_get_uint_prop2 (Foo* self);
+VALA_EXTERN void foo_set_uint_prop2 (Foo* self,
+                         guint value);
+VALA_EXTERN guint64 foo_get_uint64_prop (Foo* self);
+VALA_EXTERN void foo_set_uint64_prop (Foo* self,
+                          guint64 value);
+VALA_EXTERN guint64 foo_get_uint64_prop2 (Foo* self);
+VALA_EXTERN void foo_set_uint64_prop2 (Foo* self,
+                           guint64 value);
+VALA_EXTERN gulong foo_get_ulong_prop (Foo* self);
+VALA_EXTERN void foo_set_ulong_prop (Foo* self,
+                         gulong value);
+VALA_EXTERN gulong foo_get_ulong_prop2 (Foo* self);
+VALA_EXTERN void foo_set_ulong_prop2 (Foo* self,
+                          gulong value);
+VALA_EXTERN gunichar foo_get_unichar_prop (Foo* self);
+VALA_EXTERN void foo_set_unichar_prop (Foo* self,
+                           gunichar value);
+VALA_EXTERN GType foo_get_gtype_prop (Foo* self);
+VALA_EXTERN void foo_set_gtype_prop (Foo* self,
+                         GType value);
+VALA_EXTERN GType foo_get_gtype_prop2 (Foo* self);
+VALA_EXTERN void foo_set_gtype_prop2 (Foo* self,
+                          GType value);
+VALA_EXTERN GVariant* foo_get_variant_prop (Foo* self);
+VALA_EXTERN void foo_set_variant_prop (Foo* self,
+                           GVariant* value);
+VALA_EXTERN GVariant* foo_get_variant_prop2 (Foo* self);
+VALA_EXTERN void foo_set_variant_prop2 (Foo* self,
+                            GVariant* value);
+VALA_EXTERN void foo_get_struct_prop (Foo* self,
+                          FooStruct * result);
+VALA_EXTERN void foo_set_struct_prop (Foo* self,
+                          FooStruct * value);
+static gboolean _foo_struct_equal (const FooStruct * s1,
+                            const FooStruct * s2);
+VALA_EXTERN void foo_get_struct_prop2 (Foo* self,
+                           FooStruct * result);
+VALA_EXTERN void foo_set_struct_prop2 (Foo* self,
+                           FooStruct * value);
+VALA_EXTERN gchar** foo_get_strv_prop (Foo* self,
+                           gint* result_length1);
+VALA_EXTERN void foo_set_strv_prop (Foo* self,
+                        gchar** value,
+                        gint value_length1);
+static gchar** _vala_array_dup1 (gchar** self,
+                          gssize length);
+VALA_EXTERN gchar** foo_get_strv_prop2 (Foo* self,
+                            gint* result_length1);
+VALA_EXTERN void foo_set_strv_prop2 (Foo* self,
+                         gchar** value,
+                         gint value_length1);
+static gchar** _vala_array_dup2 (gchar** self,
+                          gssize length);
+static void foo_finalize (GObject * obj);
+static GType foo_get_type_once (void);
+static void _vala_foo_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_foo_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec);
+static void _vala_main (void);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static GType
+foo_enum_get_type_once (void)
+{
+       static const GEnumValue values[] = {{FOO_ENUM_FOO, "FOO_ENUM_FOO", "foo"}, {FOO_ENUM_BAR, 
"FOO_ENUM_BAR", "bar"}, {0, NULL, NULL}};
+       GType foo_enum_type_id;
+       foo_enum_type_id = g_enum_register_static ("FooEnum", values);
+       return foo_enum_type_id;
+}
+
+GType
+foo_enum_get_type (void)
+{
+       static volatile gsize foo_enum_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_enum_type_id__volatile)) {
+               GType foo_enum_type_id;
+               foo_enum_type_id = foo_enum_get_type_once ();
+               g_once_init_leave (&foo_enum_type_id__volatile, foo_enum_type_id);
+       }
+       return foo_enum_type_id__volatile;
+}
+
+static GType
+foo_flag_get_type_once (void)
+{
+       static const GFlagsValue values[] = {{FOO_FLAG_FOO, "FOO_FLAG_FOO", "foo"}, {FOO_FLAG_BAR, 
"FOO_FLAG_BAR", "bar"}, {0, NULL, NULL}};
+       GType foo_flag_type_id;
+       foo_flag_type_id = g_flags_register_static ("FooFlag", values);
+       return foo_flag_type_id;
+}
+
+GType
+foo_flag_get_type (void)
+{
+       static volatile gsize foo_flag_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_flag_type_id__volatile)) {
+               GType foo_flag_type_id;
+               foo_flag_type_id = foo_flag_get_type_once ();
+               g_once_init_leave (&foo_flag_type_id__volatile, foo_flag_type_id);
+       }
+       return foo_flag_type_id__volatile;
+}
+
+FooStruct*
+foo_struct_dup (const FooStruct* self)
+{
+       FooStruct* dup;
+       dup = g_new0 (FooStruct, 1);
+       memcpy (dup, self, sizeof (FooStruct));
+       return dup;
+}
+
+void
+foo_struct_free (FooStruct* self)
+{
+       g_free (self);
+}
+
+static GType
+foo_struct_get_type_once (void)
+{
+       GType foo_struct_type_id;
+       foo_struct_type_id = g_boxed_type_register_static ("FooStruct", (GBoxedCopyFunc) foo_struct_dup, 
(GBoxedFreeFunc) foo_struct_free);
+       return foo_struct_type_id;
+}
+
+GType
+foo_struct_get_type (void)
+{
+       static volatile gsize foo_struct_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_struct_type_id__volatile)) {
+               GType foo_struct_type_id;
+               foo_struct_type_id = foo_struct_get_type_once ();
+               g_once_init_leave (&foo_struct_type_id__volatile, foo_struct_type_id);
+       }
+       return foo_struct_type_id__volatile;
+}
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+gboolean
+foo_get_bool_prop (Foo* self)
+{
+       gboolean result;
+       g_return_val_if_fail (IS_FOO (self), FALSE);
+       result = self->priv->_bool_prop;
+       return result;
+}
+
+void
+foo_set_bool_prop (Foo* self,
+                   gboolean value)
+{
+       gboolean old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_bool_prop (self);
+       if (old_value != value) {
+               self->priv->_bool_prop = value;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_BOOL_PROP_PROPERTY]);
+       }
+}
+
+gboolean
+foo_get_bool_prop2 (Foo* self)
+{
+       gboolean result;
+       g_return_val_if_fail (IS_FOO (self), FALSE);
+       result = self->priv->_bool_prop2;
+       return result;
+}
+
+void
+foo_set_bool_prop2 (Foo* self,
+                    gboolean value)
+{
+       gboolean old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_bool_prop2 (self);
+       if (old_value != value) {
+               self->priv->_bool_prop2 = value;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_BOOL_PROP2_PROPERTY]);
+       }
+}
+
+gchar
+foo_get_char_prop (Foo* self)
+{
+       gchar result;
+       g_return_val_if_fail (IS_FOO (self), '\0');
+       result = self->priv->_char_prop;
+       return result;
+}
+
+void
+foo_set_char_prop (Foo* self,
+                   gchar value)
+{
+       gchar old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_char_prop (self);
+       if (old_value != value) {
+               self->priv->_char_prop = value;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_CHAR_PROP_PROPERTY]);
+       }
+}
+
+gchar
+foo_get_char_prop2 (Foo* self)
+{
+       gchar result;
+       g_return_val_if_fail (IS_FOO (self), '\0');
+       result = self->priv->_char_prop2;
+       return result;
+}
+
+void
+foo_set_char_prop2 (Foo* self,
+                    gchar value)
+{
+       gchar old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_char_prop2 (self);
+       if (old_value != value) {
+               self->priv->_char_prop2 = value;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_CHAR_PROP2_PROPERTY]);
+       }
+}
+
+gdouble
+foo_get_double_prop (Foo* self)
+{
+       gdouble result;
+       g_return_val_if_fail (IS_FOO (self), 0.0);
+       result = self->priv->_double_prop;
+       return result;
+}
+
+void
+foo_set_double_prop (Foo* self,
+                     gdouble value)
+{
+       gdouble old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_double_prop (self);
+       if (old_value != value) {
+               self->priv->_double_prop = value;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_DOUBLE_PROP_PROPERTY]);
+       }
+}
+
+gdouble
+foo_get_double_prop2 (Foo* self)
+{
+       gdouble result;
+       g_return_val_if_fail (IS_FOO (self), 0.0);
+       result = self->priv->_double_prop2;
+       return result;
+}
+
+void
+foo_set_double_prop2 (Foo* self,
+                      gdouble value)
+{
+       gdouble old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_double_prop2 (self);
+       if (old_value != value) {
+               self->priv->_double_prop2 = value;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_DOUBLE_PROP2_PROPERTY]);
+       }
+}
+
+FooEnum
+foo_get_enum_prop (Foo* self)
+{
+       FooEnum result;
+       FooEnum _tmp0_;
+       g_return_val_if_fail (IS_FOO (self), 0);
+       _tmp0_ = self->priv->_enum_prop;
+       result = _tmp0_;
+       return result;
+}
+
+void
+foo_set_enum_prop (Foo* self,
+                   FooEnum value)
+{
+       FooEnum old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_enum_prop (self);
+       if (old_value != value) {
+               self->priv->_enum_prop = value;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_ENUM_PROP_PROPERTY]);
+       }
+}
+
+FooEnum
+foo_get_enum_prop2 (Foo* self)
+{
+       FooEnum result;
+       FooEnum _tmp0_;
+       g_return_val_if_fail (IS_FOO (self), 0);
+       _tmp0_ = self->priv->_enum_prop2;
+       result = _tmp0_;
+       return result;
+}
+
+void
+foo_set_enum_prop2 (Foo* self,
+                    FooEnum value)
+{
+       FooEnum old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_enum_prop2 (self);
+       if (old_value != value) {
+               self->priv->_enum_prop2 = value;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_ENUM_PROP2_PROPERTY]);
+       }
+}
+
+FooFlag
+foo_get_flag_prop (Foo* self)
+{
+       FooFlag result;
+       FooFlag _tmp0_;
+       g_return_val_if_fail (IS_FOO (self), 0U);
+       _tmp0_ = self->priv->_flag_prop;
+       result = _tmp0_;
+       return result;
+}
+
+void
+foo_set_flag_prop (Foo* self,
+                   FooFlag value)
+{
+       FooFlag old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_flag_prop (self);
+       if (old_value != value) {
+               self->priv->_flag_prop = value;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_FLAG_PROP_PROPERTY]);
+       }
+}
+
+FooFlag
+foo_get_flag_prop2 (Foo* self)
+{
+       FooFlag result;
+       FooFlag _tmp0_;
+       g_return_val_if_fail (IS_FOO (self), 0U);
+       _tmp0_ = self->priv->_flag_prop2;
+       result = _tmp0_;
+       return result;
+}
+
+void
+foo_set_flag_prop2 (Foo* self,
+                    FooFlag value)
+{
+       FooFlag old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_flag_prop2 (self);
+       if (old_value != value) {
+               self->priv->_flag_prop2 = value;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_FLAG_PROP2_PROPERTY]);
+       }
+}
+
+gfloat
+foo_get_float_prop (Foo* self)
+{
+       gfloat result;
+       g_return_val_if_fail (IS_FOO (self), 0.0F);
+       result = self->priv->_float_prop;
+       return result;
+}
+
+void
+foo_set_float_prop (Foo* self,
+                    gfloat value)
+{
+       gfloat old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_float_prop (self);
+       if (old_value != value) {
+               self->priv->_float_prop = value;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_FLOAT_PROP_PROPERTY]);
+       }
+}
+
+gfloat
+foo_get_float_prop2 (Foo* self)
+{
+       gfloat result;
+       g_return_val_if_fail (IS_FOO (self), 0.0F);
+       result = self->priv->_float_prop2;
+       return result;
+}
+
+void
+foo_set_float_prop2 (Foo* self,
+                     gfloat value)
+{
+       gfloat old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_float_prop2 (self);
+       if (old_value != value) {
+               self->priv->_float_prop2 = value;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_FLOAT_PROP2_PROPERTY]);
+       }
+}
+
+gint
+foo_get_int_prop (Foo* self)
+{
+       gint result;
+       g_return_val_if_fail (IS_FOO (self), 0);
+       result = self->priv->_int_prop;
+       return result;
+}
+
+void
+foo_set_int_prop (Foo* self,
+                  gint value)
+{
+       gint old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_int_prop (self);
+       if (old_value != value) {
+               self->priv->_int_prop = value;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_INT_PROP_PROPERTY]);
+       }
+}
+
+gint
+foo_get_int_prop2 (Foo* self)
+{
+       gint result;
+       g_return_val_if_fail (IS_FOO (self), 0);
+       result = self->priv->_int_prop2;
+       return result;
+}
+
+void
+foo_set_int_prop2 (Foo* self,
+                   gint value)
+{
+       gint old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_int_prop2 (self);
+       if (old_value != value) {
+               self->priv->_int_prop2 = value;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_INT_PROP2_PROPERTY]);
+       }
+}
+
+gint64
+foo_get_int64_prop (Foo* self)
+{
+       gint64 result;
+       g_return_val_if_fail (IS_FOO (self), 0LL);
+       result = self->priv->_int64_prop;
+       return result;
+}
+
+void
+foo_set_int64_prop (Foo* self,
+                    gint64 value)
+{
+       gint64 old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_int64_prop (self);
+       if (old_value != value) {
+               self->priv->_int64_prop = value;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_INT64_PROP_PROPERTY]);
+       }
+}
+
+gint64
+foo_get_int64_prop2 (Foo* self)
+{
+       gint64 result;
+       g_return_val_if_fail (IS_FOO (self), 0LL);
+       result = self->priv->_int64_prop2;
+       return result;
+}
+
+void
+foo_set_int64_prop2 (Foo* self,
+                     gint64 value)
+{
+       gint64 old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_int64_prop2 (self);
+       if (old_value != value) {
+               self->priv->_int64_prop2 = value;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_INT64_PROP2_PROPERTY]);
+       }
+}
+
+glong
+foo_get_long_prop (Foo* self)
+{
+       glong result;
+       g_return_val_if_fail (IS_FOO (self), 0L);
+       result = self->priv->_long_prop;
+       return result;
+}
+
+void
+foo_set_long_prop (Foo* self,
+                   glong value)
+{
+       glong old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_long_prop (self);
+       if (old_value != value) {
+               self->priv->_long_prop = value;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_LONG_PROP_PROPERTY]);
+       }
+}
+
+glong
+foo_get_long_prop2 (Foo* self)
+{
+       glong result;
+       g_return_val_if_fail (IS_FOO (self), 0L);
+       result = self->priv->_long_prop2;
+       return result;
+}
+
+void
+foo_set_long_prop2 (Foo* self,
+                    glong value)
+{
+       glong old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_long_prop2 (self);
+       if (old_value != value) {
+               self->priv->_long_prop2 = value;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_LONG_PROP2_PROPERTY]);
+       }
+}
+
+GObject*
+foo_get_object_prop (Foo* self)
+{
+       GObject* result;
+       GObject* _tmp0_;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = self->priv->_object_prop;
+       result = _tmp0_;
+       return result;
+}
+
+static gpointer
+_g_object_ref0 (gpointer self)
+{
+       return self ? g_object_ref (self) : NULL;
+}
+
+void
+foo_set_object_prop (Foo* self,
+                     GObject* value)
+{
+       GObject* old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_object_prop (self);
+       if (old_value != value) {
+               GObject* _tmp0_;
+               _tmp0_ = _g_object_ref0 (value);
+               _g_object_unref0 (self->priv->_object_prop);
+               self->priv->_object_prop = _tmp0_;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_OBJECT_PROP_PROPERTY]);
+       }
+}
+
+GParamSpec*
+foo_get_param_prop (Foo* self)
+{
+       GParamSpec* result;
+       GParamSpec* _tmp0_;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = self->priv->_param_prop;
+       result = _tmp0_;
+       return result;
+}
+
+static gpointer
+_g_param_spec_ref0 (gpointer self)
+{
+       return self ? g_param_spec_ref (self) : NULL;
+}
+
+void
+foo_set_param_prop (Foo* self,
+                    GParamSpec* value)
+{
+       GParamSpec* old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_param_prop (self);
+       if (old_value != value) {
+               GParamSpec* _tmp0_;
+               _tmp0_ = _g_param_spec_ref0 (value);
+               _g_param_spec_unref0 (self->priv->_param_prop);
+               self->priv->_param_prop = _tmp0_;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_PARAM_PROP_PROPERTY]);
+       }
+}
+
+void*
+foo_get_pointer_prop (Foo* self)
+{
+       void* result;
+       void* _tmp0_;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = self->priv->_pointer_prop;
+       result = _tmp0_;
+       return result;
+}
+
+void
+foo_set_pointer_prop (Foo* self,
+                      void* value)
+{
+       void* old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_pointer_prop (self);
+       if (old_value != value) {
+               self->priv->_pointer_prop = value;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_POINTER_PROP_PROPERTY]);
+       }
+}
+
+const gchar*
+foo_get_string_prop (Foo* self)
+{
+       const gchar* result;
+       const gchar* _tmp0_;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = self->priv->_string_prop;
+       result = _tmp0_;
+       return result;
+}
+
+void
+foo_set_string_prop (Foo* self,
+                     const gchar* value)
+{
+       gchar* old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_string_prop (self);
+       if (g_strcmp0 (value, old_value) != 0) {
+               gchar* _tmp0_;
+               _tmp0_ = g_strdup (value);
+               _g_free0 (self->priv->_string_prop);
+               self->priv->_string_prop = _tmp0_;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_STRING_PROP_PROPERTY]);
+       }
+}
+
+const gchar*
+foo_get_string_prop2 (Foo* self)
+{
+       const gchar* result;
+       const gchar* _tmp0_;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = self->priv->_string_prop2;
+       result = _tmp0_;
+       return result;
+}
+
+void
+foo_set_string_prop2 (Foo* self,
+                      const gchar* value)
+{
+       gchar* old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_string_prop2 (self);
+       if (g_strcmp0 (value, old_value) != 0) {
+               gchar* _tmp0_;
+               _tmp0_ = g_strdup (value);
+               _g_free0 (self->priv->_string_prop2);
+               self->priv->_string_prop2 = _tmp0_;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_STRING_PROP2_PROPERTY]);
+       }
+}
+
+guchar
+foo_get_uchar_prop (Foo* self)
+{
+       guchar result;
+       g_return_val_if_fail (IS_FOO (self), '\0');
+       result = self->priv->_uchar_prop;
+       return result;
+}
+
+void
+foo_set_uchar_prop (Foo* self,
+                    guchar value)
+{
+       guchar old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_uchar_prop (self);
+       if (old_value != value) {
+               self->priv->_uchar_prop = value;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_UCHAR_PROP_PROPERTY]);
+       }
+}
+
+guchar
+foo_get_uchar_prop2 (Foo* self)
+{
+       guchar result;
+       g_return_val_if_fail (IS_FOO (self), '\0');
+       result = self->priv->_uchar_prop2;
+       return result;
+}
+
+void
+foo_set_uchar_prop2 (Foo* self,
+                     guchar value)
+{
+       guchar old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_uchar_prop2 (self);
+       if (old_value != value) {
+               self->priv->_uchar_prop2 = value;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_UCHAR_PROP2_PROPERTY]);
+       }
+}
+
+guint
+foo_get_uint_prop (Foo* self)
+{
+       guint result;
+       g_return_val_if_fail (IS_FOO (self), 0U);
+       result = self->priv->_uint_prop;
+       return result;
+}
+
+void
+foo_set_uint_prop (Foo* self,
+                   guint value)
+{
+       guint old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_uint_prop (self);
+       if (old_value != value) {
+               self->priv->_uint_prop = value;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_UINT_PROP_PROPERTY]);
+       }
+}
+
+guint
+foo_get_uint_prop2 (Foo* self)
+{
+       guint result;
+       g_return_val_if_fail (IS_FOO (self), 0U);
+       result = self->priv->_uint_prop2;
+       return result;
+}
+
+void
+foo_set_uint_prop2 (Foo* self,
+                    guint value)
+{
+       guint old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_uint_prop2 (self);
+       if (old_value != value) {
+               self->priv->_uint_prop2 = value;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_UINT_PROP2_PROPERTY]);
+       }
+}
+
+guint64
+foo_get_uint64_prop (Foo* self)
+{
+       guint64 result;
+       g_return_val_if_fail (IS_FOO (self), 0ULL);
+       result = self->priv->_uint64_prop;
+       return result;
+}
+
+void
+foo_set_uint64_prop (Foo* self,
+                     guint64 value)
+{
+       guint64 old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_uint64_prop (self);
+       if (old_value != value) {
+               self->priv->_uint64_prop = value;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_UINT64_PROP_PROPERTY]);
+       }
+}
+
+guint64
+foo_get_uint64_prop2 (Foo* self)
+{
+       guint64 result;
+       g_return_val_if_fail (IS_FOO (self), 0ULL);
+       result = self->priv->_uint64_prop2;
+       return result;
+}
+
+void
+foo_set_uint64_prop2 (Foo* self,
+                      guint64 value)
+{
+       guint64 old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_uint64_prop2 (self);
+       if (old_value != value) {
+               self->priv->_uint64_prop2 = value;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_UINT64_PROP2_PROPERTY]);
+       }
+}
+
+gulong
+foo_get_ulong_prop (Foo* self)
+{
+       gulong result;
+       g_return_val_if_fail (IS_FOO (self), 0UL);
+       result = self->priv->_ulong_prop;
+       return result;
+}
+
+void
+foo_set_ulong_prop (Foo* self,
+                    gulong value)
+{
+       gulong old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_ulong_prop (self);
+       if (old_value != value) {
+               self->priv->_ulong_prop = value;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_ULONG_PROP_PROPERTY]);
+       }
+}
+
+gulong
+foo_get_ulong_prop2 (Foo* self)
+{
+       gulong result;
+       g_return_val_if_fail (IS_FOO (self), 0UL);
+       result = self->priv->_ulong_prop2;
+       return result;
+}
+
+void
+foo_set_ulong_prop2 (Foo* self,
+                     gulong value)
+{
+       gulong old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_ulong_prop2 (self);
+       if (old_value != value) {
+               self->priv->_ulong_prop2 = value;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_ULONG_PROP2_PROPERTY]);
+       }
+}
+
+gunichar
+foo_get_unichar_prop (Foo* self)
+{
+       gunichar result;
+       g_return_val_if_fail (IS_FOO (self), 0U);
+       result = self->priv->_unichar_prop;
+       return result;
+}
+
+void
+foo_set_unichar_prop (Foo* self,
+                      gunichar value)
+{
+       gunichar old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_unichar_prop (self);
+       if (old_value != value) {
+               self->priv->_unichar_prop = value;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_UNICHAR_PROP_PROPERTY]);
+       }
+}
+
+GType
+foo_get_gtype_prop (Foo* self)
+{
+       GType result;
+       g_return_val_if_fail (IS_FOO (self), 0UL);
+       result = self->priv->_gtype_prop;
+       return result;
+}
+
+void
+foo_set_gtype_prop (Foo* self,
+                    GType value)
+{
+       GType old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_gtype_prop (self);
+       if (old_value != value) {
+               self->priv->_gtype_prop = value;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_GTYPE_PROP_PROPERTY]);
+       }
+}
+
+GType
+foo_get_gtype_prop2 (Foo* self)
+{
+       GType result;
+       g_return_val_if_fail (IS_FOO (self), 0UL);
+       result = self->priv->_gtype_prop2;
+       return result;
+}
+
+void
+foo_set_gtype_prop2 (Foo* self,
+                     GType value)
+{
+       GType old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_gtype_prop2 (self);
+       if (old_value != value) {
+               self->priv->_gtype_prop2 = value;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_GTYPE_PROP2_PROPERTY]);
+       }
+}
+
+GVariant*
+foo_get_variant_prop (Foo* self)
+{
+       GVariant* result;
+       GVariant* _tmp0_;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = self->priv->_variant_prop;
+       result = _tmp0_;
+       return result;
+}
+
+static gpointer
+_g_variant_ref0 (gpointer self)
+{
+       return self ? g_variant_ref (self) : NULL;
+}
+
+void
+foo_set_variant_prop (Foo* self,
+                      GVariant* value)
+{
+       GVariant* old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_variant_prop (self);
+       if (old_value != value) {
+               GVariant* _tmp0_;
+               _tmp0_ = _g_variant_ref0 (value);
+               _g_variant_unref0 (self->priv->_variant_prop);
+               self->priv->_variant_prop = _tmp0_;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_VARIANT_PROP_PROPERTY]);
+       }
+}
+
+GVariant*
+foo_get_variant_prop2 (Foo* self)
+{
+       GVariant* result;
+       GVariant* _tmp0_;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = self->priv->_variant_prop2;
+       result = _tmp0_;
+       return result;
+}
+
+void
+foo_set_variant_prop2 (Foo* self,
+                       GVariant* value)
+{
+       GVariant* old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_variant_prop2 (self);
+       if (old_value != value) {
+               GVariant* _tmp0_;
+               _tmp0_ = _g_variant_ref0 (value);
+               _g_variant_unref0 (self->priv->_variant_prop2);
+               self->priv->_variant_prop2 = _tmp0_;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_VARIANT_PROP2_PROPERTY]);
+       }
+}
+
+void
+foo_get_struct_prop (Foo* self,
+                     FooStruct * result)
+{
+       FooStruct _tmp0_;
+       g_return_if_fail (IS_FOO (self));
+       _tmp0_ = self->priv->_struct_prop;
+       *result = _tmp0_;
+       return;
+}
+
+static gboolean
+_foo_struct_equal (const FooStruct * s1,
+                   const FooStruct * s2)
+{
+       if (s1 == s2) {
+               return TRUE;
+       }
+       if (s1 == NULL) {
+               return FALSE;
+       }
+       if (s2 == NULL) {
+               return FALSE;
+       }
+       if (s1->i != s2->i) {
+               return FALSE;
+       }
+       return TRUE;
+}
+
+void
+foo_set_struct_prop (Foo* self,
+                     FooStruct * value)
+{
+       FooStruct old_value;
+       g_return_if_fail (IS_FOO (self));
+       foo_get_struct_prop (self, &old_value);
+       if (_foo_struct_equal (value, &old_value) != TRUE) {
+               FooStruct _tmp0_;
+               _tmp0_ = *value;
+               self->priv->_struct_prop = _tmp0_;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_STRUCT_PROP_PROPERTY]);
+       }
+}
+
+void
+foo_get_struct_prop2 (Foo* self,
+                      FooStruct * result)
+{
+       FooStruct _tmp0_;
+       g_return_if_fail (IS_FOO (self));
+       _tmp0_ = self->priv->_struct_prop2;
+       *result = _tmp0_;
+       return;
+}
+
+void
+foo_set_struct_prop2 (Foo* self,
+                      FooStruct * value)
+{
+       FooStruct old_value;
+       g_return_if_fail (IS_FOO (self));
+       foo_get_struct_prop2 (self, &old_value);
+       if (_foo_struct_equal (value, &old_value) != TRUE) {
+               FooStruct _tmp0_;
+               _tmp0_ = *value;
+               self->priv->_struct_prop2 = _tmp0_;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_STRUCT_PROP2_PROPERTY]);
+       }
+}
+
+gchar**
+foo_get_strv_prop (Foo* self,
+                   gint* result_length1)
+{
+       gchar** result;
+       gchar** _tmp0_;
+       gint _tmp0__length1;
+       gchar** _tmp1_;
+       gint _tmp1__length1;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = self->priv->_strv_prop;
+       _tmp0__length1 = self->priv->_strv_prop_length1;
+       _tmp1_ = _tmp0_;
+       _tmp1__length1 = _tmp0__length1;
+       if (result_length1) {
+               *result_length1 = _tmp1__length1;
+       }
+       result = _tmp1_;
+       return result;
+}
+
+static gchar**
+_vala_array_dup1 (gchar** self,
+                  gssize length)
+{
+       if (length >= 0) {
+               gchar** result;
+               gssize i;
+               result = g_new0 (gchar*, length + 1);
+               for (i = 0; i < length; i++) {
+                       gchar* _tmp0_;
+                       _tmp0_ = g_strdup (self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+void
+foo_set_strv_prop (Foo* self,
+                   gchar** value,
+                   gint value_length1)
+{
+       gchar** old_value;
+       gint old_value_length;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_strv_prop (self, &old_value_length);
+       if (old_value != value) {
+               gchar** _tmp0_;
+               gint _tmp0__length1;
+               _tmp0_ = (value != NULL) ? _vala_array_dup1 (value, value_length1) : value;
+               _tmp0__length1 = value_length1;
+               self->priv->_strv_prop = (_vala_array_free (self->priv->_strv_prop, 
self->priv->_strv_prop_length1, (GDestroyNotify) g_free), NULL);
+               self->priv->_strv_prop = _tmp0_;
+               self->priv->_strv_prop_length1 = _tmp0__length1;
+               self->priv->__strv_prop_size_ = self->priv->_strv_prop_length1;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_STRV_PROP_PROPERTY]);
+       }
+}
+
+gchar**
+foo_get_strv_prop2 (Foo* self,
+                    gint* result_length1)
+{
+       gchar** result;
+       gchar** _tmp0_;
+       gint _tmp0__length1;
+       gchar** _tmp1_;
+       gint _tmp1__length1;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = self->priv->_strv_prop2;
+       _tmp0__length1 = self->priv->_strv_prop2_length1;
+       _tmp1_ = _tmp0_;
+       _tmp1__length1 = _tmp0__length1;
+       if (result_length1) {
+               *result_length1 = _tmp1__length1;
+       }
+       result = _tmp1_;
+       return result;
+}
+
+static gchar**
+_vala_array_dup2 (gchar** self,
+                  gssize length)
+{
+       if (length >= 0) {
+               gchar** result;
+               gssize i;
+               result = g_new0 (gchar*, length + 1);
+               for (i = 0; i < length; i++) {
+                       gchar* _tmp0_;
+                       _tmp0_ = g_strdup (self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+void
+foo_set_strv_prop2 (Foo* self,
+                    gchar** value,
+                    gint value_length1)
+{
+       gchar** old_value;
+       gint old_value_length;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_strv_prop2 (self, &old_value_length);
+       if (old_value != value) {
+               gchar** _tmp0_;
+               gint _tmp0__length1;
+               _tmp0_ = (value != NULL) ? _vala_array_dup2 (value, value_length1) : value;
+               _tmp0__length1 = value_length1;
+               self->priv->_strv_prop2 = (_vala_array_free (self->priv->_strv_prop2, 
self->priv->_strv_prop2_length1, (GDestroyNotify) g_free), NULL);
+               self->priv->_strv_prop2 = _tmp0_;
+               self->priv->_strv_prop2_length1 = _tmp0__length1;
+               self->priv->__strv_prop2_size_ = self->priv->_strv_prop2_length1;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_STRV_PROP2_PROPERTY]);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_foo_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_foo_set_property;
+       G_OBJECT_CLASS (klass)->finalize = foo_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_BOOL_PROP_PROPERTY, 
foo_properties[FOO_BOOL_PROP_PROPERTY] = g_param_spec_boolean ("bool-prop", "bool-prop", "bool-prop", FALSE, 
G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_BOOL_PROP2_PROPERTY, 
foo_properties[FOO_BOOL_PROP2_PROPERTY] = g_param_spec_boolean ("bool-prop2", "bool-prop2", "bool-prop2", 
TRUE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_CHAR_PROP_PROPERTY, 
foo_properties[FOO_CHAR_PROP_PROPERTY] = g_param_spec_char ("char-prop", "char-prop", "char-prop", G_MININT8, 
G_MAXINT8, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_CHAR_PROP2_PROPERTY, 
foo_properties[FOO_CHAR_PROP2_PROPERTY] = g_param_spec_char ("char-prop2", "char-prop2", "char-prop2", 
G_MININT8, G_MAXINT8, 'c', G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_DOUBLE_PROP_PROPERTY, 
foo_properties[FOO_DOUBLE_PROP_PROPERTY] = g_param_spec_double ("double-prop", "double-prop", "double-prop", 
-G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_DOUBLE_PROP2_PROPERTY, 
foo_properties[FOO_DOUBLE_PROP2_PROPERTY] = g_param_spec_double ("double-prop2", "double-prop2", 
"double-prop2", -G_MAXDOUBLE, G_MAXDOUBLE, 3.1415, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | 
G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_ENUM_PROP_PROPERTY, 
foo_properties[FOO_ENUM_PROP_PROPERTY] = g_param_spec_enum ("enum-prop", "enum-prop", "enum-prop", 
TYPE_FOO_ENUM, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_ENUM_PROP2_PROPERTY, 
foo_properties[FOO_ENUM_PROP2_PROPERTY] = g_param_spec_enum ("enum-prop2", "enum-prop2", "enum-prop2", 
TYPE_FOO_ENUM, FOO_ENUM_BAR, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_FLAG_PROP_PROPERTY, 
foo_properties[FOO_FLAG_PROP_PROPERTY] = g_param_spec_flags ("flag-prop", "flag-prop", "flag-prop", 
TYPE_FOO_FLAG, 0U, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_FLAG_PROP2_PROPERTY, 
foo_properties[FOO_FLAG_PROP2_PROPERTY] = g_param_spec_flags ("flag-prop2", "flag-prop2", "flag-prop2", 
TYPE_FOO_FLAG, FOO_FLAG_BAR, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_FLOAT_PROP_PROPERTY, 
foo_properties[FOO_FLOAT_PROP_PROPERTY] = g_param_spec_float ("float-prop", "float-prop", "float-prop", 
-G_MAXFLOAT, G_MAXFLOAT, 0.0F, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_FLOAT_PROP2_PROPERTY, 
foo_properties[FOO_FLOAT_PROP2_PROPERTY] = g_param_spec_float ("float-prop2", "float-prop2", "float-prop2", 
-G_MAXFLOAT, G_MAXFLOAT, 47.11f, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_INT_PROP_PROPERTY, 
foo_properties[FOO_INT_PROP_PROPERTY] = g_param_spec_int ("int-prop", "int-prop", "int-prop", G_MININT, 
G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_INT_PROP2_PROPERTY, 
foo_properties[FOO_INT_PROP2_PROPERTY] = g_param_spec_int ("int-prop2", "int-prop2", "int-prop2", G_MININT, 
G_MAXINT, G_MININT, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_INT64_PROP_PROPERTY, 
foo_properties[FOO_INT64_PROP_PROPERTY] = g_param_spec_int64 ("int64-prop", "int64-prop", "int64-prop", 
G_MININT64, G_MAXINT64, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_INT64_PROP2_PROPERTY, 
foo_properties[FOO_INT64_PROP2_PROPERTY] = g_param_spec_int64 ("int64-prop2", "int64-prop2", "int64-prop2", 
G_MININT64, G_MAXINT64, G_MININT64, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_LONG_PROP_PROPERTY, 
foo_properties[FOO_LONG_PROP_PROPERTY] = g_param_spec_long ("long-prop", "long-prop", "long-prop", G_MINLONG, 
G_MAXLONG, 0L, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_LONG_PROP2_PROPERTY, 
foo_properties[FOO_LONG_PROP2_PROPERTY] = g_param_spec_long ("long-prop2", "long-prop2", "long-prop2", 
G_MINLONG, G_MAXLONG, G_MAXLONG, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_OBJECT_PROP_PROPERTY, 
foo_properties[FOO_OBJECT_PROP_PROPERTY] = g_param_spec_object ("object-prop", "object-prop", "object-prop", 
G_TYPE_OBJECT, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_PARAM_PROP_PROPERTY, 
foo_properties[FOO_PARAM_PROP_PROPERTY] = g_param_spec_param ("param-prop", "param-prop", "param-prop", 
G_TYPE_PARAM, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_POINTER_PROP_PROPERTY, 
foo_properties[FOO_POINTER_PROP_PROPERTY] = g_param_spec_pointer ("pointer-prop", "pointer-prop", 
"pointer-prop", G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_STRING_PROP_PROPERTY, 
foo_properties[FOO_STRING_PROP_PROPERTY] = g_param_spec_string ("string-prop", "string-prop", "string-prop", 
NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_STRING_PROP2_PROPERTY, 
foo_properties[FOO_STRING_PROP2_PROPERTY] = g_param_spec_string ("string-prop2", "string-prop2", 
"string-prop2", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_UCHAR_PROP_PROPERTY, 
foo_properties[FOO_UCHAR_PROP_PROPERTY] = g_param_spec_uchar ("uchar-prop", "uchar-prop", "uchar-prop", 0, 
G_MAXUINT8, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_UCHAR_PROP2_PROPERTY, 
foo_properties[FOO_UCHAR_PROP2_PROPERTY] = g_param_spec_uchar ("uchar-prop2", "uchar-prop2", "uchar-prop2", 
0, G_MAXUINT8, (guchar) 'u', G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_UINT_PROP_PROPERTY, 
foo_properties[FOO_UINT_PROP_PROPERTY] = g_param_spec_uint ("uint-prop", "uint-prop", "uint-prop", 0, 
G_MAXUINT, 0U, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_UINT_PROP2_PROPERTY, 
foo_properties[FOO_UINT_PROP2_PROPERTY] = g_param_spec_uint ("uint-prop2", "uint-prop2", "uint-prop2", 0, 
G_MAXUINT, G_MAXUINT, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_UINT64_PROP_PROPERTY, 
foo_properties[FOO_UINT64_PROP_PROPERTY] = g_param_spec_uint64 ("uint64-prop", "uint64-prop", "uint64-prop", 
0, G_MAXUINT64, 0U, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_UINT64_PROP2_PROPERTY, 
foo_properties[FOO_UINT64_PROP2_PROPERTY] = g_param_spec_uint64 ("uint64-prop2", "uint64-prop2", 
"uint64-prop2", 0, G_MAXUINT64, G_MAXUINT64, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_ULONG_PROP_PROPERTY, 
foo_properties[FOO_ULONG_PROP_PROPERTY] = g_param_spec_ulong ("ulong-prop", "ulong-prop", "ulong-prop", 0, 
G_MAXULONG, 0UL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_ULONG_PROP2_PROPERTY, 
foo_properties[FOO_ULONG_PROP2_PROPERTY] = g_param_spec_ulong ("ulong-prop2", "ulong-prop2", "ulong-prop2", 
0, G_MAXULONG, G_MAXULONG, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_UNICHAR_PROP_PROPERTY, 
foo_properties[FOO_UNICHAR_PROP_PROPERTY] = g_param_spec_uint ("unichar-prop", "unichar-prop", 
"unichar-prop", 0, G_MAXUINT, 0U, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_GTYPE_PROP_PROPERTY, 
foo_properties[FOO_GTYPE_PROP_PROPERTY] = g_param_spec_gtype ("gtype-prop", "gtype-prop", "gtype-prop", 
G_TYPE_NONE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_GTYPE_PROP2_PROPERTY, 
foo_properties[FOO_GTYPE_PROP2_PROPERTY] = g_param_spec_gtype ("gtype-prop2", "gtype-prop2", "gtype-prop2", 
G_TYPE_STRING, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_VARIANT_PROP_PROPERTY, 
foo_properties[FOO_VARIANT_PROP_PROPERTY] = g_param_spec_variant ("variant-prop", "variant-prop", 
"variant-prop", G_VARIANT_TYPE_ANY, NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_VARIANT_PROP2_PROPERTY, 
foo_properties[FOO_VARIANT_PROP2_PROPERTY] = g_param_spec_variant ("variant-prop2", "variant-prop2", 
"variant-prop2", G_VARIANT_TYPE_ANY, NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_STRUCT_PROP_PROPERTY, 
foo_properties[FOO_STRUCT_PROP_PROPERTY] = g_param_spec_boxed ("struct-prop", "struct-prop", "struct-prop", 
TYPE_FOO_STRUCT, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_STRUCT_PROP2_PROPERTY, 
foo_properties[FOO_STRUCT_PROP2_PROPERTY] = g_param_spec_boxed ("struct-prop2", "struct-prop2", 
"struct-prop2", TYPE_FOO_STRUCT, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_STRV_PROP_PROPERTY, 
foo_properties[FOO_STRV_PROP_PROPERTY] = g_param_spec_boxed ("strv-prop", "strv-prop", "strv-prop", 
G_TYPE_STRV, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_STRV_PROP2_PROPERTY, 
foo_properties[FOO_STRV_PROP2_PROPERTY] = g_param_spec_boxed ("strv-prop2", "strv-prop2", "strv-prop2", 
G_TYPE_STRV, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       gchar* _tmp0_;
+       GVariant* _tmp1_;
+       FooStruct _tmp2_ = {0};
+       gchar* _tmp3_;
+       gchar* _tmp4_;
+       gchar** _tmp5_;
+       self->priv = foo_get_instance_private (self);
+       self->priv->_bool_prop2 = TRUE;
+       self->priv->_char_prop2 = 'c';
+       self->priv->_double_prop2 = 3.1415;
+       self->priv->_enum_prop2 = FOO_ENUM_BAR;
+       self->priv->_flag_prop2 = FOO_FLAG_BAR;
+       self->priv->_float_prop2 = 47.11f;
+       self->priv->_int_prop2 = G_MININT;
+       self->priv->_int64_prop2 = G_MININT64;
+       self->priv->_long_prop2 = G_MAXLONG;
+       _tmp0_ = g_strdup ("foo");
+       self->priv->_string_prop2 = _tmp0_;
+       self->priv->_uchar_prop2 = (guchar) 'u';
+       self->priv->_uint_prop2 = G_MAXUINT;
+       self->priv->_uint64_prop2 = G_MAXUINT64;
+       self->priv->_ulong_prop2 = G_MAXULONG;
+       self->priv->_gtype_prop2 = G_TYPE_STRING;
+       _tmp1_ = g_variant_new ("as", NULL);
+       g_variant_ref_sink (_tmp1_);
+       self->priv->_variant_prop2 = _tmp1_;
+       memset (&_tmp2_, 0, sizeof (FooStruct));
+       _tmp2_.i = 4711;
+       self->priv->_struct_prop2 = _tmp2_;
+       _tmp3_ = g_strdup ("foo");
+       _tmp4_ = g_strdup ("bar");
+       _tmp5_ = g_new0 (gchar*, 2 + 1);
+       _tmp5_[0] = _tmp3_;
+       _tmp5_[1] = _tmp4_;
+       self->priv->_strv_prop2 = _tmp5_;
+       self->priv->_strv_prop2_length1 = 2;
+       self->priv->__strv_prop2_size_ = self->priv->_strv_prop2_length1;
+}
+
+static void
+foo_finalize (GObject * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       _g_object_unref0 (self->priv->_object_prop);
+       _g_param_spec_unref0 (self->priv->_param_prop);
+       _g_free0 (self->priv->_string_prop);
+       _g_free0 (self->priv->_string_prop2);
+       _g_variant_unref0 (self->priv->_variant_prop);
+       _g_variant_unref0 (self->priv->_variant_prop2);
+       self->priv->_strv_prop = (_vala_array_free (self->priv->_strv_prop, self->priv->_strv_prop_length1, 
(GDestroyNotify) g_free), NULL);
+       self->priv->_strv_prop2 = (_vala_array_free (self->priv->_strv_prop2, 
self->priv->_strv_prop2_length1, (GDestroyNotify) g_free), NULL);
+       G_OBJECT_CLASS (foo_parent_class)->finalize (obj);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_foo_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_BOOL_PROP_PROPERTY:
+               g_value_set_boolean (value, foo_get_bool_prop (self));
+               break;
+               case FOO_BOOL_PROP2_PROPERTY:
+               g_value_set_boolean (value, foo_get_bool_prop2 (self));
+               break;
+               case FOO_CHAR_PROP_PROPERTY:
+               g_value_set_schar (value, foo_get_char_prop (self));
+               break;
+               case FOO_CHAR_PROP2_PROPERTY:
+               g_value_set_schar (value, foo_get_char_prop2 (self));
+               break;
+               case FOO_DOUBLE_PROP_PROPERTY:
+               g_value_set_double (value, foo_get_double_prop (self));
+               break;
+               case FOO_DOUBLE_PROP2_PROPERTY:
+               g_value_set_double (value, foo_get_double_prop2 (self));
+               break;
+               case FOO_ENUM_PROP_PROPERTY:
+               g_value_set_enum (value, foo_get_enum_prop (self));
+               break;
+               case FOO_ENUM_PROP2_PROPERTY:
+               g_value_set_enum (value, foo_get_enum_prop2 (self));
+               break;
+               case FOO_FLAG_PROP_PROPERTY:
+               g_value_set_flags (value, foo_get_flag_prop (self));
+               break;
+               case FOO_FLAG_PROP2_PROPERTY:
+               g_value_set_flags (value, foo_get_flag_prop2 (self));
+               break;
+               case FOO_FLOAT_PROP_PROPERTY:
+               g_value_set_float (value, foo_get_float_prop (self));
+               break;
+               case FOO_FLOAT_PROP2_PROPERTY:
+               g_value_set_float (value, foo_get_float_prop2 (self));
+               break;
+               case FOO_INT_PROP_PROPERTY:
+               g_value_set_int (value, foo_get_int_prop (self));
+               break;
+               case FOO_INT_PROP2_PROPERTY:
+               g_value_set_int (value, foo_get_int_prop2 (self));
+               break;
+               case FOO_INT64_PROP_PROPERTY:
+               g_value_set_int64 (value, foo_get_int64_prop (self));
+               break;
+               case FOO_INT64_PROP2_PROPERTY:
+               g_value_set_int64 (value, foo_get_int64_prop2 (self));
+               break;
+               case FOO_LONG_PROP_PROPERTY:
+               g_value_set_long (value, foo_get_long_prop (self));
+               break;
+               case FOO_LONG_PROP2_PROPERTY:
+               g_value_set_long (value, foo_get_long_prop2 (self));
+               break;
+               case FOO_OBJECT_PROP_PROPERTY:
+               g_value_set_object (value, foo_get_object_prop (self));
+               break;
+               case FOO_PARAM_PROP_PROPERTY:
+               g_value_set_param (value, foo_get_param_prop (self));
+               break;
+               case FOO_POINTER_PROP_PROPERTY:
+               g_value_set_pointer (value, foo_get_pointer_prop (self));
+               break;
+               case FOO_STRING_PROP_PROPERTY:
+               g_value_set_string (value, foo_get_string_prop (self));
+               break;
+               case FOO_STRING_PROP2_PROPERTY:
+               g_value_set_string (value, foo_get_string_prop2 (self));
+               break;
+               case FOO_UCHAR_PROP_PROPERTY:
+               g_value_set_uchar (value, foo_get_uchar_prop (self));
+               break;
+               case FOO_UCHAR_PROP2_PROPERTY:
+               g_value_set_uchar (value, foo_get_uchar_prop2 (self));
+               break;
+               case FOO_UINT_PROP_PROPERTY:
+               g_value_set_uint (value, foo_get_uint_prop (self));
+               break;
+               case FOO_UINT_PROP2_PROPERTY:
+               g_value_set_uint (value, foo_get_uint_prop2 (self));
+               break;
+               case FOO_UINT64_PROP_PROPERTY:
+               g_value_set_uint64 (value, foo_get_uint64_prop (self));
+               break;
+               case FOO_UINT64_PROP2_PROPERTY:
+               g_value_set_uint64 (value, foo_get_uint64_prop2 (self));
+               break;
+               case FOO_ULONG_PROP_PROPERTY:
+               g_value_set_ulong (value, foo_get_ulong_prop (self));
+               break;
+               case FOO_ULONG_PROP2_PROPERTY:
+               g_value_set_ulong (value, foo_get_ulong_prop2 (self));
+               break;
+               case FOO_UNICHAR_PROP_PROPERTY:
+               g_value_set_uint (value, foo_get_unichar_prop (self));
+               break;
+               case FOO_GTYPE_PROP_PROPERTY:
+               g_value_set_gtype (value, foo_get_gtype_prop (self));
+               break;
+               case FOO_GTYPE_PROP2_PROPERTY:
+               g_value_set_gtype (value, foo_get_gtype_prop2 (self));
+               break;
+               case FOO_VARIANT_PROP_PROPERTY:
+               g_value_set_variant (value, foo_get_variant_prop (self));
+               break;
+               case FOO_VARIANT_PROP2_PROPERTY:
+               g_value_set_variant (value, foo_get_variant_prop2 (self));
+               break;
+               case FOO_STRUCT_PROP_PROPERTY:
+               {
+                       FooStruct boxed;
+                       foo_get_struct_prop (self, &boxed);
+                       g_value_set_boxed (value, &boxed);
+               }
+               break;
+               case FOO_STRUCT_PROP2_PROPERTY:
+               {
+                       FooStruct boxed;
+                       foo_get_struct_prop2 (self, &boxed);
+                       g_value_set_boxed (value, &boxed);
+               }
+               break;
+               case FOO_STRV_PROP_PROPERTY:
+               {
+                       int length;
+                       g_value_set_boxed (value, foo_get_strv_prop (self, &length));
+               }
+               break;
+               case FOO_STRV_PROP2_PROPERTY:
+               {
+                       int length;
+                       g_value_set_boxed (value, foo_get_strv_prop2 (self, &length));
+               }
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_foo_set_property (GObject * object,
+                        guint property_id,
+                        const GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_BOOL_PROP_PROPERTY:
+               foo_set_bool_prop (self, g_value_get_boolean (value));
+               break;
+               case FOO_BOOL_PROP2_PROPERTY:
+               foo_set_bool_prop2 (self, g_value_get_boolean (value));
+               break;
+               case FOO_CHAR_PROP_PROPERTY:
+               foo_set_char_prop (self, g_value_get_schar (value));
+               break;
+               case FOO_CHAR_PROP2_PROPERTY:
+               foo_set_char_prop2 (self, g_value_get_schar (value));
+               break;
+               case FOO_DOUBLE_PROP_PROPERTY:
+               foo_set_double_prop (self, g_value_get_double (value));
+               break;
+               case FOO_DOUBLE_PROP2_PROPERTY:
+               foo_set_double_prop2 (self, g_value_get_double (value));
+               break;
+               case FOO_ENUM_PROP_PROPERTY:
+               foo_set_enum_prop (self, g_value_get_enum (value));
+               break;
+               case FOO_ENUM_PROP2_PROPERTY:
+               foo_set_enum_prop2 (self, g_value_get_enum (value));
+               break;
+               case FOO_FLAG_PROP_PROPERTY:
+               foo_set_flag_prop (self, g_value_get_flags (value));
+               break;
+               case FOO_FLAG_PROP2_PROPERTY:
+               foo_set_flag_prop2 (self, g_value_get_flags (value));
+               break;
+               case FOO_FLOAT_PROP_PROPERTY:
+               foo_set_float_prop (self, g_value_get_float (value));
+               break;
+               case FOO_FLOAT_PROP2_PROPERTY:
+               foo_set_float_prop2 (self, g_value_get_float (value));
+               break;
+               case FOO_INT_PROP_PROPERTY:
+               foo_set_int_prop (self, g_value_get_int (value));
+               break;
+               case FOO_INT_PROP2_PROPERTY:
+               foo_set_int_prop2 (self, g_value_get_int (value));
+               break;
+               case FOO_INT64_PROP_PROPERTY:
+               foo_set_int64_prop (self, g_value_get_int64 (value));
+               break;
+               case FOO_INT64_PROP2_PROPERTY:
+               foo_set_int64_prop2 (self, g_value_get_int64 (value));
+               break;
+               case FOO_LONG_PROP_PROPERTY:
+               foo_set_long_prop (self, g_value_get_long (value));
+               break;
+               case FOO_LONG_PROP2_PROPERTY:
+               foo_set_long_prop2 (self, g_value_get_long (value));
+               break;
+               case FOO_OBJECT_PROP_PROPERTY:
+               foo_set_object_prop (self, g_value_get_object (value));
+               break;
+               case FOO_PARAM_PROP_PROPERTY:
+               foo_set_param_prop (self, g_value_get_param (value));
+               break;
+               case FOO_POINTER_PROP_PROPERTY:
+               foo_set_pointer_prop (self, g_value_get_pointer (value));
+               break;
+               case FOO_STRING_PROP_PROPERTY:
+               foo_set_string_prop (self, g_value_get_string (value));
+               break;
+               case FOO_STRING_PROP2_PROPERTY:
+               foo_set_string_prop2 (self, g_value_get_string (value));
+               break;
+               case FOO_UCHAR_PROP_PROPERTY:
+               foo_set_uchar_prop (self, g_value_get_uchar (value));
+               break;
+               case FOO_UCHAR_PROP2_PROPERTY:
+               foo_set_uchar_prop2 (self, g_value_get_uchar (value));
+               break;
+               case FOO_UINT_PROP_PROPERTY:
+               foo_set_uint_prop (self, g_value_get_uint (value));
+               break;
+               case FOO_UINT_PROP2_PROPERTY:
+               foo_set_uint_prop2 (self, g_value_get_uint (value));
+               break;
+               case FOO_UINT64_PROP_PROPERTY:
+               foo_set_uint64_prop (self, g_value_get_uint64 (value));
+               break;
+               case FOO_UINT64_PROP2_PROPERTY:
+               foo_set_uint64_prop2 (self, g_value_get_uint64 (value));
+               break;
+               case FOO_ULONG_PROP_PROPERTY:
+               foo_set_ulong_prop (self, g_value_get_ulong (value));
+               break;
+               case FOO_ULONG_PROP2_PROPERTY:
+               foo_set_ulong_prop2 (self, g_value_get_ulong (value));
+               break;
+               case FOO_UNICHAR_PROP_PROPERTY:
+               foo_set_unichar_prop (self, g_value_get_uint (value));
+               break;
+               case FOO_GTYPE_PROP_PROPERTY:
+               foo_set_gtype_prop (self, g_value_get_gtype (value));
+               break;
+               case FOO_GTYPE_PROP2_PROPERTY:
+               foo_set_gtype_prop2 (self, g_value_get_gtype (value));
+               break;
+               case FOO_VARIANT_PROP_PROPERTY:
+               foo_set_variant_prop (self, g_value_get_variant (value));
+               break;
+               case FOO_VARIANT_PROP2_PROPERTY:
+               foo_set_variant_prop2 (self, g_value_get_variant (value));
+               break;
+               case FOO_STRUCT_PROP_PROPERTY:
+               foo_set_struct_prop (self, g_value_get_boxed (value));
+               break;
+               case FOO_STRUCT_PROP2_PROPERTY:
+               foo_set_struct_prop2 (self, g_value_get_boxed (value));
+               break;
+               case FOO_STRV_PROP_PROPERTY:
+               {
+                       gpointer boxed;
+                       boxed = g_value_get_boxed (value);
+                       foo_set_strv_prop (self, boxed, (boxed == NULL) ? 0 : g_strv_length (boxed));
+               }
+               break;
+               case FOO_STRV_PROP2_PROPERTY:
+               {
+                       gpointer boxed;
+                       boxed = g_value_get_boxed (value);
+                       foo_set_strv_prop2 (self, boxed, (boxed == NULL) ? 0 : g_strv_length (boxed));
+               }
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       GObjectClass* foo_class = NULL;
+       GObjectClass* _tmp1_;
+       GParamSpec* _tmp2_;
+       gboolean _tmp3_;
+       gboolean _tmp4_;
+       GParamSpec* _tmp5_;
+       gchar _tmp6_;
+       gchar _tmp7_;
+       GParamSpec* _tmp8_;
+       gdouble _tmp9_;
+       gdouble _tmp10_;
+       GParamSpec* _tmp11_;
+       FooEnum _tmp12_;
+       FooEnum _tmp13_;
+       GParamSpec* _tmp14_;
+       FooFlag _tmp15_;
+       FooFlag _tmp16_;
+       GParamSpec* _tmp17_;
+       gfloat _tmp18_;
+       gfloat _tmp19_;
+       GParamSpec* _tmp20_;
+       gint _tmp21_;
+       gint _tmp22_;
+       GParamSpec* _tmp23_;
+       gint64 _tmp24_;
+       gint64 _tmp25_;
+       GParamSpec* _tmp26_;
+       glong _tmp27_;
+       glong _tmp28_;
+       GParamSpec* _tmp29_;
+       GParamSpec* _tmp30_;
+       GParamSpec* _tmp31_;
+       GParamSpec* _tmp32_;
+       const gchar* _tmp33_;
+       const gchar* _tmp34_;
+       GParamSpec* _tmp35_;
+       guchar _tmp36_;
+       guchar _tmp37_;
+       GParamSpec* _tmp38_;
+       guint _tmp39_;
+       guint _tmp40_;
+       GParamSpec* _tmp41_;
+       guint64 _tmp42_;
+       guint64 _tmp43_;
+       GParamSpec* _tmp44_;
+       gulong _tmp45_;
+       gulong _tmp46_;
+       GParamSpec* _tmp47_;
+       GParamSpec* _tmp48_;
+       GType _tmp49_;
+       GType _tmp50_;
+       GParamSpec* _tmp51_;
+       GVariant* _tmp52_;
+       GVariant* _tmp53_;
+       const GVariantType* _tmp54_;
+       GParamSpec* _tmp55_;
+       FooStruct _tmp56_ = {0};
+       FooStruct _tmp57_;
+       GParamSpec* _tmp58_;
+       gchar** _tmp59_;
+       gint _tmp59__length1;
+       gint _tmp60_ = 0;
+       gchar** _tmp61_;
+       gint _tmp61__length1;
+       const gchar* _tmp62_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       _tmp1_ = G_OBJECT_GET_CLASS (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject));
+       foo_class = _tmp1_;
+       _tmp2_ = g_object_class_find_property (foo_class, "bool-prop");
+       _vala_assert (G_TYPE_CHECK_INSTANCE_TYPE (_tmp2_, G_TYPE_PARAM_BOOLEAN), "foo_class.find_property 
(\"bool-prop\") is ParamSpecBoolean");
+       _tmp3_ = foo_get_bool_prop2 (foo);
+       _tmp4_ = _tmp3_;
+       _vala_assert (_tmp4_ == TRUE, "foo.bool_prop2 == true");
+       _tmp5_ = g_object_class_find_property (foo_class, "char-prop");
+       _vala_assert (G_TYPE_CHECK_INSTANCE_TYPE (_tmp5_, G_TYPE_PARAM_CHAR), "foo_class.find_property 
(\"char-prop\") is ParamSpecChar");
+       _tmp6_ = foo_get_char_prop2 (foo);
+       _tmp7_ = _tmp6_;
+       _vala_assert (_tmp7_ == 'c', "foo.char_prop2 == 'c'");
+       _tmp8_ = g_object_class_find_property (foo_class, "double-prop");
+       _vala_assert (G_TYPE_CHECK_INSTANCE_TYPE (_tmp8_, G_TYPE_PARAM_DOUBLE), "foo_class.find_property 
(\"double-prop\") is ParamSpecDouble");
+       _tmp9_ = foo_get_double_prop2 (foo);
+       _tmp10_ = _tmp9_;
+       _vala_assert (_tmp10_ == 3.1415, "foo.double_prop2 == 3.1415");
+       _tmp11_ = g_object_class_find_property (foo_class, "enum-prop");
+       _vala_assert (G_TYPE_CHECK_INSTANCE_TYPE (_tmp11_, G_TYPE_PARAM_ENUM), "foo_class.find_property 
(\"enum-prop\") is ParamSpecEnum");
+       _tmp12_ = foo_get_enum_prop2 (foo);
+       _tmp13_ = _tmp12_;
+       _vala_assert (_tmp13_ == FOO_ENUM_BAR, "foo.enum_prop2 == FooEnum.BAR");
+       _tmp14_ = g_object_class_find_property (foo_class, "flag-prop");
+       _vala_assert (G_TYPE_CHECK_INSTANCE_TYPE (_tmp14_, G_TYPE_PARAM_FLAGS), "foo_class.find_property 
(\"flag-prop\") is ParamSpecFlags");
+       _tmp15_ = foo_get_flag_prop2 (foo);
+       _tmp16_ = _tmp15_;
+       _vala_assert (_tmp16_ == FOO_FLAG_BAR, "foo.flag_prop2 == FooFlag.BAR");
+       _tmp17_ = g_object_class_find_property (foo_class, "float-prop");
+       _vala_assert (G_TYPE_CHECK_INSTANCE_TYPE (_tmp17_, G_TYPE_PARAM_FLOAT), "foo_class.find_property 
(\"float-prop\") is ParamSpecFloat");
+       _tmp18_ = foo_get_float_prop2 (foo);
+       _tmp19_ = _tmp18_;
+       _vala_assert (_tmp19_ == 47.11f, "foo.float_prop2 == 47.11f");
+       _tmp20_ = g_object_class_find_property (foo_class, "int-prop");
+       _vala_assert (G_TYPE_CHECK_INSTANCE_TYPE (_tmp20_, G_TYPE_PARAM_INT), "foo_class.find_property 
(\"int-prop\") is ParamSpecInt");
+       _tmp21_ = foo_get_int_prop2 (foo);
+       _tmp22_ = _tmp21_;
+       _vala_assert (_tmp22_ == G_MININT, "foo.int_prop2 == int.MIN");
+       _tmp23_ = g_object_class_find_property (foo_class, "int64-prop");
+       _vala_assert (G_TYPE_CHECK_INSTANCE_TYPE (_tmp23_, G_TYPE_PARAM_INT64), "foo_class.find_property 
(\"int64-prop\") is ParamSpecInt64");
+       _tmp24_ = foo_get_int64_prop2 (foo);
+       _tmp25_ = _tmp24_;
+       _vala_assert (_tmp25_ == G_MININT64, "foo.int64_prop2 == int64.MIN");
+       _tmp26_ = g_object_class_find_property (foo_class, "long-prop");
+       _vala_assert (G_TYPE_CHECK_INSTANCE_TYPE (_tmp26_, G_TYPE_PARAM_LONG), "foo_class.find_property 
(\"long-prop\") is ParamSpecLong");
+       _tmp27_ = foo_get_long_prop2 (foo);
+       _tmp28_ = _tmp27_;
+       _vala_assert (_tmp28_ == G_MAXLONG, "foo.long_prop2 == long.MAX");
+       _tmp29_ = g_object_class_find_property (foo_class, "object-prop");
+       _vala_assert (G_TYPE_CHECK_INSTANCE_TYPE (_tmp29_, G_TYPE_PARAM_OBJECT), "foo_class.find_property 
(\"object-prop\") is ParamSpecObject");
+       _tmp30_ = g_object_class_find_property (foo_class, "param-prop");
+       _vala_assert (G_TYPE_CHECK_INSTANCE_TYPE (_tmp30_, G_TYPE_PARAM_PARAM), "foo_class.find_property 
(\"param-prop\") is ParamSpecParam");
+       _tmp31_ = g_object_class_find_property (foo_class, "pointer-prop");
+       _vala_assert (G_TYPE_CHECK_INSTANCE_TYPE (_tmp31_, G_TYPE_PARAM_POINTER), "foo_class.find_property 
(\"pointer-prop\") is ParamSpecPointer");
+       _tmp32_ = g_object_class_find_property (foo_class, "string-prop");
+       _vala_assert (G_TYPE_CHECK_INSTANCE_TYPE (_tmp32_, G_TYPE_PARAM_STRING), "foo_class.find_property 
(\"string-prop\") is ParamSpecString");
+       _tmp33_ = foo_get_string_prop2 (foo);
+       _tmp34_ = _tmp33_;
+       _vala_assert (g_strcmp0 (_tmp34_, "foo") == 0, "foo.string_prop2 == \"foo\"");
+       _tmp35_ = g_object_class_find_property (foo_class, "uchar-prop");
+       _vala_assert (G_TYPE_CHECK_INSTANCE_TYPE (_tmp35_, G_TYPE_PARAM_UCHAR), "foo_class.find_property 
(\"uchar-prop\") is ParamSpecUChar");
+       _tmp36_ = foo_get_uchar_prop2 (foo);
+       _tmp37_ = _tmp36_;
+       _vala_assert (_tmp37_ == ((guchar) 'u'), "foo.uchar_prop2 == 'u'");
+       _tmp38_ = g_object_class_find_property (foo_class, "uint-prop");
+       _vala_assert (G_TYPE_CHECK_INSTANCE_TYPE (_tmp38_, G_TYPE_PARAM_UINT), "foo_class.find_property 
(\"uint-prop\") is ParamSpecUInt");
+       _tmp39_ = foo_get_uint_prop2 (foo);
+       _tmp40_ = _tmp39_;
+       _vala_assert (_tmp40_ == G_MAXUINT, "foo.uint_prop2 == uint.MAX");
+       _tmp41_ = g_object_class_find_property (foo_class, "uint64-prop");
+       _vala_assert (G_TYPE_CHECK_INSTANCE_TYPE (_tmp41_, G_TYPE_PARAM_UINT64), "foo_class.find_property 
(\"uint64-prop\") is ParamSpecUInt64");
+       _tmp42_ = foo_get_uint64_prop2 (foo);
+       _tmp43_ = _tmp42_;
+       _vala_assert (_tmp43_ == G_MAXUINT64, "foo.uint64_prop2 == uint64.MAX");
+       _tmp44_ = g_object_class_find_property (foo_class, "ulong-prop");
+       _vala_assert (G_TYPE_CHECK_INSTANCE_TYPE (_tmp44_, G_TYPE_PARAM_ULONG), "foo_class.find_property 
(\"ulong-prop\") is ParamSpecULong");
+       _tmp45_ = foo_get_ulong_prop2 (foo);
+       _tmp46_ = _tmp45_;
+       _vala_assert (_tmp46_ == G_MAXULONG, "foo.ulong_prop2 == ulong.MAX");
+       _tmp47_ = g_object_class_find_property (foo_class, "unichar-prop");
+       _vala_assert (G_TYPE_CHECK_INSTANCE_TYPE (_tmp47_, G_TYPE_PARAM_UINT), "foo_class.find_property 
(\"unichar-prop\") is ParamSpecUInt");
+       _tmp48_ = g_object_class_find_property (foo_class, "gtype-prop");
+       _vala_assert (G_TYPE_CHECK_INSTANCE_TYPE (_tmp48_, G_TYPE_PARAM_GTYPE), "foo_class.find_property 
(\"gtype-prop\") is ParamSpecGType");
+       _tmp49_ = foo_get_gtype_prop2 (foo);
+       _tmp50_ = _tmp49_;
+       _vala_assert (_tmp50_ == G_TYPE_STRING, "foo.gtype_prop2 == typeof (string)");
+       _tmp51_ = g_object_class_find_property (foo_class, "variant-prop");
+       _vala_assert (G_TYPE_CHECK_INSTANCE_TYPE (_tmp51_, G_TYPE_PARAM_VARIANT), "foo_class.find_property 
(\"variant-prop\") is ParamSpecVariant");
+       _tmp52_ = foo_get_variant_prop2 (foo);
+       _tmp53_ = _tmp52_;
+       _tmp54_ = G_VARIANT_TYPE_STRING_ARRAY;
+       _vala_assert (g_variant_is_of_type (_tmp53_, _tmp54_), "foo.variant_prop2.is_of_type 
(VariantType.STRING_ARRAY)");
+       _tmp55_ = g_object_class_find_property (foo_class, "struct-prop");
+       _vala_assert (G_TYPE_CHECK_INSTANCE_TYPE (_tmp55_, G_TYPE_PARAM_BOXED), "foo_class.find_property 
(\"struct-prop\") is ParamSpecBoxed");
+       foo_get_struct_prop2 (foo, &_tmp56_);
+       _tmp57_ = _tmp56_;
+       _vala_assert (_tmp57_.i == 4711, "foo.struct_prop2.i == 4711");
+       _tmp58_ = g_object_class_find_property (foo_class, "strv-prop");
+       _vala_assert (G_TYPE_CHECK_INSTANCE_TYPE (_tmp58_, G_TYPE_PARAM_BOXED), "foo_class.find_property 
(\"strv-prop\") is ParamSpecBoxed");
+       _tmp59_ = foo_get_strv_prop2 (foo, &_tmp60_);
+       _tmp59__length1 = _tmp60_;
+       _tmp61_ = _tmp59_;
+       _tmp61__length1 = _tmp59__length1;
+       _tmp62_ = _tmp61_[1];
+       _vala_assert (g_strcmp0 (_tmp62_, "bar") == 0, "foo.strv_prop2[1] == \"bar\"");
+       _g_object_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/objects/plugin-module-init.c-expected b/tests/objects/plugin-module-init.c-expected
new file mode 100644
index 000000000..48922e571
--- /dev/null
+++ b/tests/objects/plugin-module-init.c-expected
@@ -0,0 +1,141 @@
+/* objects_plugin_module_init.c generated by valac, the Vala compiler
+ * generated from objects_plugin_module_init.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_MODULE (module_get_type ())
+#define MODULE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MODULE, Module))
+#define MODULE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MODULE, ModuleClass))
+#define IS_MODULE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MODULE))
+#define IS_MODULE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MODULE))
+#define MODULE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MODULE, ModuleClass))
+
+typedef struct _Module Module;
+typedef struct _ModuleClass ModuleClass;
+typedef struct _ModulePrivate ModulePrivate;
+enum  {
+       MODULE_0_PROPERTY,
+       MODULE_NUM_PROPERTIES
+};
+static GParamSpec* module_properties[MODULE_NUM_PROPERTIES];
+
+struct _Module {
+       GTypeModule parent_instance;
+       ModulePrivate * priv;
+};
+
+struct _ModuleClass {
+       GTypeModuleClass parent_class;
+};
+
+struct _ModulePrivate {
+       gint private_field;
+};
+
+static gint Module_private_offset;
+static gpointer module_parent_class = NULL;
+static GType module_type_id = 0;
+
+GType module_register_type (GTypeModule * module);
+VALA_EXTERN GType module_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Module, g_object_unref)
+VALA_EXTERN Module* module_new (void);
+VALA_EXTERN Module* module_construct (GType object_type);
+static void module_finalize (GObject * obj);
+VALA_EXTERN GType init_plugin (GTypeModule* m);
+static void _vala_main (void);
+
+static inline gpointer
+module_get_instance_private (Module* self)
+{
+       return G_STRUCT_MEMBER_P (self, Module_private_offset);
+}
+
+Module*
+module_construct (GType object_type)
+{
+       Module * self = NULL;
+       self = (Module*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Module*
+module_new (void)
+{
+       return module_construct (TYPE_MODULE);
+}
+
+static void
+module_class_init (ModuleClass * klass,
+                   gpointer klass_data)
+{
+       module_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Module_private_offset);
+       G_OBJECT_CLASS (klass)->finalize = module_finalize;
+}
+
+static void
+module_instance_init (Module * self,
+                      gpointer klass)
+{
+       self->priv = module_get_instance_private (self);
+       self->priv->private_field = 42;
+}
+
+static void
+module_finalize (GObject * obj)
+{
+       Module * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_MODULE, Module);
+       G_OBJECT_CLASS (module_parent_class)->finalize (obj);
+}
+
+GType
+module_get_type (void)
+{
+       return module_type_id;
+}
+
+GType
+module_register_type (GTypeModule * module)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (ModuleClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) module_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(Module), 0, (GInstanceInitFunc) module_instance_init, NULL };
+       module_type_id = g_type_module_register_type (module, g_type_module_get_type (), "Module", 
&g_define_type_info, 0);
+       Module_private_offset = sizeof (ModulePrivate);
+       return module_type_id;
+}
+
+GType
+init_plugin (GTypeModule* m)
+{
+       GType result = 0UL;
+       g_return_val_if_fail ((m == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (m, g_type_module_get_type ()), 0UL);
+       module_register_type (m);
+       result = TYPE_MODULE;
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/properties.c-expected b/tests/objects/properties.c-expected
new file mode 100644
index 000000000..e4931d146
--- /dev/null
+++ b/tests/objects/properties.c-expected
@@ -0,0 +1,2212 @@
+/* objects_properties.c generated by valac, the Vala compiler
+ * generated from objects_properties.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef void (*Delegate) (void);
+
+#define TYPE_REAL_STRUCT (real_struct_get_type ())
+typedef struct _RealStruct RealStruct;
+
+#define TYPE_NON_PRIV_ACCESS (non_priv_access_get_type ())
+#define NON_PRIV_ACCESS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_NON_PRIV_ACCESS, NonPrivAccess))
+#define NON_PRIV_ACCESS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_NON_PRIV_ACCESS, 
NonPrivAccessClass))
+#define IS_NON_PRIV_ACCESS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_NON_PRIV_ACCESS))
+#define IS_NON_PRIV_ACCESS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_NON_PRIV_ACCESS))
+#define NON_PRIV_ACCESS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_NON_PRIV_ACCESS, 
NonPrivAccessClass))
+
+typedef struct _NonPrivAccess NonPrivAccess;
+typedef struct _NonPrivAccessClass NonPrivAccessClass;
+typedef struct _NonPrivAccessPrivate NonPrivAccessPrivate;
+enum  {
+       NON_PRIV_ACCESS_0_PROPERTY,
+       NON_PRIV_ACCESS_REAL_STRUCT_PROPERTY,
+       NON_PRIV_ACCESS_NUM_PROPERTIES
+};
+static GParamSpec* non_priv_access_properties[NON_PRIV_ACCESS_NUM_PROPERTIES];
+
+#define TYPE_SAMPLE (sample_get_type ())
+#define SAMPLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SAMPLE, Sample))
+#define SAMPLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SAMPLE, SampleClass))
+#define IS_SAMPLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SAMPLE))
+#define IS_SAMPLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SAMPLE))
+#define SAMPLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SAMPLE, SampleClass))
+
+typedef struct _Sample Sample;
+typedef struct _SampleClass SampleClass;
+typedef struct _SamplePrivate SamplePrivate;
+enum  {
+       SAMPLE_0_PROPERTY,
+       SAMPLE_DELEG_PROPERTY,
+       SAMPLE_NAME_PROPERTY,
+       SAMPLE_READ_ONLY_PROPERTY,
+       SAMPLE_PUBLIC_PROP_PROPERTY,
+       SAMPLE_NUM_PROPERTIES
+};
+static GParamSpec* sample_properties[SAMPLE_NUM_PROPERTIES];
+#define _g_free0(var) (var = (g_free (var), NULL))
+
+#define MAMAN_TYPE_IBAZ (maman_ibaz_get_type ())
+#define MAMAN_IBAZ(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_IBAZ, MamanIbaz))
+#define MAMAN_IS_IBAZ(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_IBAZ))
+#define MAMAN_IBAZ_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), MAMAN_TYPE_IBAZ, 
MamanIbazIface))
+
+typedef struct _MamanIbaz MamanIbaz;
+typedef struct _MamanIbazIface MamanIbazIface;
+
+#define MAMAN_TYPE_BAZ (maman_baz_get_type ())
+#define MAMAN_BAZ(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_BAZ, MamanBaz))
+#define MAMAN_BAZ_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAMAN_TYPE_BAZ, MamanBazClass))
+#define MAMAN_IS_BAZ(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_BAZ))
+#define MAMAN_IS_BAZ_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAMAN_TYPE_BAZ))
+#define MAMAN_BAZ_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAMAN_TYPE_BAZ, MamanBazClass))
+
+typedef struct _MamanBaz MamanBaz;
+typedef struct _MamanBazClass MamanBazClass;
+#define _real_struct_free0(var) ((var == NULL) ? NULL : (var = (real_struct_free (var), NULL)))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+
+#define MAMAN_TYPE_FOO (maman_foo_get_type ())
+#define MAMAN_FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_FOO, MamanFoo))
+#define MAMAN_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAMAN_TYPE_FOO, MamanFooClass))
+#define MAMAN_IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_FOO))
+#define MAMAN_IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAMAN_TYPE_FOO))
+#define MAMAN_FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAMAN_TYPE_FOO, MamanFooClass))
+
+typedef struct _MamanFoo MamanFoo;
+typedef struct _MamanFooClass MamanFooClass;
+typedef struct _MamanFooPrivate MamanFooPrivate;
+enum  {
+       MAMAN_FOO_0_PROPERTY,
+       MAMAN_FOO_PUBLIC_BASE_PROPERTY_PROPERTY,
+       MAMAN_FOO_ABSTRACT_BASE_PROPERTY_PROPERTY,
+       MAMAN_FOO_NUM_PROPERTIES
+};
+static GParamSpec* maman_foo_properties[MAMAN_FOO_NUM_PROPERTIES];
+typedef enum  {
+       FOO_ENUM_FOO
+} FooEnum;
+
+#define TYPE_FOO_ENUM (foo_enum_get_type ())
+
+#define MAMAN_TYPE_ENUM_DEFAULT (maman_enum_default_get_type ())
+#define MAMAN_ENUM_DEFAULT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_ENUM_DEFAULT, 
MamanEnumDefault))
+#define MAMAN_ENUM_DEFAULT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAMAN_TYPE_ENUM_DEFAULT, 
MamanEnumDefaultClass))
+#define MAMAN_IS_ENUM_DEFAULT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_ENUM_DEFAULT))
+#define MAMAN_IS_ENUM_DEFAULT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAMAN_TYPE_ENUM_DEFAULT))
+#define MAMAN_ENUM_DEFAULT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAMAN_TYPE_ENUM_DEFAULT, 
MamanEnumDefaultClass))
+
+typedef struct _MamanEnumDefault MamanEnumDefault;
+typedef struct _MamanEnumDefaultClass MamanEnumDefaultClass;
+typedef struct _MamanEnumDefaultPrivate MamanEnumDefaultPrivate;
+typedef struct _MamanParamSpecEnumDefault MamanParamSpecEnumDefault;
+
+#define MAMAN_TYPE_BAR (maman_bar_get_type ())
+#define MAMAN_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_BAR, MamanBar))
+#define MAMAN_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAMAN_TYPE_BAR, MamanBarClass))
+#define MAMAN_IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_BAR))
+#define MAMAN_IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAMAN_TYPE_BAR))
+#define MAMAN_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAMAN_TYPE_BAR, MamanBarClass))
+
+typedef struct _MamanBar MamanBar;
+typedef struct _MamanBarClass MamanBarClass;
+typedef struct _MamanBarPrivate MamanBarPrivate;
+enum  {
+       MAMAN_BAR_0_PROPERTY,
+       MAMAN_BAR_PUBLIC_PROPERTY_PROPERTY,
+       MAMAN_BAR_ABSTRACT_BASE_PROPERTY_PROPERTY,
+       MAMAN_BAR_NUM_PROPERTIES
+};
+static GParamSpec* maman_bar_properties[MAMAN_BAR_NUM_PROPERTIES];
+typedef struct _MamanBazPrivate MamanBazPrivate;
+enum  {
+       MAMAN_BAZ_0_PROPERTY,
+       MAMAN_BAZ_NUMBER_PROPERTY,
+       MAMAN_BAZ_NUM_PROPERTIES
+};
+static GParamSpec* maman_baz_properties[MAMAN_BAZ_NUM_PROPERTIES];
+
+#define MAMAN_TYPE_IBIZ (maman_ibiz_get_type ())
+#define MAMAN_IBIZ(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_IBIZ, MamanIBiz))
+#define MAMAN_IS_IBIZ(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_IBIZ))
+#define MAMAN_IBIZ_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), MAMAN_TYPE_IBIZ, 
MamanIBizIface))
+
+typedef struct _MamanIBiz MamanIBiz;
+typedef struct _MamanIBizIface MamanIBizIface;
+
+#define MAMAN_TYPE_ABIZ (maman_abiz_get_type ())
+#define MAMAN_ABIZ(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_ABIZ, MamanABiz))
+#define MAMAN_ABIZ_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAMAN_TYPE_ABIZ, MamanABizClass))
+#define MAMAN_IS_ABIZ(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_ABIZ))
+#define MAMAN_IS_ABIZ_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAMAN_TYPE_ABIZ))
+#define MAMAN_ABIZ_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAMAN_TYPE_ABIZ, MamanABizClass))
+
+typedef struct _MamanABiz MamanABiz;
+typedef struct _MamanABizClass MamanABizClass;
+typedef struct _MamanABizPrivate MamanABizPrivate;
+enum  {
+       MAMAN_ABIZ_0_PROPERTY,
+       MAMAN_ABIZ_NUMBER_PROPERTY,
+       MAMAN_ABIZ_NUMBER2_PROPERTY,
+       MAMAN_ABIZ_NUM_PROPERTIES
+};
+static GParamSpec* maman_abiz_properties[MAMAN_ABIZ_NUM_PROPERTIES];
+
+#define MAMAN_TYPE_BIZ (maman_biz_get_type ())
+#define MAMAN_BIZ(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_BIZ, MamanBiz))
+#define MAMAN_BIZ_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAMAN_TYPE_BIZ, MamanBizClass))
+#define MAMAN_IS_BIZ(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_BIZ))
+#define MAMAN_IS_BIZ_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAMAN_TYPE_BIZ))
+#define MAMAN_BIZ_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAMAN_TYPE_BIZ, MamanBizClass))
+
+typedef struct _MamanBiz MamanBiz;
+typedef struct _MamanBizClass MamanBizClass;
+typedef struct _MamanBizPrivate MamanBizPrivate;
+enum  {
+       MAMAN_BIZ_0_PROPERTY,
+       MAMAN_BIZ_NUMBER2_PROPERTY,
+       MAMAN_BIZ_NUM_PROPERTIES
+};
+static GParamSpec* maman_biz_properties[MAMAN_BIZ_NUM_PROPERTIES];
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _RealStruct {
+       gint field;
+};
+
+struct _NonPrivAccess {
+       GObject parent_instance;
+       NonPrivAccessPrivate * priv;
+};
+
+struct _NonPrivAccessClass {
+       GObjectClass parent_class;
+};
+
+struct _NonPrivAccessPrivate {
+       RealStruct _real_struct;
+};
+
+struct _Sample {
+       GObject parent_instance;
+       SamplePrivate * priv;
+};
+
+struct _SampleClass {
+       GObjectClass parent_class;
+};
+
+struct _SamplePrivate {
+       gchar* _automatic;
+       Delegate _deleg;
+       gchar* _name;
+       gchar* _read_only;
+       gint _public_prop;
+       gint _private_prop;
+       GRecMutex __lock_public_prop;
+       GRecMutex __lock_private_prop;
+};
+
+struct _MamanIbazIface {
+       GTypeInterface parent_iface;
+       gint (*get_number) (MamanIbaz* self);
+};
+
+struct _MamanFoo {
+       GObject parent_instance;
+       MamanFooPrivate * priv;
+};
+
+struct _MamanFooClass {
+       GObjectClass parent_class;
+       gint (*get_abstract_base_property) (MamanFoo* self);
+       void (*set_abstract_base_property) (MamanFoo* self, gint value);
+};
+
+struct _MamanFooPrivate {
+       gint _public_base_property;
+};
+
+struct _MamanEnumDefault {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       MamanEnumDefaultPrivate * priv;
+};
+
+struct _MamanEnumDefaultClass {
+       GTypeClass parent_class;
+       void (*finalize) (MamanEnumDefault *self);
+       FooEnum (*get_bar) (MamanEnumDefault* self);
+};
+
+struct _MamanParamSpecEnumDefault {
+       GParamSpec parent_instance;
+};
+
+struct _MamanBar {
+       MamanFoo parent_instance;
+       MamanBarPrivate * priv;
+};
+
+struct _MamanBarClass {
+       MamanFooClass parent_class;
+};
+
+struct _MamanBarPrivate {
+       gint _public_property;
+       gint _abstract_base_property;
+};
+
+struct _MamanBaz {
+       GObject parent_instance;
+       MamanBazPrivate * priv;
+};
+
+struct _MamanBazClass {
+       GObjectClass parent_class;
+};
+
+struct _MamanIBizIface {
+       GTypeInterface parent_iface;
+       gint (*get_number) (MamanIBiz* self);
+       void (*set_number) (MamanIBiz* self, gint value);
+};
+
+struct _MamanABiz {
+       GObject parent_instance;
+       MamanABizPrivate * priv;
+};
+
+struct _MamanABizClass {
+       GObjectClass parent_class;
+       gint (*get_number2) (MamanABiz* self);
+       void (*set_number2) (MamanABiz* self, gint value);
+};
+
+struct _MamanABizPrivate {
+       gint _number;
+};
+
+struct _MamanBiz {
+       MamanABiz parent_instance;
+       MamanBizPrivate * priv;
+};
+
+struct _MamanBizClass {
+       MamanABizClass parent_class;
+};
+
+struct _MamanBizPrivate {
+       gint _number2;
+};
+
+static gint NonPrivAccess_private_offset;
+static gpointer non_priv_access_parent_class = NULL;
+static gint Sample_private_offset;
+static gpointer sample_parent_class = NULL;
+static gint MamanFoo_private_offset;
+static gpointer maman_foo_parent_class = NULL;
+static gpointer maman_enum_default_parent_class = NULL;
+static gint MamanBar_private_offset;
+static gpointer maman_bar_parent_class = NULL;
+static gpointer maman_baz_parent_class = NULL;
+static MamanIbazIface * maman_baz_maman_ibaz_parent_iface = NULL;
+static gint MamanABiz_private_offset;
+static gpointer maman_abiz_parent_class = NULL;
+static MamanIBizIface * maman_abiz_maman_ibiz_parent_iface = NULL;
+static gint MamanBiz_private_offset;
+static gpointer maman_biz_parent_class = NULL;
+
+VALA_EXTERN GType real_struct_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN RealStruct* real_struct_dup (const RealStruct* self);
+VALA_EXTERN void real_struct_free (RealStruct* self);
+VALA_EXTERN GType non_priv_access_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (NonPrivAccess, g_object_unref)
+VALA_EXTERN NonPrivAccess* non_priv_access_new (void);
+VALA_EXTERN NonPrivAccess* non_priv_access_construct (GType object_type);
+VALA_EXTERN void non_priv_access_get_real_struct (NonPrivAccess* self,
+                                      RealStruct * result);
+VALA_EXTERN void non_priv_access_set_real_struct (NonPrivAccess* self,
+                                      RealStruct * value);
+static gboolean _real_struct_equal (const RealStruct * s1,
+                             const RealStruct * s2);
+static void non_priv_access_finalize (GObject * obj);
+static GType non_priv_access_get_type_once (void);
+static void _vala_non_priv_access_get_property (GObject * object,
+                                         guint property_id,
+                                         GValue * value,
+                                         GParamSpec * pspec);
+static void _vala_non_priv_access_set_property (GObject * object,
+                                         guint property_id,
+                                         const GValue * value,
+                                         GParamSpec * pspec);
+VALA_EXTERN GType sample_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Sample, g_object_unref)
+VALA_EXTERN Sample* sample_new (const gchar* name);
+VALA_EXTERN Sample* sample_construct (GType object_type,
+                          const gchar* name);
+VALA_EXTERN void sample_set_name (Sample* self,
+                      const gchar* value);
+VALA_EXTERN void sample_run (Sample* self);
+static void __lambda4_ (Sample* self,
+                 GObject* s,
+                 GParamSpec* p);
+static void ___lambda4__g_object_notify (GObject* _sender,
+                                  GParamSpec* pspec,
+                                  gpointer self);
+static void sample_set_automatic (Sample* self,
+                           const gchar* value);
+static const gchar* sample_get_automatic (Sample* self);
+VALA_EXTERN const gchar* sample_get_name (Sample* self);
+VALA_EXTERN const gchar* sample_get_read_only (Sample* self);
+VALA_EXTERN void sample_set_deleg (Sample* self,
+                       Delegate value);
+VALA_EXTERN gint sample_get_public_prop (Sample* self);
+VALA_EXTERN void sample_set_public_prop (Sample* self,
+                             gint value);
+static gint sample_get_private_prop (Sample* self);
+static void sample_set_private_prop (Sample* self,
+                              gint value);
+static gint sample_main (void);
+VALA_EXTERN void maman_bar_run (void);
+VALA_EXTERN GType maman_ibaz_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN MamanBaz* maman_baz_new (void);
+VALA_EXTERN MamanBaz* maman_baz_construct (GType object_type);
+VALA_EXTERN GType maman_baz_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MamanBaz, g_object_unref)
+VALA_EXTERN void maman_ibaz_simple_method (MamanIbaz* self);
+VALA_EXTERN Delegate sample_get_deleg (Sample* self);
+static GObject * sample_constructor (GType type,
+                              guint n_construct_properties,
+                              GObjectConstructParam * construct_properties);
+static void sample_finalize (GObject * obj);
+static GType sample_get_type_once (void);
+static void _vala_sample_get_property (GObject * object,
+                                guint property_id,
+                                GValue * value,
+                                GParamSpec * pspec);
+static void _vala_sample_set_property (GObject * object,
+                                guint property_id,
+                                const GValue * value,
+                                GParamSpec * pspec);
+VALA_EXTERN GType maman_foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MamanFoo, g_object_unref)
+VALA_EXTERN MamanFoo* maman_foo_construct (GType object_type);
+VALA_EXTERN gint maman_foo_get_public_base_property (MamanFoo* self);
+VALA_EXTERN void maman_foo_set_public_base_property (MamanFoo* self,
+                                         gint value);
+VALA_EXTERN gint maman_foo_get_abstract_base_property (MamanFoo* self);
+VALA_EXTERN void maman_foo_set_abstract_base_property (MamanFoo* self,
+                                           gint value);
+static void maman_foo_finalize (GObject * obj);
+static GType maman_foo_get_type_once (void);
+static void _vala_maman_foo_get_property (GObject * object,
+                                   guint property_id,
+                                   GValue * value,
+                                   GParamSpec * pspec);
+static void _vala_maman_foo_set_property (GObject * object,
+                                   guint property_id,
+                                   const GValue * value,
+                                   GParamSpec * pspec);
+VALA_EXTERN GType foo_enum_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN gpointer maman_enum_default_ref (gpointer instance);
+VALA_EXTERN void maman_enum_default_unref (gpointer instance);
+VALA_EXTERN GParamSpec* maman_param_spec_enum_default (const gchar* name,
+                                           const gchar* nick,
+                                           const gchar* blurb,
+                                           GType object_type,
+                                           GParamFlags flags);
+VALA_EXTERN void maman_value_set_enum_default (GValue* value,
+                                   gpointer v_object);
+VALA_EXTERN void maman_value_take_enum_default (GValue* value,
+                                    gpointer v_object);
+VALA_EXTERN gpointer maman_value_get_enum_default (const GValue* value);
+VALA_EXTERN GType maman_enum_default_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MamanEnumDefault, maman_enum_default_unref)
+VALA_EXTERN MamanEnumDefault* maman_enum_default_construct (GType object_type);
+VALA_EXTERN FooEnum maman_enum_default_get_bar (MamanEnumDefault* self);
+static void maman_enum_default_finalize (MamanEnumDefault * obj);
+static GType maman_enum_default_get_type_once (void);
+VALA_EXTERN GType maman_bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MamanBar, g_object_unref)
+static void maman_bar_do_action (MamanBar* self);
+VALA_EXTERN gint maman_bar_get_public_property (MamanBar* self);
+VALA_EXTERN void maman_bar_set_public_property (MamanBar* self,
+                                    gint value);
+VALA_EXTERN MamanBar* maman_bar_new (void);
+VALA_EXTERN MamanBar* maman_bar_construct (GType object_type);
+static void maman_bar_finalize (GObject * obj);
+static GType maman_bar_get_type_once (void);
+static void _vala_maman_bar_get_property (GObject * object,
+                                   guint property_id,
+                                   GValue * value,
+                                   GParamSpec * pspec);
+static void _vala_maman_bar_set_property (GObject * object,
+                                   guint property_id,
+                                   const GValue * value,
+                                   GParamSpec * pspec);
+VALA_EXTERN gint maman_ibaz_get_number (MamanIbaz* self);
+static GType maman_ibaz_get_type_once (void);
+static GType maman_baz_get_type_once (void);
+static void _vala_maman_baz_get_property (GObject * object,
+                                   guint property_id,
+                                   GValue * value,
+                                   GParamSpec * pspec);
+VALA_EXTERN GType maman_ibiz_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN gint maman_ibiz_get_number (MamanIBiz* self);
+VALA_EXTERN void maman_ibiz_set_number (MamanIBiz* self,
+                            gint value);
+static GType maman_ibiz_get_type_once (void);
+VALA_EXTERN GType maman_abiz_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MamanABiz, g_object_unref)
+VALA_EXTERN MamanABiz* maman_abiz_construct (GType object_type);
+VALA_EXTERN gint maman_abiz_get_number2 (MamanABiz* self);
+VALA_EXTERN void maman_abiz_set_number2 (MamanABiz* self,
+                             gint value);
+static void maman_abiz_finalize (GObject * obj);
+static GType maman_abiz_get_type_once (void);
+static void _vala_maman_abiz_get_property (GObject * object,
+                                    guint property_id,
+                                    GValue * value,
+                                    GParamSpec * pspec);
+static void _vala_maman_abiz_set_property (GObject * object,
+                                    guint property_id,
+                                    const GValue * value,
+                                    GParamSpec * pspec);
+VALA_EXTERN GType maman_biz_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MamanBiz, g_object_unref)
+VALA_EXTERN MamanBiz* maman_biz_new (void);
+VALA_EXTERN MamanBiz* maman_biz_construct (GType object_type);
+static void maman_biz_finalize (GObject * obj);
+static GType maman_biz_get_type_once (void);
+static void _vala_maman_biz_get_property (GObject * object,
+                                   guint property_id,
+                                   GValue * value,
+                                   GParamSpec * pspec);
+static void _vala_maman_biz_set_property (GObject * object,
+                                   guint property_id,
+                                   const GValue * value,
+                                   GParamSpec * pspec);
+
+RealStruct*
+real_struct_dup (const RealStruct* self)
+{
+       RealStruct* dup;
+       dup = g_new0 (RealStruct, 1);
+       memcpy (dup, self, sizeof (RealStruct));
+       return dup;
+}
+
+void
+real_struct_free (RealStruct* self)
+{
+       g_free (self);
+}
+
+static GType
+real_struct_get_type_once (void)
+{
+       GType real_struct_type_id;
+       real_struct_type_id = g_boxed_type_register_static ("RealStruct", (GBoxedCopyFunc) real_struct_dup, 
(GBoxedFreeFunc) real_struct_free);
+       return real_struct_type_id;
+}
+
+GType
+real_struct_get_type (void)
+{
+       static volatile gsize real_struct_type_id__volatile = 0;
+       if (g_once_init_enter (&real_struct_type_id__volatile)) {
+               GType real_struct_type_id;
+               real_struct_type_id = real_struct_get_type_once ();
+               g_once_init_leave (&real_struct_type_id__volatile, real_struct_type_id);
+       }
+       return real_struct_type_id__volatile;
+}
+
+static inline gpointer
+non_priv_access_get_instance_private (NonPrivAccess* self)
+{
+       return G_STRUCT_MEMBER_P (self, NonPrivAccess_private_offset);
+}
+
+NonPrivAccess*
+non_priv_access_construct (GType object_type)
+{
+       NonPrivAccess * self = NULL;
+       self = (NonPrivAccess*) g_object_new (object_type, NULL);
+       return self;
+}
+
+NonPrivAccess*
+non_priv_access_new (void)
+{
+       return non_priv_access_construct (TYPE_NON_PRIV_ACCESS);
+}
+
+void
+non_priv_access_get_real_struct (NonPrivAccess* self,
+                                 RealStruct * result)
+{
+       RealStruct _tmp0_;
+       g_return_if_fail (IS_NON_PRIV_ACCESS (self));
+       _tmp0_ = self->priv->_real_struct;
+       *result = _tmp0_;
+       return;
+}
+
+static gboolean
+_real_struct_equal (const RealStruct * s1,
+                    const RealStruct * s2)
+{
+       if (s1 == s2) {
+               return TRUE;
+       }
+       if (s1 == NULL) {
+               return FALSE;
+       }
+       if (s2 == NULL) {
+               return FALSE;
+       }
+       if (s1->field != s2->field) {
+               return FALSE;
+       }
+       return TRUE;
+}
+
+void
+non_priv_access_set_real_struct (NonPrivAccess* self,
+                                 RealStruct * value)
+{
+       RealStruct old_value;
+       g_return_if_fail (IS_NON_PRIV_ACCESS (self));
+       non_priv_access_get_real_struct (self, &old_value);
+       if (_real_struct_equal (value, &old_value) != TRUE) {
+               RealStruct _tmp0_;
+               _tmp0_ = *value;
+               self->priv->_real_struct = _tmp0_;
+               g_object_notify_by_pspec ((GObject *) self, 
non_priv_access_properties[NON_PRIV_ACCESS_REAL_STRUCT_PROPERTY]);
+       }
+}
+
+static void
+non_priv_access_class_init (NonPrivAccessClass * klass,
+                            gpointer klass_data)
+{
+       non_priv_access_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &NonPrivAccess_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_non_priv_access_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_non_priv_access_set_property;
+       G_OBJECT_CLASS (klass)->finalize = non_priv_access_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), NON_PRIV_ACCESS_REAL_STRUCT_PROPERTY, 
non_priv_access_properties[NON_PRIV_ACCESS_REAL_STRUCT_PROPERTY] = g_param_spec_boxed ("real-struct", 
"real-struct", "real-struct", TYPE_REAL_STRUCT, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | 
G_PARAM_WRITABLE));
+}
+
+static void
+non_priv_access_instance_init (NonPrivAccess * self,
+                               gpointer klass)
+{
+       self->priv = non_priv_access_get_instance_private (self);
+}
+
+static void
+non_priv_access_finalize (GObject * obj)
+{
+       NonPrivAccess * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_NON_PRIV_ACCESS, NonPrivAccess);
+       G_OBJECT_CLASS (non_priv_access_parent_class)->finalize (obj);
+}
+
+static GType
+non_priv_access_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (NonPrivAccessClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) non_priv_access_class_init, (GClassFinalizeFunc) NULL, NULL, 
sizeof (NonPrivAccess), 0, (GInstanceInitFunc) non_priv_access_instance_init, NULL };
+       GType non_priv_access_type_id;
+       non_priv_access_type_id = g_type_register_static (G_TYPE_OBJECT, "NonPrivAccess", 
&g_define_type_info, 0);
+       NonPrivAccess_private_offset = g_type_add_instance_private (non_priv_access_type_id, sizeof 
(NonPrivAccessPrivate));
+       return non_priv_access_type_id;
+}
+
+GType
+non_priv_access_get_type (void)
+{
+       static volatile gsize non_priv_access_type_id__volatile = 0;
+       if (g_once_init_enter (&non_priv_access_type_id__volatile)) {
+               GType non_priv_access_type_id;
+               non_priv_access_type_id = non_priv_access_get_type_once ();
+               g_once_init_leave (&non_priv_access_type_id__volatile, non_priv_access_type_id);
+       }
+       return non_priv_access_type_id__volatile;
+}
+
+static void
+_vala_non_priv_access_get_property (GObject * object,
+                                    guint property_id,
+                                    GValue * value,
+                                    GParamSpec * pspec)
+{
+       NonPrivAccess * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_NON_PRIV_ACCESS, NonPrivAccess);
+       switch (property_id) {
+               case NON_PRIV_ACCESS_REAL_STRUCT_PROPERTY:
+               {
+                       RealStruct boxed;
+                       non_priv_access_get_real_struct (self, &boxed);
+                       g_value_set_boxed (value, &boxed);
+               }
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_non_priv_access_set_property (GObject * object,
+                                    guint property_id,
+                                    const GValue * value,
+                                    GParamSpec * pspec)
+{
+       NonPrivAccess * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_NON_PRIV_ACCESS, NonPrivAccess);
+       switch (property_id) {
+               case NON_PRIV_ACCESS_REAL_STRUCT_PROPERTY:
+               non_priv_access_set_real_struct (self, g_value_get_boxed (value));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static inline gpointer
+sample_get_instance_private (Sample* self)
+{
+       return G_STRUCT_MEMBER_P (self, Sample_private_offset);
+}
+
+Sample*
+sample_construct (GType object_type,
+                  const gchar* name)
+{
+       Sample * self = NULL;
+       g_return_val_if_fail (name != NULL, NULL);
+       self = (Sample*) g_object_new (object_type, NULL);
+       sample_set_name (self, name);
+       return self;
+}
+
+Sample*
+sample_new (const gchar* name)
+{
+       return sample_construct (TYPE_SAMPLE, name);
+}
+
+static void
+__lambda4_ (Sample* self,
+            GObject* s,
+            GParamSpec* p)
+{
+       FILE* _tmp0_;
+       const gchar* _tmp1_;
+       g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (s, G_TYPE_OBJECT));
+       g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (p, G_TYPE_PARAM));
+       _tmp0_ = stdout;
+       _tmp1_ = p->name;
+       fprintf (_tmp0_, "property `%s' has changed!\n", _tmp1_);
+}
+
+static void
+___lambda4__g_object_notify (GObject* _sender,
+                             GParamSpec* pspec,
+                             gpointer self)
+{
+       __lambda4_ ((Sample*) self, _sender, pspec);
+}
+
+void
+sample_run (Sample* self)
+{
+       FILE* _tmp0_;
+       const gchar* _tmp1_;
+       FILE* _tmp2_;
+       const gchar* _tmp3_;
+       const gchar* _tmp4_;
+       FILE* _tmp5_;
+       const gchar* _tmp6_;
+       const gchar* _tmp7_;
+       FILE* _tmp8_;
+       const gchar* _tmp9_;
+       GError* _inner_error0_ = NULL;
+       g_return_if_fail (IS_SAMPLE (self));
+       g_signal_connect_object (G_TYPE_CHECK_INSTANCE_CAST (self, G_TYPE_OBJECT, GObject), "notify", 
(GCallback) ___lambda4__g_object_notify, self, 0);
+       sample_set_automatic (self, "TheNewAutomatic");
+       sample_set_name (self, "TheNewName");
+       _tmp0_ = stdout;
+       _tmp1_ = self->priv->_automatic;
+       fprintf (_tmp0_, "automatic: %s\n", _tmp1_);
+       _tmp2_ = stdout;
+       _tmp3_ = sample_get_name (self);
+       _tmp4_ = _tmp3_;
+       fprintf (_tmp2_, "name: %s\n", _tmp4_);
+       _tmp5_ = stdout;
+       _tmp6_ = sample_get_read_only (self);
+       _tmp7_ = _tmp6_;
+       fprintf (_tmp5_, "read_only: %s\n", _tmp7_);
+       _tmp8_ = stdout;
+       _tmp9_ = self->priv->_automatic;
+       fprintf (_tmp8_, "automatic: %s\n", _tmp9_);
+       sample_set_deleg (self, NULL);
+       {
+               gint _tmp10_;
+               _tmp10_ = self->priv->_public_prop;
+               g_rec_mutex_lock (&self->priv->__lock_public_prop);
+               {
+                       sample_set_public_prop (self, 42);
+               }
+               __finally0:
+               {
+                       gint _tmp11_;
+                       _tmp11_ = self->priv->_public_prop;
+                       g_rec_mutex_unlock (&self->priv->__lock_public_prop);
+               }
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+       }
+       {
+               gint _tmp12_;
+               _tmp12_ = self->priv->_private_prop;
+               g_rec_mutex_lock (&self->priv->__lock_private_prop);
+               {
+                       sample_set_private_prop (self, 42);
+               }
+               __finally1:
+               {
+                       gint _tmp13_;
+                       _tmp13_ = self->priv->_private_prop;
+                       g_rec_mutex_unlock (&self->priv->__lock_private_prop);
+               }
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+       }
+}
+
+static gint
+sample_main (void)
+{
+       Sample* test = NULL;
+       Sample* _tmp0_;
+       FILE* _tmp1_;
+       MamanIbaz* ibaz = NULL;
+       MamanBaz* _tmp2_;
+       FILE* _tmp3_;
+       NonPrivAccess* nonpriv = NULL;
+       NonPrivAccess* _tmp4_;
+       RealStruct _tmp5_ = {0};
+       RealStruct* _tmp6_;
+       RealStruct* _tmp7_;
+       RealStruct* _tmp8_;
+       gint result = 0;
+       _tmp0_ = sample_new ("InitialName");
+       test = _tmp0_;
+       sample_run (test);
+       maman_bar_run ();
+       _tmp1_ = stdout;
+       fprintf (_tmp1_, "Interface Properties Test: 1");
+       _tmp2_ = maman_baz_new ();
+       ibaz = G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, MAMAN_TYPE_IBAZ, MamanIbaz);
+       maman_ibaz_simple_method (ibaz);
+       _tmp3_ = stdout;
+       fprintf (_tmp3_, " 3\n");
+       _tmp4_ = non_priv_access_new ();
+       nonpriv = _tmp4_;
+       _tmp5_.field = 10;
+       g_object_set (nonpriv, "real-struct", &_tmp5_, NULL);
+       g_object_get (nonpriv, "real-struct", &_tmp6_, NULL);
+       _tmp7_ = _tmp6_;
+       _tmp8_ = _tmp7_;
+       _vala_assert ((*_tmp8_).field == 10, "nonpriv.real_struct.field == 10");
+       _real_struct_free0 (_tmp8_);
+       result = 0;
+       _g_object_unref0 (nonpriv);
+       _g_object_unref0 (ibaz);
+       _g_object_unref0 (test);
+       return result;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       return sample_main ();
+}
+
+static const gchar*
+sample_get_automatic (Sample* self)
+{
+       const gchar* result;
+       const gchar* _tmp0_;
+       g_return_val_if_fail (IS_SAMPLE (self), NULL);
+       _tmp0_ = self->priv->_automatic;
+       result = _tmp0_;
+       return result;
+}
+
+static void
+sample_set_automatic (Sample* self,
+                      const gchar* value)
+{
+       gchar* _tmp0_;
+       g_return_if_fail (IS_SAMPLE (self));
+       _tmp0_ = g_strdup (value);
+       _g_free0 (self->priv->_automatic);
+       self->priv->_automatic = _tmp0_;
+}
+
+Delegate
+sample_get_deleg (Sample* self)
+{
+       Delegate result;
+       Delegate _tmp0_;
+       g_return_val_if_fail (IS_SAMPLE (self), NULL);
+       _tmp0_ = self->priv->_deleg;
+       result = _tmp0_;
+       return result;
+}
+
+void
+sample_set_deleg (Sample* self,
+                  Delegate value)
+{
+       Delegate old_value;
+       g_return_if_fail (IS_SAMPLE (self));
+       old_value = sample_get_deleg (self);
+       if (old_value != value) {
+               Delegate _tmp0_;
+               _tmp0_ = value;
+               value = NULL;
+               self->priv->_deleg = _tmp0_;
+               g_object_notify_by_pspec ((GObject *) self, sample_properties[SAMPLE_DELEG_PROPERTY]);
+       }
+}
+
+const gchar*
+sample_get_name (Sample* self)
+{
+       const gchar* result;
+       const gchar* _tmp0_;
+       g_return_val_if_fail (IS_SAMPLE (self), NULL);
+       _tmp0_ = self->priv->_name;
+       result = _tmp0_;
+       return result;
+}
+
+void
+sample_set_name (Sample* self,
+                 const gchar* value)
+{
+       gchar* _tmp0_;
+       g_return_if_fail (IS_SAMPLE (self));
+       _tmp0_ = g_strdup (value);
+       _g_free0 (self->priv->_name);
+       self->priv->_name = _tmp0_;
+       g_object_notify_by_pspec ((GObject *) self, sample_properties[SAMPLE_NAME_PROPERTY]);
+}
+
+const gchar*
+sample_get_read_only (Sample* self)
+{
+       const gchar* result;
+       const gchar* _tmp0_;
+       g_return_val_if_fail (IS_SAMPLE (self), NULL);
+       _tmp0_ = self->priv->_read_only;
+       result = _tmp0_;
+       return result;
+}
+
+gint
+sample_get_public_prop (Sample* self)
+{
+       gint result;
+       g_return_val_if_fail (IS_SAMPLE (self), 0);
+       result = self->priv->_public_prop;
+       return result;
+}
+
+void
+sample_set_public_prop (Sample* self,
+                        gint value)
+{
+       gint old_value;
+       g_return_if_fail (IS_SAMPLE (self));
+       old_value = sample_get_public_prop (self);
+       if (old_value != value) {
+               self->priv->_public_prop = value;
+               g_object_notify_by_pspec ((GObject *) self, sample_properties[SAMPLE_PUBLIC_PROP_PROPERTY]);
+       }
+}
+
+static gint
+sample_get_private_prop (Sample* self)
+{
+       gint result;
+       g_return_val_if_fail (IS_SAMPLE (self), 0);
+       result = self->priv->_private_prop;
+       return result;
+}
+
+static void
+sample_set_private_prop (Sample* self,
+                         gint value)
+{
+       g_return_if_fail (IS_SAMPLE (self));
+       self->priv->_private_prop = value;
+}
+
+static GObject *
+sample_constructor (GType type,
+                    guint n_construct_properties,
+                    GObjectConstructParam * construct_properties)
+{
+       GObject * obj;
+       GObjectClass * parent_class;
+       Sample * self;
+       gchar* _tmp0_;
+       gchar* _tmp1_;
+       parent_class = G_OBJECT_CLASS (sample_parent_class);
+       obj = parent_class->constructor (type, n_construct_properties, construct_properties);
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_SAMPLE, Sample);
+       _tmp0_ = g_strdup ("InitialAutomatic");
+       _g_free0 (self->priv->_automatic);
+       self->priv->_automatic = _tmp0_;
+       _tmp1_ = g_strdup ("InitialReadOnly");
+       _g_free0 (self->priv->_read_only);
+       self->priv->_read_only = _tmp1_;
+       return obj;
+}
+
+static void
+sample_class_init (SampleClass * klass,
+                   gpointer klass_data)
+{
+       sample_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Sample_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_sample_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_sample_set_property;
+       G_OBJECT_CLASS (klass)->constructor = sample_constructor;
+       G_OBJECT_CLASS (klass)->finalize = sample_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), SAMPLE_DELEG_PROPERTY, 
sample_properties[SAMPLE_DELEG_PROPERTY] = g_param_spec_pointer ("deleg", "deleg", "deleg", 
G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), SAMPLE_NAME_PROPERTY, 
sample_properties[SAMPLE_NAME_PROPERTY] = g_param_spec_string ("name", "name", "name", NULL, 
G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), SAMPLE_READ_ONLY_PROPERTY, 
sample_properties[SAMPLE_READ_ONLY_PROPERTY] = g_param_spec_string ("read-only", "read-only", "read-only", 
NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), SAMPLE_PUBLIC_PROP_PROPERTY, 
sample_properties[SAMPLE_PUBLIC_PROP_PROPERTY] = g_param_spec_int ("public-prop", "public-prop", 
"public-prop", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+}
+
+static void
+sample_instance_init (Sample * self,
+                      gpointer klass)
+{
+       self->priv = sample_get_instance_private (self);
+       g_rec_mutex_init (&self->priv->__lock_public_prop);
+       g_rec_mutex_init (&self->priv->__lock_private_prop);
+}
+
+static void
+sample_finalize (GObject * obj)
+{
+       Sample * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_SAMPLE, Sample);
+       _g_free0 (self->priv->_automatic);
+       _g_free0 (self->priv->_name);
+       _g_free0 (self->priv->_read_only);
+       g_rec_mutex_clear (&self->priv->__lock_public_prop);
+       g_rec_mutex_clear (&self->priv->__lock_private_prop);
+       G_OBJECT_CLASS (sample_parent_class)->finalize (obj);
+}
+
+static GType
+sample_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (SampleClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) sample_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(Sample), 0, (GInstanceInitFunc) sample_instance_init, NULL };
+       GType sample_type_id;
+       sample_type_id = g_type_register_static (G_TYPE_OBJECT, "Sample", &g_define_type_info, 0);
+       Sample_private_offset = g_type_add_instance_private (sample_type_id, sizeof (SamplePrivate));
+       return sample_type_id;
+}
+
+GType
+sample_get_type (void)
+{
+       static volatile gsize sample_type_id__volatile = 0;
+       if (g_once_init_enter (&sample_type_id__volatile)) {
+               GType sample_type_id;
+               sample_type_id = sample_get_type_once ();
+               g_once_init_leave (&sample_type_id__volatile, sample_type_id);
+       }
+       return sample_type_id__volatile;
+}
+
+static void
+_vala_sample_get_property (GObject * object,
+                           guint property_id,
+                           GValue * value,
+                           GParamSpec * pspec)
+{
+       Sample * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_SAMPLE, Sample);
+       switch (property_id) {
+               case SAMPLE_DELEG_PROPERTY:
+               g_value_set_pointer (value, sample_get_deleg (self));
+               break;
+               case SAMPLE_NAME_PROPERTY:
+               g_value_set_string (value, sample_get_name (self));
+               break;
+               case SAMPLE_READ_ONLY_PROPERTY:
+               g_value_set_string (value, sample_get_read_only (self));
+               break;
+               case SAMPLE_PUBLIC_PROP_PROPERTY:
+               g_value_set_int (value, sample_get_public_prop (self));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_sample_set_property (GObject * object,
+                           guint property_id,
+                           const GValue * value,
+                           GParamSpec * pspec)
+{
+       Sample * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_SAMPLE, Sample);
+       switch (property_id) {
+               case SAMPLE_DELEG_PROPERTY:
+               sample_set_deleg (self, g_value_get_pointer (value));
+               break;
+               case SAMPLE_NAME_PROPERTY:
+               sample_set_name (self, g_value_get_string (value));
+               break;
+               case SAMPLE_PUBLIC_PROP_PROPERTY:
+               sample_set_public_prop (self, g_value_get_int (value));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static inline gpointer
+maman_foo_get_instance_private (MamanFoo* self)
+{
+       return G_STRUCT_MEMBER_P (self, MamanFoo_private_offset);
+}
+
+MamanFoo*
+maman_foo_construct (GType object_type)
+{
+       MamanFoo * self = NULL;
+       self = (MamanFoo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+gint
+maman_foo_get_public_base_property (MamanFoo* self)
+{
+       gint result;
+       g_return_val_if_fail (MAMAN_IS_FOO (self), 0);
+       result = self->priv->_public_base_property;
+       return result;
+}
+
+void
+maman_foo_set_public_base_property (MamanFoo* self,
+                                    gint value)
+{
+       g_return_if_fail (MAMAN_IS_FOO (self));
+       self->priv->_public_base_property = value;
+       g_object_notify_by_pspec ((GObject *) self, 
maman_foo_properties[MAMAN_FOO_PUBLIC_BASE_PROPERTY_PROPERTY]);
+}
+
+gint
+maman_foo_get_abstract_base_property (MamanFoo* self)
+{
+       MamanFooClass* _klass_;
+       g_return_val_if_fail (MAMAN_IS_FOO (self), 0);
+       _klass_ = MAMAN_FOO_GET_CLASS (self);
+       if (_klass_->get_abstract_base_property) {
+               return _klass_->get_abstract_base_property (self);
+       }
+       return -1;
+}
+
+void
+maman_foo_set_abstract_base_property (MamanFoo* self,
+                                      gint value)
+{
+       MamanFooClass* _klass_;
+       g_return_if_fail (MAMAN_IS_FOO (self));
+       _klass_ = MAMAN_FOO_GET_CLASS (self);
+       if (_klass_->set_abstract_base_property) {
+               _klass_->set_abstract_base_property (self, value);
+       }
+}
+
+static void
+maman_foo_class_init (MamanFooClass * klass,
+                      gpointer klass_data)
+{
+       maman_foo_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &MamanFoo_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_maman_foo_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_maman_foo_set_property;
+       G_OBJECT_CLASS (klass)->finalize = maman_foo_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), MAMAN_FOO_PUBLIC_BASE_PROPERTY_PROPERTY, 
maman_foo_properties[MAMAN_FOO_PUBLIC_BASE_PROPERTY_PROPERTY] = g_param_spec_int ("public-base-property", 
"public-base-property", "public-base-property", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | 
G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), MAMAN_FOO_ABSTRACT_BASE_PROPERTY_PROPERTY, 
maman_foo_properties[MAMAN_FOO_ABSTRACT_BASE_PROPERTY_PROPERTY] = g_param_spec_int ("abstract-base-property", 
"abstract-base-property", "abstract-base-property", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | 
G_PARAM_READABLE | G_PARAM_WRITABLE));
+}
+
+static void
+maman_foo_instance_init (MamanFoo * self,
+                         gpointer klass)
+{
+       self->priv = maman_foo_get_instance_private (self);
+       self->priv->_public_base_property = 2;
+}
+
+static void
+maman_foo_finalize (GObject * obj)
+{
+       MamanFoo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, MAMAN_TYPE_FOO, MamanFoo);
+       G_OBJECT_CLASS (maman_foo_parent_class)->finalize (obj);
+}
+
+static GType
+maman_foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (MamanFooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(MamanFoo), 0, (GInstanceInitFunc) maman_foo_instance_init, NULL };
+       GType maman_foo_type_id;
+       maman_foo_type_id = g_type_register_static (G_TYPE_OBJECT, "MamanFoo", &g_define_type_info, 
G_TYPE_FLAG_ABSTRACT);
+       MamanFoo_private_offset = g_type_add_instance_private (maman_foo_type_id, sizeof (MamanFooPrivate));
+       return maman_foo_type_id;
+}
+
+GType
+maman_foo_get_type (void)
+{
+       static volatile gsize maman_foo_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_foo_type_id__volatile)) {
+               GType maman_foo_type_id;
+               maman_foo_type_id = maman_foo_get_type_once ();
+               g_once_init_leave (&maman_foo_type_id__volatile, maman_foo_type_id);
+       }
+       return maman_foo_type_id__volatile;
+}
+
+static void
+_vala_maman_foo_get_property (GObject * object,
+                              guint property_id,
+                              GValue * value,
+                              GParamSpec * pspec)
+{
+       MamanFoo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, MAMAN_TYPE_FOO, MamanFoo);
+       switch (property_id) {
+               case MAMAN_FOO_PUBLIC_BASE_PROPERTY_PROPERTY:
+               g_value_set_int (value, maman_foo_get_public_base_property (self));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_maman_foo_set_property (GObject * object,
+                              guint property_id,
+                              const GValue * value,
+                              GParamSpec * pspec)
+{
+       MamanFoo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, MAMAN_TYPE_FOO, MamanFoo);
+       switch (property_id) {
+               case MAMAN_FOO_PUBLIC_BASE_PROPERTY_PROPERTY:
+               maman_foo_set_public_base_property (self, g_value_get_int (value));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static GType
+foo_enum_get_type_once (void)
+{
+       static const GEnumValue values[] = {{FOO_ENUM_FOO, "FOO_ENUM_FOO", "foo"}, {0, NULL, NULL}};
+       GType foo_enum_type_id;
+       foo_enum_type_id = g_enum_register_static ("FooEnum", values);
+       return foo_enum_type_id;
+}
+
+GType
+foo_enum_get_type (void)
+{
+       static volatile gsize foo_enum_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_enum_type_id__volatile)) {
+               GType foo_enum_type_id;
+               foo_enum_type_id = foo_enum_get_type_once ();
+               g_once_init_leave (&foo_enum_type_id__volatile, foo_enum_type_id);
+       }
+       return foo_enum_type_id__volatile;
+}
+
+MamanEnumDefault*
+maman_enum_default_construct (GType object_type)
+{
+       MamanEnumDefault* self = NULL;
+       self = (MamanEnumDefault*) g_type_create_instance (object_type);
+       return self;
+}
+
+FooEnum
+maman_enum_default_get_bar (MamanEnumDefault* self)
+{
+       MamanEnumDefaultClass* _klass_;
+       g_return_val_if_fail (MAMAN_IS_ENUM_DEFAULT (self), 0);
+       _klass_ = MAMAN_ENUM_DEFAULT_GET_CLASS (self);
+       if (_klass_->get_bar) {
+               return _klass_->get_bar (self);
+       }
+       return 0;
+}
+
+static void
+maman_value_enum_default_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+maman_value_enum_default_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               maman_enum_default_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+maman_value_enum_default_copy_value (const GValue* src_value,
+                                     GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = maman_enum_default_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+maman_value_enum_default_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+maman_value_enum_default_collect_value (GValue* value,
+                                        guint n_collect_values,
+                                        GTypeCValue* collect_values,
+                                        guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               MamanEnumDefault * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = maman_enum_default_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+maman_value_enum_default_lcopy_value (const GValue* value,
+                                      guint n_collect_values,
+                                      GTypeCValue* collect_values,
+                                      guint collect_flags)
+{
+       MamanEnumDefault ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = maman_enum_default_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+maman_param_spec_enum_default (const gchar* name,
+                               const gchar* nick,
+                               const gchar* blurb,
+                               GType object_type,
+                               GParamFlags flags)
+{
+       MamanParamSpecEnumDefault* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, MAMAN_TYPE_ENUM_DEFAULT), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+maman_value_get_enum_default (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, MAMAN_TYPE_ENUM_DEFAULT), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+maman_value_set_enum_default (GValue* value,
+                              gpointer v_object)
+{
+       MamanEnumDefault * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, MAMAN_TYPE_ENUM_DEFAULT));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, MAMAN_TYPE_ENUM_DEFAULT));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               maman_enum_default_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               maman_enum_default_unref (old);
+       }
+}
+
+void
+maman_value_take_enum_default (GValue* value,
+                               gpointer v_object)
+{
+       MamanEnumDefault * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, MAMAN_TYPE_ENUM_DEFAULT));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, MAMAN_TYPE_ENUM_DEFAULT));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               maman_enum_default_unref (old);
+       }
+}
+
+static void
+maman_enum_default_class_init (MamanEnumDefaultClass * klass,
+                               gpointer klass_data)
+{
+       maman_enum_default_parent_class = g_type_class_peek_parent (klass);
+       ((MamanEnumDefaultClass *) klass)->finalize = maman_enum_default_finalize;
+}
+
+static void
+maman_enum_default_instance_init (MamanEnumDefault * self,
+                                  gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+maman_enum_default_finalize (MamanEnumDefault * obj)
+{
+       MamanEnumDefault * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, MAMAN_TYPE_ENUM_DEFAULT, MamanEnumDefault);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+maman_enum_default_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { maman_value_enum_default_init, 
maman_value_enum_default_free_value, maman_value_enum_default_copy_value, 
maman_value_enum_default_peek_pointer, "p", maman_value_enum_default_collect_value, "p", 
maman_value_enum_default_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (MamanEnumDefaultClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_enum_default_class_init, (GClassFinalizeFunc) NULL, NULL, 
sizeof (MamanEnumDefault), 0, (GInstanceInitFunc) maman_enum_default_instance_init, 
&g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType maman_enum_default_type_id;
+       maman_enum_default_type_id = g_type_register_fundamental (g_type_fundamental_next (), 
"MamanEnumDefault", &g_define_type_info, &g_define_type_fundamental_info, G_TYPE_FLAG_ABSTRACT);
+       return maman_enum_default_type_id;
+}
+
+GType
+maman_enum_default_get_type (void)
+{
+       static volatile gsize maman_enum_default_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_enum_default_type_id__volatile)) {
+               GType maman_enum_default_type_id;
+               maman_enum_default_type_id = maman_enum_default_get_type_once ();
+               g_once_init_leave (&maman_enum_default_type_id__volatile, maman_enum_default_type_id);
+       }
+       return maman_enum_default_type_id__volatile;
+}
+
+gpointer
+maman_enum_default_ref (gpointer instance)
+{
+       MamanEnumDefault * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+maman_enum_default_unref (gpointer instance)
+{
+       MamanEnumDefault * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               MAMAN_ENUM_DEFAULT_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static inline gpointer
+maman_bar_get_instance_private (MamanBar* self)
+{
+       return G_STRUCT_MEMBER_P (self, MamanBar_private_offset);
+}
+
+static void
+maman_bar_do_action (MamanBar* self)
+{
+       FILE* _tmp0_;
+       gint _tmp1_;
+       gint _tmp2_;
+       gint _tmp3_;
+       FILE* _tmp4_;
+       gint _tmp5_;
+       gint _tmp6_;
+       gint _tmp7_;
+       g_return_if_fail (MAMAN_IS_BAR (self));
+       _tmp0_ = stdout;
+       _tmp1_ = maman_foo_get_public_base_property (G_TYPE_CHECK_INSTANCE_CAST (self, MAMAN_TYPE_FOO, 
MamanFoo));
+       _tmp2_ = _tmp1_;
+       _tmp3_ = self->priv->_public_property;
+       fprintf (_tmp0_, " %d %d", _tmp2_, _tmp3_);
+       maman_foo_set_public_base_property (G_TYPE_CHECK_INSTANCE_CAST (self, MAMAN_TYPE_FOO, MamanFoo), 4);
+       maman_bar_set_public_property (self, 5);
+       _tmp4_ = stdout;
+       _tmp5_ = maman_foo_get_public_base_property (G_TYPE_CHECK_INSTANCE_CAST (self, MAMAN_TYPE_FOO, 
MamanFoo));
+       _tmp6_ = _tmp5_;
+       _tmp7_ = self->priv->_public_property;
+       fprintf (_tmp4_, " %d %d", _tmp6_, _tmp7_);
+}
+
+static gpointer
+_g_object_ref0 (gpointer self)
+{
+       return self ? g_object_ref (self) : NULL;
+}
+
+void
+maman_bar_run (void)
+{
+       FILE* _tmp0_;
+       MamanBar* bar = NULL;
+       MamanBar* _tmp1_;
+       MamanFoo* foo = NULL;
+       MamanFoo* _tmp2_;
+       FILE* _tmp3_;
+       gint _tmp4_;
+       gint _tmp5_;
+       FILE* _tmp6_;
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, "Property Test: 1");
+       _tmp1_ = maman_bar_new ();
+       bar = _tmp1_;
+       maman_bar_do_action (bar);
+       _tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (bar, MAMAN_TYPE_FOO, MamanFoo));
+       foo = _tmp2_;
+       maman_foo_set_abstract_base_property (foo, 6);
+       _tmp3_ = stdout;
+       _tmp4_ = maman_foo_get_abstract_base_property (foo);
+       _tmp5_ = _tmp4_;
+       fprintf (_tmp3_, " %d", _tmp5_);
+       _tmp6_ = stdout;
+       fprintf (_tmp6_, " 7\n");
+       _g_object_unref0 (foo);
+       _g_object_unref0 (bar);
+}
+
+MamanBar*
+maman_bar_construct (GType object_type)
+{
+       MamanBar * self = NULL;
+       self = (MamanBar*) maman_foo_construct (object_type);
+       return self;
+}
+
+MamanBar*
+maman_bar_new (void)
+{
+       return maman_bar_construct (MAMAN_TYPE_BAR);
+}
+
+gint
+maman_bar_get_public_property (MamanBar* self)
+{
+       gint result;
+       g_return_val_if_fail (MAMAN_IS_BAR (self), 0);
+       result = self->priv->_public_property;
+       return result;
+}
+
+void
+maman_bar_set_public_property (MamanBar* self,
+                               gint value)
+{
+       gint old_value;
+       g_return_if_fail (MAMAN_IS_BAR (self));
+       old_value = maman_bar_get_public_property (self);
+       if (old_value != value) {
+               self->priv->_public_property = value;
+               g_object_notify_by_pspec ((GObject *) self, 
maman_bar_properties[MAMAN_BAR_PUBLIC_PROPERTY_PROPERTY]);
+       }
+}
+
+static gint
+maman_bar_real_get_abstract_base_property (MamanFoo* base)
+{
+       gint result;
+       MamanBar* self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, MAMAN_TYPE_BAR, MamanBar);
+       result = self->priv->_abstract_base_property;
+       return result;
+}
+
+static void
+maman_bar_real_set_abstract_base_property (MamanFoo* base,
+                                           gint value)
+{
+       MamanBar* self;
+       gint old_value;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, MAMAN_TYPE_BAR, MamanBar);
+       old_value = maman_bar_real_get_abstract_base_property (base);
+       if (old_value != value) {
+               self->priv->_abstract_base_property = value;
+               g_object_notify_by_pspec ((GObject *) self, 
maman_bar_properties[MAMAN_BAR_ABSTRACT_BASE_PROPERTY_PROPERTY]);
+       }
+}
+
+static void
+maman_bar_class_init (MamanBarClass * klass,
+                      gpointer klass_data)
+{
+       maman_bar_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &MamanBar_private_offset);
+       MAMAN_FOO_CLASS (klass)->get_abstract_base_property = maman_bar_real_get_abstract_base_property;
+       MAMAN_FOO_CLASS (klass)->set_abstract_base_property = maman_bar_real_set_abstract_base_property;
+       G_OBJECT_CLASS (klass)->get_property = _vala_maman_bar_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_maman_bar_set_property;
+       G_OBJECT_CLASS (klass)->finalize = maman_bar_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), MAMAN_BAR_PUBLIC_PROPERTY_PROPERTY, 
maman_bar_properties[MAMAN_BAR_PUBLIC_PROPERTY_PROPERTY] = g_param_spec_int ("public-property", 
"public-property", "public-property", G_MININT, G_MAXINT, 3, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | 
G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), MAMAN_BAR_ABSTRACT_BASE_PROPERTY_PROPERTY, 
maman_bar_properties[MAMAN_BAR_ABSTRACT_BASE_PROPERTY_PROPERTY] = g_param_spec_int ("abstract-base-property", 
"abstract-base-property", "abstract-base-property", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | 
G_PARAM_READABLE | G_PARAM_WRITABLE));
+}
+
+static void
+maman_bar_instance_init (MamanBar * self,
+                         gpointer klass)
+{
+       self->priv = maman_bar_get_instance_private (self);
+       self->priv->_public_property = 3;
+}
+
+static void
+maman_bar_finalize (GObject * obj)
+{
+       MamanBar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, MAMAN_TYPE_BAR, MamanBar);
+       G_OBJECT_CLASS (maman_bar_parent_class)->finalize (obj);
+}
+
+static GType
+maman_bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (MamanBarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(MamanBar), 0, (GInstanceInitFunc) maman_bar_instance_init, NULL };
+       GType maman_bar_type_id;
+       maman_bar_type_id = g_type_register_static (MAMAN_TYPE_FOO, "MamanBar", &g_define_type_info, 0);
+       MamanBar_private_offset = g_type_add_instance_private (maman_bar_type_id, sizeof (MamanBarPrivate));
+       return maman_bar_type_id;
+}
+
+GType
+maman_bar_get_type (void)
+{
+       static volatile gsize maman_bar_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_bar_type_id__volatile)) {
+               GType maman_bar_type_id;
+               maman_bar_type_id = maman_bar_get_type_once ();
+               g_once_init_leave (&maman_bar_type_id__volatile, maman_bar_type_id);
+       }
+       return maman_bar_type_id__volatile;
+}
+
+static void
+_vala_maman_bar_get_property (GObject * object,
+                              guint property_id,
+                              GValue * value,
+                              GParamSpec * pspec)
+{
+       MamanBar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, MAMAN_TYPE_BAR, MamanBar);
+       switch (property_id) {
+               case MAMAN_BAR_PUBLIC_PROPERTY_PROPERTY:
+               g_value_set_int (value, maman_bar_get_public_property (self));
+               break;
+               case MAMAN_BAR_ABSTRACT_BASE_PROPERTY_PROPERTY:
+               g_value_set_int (value, maman_foo_get_abstract_base_property (G_TYPE_CHECK_INSTANCE_CAST 
(self, MAMAN_TYPE_FOO, MamanFoo)));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_maman_bar_set_property (GObject * object,
+                              guint property_id,
+                              const GValue * value,
+                              GParamSpec * pspec)
+{
+       MamanBar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, MAMAN_TYPE_BAR, MamanBar);
+       switch (property_id) {
+               case MAMAN_BAR_PUBLIC_PROPERTY_PROPERTY:
+               maman_bar_set_public_property (self, g_value_get_int (value));
+               break;
+               case MAMAN_BAR_ABSTRACT_BASE_PROPERTY_PROPERTY:
+               maman_foo_set_abstract_base_property (G_TYPE_CHECK_INSTANCE_CAST (self, MAMAN_TYPE_FOO, 
MamanFoo), g_value_get_int (value));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+void
+maman_ibaz_simple_method (MamanIbaz* self)
+{
+       gint n = 0;
+       gint _tmp0_;
+       gint _tmp1_;
+       FILE* _tmp2_;
+       _tmp0_ = maman_ibaz_get_number (self);
+       _tmp1_ = _tmp0_;
+       n = _tmp1_;
+       _tmp2_ = stdout;
+       fprintf (_tmp2_, " %d", n);
+}
+
+gint
+maman_ibaz_get_number (MamanIbaz* self)
+{
+       MamanIbazIface* _iface_;
+       g_return_val_if_fail (MAMAN_IS_IBAZ (self), 0);
+       _iface_ = MAMAN_IBAZ_GET_INTERFACE (self);
+       if (_iface_->get_number) {
+               return _iface_->get_number (self);
+       }
+       return -1;
+}
+
+static void
+maman_ibaz_default_init (MamanIbazIface * iface,
+                         gpointer iface_data)
+{
+       g_object_interface_install_property (iface, g_param_spec_int ("number", "number", "number", G_MININT, 
G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
+}
+
+static GType
+maman_ibaz_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (MamanIbazIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_ibaz_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType maman_ibaz_type_id;
+       maman_ibaz_type_id = g_type_register_static (G_TYPE_INTERFACE, "MamanIbaz", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (maman_ibaz_type_id, G_TYPE_OBJECT);
+       return maman_ibaz_type_id;
+}
+
+GType
+maman_ibaz_get_type (void)
+{
+       static volatile gsize maman_ibaz_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_ibaz_type_id__volatile)) {
+               GType maman_ibaz_type_id;
+               maman_ibaz_type_id = maman_ibaz_get_type_once ();
+               g_once_init_leave (&maman_ibaz_type_id__volatile, maman_ibaz_type_id);
+       }
+       return maman_ibaz_type_id__volatile;
+}
+
+MamanBaz*
+maman_baz_construct (GType object_type)
+{
+       MamanBaz * self = NULL;
+       self = (MamanBaz*) g_object_new (object_type, NULL);
+       return self;
+}
+
+MamanBaz*
+maman_baz_new (void)
+{
+       return maman_baz_construct (MAMAN_TYPE_BAZ);
+}
+
+static gint
+maman_baz_real_get_number (MamanIbaz* base)
+{
+       gint result;
+       MamanBaz* self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, MAMAN_TYPE_BAZ, MamanBaz);
+       result = 2;
+       return result;
+}
+
+static void
+maman_baz_class_init (MamanBazClass * klass,
+                      gpointer klass_data)
+{
+       maman_baz_parent_class = g_type_class_peek_parent (klass);
+       G_OBJECT_CLASS (klass)->get_property = _vala_maman_baz_get_property;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), MAMAN_BAZ_NUMBER_PROPERTY, 
maman_baz_properties[MAMAN_BAZ_NUMBER_PROPERTY] = g_param_spec_int ("number", "number", "number", G_MININT, 
G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
+}
+
+static void
+maman_baz_maman_ibaz_interface_init (MamanIbazIface * iface,
+                                     gpointer iface_data)
+{
+       maman_baz_maman_ibaz_parent_iface = g_type_interface_peek_parent (iface);
+       iface->get_number = maman_baz_real_get_number;
+}
+
+static void
+maman_baz_instance_init (MamanBaz * self,
+                         gpointer klass)
+{
+}
+
+static GType
+maman_baz_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (MamanBazClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_baz_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(MamanBaz), 0, (GInstanceInitFunc) maman_baz_instance_init, NULL };
+       static const GInterfaceInfo maman_ibaz_info = { (GInterfaceInitFunc) 
maman_baz_maman_ibaz_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
+       GType maman_baz_type_id;
+       maman_baz_type_id = g_type_register_static (G_TYPE_OBJECT, "MamanBaz", &g_define_type_info, 0);
+       g_type_add_interface_static (maman_baz_type_id, MAMAN_TYPE_IBAZ, &maman_ibaz_info);
+       return maman_baz_type_id;
+}
+
+GType
+maman_baz_get_type (void)
+{
+       static volatile gsize maman_baz_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_baz_type_id__volatile)) {
+               GType maman_baz_type_id;
+               maman_baz_type_id = maman_baz_get_type_once ();
+               g_once_init_leave (&maman_baz_type_id__volatile, maman_baz_type_id);
+       }
+       return maman_baz_type_id__volatile;
+}
+
+static void
+_vala_maman_baz_get_property (GObject * object,
+                              guint property_id,
+                              GValue * value,
+                              GParamSpec * pspec)
+{
+       MamanBaz * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, MAMAN_TYPE_BAZ, MamanBaz);
+       switch (property_id) {
+               case MAMAN_BAZ_NUMBER_PROPERTY:
+               g_value_set_int (value, maman_ibaz_get_number (G_TYPE_CHECK_INSTANCE_CAST (self, 
MAMAN_TYPE_IBAZ, MamanIbaz)));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+gint
+maman_ibiz_get_number (MamanIBiz* self)
+{
+       MamanIBizIface* _iface_;
+       g_return_val_if_fail (MAMAN_IS_IBIZ (self), 0);
+       _iface_ = MAMAN_IBIZ_GET_INTERFACE (self);
+       if (_iface_->get_number) {
+               return _iface_->get_number (self);
+       }
+       return -1;
+}
+
+void
+maman_ibiz_set_number (MamanIBiz* self,
+                       gint value)
+{
+       MamanIBizIface* _iface_;
+       g_return_if_fail (MAMAN_IS_IBIZ (self));
+       _iface_ = MAMAN_IBIZ_GET_INTERFACE (self);
+       if (_iface_->set_number) {
+               _iface_->set_number (self, value);
+       }
+}
+
+static void
+maman_ibiz_default_init (MamanIBizIface * iface,
+                         gpointer iface_data)
+{
+       g_object_interface_install_property (iface, g_param_spec_int ("number", "number", "number", G_MININT, 
G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
+}
+
+static GType
+maman_ibiz_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (MamanIBizIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_ibiz_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType maman_ibiz_type_id;
+       maman_ibiz_type_id = g_type_register_static (G_TYPE_INTERFACE, "MamanIBiz", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (maman_ibiz_type_id, G_TYPE_OBJECT);
+       return maman_ibiz_type_id;
+}
+
+GType
+maman_ibiz_get_type (void)
+{
+       static volatile gsize maman_ibiz_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_ibiz_type_id__volatile)) {
+               GType maman_ibiz_type_id;
+               maman_ibiz_type_id = maman_ibiz_get_type_once ();
+               g_once_init_leave (&maman_ibiz_type_id__volatile, maman_ibiz_type_id);
+       }
+       return maman_ibiz_type_id__volatile;
+}
+
+static inline gpointer
+maman_abiz_get_instance_private (MamanABiz* self)
+{
+       return G_STRUCT_MEMBER_P (self, MamanABiz_private_offset);
+}
+
+MamanABiz*
+maman_abiz_construct (GType object_type)
+{
+       MamanABiz * self = NULL;
+       self = (MamanABiz*) g_object_new (object_type, NULL);
+       return self;
+}
+
+static gint
+maman_abiz_real_get_number (MamanIBiz* base)
+{
+       gint result;
+       MamanABiz* self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, MAMAN_TYPE_ABIZ, MamanABiz);
+       result = self->priv->_number;
+       return result;
+}
+
+static void
+maman_abiz_real_set_number (MamanIBiz* base,
+                            gint value)
+{
+       MamanABiz* self;
+       gint old_value;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, MAMAN_TYPE_ABIZ, MamanABiz);
+       old_value = maman_abiz_real_get_number (base);
+       if (old_value != value) {
+               self->priv->_number = value;
+               g_object_notify_by_pspec ((GObject *) self, 
maman_abiz_properties[MAMAN_ABIZ_NUMBER_PROPERTY]);
+       }
+}
+
+gint
+maman_abiz_get_number2 (MamanABiz* self)
+{
+       MamanABizClass* _klass_;
+       g_return_val_if_fail (MAMAN_IS_ABIZ (self), 0);
+       _klass_ = MAMAN_ABIZ_GET_CLASS (self);
+       if (_klass_->get_number2) {
+               return _klass_->get_number2 (self);
+       }
+       return -1;
+}
+
+void
+maman_abiz_set_number2 (MamanABiz* self,
+                        gint value)
+{
+       MamanABizClass* _klass_;
+       g_return_if_fail (MAMAN_IS_ABIZ (self));
+       _klass_ = MAMAN_ABIZ_GET_CLASS (self);
+       if (_klass_->set_number2) {
+               _klass_->set_number2 (self, value);
+       }
+}
+
+static void
+maman_abiz_class_init (MamanABizClass * klass,
+                       gpointer klass_data)
+{
+       maman_abiz_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &MamanABiz_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_maman_abiz_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_maman_abiz_set_property;
+       G_OBJECT_CLASS (klass)->finalize = maman_abiz_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), MAMAN_ABIZ_NUMBER_PROPERTY, 
maman_abiz_properties[MAMAN_ABIZ_NUMBER_PROPERTY] = g_param_spec_int ("number", "number", "number", G_MININT, 
G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), MAMAN_ABIZ_NUMBER2_PROPERTY, 
maman_abiz_properties[MAMAN_ABIZ_NUMBER2_PROPERTY] = g_param_spec_int ("number2", "number2", "number2", 
G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | 
G_PARAM_CONSTRUCT_ONLY));
+}
+
+static void
+maman_abiz_maman_ibiz_interface_init (MamanIBizIface * iface,
+                                      gpointer iface_data)
+{
+       maman_abiz_maman_ibiz_parent_iface = g_type_interface_peek_parent (iface);
+       iface->get_number = maman_abiz_real_get_number;
+       iface->set_number = maman_abiz_real_set_number;
+}
+
+static void
+maman_abiz_instance_init (MamanABiz * self,
+                          gpointer klass)
+{
+       self->priv = maman_abiz_get_instance_private (self);
+}
+
+static void
+maman_abiz_finalize (GObject * obj)
+{
+       MamanABiz * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, MAMAN_TYPE_ABIZ, MamanABiz);
+       G_OBJECT_CLASS (maman_abiz_parent_class)->finalize (obj);
+}
+
+static GType
+maman_abiz_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (MamanABizClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_abiz_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(MamanABiz), 0, (GInstanceInitFunc) maman_abiz_instance_init, NULL };
+       static const GInterfaceInfo maman_ibiz_info = { (GInterfaceInitFunc) 
maman_abiz_maman_ibiz_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
+       GType maman_abiz_type_id;
+       maman_abiz_type_id = g_type_register_static (G_TYPE_OBJECT, "MamanABiz", &g_define_type_info, 
G_TYPE_FLAG_ABSTRACT);
+       g_type_add_interface_static (maman_abiz_type_id, MAMAN_TYPE_IBIZ, &maman_ibiz_info);
+       MamanABiz_private_offset = g_type_add_instance_private (maman_abiz_type_id, sizeof 
(MamanABizPrivate));
+       return maman_abiz_type_id;
+}
+
+GType
+maman_abiz_get_type (void)
+{
+       static volatile gsize maman_abiz_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_abiz_type_id__volatile)) {
+               GType maman_abiz_type_id;
+               maman_abiz_type_id = maman_abiz_get_type_once ();
+               g_once_init_leave (&maman_abiz_type_id__volatile, maman_abiz_type_id);
+       }
+       return maman_abiz_type_id__volatile;
+}
+
+static void
+_vala_maman_abiz_get_property (GObject * object,
+                               guint property_id,
+                               GValue * value,
+                               GParamSpec * pspec)
+{
+       MamanABiz * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, MAMAN_TYPE_ABIZ, MamanABiz);
+       switch (property_id) {
+               case MAMAN_ABIZ_NUMBER_PROPERTY:
+               g_value_set_int (value, maman_ibiz_get_number (G_TYPE_CHECK_INSTANCE_CAST (self, 
MAMAN_TYPE_IBIZ, MamanIBiz)));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_maman_abiz_set_property (GObject * object,
+                               guint property_id,
+                               const GValue * value,
+                               GParamSpec * pspec)
+{
+       MamanABiz * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, MAMAN_TYPE_ABIZ, MamanABiz);
+       switch (property_id) {
+               case MAMAN_ABIZ_NUMBER_PROPERTY:
+               maman_ibiz_set_number (G_TYPE_CHECK_INSTANCE_CAST (self, MAMAN_TYPE_IBIZ, MamanIBiz), 
g_value_get_int (value));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static inline gpointer
+maman_biz_get_instance_private (MamanBiz* self)
+{
+       return G_STRUCT_MEMBER_P (self, MamanBiz_private_offset);
+}
+
+MamanBiz*
+maman_biz_construct (GType object_type)
+{
+       MamanBiz * self = NULL;
+       self = (MamanBiz*) maman_abiz_construct (object_type);
+       return self;
+}
+
+MamanBiz*
+maman_biz_new (void)
+{
+       return maman_biz_construct (MAMAN_TYPE_BIZ);
+}
+
+static gint
+maman_biz_real_get_number2 (MamanABiz* base)
+{
+       gint result;
+       MamanBiz* self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, MAMAN_TYPE_BIZ, MamanBiz);
+       result = self->priv->_number2;
+       return result;
+}
+
+static void
+maman_biz_real_set_number2 (MamanABiz* base,
+                            gint value)
+{
+       MamanBiz* self;
+       gint old_value;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, MAMAN_TYPE_BIZ, MamanBiz);
+       old_value = maman_biz_real_get_number2 (base);
+       if (old_value != value) {
+               self->priv->_number2 = value;
+               g_object_notify_by_pspec ((GObject *) self, maman_biz_properties[MAMAN_BIZ_NUMBER2_PROPERTY]);
+       }
+}
+
+static void
+maman_biz_class_init (MamanBizClass * klass,
+                      gpointer klass_data)
+{
+       maman_biz_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &MamanBiz_private_offset);
+       MAMAN_ABIZ_CLASS (klass)->get_number2 = maman_biz_real_get_number2;
+       MAMAN_ABIZ_CLASS (klass)->set_number2 = maman_biz_real_set_number2;
+       G_OBJECT_CLASS (klass)->get_property = _vala_maman_biz_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_maman_biz_set_property;
+       G_OBJECT_CLASS (klass)->finalize = maman_biz_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), MAMAN_BIZ_NUMBER2_PROPERTY, 
maman_biz_properties[MAMAN_BIZ_NUMBER2_PROPERTY] = g_param_spec_int ("number2", "number2", "number2", 
G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | 
G_PARAM_CONSTRUCT_ONLY));
+}
+
+static void
+maman_biz_instance_init (MamanBiz * self,
+                         gpointer klass)
+{
+       self->priv = maman_biz_get_instance_private (self);
+}
+
+static void
+maman_biz_finalize (GObject * obj)
+{
+       MamanBiz * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, MAMAN_TYPE_BIZ, MamanBiz);
+       G_OBJECT_CLASS (maman_biz_parent_class)->finalize (obj);
+}
+
+static GType
+maman_biz_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (MamanBizClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_biz_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(MamanBiz), 0, (GInstanceInitFunc) maman_biz_instance_init, NULL };
+       GType maman_biz_type_id;
+       maman_biz_type_id = g_type_register_static (MAMAN_TYPE_ABIZ, "MamanBiz", &g_define_type_info, 0);
+       MamanBiz_private_offset = g_type_add_instance_private (maman_biz_type_id, sizeof (MamanBizPrivate));
+       return maman_biz_type_id;
+}
+
+GType
+maman_biz_get_type (void)
+{
+       static volatile gsize maman_biz_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_biz_type_id__volatile)) {
+               GType maman_biz_type_id;
+               maman_biz_type_id = maman_biz_get_type_once ();
+               g_once_init_leave (&maman_biz_type_id__volatile, maman_biz_type_id);
+       }
+       return maman_biz_type_id__volatile;
+}
+
+static void
+_vala_maman_biz_get_property (GObject * object,
+                              guint property_id,
+                              GValue * value,
+                              GParamSpec * pspec)
+{
+       MamanBiz * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, MAMAN_TYPE_BIZ, MamanBiz);
+       switch (property_id) {
+               case MAMAN_BIZ_NUMBER2_PROPERTY:
+               g_value_set_int (value, maman_abiz_get_number2 (G_TYPE_CHECK_INSTANCE_CAST (self, 
MAMAN_TYPE_ABIZ, MamanABiz)));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_maman_biz_set_property (GObject * object,
+                              guint property_id,
+                              const GValue * value,
+                              GParamSpec * pspec)
+{
+       MamanBiz * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, MAMAN_TYPE_BIZ, MamanBiz);
+       switch (property_id) {
+               case MAMAN_BIZ_NUMBER2_PROPERTY:
+               maman_abiz_set_number2 (G_TYPE_CHECK_INSTANCE_CAST (self, MAMAN_TYPE_ABIZ, MamanABiz), 
g_value_get_int (value));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
diff --git a/tests/objects/property-array-length.c-expected b/tests/objects/property-array-length.c-expected
new file mode 100644
index 000000000..e41c57e99
--- /dev/null
+++ b/tests/objects/property-array-length.c-expected
@@ -0,0 +1,236 @@
+/* objects_property_array_length.c generated by valac, the Vala compiler
+ * generated from objects_property_array_length.vala, do not modify */
+
+#include <glib.h>
+#include <gio/gio.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef struct _Foo Foo;
+typedef struct _FooData FooData;
+#define _foo_free0(var) ((var == NULL) ? NULL : (var = (foo_free (var), NULL)))
+typedef struct _BarData BarData;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       int dummy;
+};
+
+struct _FooData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       guint8* data;
+       gint data_length1;
+};
+
+struct _BarData {
+       int _state_;
+       GObject* _source_object_;
+       GAsyncResult* _res_;
+       GTask* _async_result;
+       Foo* f;
+       Foo* _tmp0_;
+       guint8* _tmp1_;
+       gint _tmp1__length1;
+       gint _tmp2_;
+       guint8* _tmp3_;
+       gint _tmp3__length1;
+       guint8* _tmp4_;
+       gint _tmp4__length1;
+};
+
+VALA_EXTERN void foo_free (Foo * self);
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_free)
+static void foo_instance_init (Foo * self);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN guint8* foo_get_data (Foo* self,
+                      gint* result_length1);
+static void foo_data_free (gpointer _data);
+VALA_EXTERN void foo (guint8* data,
+          gint data_length1,
+          GAsyncReadyCallback _callback_,
+          gpointer _user_data_);
+VALA_EXTERN void foo_finish (GAsyncResult* _res_);
+static gboolean foo_co (FooData* _data_);
+static void bar_data_free (gpointer _data);
+VALA_EXTERN void bar (GAsyncReadyCallback _callback_,
+          gpointer _user_data_);
+VALA_EXTERN void bar_finish (GAsyncResult* _res_);
+static gboolean bar_co (BarData* _data_);
+static void _vala_main (void);
+
+Foo*
+foo_new (void)
+{
+       Foo* self;
+       self = g_slice_new0 (Foo);
+       foo_instance_init (self);
+       return self;
+}
+
+guint8*
+foo_get_data (Foo* self,
+              gint* result_length1)
+{
+       guint8* result;
+       guint8* _tmp0_;
+       guint8* _tmp1_;
+       gint _tmp1__length1;
+       g_return_val_if_fail (self != NULL, NULL);
+       _tmp0_ = g_new0 (guint8, 42);
+       _tmp1_ = _tmp0_;
+       _tmp1__length1 = 42;
+       if (result_length1) {
+               *result_length1 = _tmp1__length1;
+       }
+       result = _tmp1_;
+       return result;
+}
+
+static void
+foo_instance_init (Foo * self)
+{
+}
+
+void
+foo_free (Foo * self)
+{
+       g_slice_free (Foo, self);
+}
+
+static void
+foo_data_free (gpointer _data)
+{
+       FooData* _data_;
+       _data_ = _data;
+       g_slice_free (FooData, _data_);
+}
+
+void
+foo (guint8* data,
+     gint data_length1,
+     GAsyncReadyCallback _callback_,
+     gpointer _user_data_)
+{
+       FooData* _data_;
+       _data_ = g_slice_new0 (FooData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, foo_data_free);
+       _data_->data = data;
+       _data_->data_length1 = data_length1;
+       foo_co (_data_);
+}
+
+void
+foo_finish (GAsyncResult* _res_)
+{
+       FooData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static gboolean
+foo_co (FooData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _vala_assert (_data_->data_length1 == 42, "data.length == 42");
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+bar_data_free (gpointer _data)
+{
+       BarData* _data_;
+       _data_ = _data;
+       g_slice_free (BarData, _data_);
+}
+
+void
+bar (GAsyncReadyCallback _callback_,
+     gpointer _user_data_)
+{
+       BarData* _data_;
+       _data_ = g_slice_new0 (BarData);
+       _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
+       g_task_set_task_data (_data_->_async_result, _data_, bar_data_free);
+       bar_co (_data_);
+}
+
+void
+bar_finish (GAsyncResult* _res_)
+{
+       BarData* _data_;
+       _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
+}
+
+static gboolean
+bar_co (BarData* _data_)
+{
+       switch (_data_->_state_) {
+               case 0:
+               goto _state_0;
+               default:
+               g_assert_not_reached ();
+       }
+       _state_0:
+       _data_->_tmp0_ = foo_new ();
+       _data_->f = _data_->_tmp0_;
+       _data_->_tmp2_ = 0;
+       _data_->_tmp1_ = foo_get_data (_data_->f, &_data_->_tmp2_);
+       _data_->_tmp1__length1 = _data_->_tmp2_;
+       _data_->_tmp3_ = _data_->_tmp1_;
+       _data_->_tmp3__length1 = _data_->_tmp1__length1;
+       _data_->_tmp4_ = _data_->_tmp3_;
+       _data_->_tmp4__length1 = _data_->_tmp3__length1;
+       foo (_data_->_tmp4_, (gint) _data_->_tmp3__length1, NULL, NULL);
+       _data_->_tmp4_ = (g_free (_data_->_tmp4_), NULL);
+       _foo_free0 (_data_->f);
+       g_task_return_pointer (_data_->_async_result, _data_, NULL);
+       if (_data_->_state_ != 0) {
+               while (!g_task_get_completed (_data_->_async_result)) {
+                       g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
+               }
+       }
+       g_object_unref (_data_->_async_result);
+       return FALSE;
+}
+
+static void
+_vala_main (void)
+{
+       bar (NULL, NULL);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/property-array.c-expected b/tests/objects/property-array.c-expected
new file mode 100644
index 000000000..adaf27722
--- /dev/null
+++ b/tests/objects/property-array.c-expected
@@ -0,0 +1,1562 @@
+/* objects_property_array.c generated by valac, the Vala compiler
+ * generated from objects_property_array.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+#include <stdlib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_MANAM (manam_get_type ())
+typedef struct _Manam Manam;
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+enum  {
+       BAR_0_PROPERTY,
+       BAR_ARRAY_PROPERTY,
+       BAR_ARRAY_V_PROPERTY,
+       BAR_STRV_PROPERTY,
+       BAR_STRV_V_PROPERTY,
+       BAR_NUM_PROPERTIES
+};
+static GParamSpec* bar_properties[BAR_NUM_PROPERTIES];
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Manam {
+       gint i;
+};
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+       Manam** (*get_array_v) (Foo* self, gint* result_length1);
+       void (*set_array_v) (Foo* self, Manam** value, gint value_length1);
+       Manam** (*get_array_no_length_v) (Foo* self);
+       void (*set_array_no_length_v) (Foo* self, Manam** value);
+       gchar** (*get_strv_v) (Foo* self);
+       void (*set_strv_v) (Foo* self, gchar** value);
+};
+
+struct _FooPrivate {
+       Manam** _array;
+       gint _array_length1;
+       gint __array_size_;
+       Manam** _array_v;
+       gint _array_v_length1;
+       gint __array_v_size_;
+       Manam** _array_no_length;
+       gint _array_no_length_length1;
+       gint __array_no_length_size_;
+       Manam** _array_no_length_v;
+       gint _array_no_length_v_length1;
+       gint __array_no_length_v_size_;
+       gchar** _strv;
+       gint _strv_length1;
+       gint __strv_size_;
+       gchar** _strv_v;
+       gint _strv_v_length1;
+       gint __strv_v_size_;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+struct _Bar {
+       GObject parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       GObjectClass parent_class;
+       Manam** (*get_array_v) (Bar* self);
+       void (*set_array_v) (Bar* self, Manam** value);
+       gchar** (*get_strv_v) (Bar* self);
+       void (*set_strv_v) (Bar* self, gchar** value);
+};
+
+struct _BarPrivate {
+       Manam** _array;
+       gint _array_length1;
+       gint __array_size_;
+       Manam** _array_v;
+       gint _array_v_length1;
+       gint __array_v_size_;
+       gchar** _strv;
+       gint _strv_length1;
+       gint __strv_size_;
+       gchar** _strv_v;
+       gint _strv_v_length1;
+       gint __strv_v_size_;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+static gint Bar_private_offset;
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN GType manam_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Manam* manam_dup (const Manam* self);
+VALA_EXTERN void manam_free (Manam* self);
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Manam** foo_get_array_v (Foo* self,
+                         gint* result_length1);
+VALA_EXTERN void foo_set_array_v (Foo* self,
+                      Manam** value,
+                      gint value_length1);
+VALA_EXTERN Manam** foo_get_array_no_length_v (Foo* self);
+VALA_EXTERN void foo_set_array_no_length_v (Foo* self,
+                                Manam** value);
+VALA_EXTERN gchar** foo_get_strv_v (Foo* self);
+VALA_EXTERN void foo_set_strv_v (Foo* self,
+                     gchar** value);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+VALA_EXTERN Manam** foo_get_array (Foo* self,
+                       gint* result_length1);
+VALA_EXTERN void foo_set_array (Foo* self,
+                    Manam** value,
+                    gint value_length1);
+static Manam** _vala_array_dup1 (Manam** self,
+                          gssize length);
+static Manam** _vala_array_dup2 (Manam** self,
+                          gssize length);
+VALA_EXTERN Manam** foo_get_array_no_length (Foo* self);
+VALA_EXTERN void foo_set_array_no_length (Foo* self,
+                              Manam** value);
+static Manam** _vala_array_dup3 (Manam** self,
+                          gssize length);
+static Manam** _vala_array_dup4 (Manam** self,
+                          gssize length);
+VALA_EXTERN gchar** foo_get_strv (Foo* self);
+VALA_EXTERN void foo_set_strv (Foo* self,
+                   gchar** value);
+static gchar** _vala_array_dup5 (gchar** self,
+                          gssize length);
+static gchar** _vala_array_dup6 (gchar** self,
+                          gssize length);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
+VALA_EXTERN Manam** bar_get_array_v (Bar* self);
+VALA_EXTERN void bar_set_array_v (Bar* self,
+                      Manam** value);
+VALA_EXTERN gchar** bar_get_strv_v (Bar* self);
+VALA_EXTERN void bar_set_strv_v (Bar* self,
+                     gchar** value);
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+VALA_EXTERN Manam** bar_get_array (Bar* self);
+VALA_EXTERN void bar_set_array (Bar* self,
+                    Manam** value);
+static Manam** _vala_array_dup7 (Manam** self,
+                          gssize length);
+static Manam** _vala_array_dup8 (Manam** self,
+                          gssize length);
+VALA_EXTERN gchar** bar_get_strv (Bar* self);
+VALA_EXTERN void bar_set_strv (Bar* self,
+                   gchar** value);
+static gchar** _vala_array_dup9 (gchar** self,
+                          gssize length);
+static gchar** _vala_array_dup10 (gchar** self,
+                           gssize length);
+static void bar_finalize (GObject * obj);
+static GType bar_get_type_once (void);
+static void _vala_bar_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_bar_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec);
+static void _vala_main (void);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+static gssize _vala_array_length (gpointer array);
+
+Manam*
+manam_dup (const Manam* self)
+{
+       Manam* dup;
+       dup = g_new0 (Manam, 1);
+       memcpy (dup, self, sizeof (Manam));
+       return dup;
+}
+
+void
+manam_free (Manam* self)
+{
+       g_free (self);
+}
+
+static GType
+manam_get_type_once (void)
+{
+       GType manam_type_id;
+       manam_type_id = g_boxed_type_register_static ("Manam", (GBoxedCopyFunc) manam_dup, (GBoxedFreeFunc) 
manam_free);
+       return manam_type_id;
+}
+
+GType
+manam_get_type (void)
+{
+       static volatile gsize manam_type_id__volatile = 0;
+       if (g_once_init_enter (&manam_type_id__volatile)) {
+               GType manam_type_id;
+               manam_type_id = manam_get_type_once ();
+               g_once_init_leave (&manam_type_id__volatile, manam_type_id);
+       }
+       return manam_type_id__volatile;
+}
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+Manam**
+foo_get_array (Foo* self,
+               gint* result_length1)
+{
+       Manam** result;
+       Manam** _tmp0_;
+       gint _tmp0__length1;
+       Manam** _tmp1_;
+       gint _tmp1__length1;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = self->priv->_array;
+       _tmp0__length1 = self->priv->_array_length1;
+       _tmp1_ = _tmp0_;
+       _tmp1__length1 = _tmp0__length1;
+       if (result_length1) {
+               *result_length1 = _tmp1__length1;
+       }
+       result = _tmp1_;
+       return result;
+}
+
+static gpointer
+_manam_dup0 (gpointer self)
+{
+       return self ? manam_dup (self) : NULL;
+}
+
+static Manam**
+_vala_array_dup1 (Manam** self,
+                  gssize length)
+{
+       if (length > 0) {
+               Manam** result;
+               gssize i;
+               result = g_new0 (Manam*, length);
+               for (i = 0; i < length; i++) {
+                       Manam* _tmp0_;
+                       _tmp0_ = _manam_dup0 (self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+void
+foo_set_array (Foo* self,
+               Manam** value,
+               gint value_length1)
+{
+       Manam** _tmp0_;
+       gint _tmp0__length1;
+       g_return_if_fail (IS_FOO (self));
+       _tmp0_ = (value != NULL) ? _vala_array_dup1 (value, value_length1) : value;
+       _tmp0__length1 = value_length1;
+       self->priv->_array = (_vala_array_free (self->priv->_array, self->priv->_array_length1, 
(GDestroyNotify) manam_free), NULL);
+       self->priv->_array = _tmp0_;
+       self->priv->_array_length1 = _tmp0__length1;
+       self->priv->__array_size_ = self->priv->_array_length1;
+}
+
+Manam**
+foo_get_array_v (Foo* self,
+                 gint* result_length1)
+{
+       FooClass* _klass_;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->get_array_v) {
+               return _klass_->get_array_v (self, result_length1);
+       }
+       return NULL;
+}
+
+static Manam**
+foo_real_get_array_v (Foo* base,
+                      gint* result_length1)
+{
+       Manam** result;
+       Foo* self;
+       Manam** _tmp0_;
+       gint _tmp0__length1;
+       Manam** _tmp1_;
+       gint _tmp1__length1;
+       self = base;
+       _tmp0_ = self->priv->_array_v;
+       _tmp0__length1 = self->priv->_array_v_length1;
+       _tmp1_ = _tmp0_;
+       _tmp1__length1 = _tmp0__length1;
+       if (result_length1) {
+               *result_length1 = _tmp1__length1;
+       }
+       result = _tmp1_;
+       return result;
+}
+
+void
+foo_set_array_v (Foo* self,
+                 Manam** value,
+                 gint value_length1)
+{
+       FooClass* _klass_;
+       g_return_if_fail (IS_FOO (self));
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->set_array_v) {
+               _klass_->set_array_v (self, value, value_length1);
+       }
+}
+
+static Manam**
+_vala_array_dup2 (Manam** self,
+                  gssize length)
+{
+       if (length > 0) {
+               Manam** result;
+               gssize i;
+               result = g_new0 (Manam*, length);
+               for (i = 0; i < length; i++) {
+                       Manam* _tmp0_;
+                       _tmp0_ = _manam_dup0 (self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+static void
+foo_real_set_array_v (Foo* base,
+                      Manam** value,
+                      gint value_length1)
+{
+       Foo* self;
+       Manam** _tmp0_;
+       gint _tmp0__length1;
+       self = base;
+       _tmp0_ = (value != NULL) ? _vala_array_dup2 (value, value_length1) : value;
+       _tmp0__length1 = value_length1;
+       self->priv->_array_v = (_vala_array_free (self->priv->_array_v, self->priv->_array_v_length1, 
(GDestroyNotify) manam_free), NULL);
+       self->priv->_array_v = _tmp0_;
+       self->priv->_array_v_length1 = _tmp0__length1;
+       self->priv->__array_v_size_ = self->priv->_array_v_length1;
+}
+
+Manam**
+foo_get_array_no_length (Foo* self)
+{
+       Manam** result;
+       Manam** _tmp0_;
+       gint _tmp0__length1;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = self->priv->_array_no_length;
+       _tmp0__length1 = self->priv->_array_no_length_length1;
+       result = _tmp0_;
+       return result;
+}
+
+static Manam**
+_vala_array_dup3 (Manam** self,
+                  gssize length)
+{
+       if (length > 0) {
+               Manam** result;
+               gssize i;
+               result = g_new0 (Manam*, length);
+               for (i = 0; i < length; i++) {
+                       Manam* _tmp0_;
+                       _tmp0_ = _manam_dup0 (self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+void
+foo_set_array_no_length (Foo* self,
+                         Manam** value)
+{
+       Manam** _tmp0_;
+       gint _tmp0__length1;
+       g_return_if_fail (IS_FOO (self));
+       _tmp0_ = (value != NULL) ? _vala_array_dup3 (value, _vala_array_length (value)) : value;
+       _tmp0__length1 = _vala_array_length (value);
+       self->priv->_array_no_length = (_vala_array_free (self->priv->_array_no_length, 
self->priv->_array_no_length_length1, (GDestroyNotify) manam_free), NULL);
+       self->priv->_array_no_length = _tmp0_;
+       self->priv->_array_no_length_length1 = _tmp0__length1;
+       self->priv->__array_no_length_size_ = self->priv->_array_no_length_length1;
+}
+
+Manam**
+foo_get_array_no_length_v (Foo* self)
+{
+       FooClass* _klass_;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->get_array_no_length_v) {
+               return _klass_->get_array_no_length_v (self);
+       }
+       return NULL;
+}
+
+static Manam**
+foo_real_get_array_no_length_v (Foo* base)
+{
+       Manam** result;
+       Foo* self;
+       Manam** _tmp0_;
+       gint _tmp0__length1;
+       self = base;
+       _tmp0_ = self->priv->_array_no_length_v;
+       _tmp0__length1 = self->priv->_array_no_length_v_length1;
+       result = _tmp0_;
+       return result;
+}
+
+void
+foo_set_array_no_length_v (Foo* self,
+                           Manam** value)
+{
+       FooClass* _klass_;
+       g_return_if_fail (IS_FOO (self));
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->set_array_no_length_v) {
+               _klass_->set_array_no_length_v (self, value);
+       }
+}
+
+static Manam**
+_vala_array_dup4 (Manam** self,
+                  gssize length)
+{
+       if (length > 0) {
+               Manam** result;
+               gssize i;
+               result = g_new0 (Manam*, length);
+               for (i = 0; i < length; i++) {
+                       Manam* _tmp0_;
+                       _tmp0_ = _manam_dup0 (self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+static void
+foo_real_set_array_no_length_v (Foo* base,
+                                Manam** value)
+{
+       Foo* self;
+       Manam** _tmp0_;
+       gint _tmp0__length1;
+       self = base;
+       _tmp0_ = (value != NULL) ? _vala_array_dup4 (value, _vala_array_length (value)) : value;
+       _tmp0__length1 = _vala_array_length (value);
+       self->priv->_array_no_length_v = (_vala_array_free (self->priv->_array_no_length_v, 
self->priv->_array_no_length_v_length1, (GDestroyNotify) manam_free), NULL);
+       self->priv->_array_no_length_v = _tmp0_;
+       self->priv->_array_no_length_v_length1 = _tmp0__length1;
+       self->priv->__array_no_length_v_size_ = self->priv->_array_no_length_v_length1;
+}
+
+gchar**
+foo_get_strv (Foo* self)
+{
+       gchar** result;
+       gchar** _tmp0_;
+       gint _tmp0__length1;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = self->priv->_strv;
+       _tmp0__length1 = self->priv->_strv_length1;
+       result = _tmp0_;
+       return result;
+}
+
+static gchar**
+_vala_array_dup5 (gchar** self,
+                  gssize length)
+{
+       if (length >= 0) {
+               gchar** result;
+               gssize i;
+               result = g_new0 (gchar*, length + 1);
+               for (i = 0; i < length; i++) {
+                       gchar* _tmp0_;
+                       _tmp0_ = g_strdup (self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+void
+foo_set_strv (Foo* self,
+              gchar** value)
+{
+       gchar** _tmp0_;
+       gint _tmp0__length1;
+       g_return_if_fail (IS_FOO (self));
+       _tmp0_ = (value != NULL) ? _vala_array_dup5 (value, _vala_array_length (value)) : value;
+       _tmp0__length1 = _vala_array_length (value);
+       self->priv->_strv = (_vala_array_free (self->priv->_strv, self->priv->_strv_length1, (GDestroyNotify) 
g_free), NULL);
+       self->priv->_strv = _tmp0_;
+       self->priv->_strv_length1 = _tmp0__length1;
+       self->priv->__strv_size_ = self->priv->_strv_length1;
+}
+
+gchar**
+foo_get_strv_v (Foo* self)
+{
+       FooClass* _klass_;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->get_strv_v) {
+               return _klass_->get_strv_v (self);
+       }
+       return NULL;
+}
+
+static gchar**
+foo_real_get_strv_v (Foo* base)
+{
+       gchar** result;
+       Foo* self;
+       gchar** _tmp0_;
+       gint _tmp0__length1;
+       self = base;
+       _tmp0_ = self->priv->_strv_v;
+       _tmp0__length1 = self->priv->_strv_v_length1;
+       result = _tmp0_;
+       return result;
+}
+
+void
+foo_set_strv_v (Foo* self,
+                gchar** value)
+{
+       FooClass* _klass_;
+       g_return_if_fail (IS_FOO (self));
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->set_strv_v) {
+               _klass_->set_strv_v (self, value);
+       }
+}
+
+static gchar**
+_vala_array_dup6 (gchar** self,
+                  gssize length)
+{
+       if (length >= 0) {
+               gchar** result;
+               gssize i;
+               result = g_new0 (gchar*, length + 1);
+               for (i = 0; i < length; i++) {
+                       gchar* _tmp0_;
+                       _tmp0_ = g_strdup (self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+static void
+foo_real_set_strv_v (Foo* base,
+                     gchar** value)
+{
+       Foo* self;
+       gchar** _tmp0_;
+       gint _tmp0__length1;
+       self = base;
+       _tmp0_ = (value != NULL) ? _vala_array_dup6 (value, _vala_array_length (value)) : value;
+       _tmp0__length1 = _vala_array_length (value);
+       self->priv->_strv_v = (_vala_array_free (self->priv->_strv_v, self->priv->_strv_v_length1, 
(GDestroyNotify) g_free), NULL);
+       self->priv->_strv_v = _tmp0_;
+       self->priv->_strv_v_length1 = _tmp0__length1;
+       self->priv->__strv_v_size_ = self->priv->_strv_v_length1;
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+       FOO_CLASS (klass)->get_array_v = foo_real_get_array_v;
+       FOO_CLASS (klass)->set_array_v = foo_real_set_array_v;
+       FOO_CLASS (klass)->get_array_no_length_v = foo_real_get_array_no_length_v;
+       FOO_CLASS (klass)->set_array_no_length_v = foo_real_set_array_no_length_v;
+       FOO_CLASS (klass)->get_strv_v = foo_real_get_strv_v;
+       FOO_CLASS (klass)->set_strv_v = foo_real_set_strv_v;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+       self->priv->_array = (_vala_array_free (self->priv->_array, self->priv->_array_length1, 
(GDestroyNotify) manam_free), NULL);
+       self->priv->_array_v = (_vala_array_free (self->priv->_array_v, self->priv->_array_v_length1, 
(GDestroyNotify) manam_free), NULL);
+       self->priv->_array_no_length = (_vala_array_free (self->priv->_array_no_length, 
self->priv->_array_no_length_length1, (GDestroyNotify) manam_free), NULL);
+       self->priv->_array_no_length_v = (_vala_array_free (self->priv->_array_no_length_v, 
self->priv->_array_no_length_v_length1, (GDestroyNotify) manam_free), NULL);
+       self->priv->_strv = (_vala_array_free (self->priv->_strv, self->priv->_strv_length1, (GDestroyNotify) 
g_free), NULL);
+       self->priv->_strv_v = (_vala_array_free (self->priv->_strv_v, self->priv->_strv_v_length1, 
(GDestroyNotify) g_free), NULL);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static inline gpointer
+bar_get_instance_private (Bar* self)
+{
+       return G_STRUCT_MEMBER_P (self, Bar_private_offset);
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar * self = NULL;
+       self = (Bar*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+Manam**
+bar_get_array (Bar* self)
+{
+       Manam** result;
+       Manam** _tmp0_;
+       gint _tmp0__length1;
+       g_return_val_if_fail (IS_BAR (self), NULL);
+       _tmp0_ = self->priv->_array;
+       _tmp0__length1 = self->priv->_array_length1;
+       result = _tmp0_;
+       return result;
+}
+
+static Manam**
+_vala_array_dup7 (Manam** self,
+                  gssize length)
+{
+       if (length > 0) {
+               Manam** result;
+               gssize i;
+               result = g_new0 (Manam*, length);
+               for (i = 0; i < length; i++) {
+                       Manam* _tmp0_;
+                       _tmp0_ = _manam_dup0 (self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+void
+bar_set_array (Bar* self,
+               Manam** value)
+{
+       Manam** old_value;
+       g_return_if_fail (IS_BAR (self));
+       old_value = bar_get_array (self);
+       if (old_value != value) {
+               Manam** _tmp0_;
+               gint _tmp0__length1;
+               _tmp0_ = (value != NULL) ? _vala_array_dup7 (value, _vala_array_length (value)) : value;
+               _tmp0__length1 = _vala_array_length (value);
+               self->priv->_array = (_vala_array_free (self->priv->_array, self->priv->_array_length1, 
(GDestroyNotify) manam_free), NULL);
+               self->priv->_array = _tmp0_;
+               self->priv->_array_length1 = _tmp0__length1;
+               self->priv->__array_size_ = self->priv->_array_length1;
+               g_object_notify_by_pspec ((GObject *) self, bar_properties[BAR_ARRAY_PROPERTY]);
+       }
+}
+
+Manam**
+bar_get_array_v (Bar* self)
+{
+       BarClass* _klass_;
+       g_return_val_if_fail (IS_BAR (self), NULL);
+       _klass_ = BAR_GET_CLASS (self);
+       if (_klass_->get_array_v) {
+               return _klass_->get_array_v (self);
+       }
+       return NULL;
+}
+
+static Manam**
+bar_real_get_array_v (Bar* base)
+{
+       Manam** result;
+       Bar* self;
+       Manam** _tmp0_;
+       gint _tmp0__length1;
+       self = base;
+       _tmp0_ = self->priv->_array_v;
+       _tmp0__length1 = self->priv->_array_v_length1;
+       result = _tmp0_;
+       return result;
+}
+
+void
+bar_set_array_v (Bar* self,
+                 Manam** value)
+{
+       BarClass* _klass_;
+       g_return_if_fail (IS_BAR (self));
+       _klass_ = BAR_GET_CLASS (self);
+       if (_klass_->set_array_v) {
+               _klass_->set_array_v (self, value);
+       }
+}
+
+static Manam**
+_vala_array_dup8 (Manam** self,
+                  gssize length)
+{
+       if (length > 0) {
+               Manam** result;
+               gssize i;
+               result = g_new0 (Manam*, length);
+               for (i = 0; i < length; i++) {
+                       Manam* _tmp0_;
+                       _tmp0_ = _manam_dup0 (self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+static void
+bar_real_set_array_v (Bar* base,
+                      Manam** value)
+{
+       Bar* self;
+       Manam** old_value;
+       self = base;
+       old_value = bar_real_get_array_v (base);
+       if (old_value != value) {
+               Manam** _tmp0_;
+               gint _tmp0__length1;
+               _tmp0_ = (value != NULL) ? _vala_array_dup8 (value, _vala_array_length (value)) : value;
+               _tmp0__length1 = _vala_array_length (value);
+               self->priv->_array_v = (_vala_array_free (self->priv->_array_v, self->priv->_array_v_length1, 
(GDestroyNotify) manam_free), NULL);
+               self->priv->_array_v = _tmp0_;
+               self->priv->_array_v_length1 = _tmp0__length1;
+               self->priv->__array_v_size_ = self->priv->_array_v_length1;
+               g_object_notify_by_pspec ((GObject *) self, bar_properties[BAR_ARRAY_V_PROPERTY]);
+       }
+}
+
+gchar**
+bar_get_strv (Bar* self)
+{
+       gchar** result;
+       gchar** _tmp0_;
+       gint _tmp0__length1;
+       g_return_val_if_fail (IS_BAR (self), NULL);
+       _tmp0_ = self->priv->_strv;
+       _tmp0__length1 = self->priv->_strv_length1;
+       result = _tmp0_;
+       return result;
+}
+
+static gchar**
+_vala_array_dup9 (gchar** self,
+                  gssize length)
+{
+       if (length >= 0) {
+               gchar** result;
+               gssize i;
+               result = g_new0 (gchar*, length + 1);
+               for (i = 0; i < length; i++) {
+                       gchar* _tmp0_;
+                       _tmp0_ = g_strdup (self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+void
+bar_set_strv (Bar* self,
+              gchar** value)
+{
+       gchar** old_value;
+       g_return_if_fail (IS_BAR (self));
+       old_value = bar_get_strv (self);
+       if (old_value != value) {
+               gchar** _tmp0_;
+               gint _tmp0__length1;
+               _tmp0_ = (value != NULL) ? _vala_array_dup9 (value, _vala_array_length (value)) : value;
+               _tmp0__length1 = _vala_array_length (value);
+               self->priv->_strv = (_vala_array_free (self->priv->_strv, self->priv->_strv_length1, 
(GDestroyNotify) g_free), NULL);
+               self->priv->_strv = _tmp0_;
+               self->priv->_strv_length1 = _tmp0__length1;
+               self->priv->__strv_size_ = self->priv->_strv_length1;
+               g_object_notify_by_pspec ((GObject *) self, bar_properties[BAR_STRV_PROPERTY]);
+       }
+}
+
+gchar**
+bar_get_strv_v (Bar* self)
+{
+       BarClass* _klass_;
+       g_return_val_if_fail (IS_BAR (self), NULL);
+       _klass_ = BAR_GET_CLASS (self);
+       if (_klass_->get_strv_v) {
+               return _klass_->get_strv_v (self);
+       }
+       return NULL;
+}
+
+static gchar**
+bar_real_get_strv_v (Bar* base)
+{
+       gchar** result;
+       Bar* self;
+       gchar** _tmp0_;
+       gint _tmp0__length1;
+       self = base;
+       _tmp0_ = self->priv->_strv_v;
+       _tmp0__length1 = self->priv->_strv_v_length1;
+       result = _tmp0_;
+       return result;
+}
+
+void
+bar_set_strv_v (Bar* self,
+                gchar** value)
+{
+       BarClass* _klass_;
+       g_return_if_fail (IS_BAR (self));
+       _klass_ = BAR_GET_CLASS (self);
+       if (_klass_->set_strv_v) {
+               _klass_->set_strv_v (self, value);
+       }
+}
+
+static gchar**
+_vala_array_dup10 (gchar** self,
+                   gssize length)
+{
+       if (length >= 0) {
+               gchar** result;
+               gssize i;
+               result = g_new0 (gchar*, length + 1);
+               for (i = 0; i < length; i++) {
+                       gchar* _tmp0_;
+                       _tmp0_ = g_strdup (self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+static void
+bar_real_set_strv_v (Bar* base,
+                     gchar** value)
+{
+       Bar* self;
+       gchar** old_value;
+       self = base;
+       old_value = bar_real_get_strv_v (base);
+       if (old_value != value) {
+               gchar** _tmp0_;
+               gint _tmp0__length1;
+               _tmp0_ = (value != NULL) ? _vala_array_dup10 (value, _vala_array_length (value)) : value;
+               _tmp0__length1 = _vala_array_length (value);
+               self->priv->_strv_v = (_vala_array_free (self->priv->_strv_v, self->priv->_strv_v_length1, 
(GDestroyNotify) g_free), NULL);
+               self->priv->_strv_v = _tmp0_;
+               self->priv->_strv_v_length1 = _tmp0__length1;
+               self->priv->__strv_v_size_ = self->priv->_strv_v_length1;
+               g_object_notify_by_pspec ((GObject *) self, bar_properties[BAR_STRV_V_PROPERTY]);
+       }
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Bar_private_offset);
+       BAR_CLASS (klass)->get_array_v = bar_real_get_array_v;
+       BAR_CLASS (klass)->set_array_v = bar_real_set_array_v;
+       BAR_CLASS (klass)->get_strv_v = bar_real_get_strv_v;
+       BAR_CLASS (klass)->set_strv_v = bar_real_set_strv_v;
+       G_OBJECT_CLASS (klass)->get_property = _vala_bar_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_bar_set_property;
+       G_OBJECT_CLASS (klass)->finalize = bar_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), BAR_ARRAY_PROPERTY, 
bar_properties[BAR_ARRAY_PROPERTY] = g_param_spec_pointer ("array", "array", "array", G_PARAM_STATIC_STRINGS 
| G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), BAR_ARRAY_V_PROPERTY, 
bar_properties[BAR_ARRAY_V_PROPERTY] = g_param_spec_pointer ("array-v", "array-v", "array-v", 
G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), BAR_STRV_PROPERTY, 
bar_properties[BAR_STRV_PROPERTY] = g_param_spec_boxed ("strv", "strv", "strv", G_TYPE_STRV, 
G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), BAR_STRV_V_PROPERTY, 
bar_properties[BAR_STRV_V_PROPERTY] = g_param_spec_boxed ("strv-v", "strv-v", "strv-v", G_TYPE_STRV, 
G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+       self->priv = bar_get_instance_private (self);
+}
+
+static void
+bar_finalize (GObject * obj)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       self->priv->_array = (_vala_array_free (self->priv->_array, self->priv->_array_length1, 
(GDestroyNotify) manam_free), NULL);
+       self->priv->_array_v = (_vala_array_free (self->priv->_array_v, self->priv->_array_v_length1, 
(GDestroyNotify) manam_free), NULL);
+       self->priv->_strv = (_vala_array_free (self->priv->_strv, self->priv->_strv_length1, (GDestroyNotify) 
g_free), NULL);
+       self->priv->_strv_v = (_vala_array_free (self->priv->_strv_v, self->priv->_strv_v_length1, 
(GDestroyNotify) g_free), NULL);
+       G_OBJECT_CLASS (bar_parent_class)->finalize (obj);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (G_TYPE_OBJECT, "Bar", &g_define_type_info, 0);
+       Bar_private_offset = g_type_add_instance_private (bar_type_id, sizeof (BarPrivate));
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_bar_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_BAR, Bar);
+       switch (property_id) {
+               case BAR_ARRAY_PROPERTY:
+               g_value_set_pointer (value, bar_get_array (self));
+               break;
+               case BAR_ARRAY_V_PROPERTY:
+               g_value_set_pointer (value, bar_get_array_v (self));
+               break;
+               case BAR_STRV_PROPERTY:
+               g_value_set_boxed (value, bar_get_strv (self));
+               break;
+               case BAR_STRV_V_PROPERTY:
+               g_value_set_boxed (value, bar_get_strv_v (self));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_bar_set_property (GObject * object,
+                        guint property_id,
+                        const GValue * value,
+                        GParamSpec * pspec)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_BAR, Bar);
+       switch (property_id) {
+               case BAR_ARRAY_PROPERTY:
+               bar_set_array (self, g_value_get_pointer (value));
+               break;
+               case BAR_ARRAY_V_PROPERTY:
+               bar_set_array_v (self, g_value_get_pointer (value));
+               break;
+               case BAR_STRV_PROPERTY:
+               {
+                       gpointer boxed;
+                       boxed = g_value_get_boxed (value);
+                       bar_set_strv (self, boxed);
+               }
+               break;
+               case BAR_STRV_V_PROPERTY:
+               {
+                       gpointer boxed;
+                       boxed = g_value_get_boxed (value);
+                       bar_set_strv_v (self, boxed);
+               }
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Manam** manam = NULL;
+       Manam _tmp0_ = {0};
+       Manam* _tmp1_;
+       Manam _tmp2_ = {0};
+       Manam* _tmp3_;
+       Manam** _tmp4_;
+       gint manam_length1;
+       gint _manam_size_;
+       gchar** minim = NULL;
+       gchar* _tmp5_;
+       gchar* _tmp6_;
+       gchar** _tmp7_;
+       gint minim_length1;
+       gint _minim_size_;
+       memset (&_tmp0_, 0, sizeof (Manam));
+       _tmp0_.i = 23;
+       _tmp1_ = _manam_dup0 (&_tmp0_);
+       memset (&_tmp2_, 0, sizeof (Manam));
+       _tmp2_.i = 42;
+       _tmp3_ = _manam_dup0 (&_tmp2_);
+       _tmp4_ = g_new0 (Manam*, 3);
+       _tmp4_[0] = _tmp1_;
+       _tmp4_[1] = _tmp3_;
+       _tmp4_[2] = NULL;
+       manam = _tmp4_;
+       manam_length1 = 3;
+       _manam_size_ = manam_length1;
+       _tmp5_ = g_strdup ("foo");
+       _tmp6_ = g_strdup ("bar");
+       _tmp7_ = g_new0 (gchar*, 3 + 1);
+       _tmp7_[0] = _tmp5_;
+       _tmp7_[1] = _tmp6_;
+       _tmp7_[2] = NULL;
+       minim = _tmp7_;
+       minim_length1 = 3;
+       _minim_size_ = minim_length1;
+       {
+               Foo* foo = NULL;
+               Foo* _tmp8_;
+               Manam** _tmp9_;
+               gint _tmp9__length1;
+               gint _tmp10_ = 0;
+               Manam** _tmp11_;
+               gint _tmp11__length1;
+               Manam* _tmp12_;
+               Manam** _tmp13_;
+               gint _tmp13__length1;
+               gint _tmp14_ = 0;
+               Manam** _tmp15_;
+               gint _tmp15__length1;
+               Manam* _tmp16_;
+               Manam** _tmp17_;
+               gint _tmp17__length1;
+               Manam** _tmp18_;
+               gint _tmp18__length1;
+               Manam* _tmp19_;
+               Manam** _tmp20_;
+               gint _tmp20__length1;
+               Manam** _tmp21_;
+               gint _tmp21__length1;
+               Manam* _tmp22_;
+               gchar** _tmp23_;
+               gint _tmp23__length1;
+               gchar** _tmp24_;
+               gint _tmp24__length1;
+               const gchar* _tmp25_;
+               gchar** _tmp26_;
+               gint _tmp26__length1;
+               gchar** _tmp27_;
+               gint _tmp27__length1;
+               const gchar* _tmp28_;
+               _tmp8_ = foo_new ();
+               foo = _tmp8_;
+               foo_set_array (foo, manam, manam_length1);
+               _tmp9_ = foo_get_array (foo, &_tmp10_);
+               _tmp9__length1 = _tmp10_;
+               _tmp11_ = _tmp9_;
+               _tmp11__length1 = _tmp9__length1;
+               _tmp12_ = _tmp11_[0];
+               _vala_assert ((*_tmp12_).i == 23, "foo.array[0].i == 23");
+               foo_set_array_v (foo, manam, manam_length1);
+               _tmp13_ = foo_get_array_v (foo, &_tmp14_);
+               _tmp13__length1 = _tmp14_;
+               _tmp15_ = _tmp13_;
+               _tmp15__length1 = _tmp13__length1;
+               _tmp16_ = _tmp15_[1];
+               _vala_assert ((*_tmp16_).i == 42, "foo.array_v[1].i == 42");
+               foo_set_array_no_length (foo, manam);
+               _tmp17_ = foo_get_array_no_length (foo);
+               _tmp17__length1 = _vala_array_length (_tmp17_);
+               _tmp18_ = _tmp17_;
+               _tmp18__length1 = _tmp17__length1;
+               _tmp19_ = _tmp18_[0];
+               _vala_assert ((*_tmp19_).i == 23, "foo.array_no_length[0].i == 23");
+               foo_set_array_no_length_v (foo, manam);
+               _tmp20_ = foo_get_array_no_length_v (foo);
+               _tmp20__length1 = _vala_array_length (_tmp20_);
+               _tmp21_ = _tmp20_;
+               _tmp21__length1 = _tmp20__length1;
+               _tmp22_ = _tmp21_[1];
+               _vala_assert ((*_tmp22_).i == 42, "foo.array_no_length_v[1].i == 42");
+               foo_set_strv (foo, minim);
+               _tmp23_ = foo_get_strv (foo);
+               _tmp23__length1 = _vala_array_length (_tmp23_);
+               _tmp24_ = _tmp23_;
+               _tmp24__length1 = _tmp23__length1;
+               _tmp25_ = _tmp24_[0];
+               _vala_assert (g_strcmp0 (_tmp25_, "foo") == 0, "foo.strv[0] == \"foo\"");
+               foo_set_strv_v (foo, minim);
+               _tmp26_ = foo_get_strv_v (foo);
+               _tmp26__length1 = _vala_array_length (_tmp26_);
+               _tmp27_ = _tmp26_;
+               _tmp27__length1 = _tmp26__length1;
+               _tmp28_ = _tmp27_[1];
+               _vala_assert (g_strcmp0 (_tmp28_, "bar") == 0, "foo.strv_v[1] == \"bar\"");
+               _foo_unref0 (foo);
+       }
+       {
+               Bar* bar = NULL;
+               Bar* _tmp29_;
+               Manam** _tmp30_;
+               gint _tmp30__length1;
+               Manam** _tmp31_;
+               gint _tmp31__length1;
+               Manam* _tmp32_;
+               Manam** _tmp33_;
+               gint _tmp33__length1;
+               Manam** _tmp34_;
+               gint _tmp34__length1;
+               Manam* _tmp35_;
+               gchar** _tmp36_;
+               gint _tmp36__length1;
+               gchar** _tmp37_;
+               gint _tmp37__length1;
+               const gchar* _tmp38_;
+               gchar** _tmp39_;
+               gint _tmp39__length1;
+               gchar** _tmp40_;
+               gint _tmp40__length1;
+               const gchar* _tmp41_;
+               Manam** res = NULL;
+               gint res_length1 = 0;
+               gint _res_size_ = 0;
+               Manam** _tmp42_ = NULL;
+               Manam** _tmp43_;
+               gint _tmp43__length1;
+               Manam* _tmp44_;
+               Manam** _tmp45_ = NULL;
+               Manam** _tmp46_;
+               gint _tmp46__length1;
+               Manam* _tmp47_;
+               gchar** strv = NULL;
+               gint strv_length1 = 0;
+               gint _strv_size_ = 0;
+               gchar** _tmp48_ = NULL;
+               gchar** _tmp49_;
+               gint _tmp49__length1;
+               const gchar* _tmp50_;
+               gchar** _tmp51_ = NULL;
+               gchar** _tmp52_;
+               gint _tmp52__length1;
+               const gchar* _tmp53_;
+               _tmp29_ = bar_new ();
+               bar = _tmp29_;
+               bar_set_array (bar, manam);
+               _tmp30_ = bar_get_array (bar);
+               _tmp30__length1 = _vala_array_length (_tmp30_);
+               _tmp31_ = _tmp30_;
+               _tmp31__length1 = _tmp30__length1;
+               _tmp32_ = _tmp31_[0];
+               _vala_assert ((*_tmp32_).i == 23, "bar.array[0].i == 23");
+               bar_set_array_v (bar, manam);
+               _tmp33_ = bar_get_array_v (bar);
+               _tmp33__length1 = _vala_array_length (_tmp33_);
+               _tmp34_ = _tmp33_;
+               _tmp34__length1 = _tmp33__length1;
+               _tmp35_ = _tmp34_[1];
+               _vala_assert ((*_tmp35_).i == 42, "bar.array_v[1].i == 42");
+               bar_set_strv (bar, minim);
+               _tmp36_ = bar_get_strv (bar);
+               _tmp36__length1 = _vala_array_length (_tmp36_);
+               _tmp37_ = _tmp36_;
+               _tmp37__length1 = _tmp36__length1;
+               _tmp38_ = _tmp37_[0];
+               _vala_assert (g_strcmp0 (_tmp38_, "foo") == 0, "bar.strv[0] == \"foo\"");
+               bar_set_strv_v (bar, minim);
+               _tmp39_ = bar_get_strv_v (bar);
+               _tmp39__length1 = _vala_array_length (_tmp39_);
+               _tmp40_ = _tmp39_;
+               _tmp40__length1 = _tmp39__length1;
+               _tmp41_ = _tmp40_[1];
+               _vala_assert (g_strcmp0 (_tmp41_, "bar") == 0, "bar.strv_v[1] == \"bar\"");
+               g_object_get (G_TYPE_CHECK_INSTANCE_CAST (bar, G_TYPE_OBJECT, GObject), "array", &_tmp42_, 
NULL);
+               res = _tmp42_;
+               res_length1 = -1;
+               _res_size_ = res_length1;
+               _tmp43_ = res;
+               _tmp43__length1 = res_length1;
+               _tmp44_ = _tmp43_[0];
+               _vala_assert ((*_tmp44_).i == 23, "res[0].i == 23");
+               g_object_get (G_TYPE_CHECK_INSTANCE_CAST (bar, G_TYPE_OBJECT, GObject), "array-v", &_tmp45_, 
NULL);
+               res = _tmp45_;
+               res_length1 = -1;
+               _res_size_ = res_length1;
+               _tmp46_ = res;
+               _tmp46__length1 = res_length1;
+               _tmp47_ = _tmp46_[1];
+               _vala_assert ((*_tmp47_).i == 42, "res[1].i == 42");
+               g_object_get (G_TYPE_CHECK_INSTANCE_CAST (bar, G_TYPE_OBJECT, GObject), "strv", &_tmp48_, 
NULL);
+               strv = _tmp48_;
+               strv_length1 = -1;
+               _strv_size_ = strv_length1;
+               _tmp49_ = strv;
+               _tmp49__length1 = strv_length1;
+               _tmp50_ = _tmp49_[0];
+               _vala_assert (g_strcmp0 (_tmp50_, "foo") == 0, "strv[0] == \"foo\"");
+               g_object_get (G_TYPE_CHECK_INSTANCE_CAST (bar, G_TYPE_OBJECT, GObject), "strv-v", &_tmp51_, 
NULL);
+               strv = _tmp51_;
+               strv_length1 = -1;
+               _strv_size_ = strv_length1;
+               _tmp52_ = strv;
+               _tmp52__length1 = strv_length1;
+               _tmp53_ = _tmp52_[1];
+               _vala_assert (g_strcmp0 (_tmp53_, "bar") == 0, "strv[1] == \"bar\"");
+               _g_object_unref0 (bar);
+       }
+       minim = (_vala_array_free (minim, minim_length1, (GDestroyNotify) g_free), NULL);
+       manam = (_vala_array_free (manam, manam_length1, (GDestroyNotify) manam_free), NULL);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
+static gssize
+_vala_array_length (gpointer array)
+{
+       gssize length;
+       length = 0;
+       if (array) {
+               while (((gpointer*) array)[length]) {
+                       length++;
+               }
+       }
+       return length;
+}
+
diff --git a/tests/objects/property-base-access.c-expected b/tests/objects/property-base-access.c-expected
new file mode 100644
index 000000000..3172a68a3
--- /dev/null
+++ b/tests/objects/property-base-access.c-expected
@@ -0,0 +1,485 @@
+/* objects_property_base_access.c generated by valac, the Vala compiler
+ * generated from objects_property_base_access.vala, do not modify */
+
+#include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+#define _g_free0(var) (var = (g_free (var), NULL))
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _FooPrivate {
+       gchar* _prop;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+struct _Bar {
+       Foo parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       FooClass parent_class;
+};
+
+struct _BarPrivate {
+       gchar* _prop;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+static gint Bar_private_offset;
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+VALA_EXTERN void foo_set_prop (Foo* self,
+                   const gchar* value);
+VALA_EXTERN const gchar* foo_get_prop (Foo* self);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, foo_unref)
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+VALA_EXTERN void bar_set_prop (Bar* self,
+                   const gchar* value);
+VALA_EXTERN const gchar* bar_get_prop (Bar* self);
+static void bar_finalize (Foo * obj);
+static GType bar_get_type_once (void);
+static void _vala_main (void);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       foo_set_prop (self, "foo");
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+const gchar*
+foo_get_prop (Foo* self)
+{
+       const gchar* result;
+       const gchar* _tmp0_;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = self->priv->_prop;
+       result = _tmp0_;
+       return result;
+}
+
+void
+foo_set_prop (Foo* self,
+              const gchar* value)
+{
+       gchar* _tmp0_;
+       g_return_if_fail (IS_FOO (self));
+       _tmp0_ = g_strdup (value);
+       _g_free0 (self->priv->_prop);
+       self->priv->_prop = _tmp0_;
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+       _g_free0 (self->priv->_prop);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static inline gpointer
+bar_get_instance_private (Bar* self)
+{
+       return G_STRUCT_MEMBER_P (self, Bar_private_offset);
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar* self = NULL;
+       const gchar* _tmp0_;
+       const gchar* _tmp1_;
+       const gchar* _tmp2_;
+       const gchar* _tmp3_;
+       const gchar* _tmp4_;
+       self = (Bar*) foo_construct (object_type);
+       bar_set_prop (self, "bar");
+       _tmp0_ = foo_get_prop (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_FOO, Foo));
+       _tmp1_ = _tmp0_;
+       _vala_assert (g_strcmp0 (_tmp1_, "foo") == 0, "base.prop == \"foo\"");
+       foo_set_prop (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_FOO, Foo), "manam");
+       _tmp2_ = foo_get_prop (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_FOO, Foo));
+       _tmp3_ = _tmp2_;
+       _vala_assert (g_strcmp0 (_tmp3_, "manam") == 0, "base.prop == \"manam\"");
+       _tmp4_ = self->priv->_prop;
+       _vala_assert (g_strcmp0 (_tmp4_, "bar") == 0, "prop == \"bar\"");
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+const gchar*
+bar_get_prop (Bar* self)
+{
+       const gchar* result;
+       const gchar* _tmp0_;
+       g_return_val_if_fail (IS_BAR (self), NULL);
+       _tmp0_ = self->priv->_prop;
+       result = _tmp0_;
+       return result;
+}
+
+void
+bar_set_prop (Bar* self,
+              const gchar* value)
+{
+       gchar* _tmp0_;
+       g_return_if_fail (IS_BAR (self));
+       _tmp0_ = g_strdup (value);
+       _g_free0 (self->priv->_prop);
+       self->priv->_prop = _tmp0_;
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = bar_finalize;
+       g_type_class_adjust_private_offset (klass, &Bar_private_offset);
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+       self->priv = bar_get_instance_private (self);
+}
+
+static void
+bar_finalize (Foo * obj)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       _g_free0 (self->priv->_prop);
+       FOO_CLASS (bar_parent_class)->finalize (obj);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (TYPE_FOO, "Bar", &g_define_type_info, 0);
+       Bar_private_offset = g_type_add_instance_private (bar_type_id, sizeof (BarPrivate));
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Bar* bar = NULL;
+       Bar* _tmp0_;
+       _tmp0_ = bar_new ();
+       bar = _tmp0_;
+       _foo_unref0 (bar);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/property-construct-only.c-expected 
b/tests/objects/property-construct-only.c-expected
new file mode 100644
index 000000000..a8fc354cc
--- /dev/null
+++ b/tests/objects/property-construct-only.c-expected
@@ -0,0 +1,648 @@
+/* objects_property_construct_only.c generated by valac, the Vala compiler
+ * generated from objects_property_construct_only.vala, do not modify */
+
+#include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_MANAM_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_free0(var) (var = (g_free (var), NULL))
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+enum  {
+       BAR_0_PROPERTY,
+       BAR_NUM_PROPERTIES
+};
+static GParamSpec* bar_properties[BAR_NUM_PROPERTIES];
+
+#define TYPE_FAZ (faz_get_type ())
+#define FAZ(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FAZ, Faz))
+#define FAZ_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FAZ, FazClass))
+#define IS_FAZ(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FAZ))
+#define IS_FAZ_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FAZ))
+#define FAZ_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FAZ, FazClass))
+
+typedef struct _Faz Faz;
+typedef struct _FazClass FazClass;
+typedef struct _FazPrivate FazPrivate;
+enum  {
+       FAZ_0_PROPERTY,
+       FAZ_MANAM_PROPERTY,
+       FAZ_NUM_PROPERTIES
+};
+static GParamSpec* faz_properties[FAZ_NUM_PROPERTIES];
+
+#define TYPE_BAZ (baz_get_type ())
+#define BAZ(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAZ, Baz))
+#define BAZ_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAZ, BazClass))
+#define IS_BAZ(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAZ))
+#define IS_BAZ_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAZ))
+#define BAZ_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAZ, BazClass))
+
+typedef struct _Baz Baz;
+typedef struct _BazClass BazClass;
+typedef struct _BazPrivate BazPrivate;
+enum  {
+       BAZ_0_PROPERTY,
+       BAZ_NUM_PROPERTIES
+};
+static GParamSpec* baz_properties[BAZ_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _FooPrivate {
+       gchar* _manam;
+};
+
+struct _Bar {
+       Foo parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       FooClass parent_class;
+};
+
+struct _Faz {
+       GObject parent_instance;
+       FazPrivate * priv;
+};
+
+struct _FazClass {
+       GObjectClass parent_class;
+};
+
+struct _FazPrivate {
+       gchar* _manam;
+};
+
+struct _Baz {
+       Faz parent_instance;
+       BazPrivate * priv;
+};
+
+struct _BazClass {
+       FazClass parent_class;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+static gpointer bar_parent_class = NULL;
+static gint Faz_private_offset;
+static gpointer faz_parent_class = NULL;
+static gpointer baz_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+VALA_EXTERN const gchar* foo_get_manam (Foo* self);
+static void foo_set_manam (Foo* self,
+                    const gchar* value);
+static GObject * foo_constructor (GType type,
+                           guint n_construct_properties,
+                           GObjectConstructParam * construct_properties);
+static void foo_finalize (GObject * obj);
+static GType foo_get_type_once (void);
+static void _vala_foo_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_foo_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static GObject * bar_constructor (GType type,
+                           guint n_construct_properties,
+                           GObjectConstructParam * construct_properties);
+static GType bar_get_type_once (void);
+VALA_EXTERN GType faz_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Faz, g_object_unref)
+VALA_EXTERN Faz* faz_new (void);
+VALA_EXTERN Faz* faz_construct (GType object_type);
+VALA_EXTERN const gchar* faz_get_manam (Faz* self);
+static void faz_set_manam (Faz* self,
+                    const gchar* value);
+static void faz_finalize (GObject * obj);
+static GType faz_get_type_once (void);
+static void _vala_faz_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_faz_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec);
+VALA_EXTERN GType baz_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Baz, g_object_unref)
+VALA_EXTERN Baz* baz_new (void);
+VALA_EXTERN Baz* baz_construct (GType object_type);
+static GType baz_get_type_once (void);
+static void _vala_main (void);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+const gchar*
+foo_get_manam (Foo* self)
+{
+       const gchar* result;
+       const gchar* _tmp0_;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = self->priv->_manam;
+       result = _tmp0_;
+       return result;
+}
+
+static void
+foo_set_manam (Foo* self,
+               const gchar* value)
+{
+       gchar* old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_manam (self);
+       if (g_strcmp0 (value, old_value) != 0) {
+               gchar* _tmp0_;
+               _tmp0_ = g_strdup (value);
+               _g_free0 (self->priv->_manam);
+               self->priv->_manam = _tmp0_;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_MANAM_PROPERTY]);
+       }
+}
+
+static GObject *
+foo_constructor (GType type,
+                 guint n_construct_properties,
+                 GObjectConstructParam * construct_properties)
+{
+       GObject * obj;
+       GObjectClass * parent_class;
+       Foo * self;
+       parent_class = G_OBJECT_CLASS (foo_parent_class);
+       obj = parent_class->constructor (type, n_construct_properties, construct_properties);
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       foo_set_manam (self, "foo");
+       return obj;
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_foo_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_foo_set_property;
+       G_OBJECT_CLASS (klass)->constructor = foo_constructor;
+       G_OBJECT_CLASS (klass)->finalize = foo_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_MANAM_PROPERTY, 
foo_properties[FOO_MANAM_PROPERTY] = g_param_spec_string ("manam", "manam", "manam", NULL, 
G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+}
+
+static void
+foo_finalize (GObject * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       _g_free0 (self->priv->_manam);
+       G_OBJECT_CLASS (foo_parent_class)->finalize (obj);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_foo_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_MANAM_PROPERTY:
+               g_value_set_string (value, foo_get_manam (self));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_foo_set_property (GObject * object,
+                        guint property_id,
+                        const GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_MANAM_PROPERTY:
+               foo_set_manam (self, g_value_get_string (value));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar * self = NULL;
+       self = (Bar*) foo_construct (object_type);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static GObject *
+bar_constructor (GType type,
+                 guint n_construct_properties,
+                 GObjectConstructParam * construct_properties)
+{
+       GObject * obj;
+       GObjectClass * parent_class;
+       Bar * self;
+       parent_class = G_OBJECT_CLASS (bar_parent_class);
+       obj = parent_class->constructor (type, n_construct_properties, construct_properties);
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       foo_set_manam (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_FOO, Foo), "bar");
+       return obj;
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       G_OBJECT_CLASS (klass)->constructor = bar_constructor;
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (TYPE_FOO, "Bar", &g_define_type_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static inline gpointer
+faz_get_instance_private (Faz* self)
+{
+       return G_STRUCT_MEMBER_P (self, Faz_private_offset);
+}
+
+Faz*
+faz_construct (GType object_type)
+{
+       Faz * self = NULL;
+       self = (Faz*) g_object_new (object_type, "manam", "faz", NULL);
+       return self;
+}
+
+Faz*
+faz_new (void)
+{
+       return faz_construct (TYPE_FAZ);
+}
+
+const gchar*
+faz_get_manam (Faz* self)
+{
+       const gchar* result;
+       const gchar* _tmp0_;
+       g_return_val_if_fail (IS_FAZ (self), NULL);
+       _tmp0_ = self->priv->_manam;
+       result = _tmp0_;
+       return result;
+}
+
+static void
+faz_set_manam (Faz* self,
+               const gchar* value)
+{
+       gchar* old_value;
+       g_return_if_fail (IS_FAZ (self));
+       old_value = faz_get_manam (self);
+       if (g_strcmp0 (value, old_value) != 0) {
+               gchar* _tmp0_;
+               _tmp0_ = g_strdup (value);
+               _g_free0 (self->priv->_manam);
+               self->priv->_manam = _tmp0_;
+               g_object_notify_by_pspec ((GObject *) self, faz_properties[FAZ_MANAM_PROPERTY]);
+       }
+}
+
+static void
+faz_class_init (FazClass * klass,
+                gpointer klass_data)
+{
+       faz_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Faz_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_faz_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_faz_set_property;
+       G_OBJECT_CLASS (klass)->finalize = faz_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FAZ_MANAM_PROPERTY, 
faz_properties[FAZ_MANAM_PROPERTY] = g_param_spec_string ("manam", "manam", "manam", NULL, 
G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
+}
+
+static void
+faz_instance_init (Faz * self,
+                   gpointer klass)
+{
+       self->priv = faz_get_instance_private (self);
+}
+
+static void
+faz_finalize (GObject * obj)
+{
+       Faz * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FAZ, Faz);
+       _g_free0 (self->priv->_manam);
+       G_OBJECT_CLASS (faz_parent_class)->finalize (obj);
+}
+
+static GType
+faz_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FazClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) faz_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Faz), 0, 
(GInstanceInitFunc) faz_instance_init, NULL };
+       GType faz_type_id;
+       faz_type_id = g_type_register_static (G_TYPE_OBJECT, "Faz", &g_define_type_info, 0);
+       Faz_private_offset = g_type_add_instance_private (faz_type_id, sizeof (FazPrivate));
+       return faz_type_id;
+}
+
+GType
+faz_get_type (void)
+{
+       static volatile gsize faz_type_id__volatile = 0;
+       if (g_once_init_enter (&faz_type_id__volatile)) {
+               GType faz_type_id;
+               faz_type_id = faz_get_type_once ();
+               g_once_init_leave (&faz_type_id__volatile, faz_type_id);
+       }
+       return faz_type_id__volatile;
+}
+
+static void
+_vala_faz_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Faz * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FAZ, Faz);
+       switch (property_id) {
+               case FAZ_MANAM_PROPERTY:
+               g_value_set_string (value, faz_get_manam (self));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_faz_set_property (GObject * object,
+                        guint property_id,
+                        const GValue * value,
+                        GParamSpec * pspec)
+{
+       Faz * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FAZ, Faz);
+       switch (property_id) {
+               case FAZ_MANAM_PROPERTY:
+               faz_set_manam (self, g_value_get_string (value));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+Baz*
+baz_construct (GType object_type)
+{
+       Baz * self = NULL;
+       self = (Baz*) g_object_new (object_type, "manam", "baz", NULL);
+       return self;
+}
+
+Baz*
+baz_new (void)
+{
+       return baz_construct (TYPE_BAZ);
+}
+
+static void
+baz_class_init (BazClass * klass,
+                gpointer klass_data)
+{
+       baz_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+baz_instance_init (Baz * self,
+                   gpointer klass)
+{
+}
+
+static GType
+baz_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BazClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) baz_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Baz), 0, 
(GInstanceInitFunc) baz_instance_init, NULL };
+       GType baz_type_id;
+       baz_type_id = g_type_register_static (TYPE_FAZ, "Baz", &g_define_type_info, 0);
+       return baz_type_id;
+}
+
+GType
+baz_get_type (void)
+{
+       static volatile gsize baz_type_id__volatile = 0;
+       if (g_once_init_enter (&baz_type_id__volatile)) {
+               GType baz_type_id;
+               baz_type_id = baz_get_type_once ();
+               g_once_init_leave (&baz_type_id__volatile, baz_type_id);
+       }
+       return baz_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       {
+               Foo* foo = NULL;
+               Foo* _tmp0_;
+               const gchar* _tmp1_;
+               const gchar* _tmp2_;
+               _tmp0_ = foo_new ();
+               foo = _tmp0_;
+               _tmp1_ = foo_get_manam (foo);
+               _tmp2_ = _tmp1_;
+               _vala_assert (g_strcmp0 (_tmp2_, "foo") == 0, "foo.manam == \"foo\"");
+               _g_object_unref0 (foo);
+       }
+       {
+               Bar* bar = NULL;
+               Bar* _tmp3_;
+               const gchar* _tmp4_;
+               const gchar* _tmp5_;
+               _tmp3_ = bar_new ();
+               bar = _tmp3_;
+               _tmp4_ = foo_get_manam (G_TYPE_CHECK_INSTANCE_CAST (bar, TYPE_FOO, Foo));
+               _tmp5_ = _tmp4_;
+               _vala_assert (g_strcmp0 (_tmp5_, "bar") == 0, "bar.manam == \"bar\"");
+               _g_object_unref0 (bar);
+       }
+       {
+               Faz* faz = NULL;
+               Faz* _tmp6_;
+               const gchar* _tmp7_;
+               const gchar* _tmp8_;
+               _tmp6_ = faz_new ();
+               faz = _tmp6_;
+               _tmp7_ = faz_get_manam (faz);
+               _tmp8_ = _tmp7_;
+               _vala_assert (g_strcmp0 (_tmp8_, "faz") == 0, "faz.manam == \"faz\"");
+               _g_object_unref0 (faz);
+       }
+       {
+               Baz* baz = NULL;
+               Baz* _tmp9_;
+               const gchar* _tmp10_;
+               const gchar* _tmp11_;
+               _tmp9_ = baz_new ();
+               baz = _tmp9_;
+               _tmp10_ = faz_get_manam (G_TYPE_CHECK_INSTANCE_CAST (baz, TYPE_FAZ, Faz));
+               _tmp11_ = _tmp10_;
+               _vala_assert (g_strcmp0 (_tmp11_, "baz") == 0, "baz.manam == \"baz\"");
+               _g_object_unref0 (baz);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/property-delegate-owned.c-expected 
b/tests/objects/property-delegate-owned.c-expected
new file mode 100644
index 000000000..2c8697c19
--- /dev/null
+++ b/tests/objects/property-delegate-owned.c-expected
@@ -0,0 +1,918 @@
+/* objects_property_delegate_owned.c generated by valac, the Vala compiler
+ * generated from objects_property_delegate_owned.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef void (*FooFunc) (gpointer user_data);
+
+#define TYPE_IFOO (ifoo_get_type ())
+#define IFOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IFOO, IFoo))
+#define IS_IFOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IFOO))
+#define IFOO_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_IFOO, IFooIface))
+
+typedef struct _IFoo IFoo;
+typedef struct _IFooIface IFooIface;
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+
+struct _IFooIface {
+       GTypeInterface parent_iface;
+       FooFunc (*get_foo) (IFoo* self, gpointer* result_target);
+       void (*set_foo) (IFoo* self, FooFunc value, gpointer value_target, GDestroyNotify 
value_target_destroy_notify);
+       FooFunc (*get_bar) (IFoo* self, gpointer* result_target);
+       void (*set_bar) (IFoo* self, FooFunc value, gpointer value_target, GDestroyNotify 
value_target_destroy_notify);
+};
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+       FooFunc (*get_foo) (Foo* self, gpointer* result_target);
+       void (*set_foo) (Foo* self, FooFunc value, gpointer value_target, GDestroyNotify 
value_target_destroy_notify);
+       FooFunc (*get_bar) (Foo* self, gpointer* result_target);
+       void (*set_bar) (Foo* self, FooFunc value, gpointer value_target, GDestroyNotify 
value_target_destroy_notify);
+};
+
+struct _FooPrivate {
+       FooFunc _bar;
+       gpointer _bar_target;
+       GDestroyNotify _bar_target_destroy_notify;
+       FooFunc _foo;
+       gpointer _foo_target;
+       GDestroyNotify _foo_target_destroy_notify;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+struct _Bar {
+       Foo parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       FooClass parent_class;
+};
+
+struct _BarPrivate {
+       FooFunc _bar;
+       gpointer _bar_target;
+       GDestroyNotify _bar_target_destroy_notify;
+       FooFunc _foo;
+       gpointer _foo_target;
+       GDestroyNotify _foo_target_destroy_notify;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+static IFooIface * foo_ifoo_parent_iface = NULL;
+static gint Bar_private_offset;
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN GType ifoo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN FooFunc ifoo_get_foo (IFoo* self,
+                      gpointer* result_target);
+VALA_EXTERN void ifoo_set_foo (IFoo* self,
+                   FooFunc value,
+                   gpointer value_target,
+                   GDestroyNotify value_target_destroy_notify);
+VALA_EXTERN FooFunc ifoo_get_bar (IFoo* self,
+                      gpointer* result_target);
+VALA_EXTERN void ifoo_set_bar (IFoo* self,
+                   FooFunc value,
+                   gpointer value_target,
+                   GDestroyNotify value_target_destroy_notify);
+static GType ifoo_get_type_once (void);
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN FooFunc foo_get_foo (Foo* self,
+                     gpointer* result_target);
+VALA_EXTERN void foo_set_foo (Foo* self,
+                  FooFunc value,
+                  gpointer value_target,
+                  GDestroyNotify value_target_destroy_notify);
+VALA_EXTERN FooFunc foo_get_bar (Foo* self,
+                     gpointer* result_target);
+VALA_EXTERN void foo_set_bar (Foo* self,
+                  FooFunc value,
+                  gpointer value_target,
+                  GDestroyNotify value_target_destroy_notify);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void __lambda4_ (Foo* self);
+static void ___lambda4__foo_func (gpointer self);
+static void __lambda5_ (Foo* self);
+static void ___lambda5__foo_func (gpointer self);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, foo_unref)
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static void __lambda6_ (Bar* self);
+static void ___lambda6__foo_func (gpointer self);
+static void __lambda7_ (Bar* self);
+static void ___lambda7__foo_func (gpointer self);
+static void bar_finalize (Foo * obj);
+static GType bar_get_type_once (void);
+static void _vala_main (void);
+
+FooFunc
+ifoo_get_foo (IFoo* self,
+              gpointer* result_target)
+{
+       IFooIface* _iface_;
+       g_return_val_if_fail (IS_IFOO (self), NULL);
+       _iface_ = IFOO_GET_INTERFACE (self);
+       if (_iface_->get_foo) {
+               return _iface_->get_foo (self, result_target);
+       }
+       return NULL;
+}
+
+void
+ifoo_set_foo (IFoo* self,
+              FooFunc value,
+              gpointer value_target,
+              GDestroyNotify value_target_destroy_notify)
+{
+       IFooIface* _iface_;
+       g_return_if_fail (IS_IFOO (self));
+       _iface_ = IFOO_GET_INTERFACE (self);
+       if (_iface_->set_foo) {
+               _iface_->set_foo (self, value, value_target, value_target_destroy_notify);
+       }
+}
+
+FooFunc
+ifoo_get_bar (IFoo* self,
+              gpointer* result_target)
+{
+       IFooIface* _iface_;
+       g_return_val_if_fail (IS_IFOO (self), NULL);
+       _iface_ = IFOO_GET_INTERFACE (self);
+       if (_iface_->get_bar) {
+               return _iface_->get_bar (self, result_target);
+       }
+       return NULL;
+}
+
+void
+ifoo_set_bar (IFoo* self,
+              FooFunc value,
+              gpointer value_target,
+              GDestroyNotify value_target_destroy_notify)
+{
+       IFooIface* _iface_;
+       g_return_if_fail (IS_IFOO (self));
+       _iface_ = IFOO_GET_INTERFACE (self);
+       if (_iface_->set_bar) {
+               _iface_->set_bar (self, value, value_target, value_target_destroy_notify);
+       }
+}
+
+static void
+ifoo_default_init (IFooIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+ifoo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (IFooIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) ifoo_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType ifoo_type_id;
+       ifoo_type_id = g_type_register_static (G_TYPE_INTERFACE, "IFoo", &g_define_type_info, 0);
+       return ifoo_type_id;
+}
+
+GType
+ifoo_get_type (void)
+{
+       static volatile gsize ifoo_type_id__volatile = 0;
+       if (g_once_init_enter (&ifoo_type_id__volatile)) {
+               GType ifoo_type_id;
+               ifoo_type_id = ifoo_get_type_once ();
+               g_once_init_leave (&ifoo_type_id__volatile, ifoo_type_id);
+       }
+       return ifoo_type_id__volatile;
+}
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+static void
+__lambda4_ (Foo* self)
+{
+}
+
+static void
+___lambda4__foo_func (gpointer self)
+{
+       __lambda4_ ((Foo*) self);
+}
+
+static void
+__lambda5_ (Foo* self)
+{
+}
+
+static void
+___lambda5__foo_func (gpointer self)
+{
+       __lambda5_ ((Foo*) self);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       foo_set_foo (self, ___lambda4__foo_func, foo_ref (self), foo_unref);
+       foo_set_bar (self, ___lambda5__foo_func, foo_ref (self), foo_unref);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+FooFunc
+foo_get_foo (Foo* self,
+             gpointer* result_target)
+{
+       FooClass* _klass_;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->get_foo) {
+               return _klass_->get_foo (self, result_target);
+       }
+       return NULL;
+}
+
+static FooFunc
+foo_real_get_foo (Foo* base,
+                  gpointer* result_target)
+{
+       FooFunc result;
+       Foo* self;
+       FooFunc _tmp0_;
+       gpointer _tmp0__target;
+       FooFunc _tmp1_;
+       gpointer _tmp1__target;
+       self = base;
+       _tmp0_ = self->priv->_foo;
+       _tmp0__target = self->priv->_foo_target;
+       _tmp1_ = _tmp0_;
+       _tmp1__target = _tmp0__target;
+       *result_target = _tmp1__target;
+       result = _tmp1_;
+       return result;
+}
+
+void
+foo_set_foo (Foo* self,
+             FooFunc value,
+             gpointer value_target,
+             GDestroyNotify value_target_destroy_notify)
+{
+       FooClass* _klass_;
+       g_return_if_fail (IS_FOO (self));
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->set_foo) {
+               _klass_->set_foo (self, value, value_target, value_target_destroy_notify);
+       }
+}
+
+static void
+foo_real_set_foo (Foo* base,
+                  FooFunc value,
+                  gpointer value_target,
+                  GDestroyNotify value_target_destroy_notify)
+{
+       Foo* self;
+       FooFunc _tmp0_;
+       gpointer _tmp0__target;
+       GDestroyNotify _tmp0__target_destroy_notify;
+       self = base;
+       _tmp0_ = value;
+       _tmp0__target = value_target;
+       _tmp0__target_destroy_notify = value_target_destroy_notify;
+       value = NULL;
+       value_target = NULL;
+       value_target_destroy_notify = NULL;
+       (self->priv->_foo_target_destroy_notify == NULL) ? NULL : (self->priv->_foo_target_destroy_notify 
(self->priv->_foo_target), NULL);
+       self->priv->_foo = NULL;
+       self->priv->_foo_target = NULL;
+       self->priv->_foo_target_destroy_notify = NULL;
+       self->priv->_foo = _tmp0_;
+       self->priv->_foo_target = _tmp0__target;
+       self->priv->_foo_target_destroy_notify = _tmp0__target_destroy_notify;
+       (value_target_destroy_notify == NULL) ? NULL : (value_target_destroy_notify (value_target), NULL);
+       value = NULL;
+       value_target = NULL;
+       value_target_destroy_notify = NULL;
+}
+
+FooFunc
+foo_get_bar (Foo* self,
+             gpointer* result_target)
+{
+       FooClass* _klass_;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->get_bar) {
+               return _klass_->get_bar (self, result_target);
+       }
+       return NULL;
+}
+
+static FooFunc
+foo_real_get_bar (Foo* base,
+                  gpointer* result_target)
+{
+       FooFunc result;
+       Foo* self;
+       FooFunc _tmp0_;
+       gpointer _tmp0__target;
+       FooFunc _tmp1_;
+       gpointer _tmp1__target;
+       self = base;
+       _tmp0_ = self->priv->_bar;
+       _tmp0__target = self->priv->_bar_target;
+       _tmp1_ = _tmp0_;
+       _tmp1__target = _tmp0__target;
+       *result_target = _tmp1__target;
+       result = _tmp1_;
+       return result;
+}
+
+void
+foo_set_bar (Foo* self,
+             FooFunc value,
+             gpointer value_target,
+             GDestroyNotify value_target_destroy_notify)
+{
+       FooClass* _klass_;
+       g_return_if_fail (IS_FOO (self));
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->set_bar) {
+               _klass_->set_bar (self, value, value_target, value_target_destroy_notify);
+       }
+}
+
+static void
+foo_real_set_bar (Foo* base,
+                  FooFunc value,
+                  gpointer value_target,
+                  GDestroyNotify value_target_destroy_notify)
+{
+       Foo* self;
+       FooFunc _tmp0_;
+       gpointer _tmp0__target;
+       GDestroyNotify _tmp0__target_destroy_notify;
+       self = base;
+       _tmp0_ = value;
+       _tmp0__target = value_target;
+       _tmp0__target_destroy_notify = value_target_destroy_notify;
+       value = NULL;
+       value_target = NULL;
+       value_target_destroy_notify = NULL;
+       (self->priv->_bar_target_destroy_notify == NULL) ? NULL : (self->priv->_bar_target_destroy_notify 
(self->priv->_bar_target), NULL);
+       self->priv->_bar = NULL;
+       self->priv->_bar_target = NULL;
+       self->priv->_bar_target_destroy_notify = NULL;
+       self->priv->_bar = _tmp0_;
+       self->priv->_bar_target = _tmp0__target;
+       self->priv->_bar_target_destroy_notify = _tmp0__target_destroy_notify;
+       (value_target_destroy_notify == NULL) ? NULL : (value_target_destroy_notify (value_target), NULL);
+       value = NULL;
+       value_target = NULL;
+       value_target_destroy_notify = NULL;
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+       FOO_CLASS (klass)->get_foo = foo_real_get_foo;
+       FOO_CLASS (klass)->set_foo = foo_real_set_foo;
+       FOO_CLASS (klass)->get_bar = foo_real_get_bar;
+       FOO_CLASS (klass)->set_bar = foo_real_set_bar;
+}
+
+static void
+foo_ifoo_interface_init (IFooIface * iface,
+                         gpointer iface_data)
+{
+       foo_ifoo_parent_iface = g_type_interface_peek_parent (iface);
+       iface->get_foo = (FooFunc (*) (IFoo *)) foo_get_foo;
+       iface->set_foo = (void (*) (IFoo *, FooFunc)) foo_set_foo;
+       iface->get_bar = (FooFunc (*) (IFoo *)) foo_get_bar;
+       iface->set_bar = (void (*) (IFoo *, FooFunc)) foo_set_bar;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+       (self->priv->_bar_target_destroy_notify == NULL) ? NULL : (self->priv->_bar_target_destroy_notify 
(self->priv->_bar_target), NULL);
+       self->priv->_bar = NULL;
+       self->priv->_bar_target = NULL;
+       self->priv->_bar_target_destroy_notify = NULL;
+       (self->priv->_foo_target_destroy_notify == NULL) ? NULL : (self->priv->_foo_target_destroy_notify 
(self->priv->_foo_target), NULL);
+       self->priv->_foo = NULL;
+       self->priv->_foo_target = NULL;
+       self->priv->_foo_target_destroy_notify = NULL;
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       static const GInterfaceInfo ifoo_info = { (GInterfaceInitFunc) foo_ifoo_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       g_type_add_interface_static (foo_type_id, TYPE_IFOO, &ifoo_info);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static inline gpointer
+bar_get_instance_private (Bar* self)
+{
+       return G_STRUCT_MEMBER_P (self, Bar_private_offset);
+}
+
+static void
+__lambda6_ (Bar* self)
+{
+}
+
+static void
+___lambda6__foo_func (gpointer self)
+{
+       __lambda6_ ((Bar*) self);
+}
+
+static void
+__lambda7_ (Bar* self)
+{
+}
+
+static void
+___lambda7__foo_func (gpointer self)
+{
+       __lambda7_ ((Bar*) self);
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar* self = NULL;
+       self = (Bar*) foo_construct (object_type);
+       foo_set_foo (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_FOO, Foo), ___lambda6__foo_func, foo_ref (self), 
foo_unref);
+       foo_set_bar (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_FOO, Foo), ___lambda7__foo_func, foo_ref (self), 
foo_unref);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static FooFunc
+bar_real_get_foo (Foo* base,
+                  gpointer* result_target)
+{
+       FooFunc result;
+       Bar* self;
+       FooFunc _tmp0_;
+       gpointer _tmp0__target;
+       FooFunc _tmp1_;
+       gpointer _tmp1__target;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAR, Bar);
+       _tmp0_ = self->priv->_foo;
+       _tmp0__target = self->priv->_foo_target;
+       _tmp1_ = _tmp0_;
+       _tmp1__target = _tmp0__target;
+       *result_target = _tmp1__target;
+       result = _tmp1_;
+       return result;
+}
+
+static void
+bar_real_set_foo (Foo* base,
+                  FooFunc value,
+                  gpointer value_target,
+                  GDestroyNotify value_target_destroy_notify)
+{
+       Bar* self;
+       FooFunc _tmp0_;
+       gpointer _tmp0__target;
+       GDestroyNotify _tmp0__target_destroy_notify;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAR, Bar);
+       _tmp0_ = value;
+       _tmp0__target = value_target;
+       _tmp0__target_destroy_notify = value_target_destroy_notify;
+       value = NULL;
+       value_target = NULL;
+       value_target_destroy_notify = NULL;
+       (self->priv->_foo_target_destroy_notify == NULL) ? NULL : (self->priv->_foo_target_destroy_notify 
(self->priv->_foo_target), NULL);
+       self->priv->_foo = NULL;
+       self->priv->_foo_target = NULL;
+       self->priv->_foo_target_destroy_notify = NULL;
+       self->priv->_foo = _tmp0_;
+       self->priv->_foo_target = _tmp0__target;
+       self->priv->_foo_target_destroy_notify = _tmp0__target_destroy_notify;
+       (value_target_destroy_notify == NULL) ? NULL : (value_target_destroy_notify (value_target), NULL);
+       value = NULL;
+       value_target = NULL;
+       value_target_destroy_notify = NULL;
+}
+
+static FooFunc
+bar_real_get_bar (Foo* base,
+                  gpointer* result_target)
+{
+       FooFunc result;
+       Bar* self;
+       FooFunc _tmp0_;
+       gpointer _tmp0__target;
+       FooFunc _tmp1_;
+       gpointer _tmp1__target;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAR, Bar);
+       _tmp0_ = self->priv->_bar;
+       _tmp0__target = self->priv->_bar_target;
+       _tmp1_ = _tmp0_;
+       _tmp1__target = _tmp0__target;
+       *result_target = _tmp1__target;
+       result = _tmp1_;
+       return result;
+}
+
+static void
+bar_real_set_bar (Foo* base,
+                  FooFunc value,
+                  gpointer value_target,
+                  GDestroyNotify value_target_destroy_notify)
+{
+       Bar* self;
+       FooFunc _tmp0_;
+       gpointer _tmp0__target;
+       GDestroyNotify _tmp0__target_destroy_notify;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAR, Bar);
+       _tmp0_ = value;
+       _tmp0__target = value_target;
+       _tmp0__target_destroy_notify = value_target_destroy_notify;
+       value = NULL;
+       value_target = NULL;
+       value_target_destroy_notify = NULL;
+       (self->priv->_bar_target_destroy_notify == NULL) ? NULL : (self->priv->_bar_target_destroy_notify 
(self->priv->_bar_target), NULL);
+       self->priv->_bar = NULL;
+       self->priv->_bar_target = NULL;
+       self->priv->_bar_target_destroy_notify = NULL;
+       self->priv->_bar = _tmp0_;
+       self->priv->_bar_target = _tmp0__target;
+       self->priv->_bar_target_destroy_notify = _tmp0__target_destroy_notify;
+       (value_target_destroy_notify == NULL) ? NULL : (value_target_destroy_notify (value_target), NULL);
+       value = NULL;
+       value_target = NULL;
+       value_target_destroy_notify = NULL;
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = bar_finalize;
+       g_type_class_adjust_private_offset (klass, &Bar_private_offset);
+       FOO_CLASS (klass)->get_foo = bar_real_get_foo;
+       FOO_CLASS (klass)->set_foo = bar_real_set_foo;
+       FOO_CLASS (klass)->get_bar = bar_real_get_bar;
+       FOO_CLASS (klass)->set_bar = bar_real_set_bar;
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+       self->priv = bar_get_instance_private (self);
+}
+
+static void
+bar_finalize (Foo * obj)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       (self->priv->_bar_target_destroy_notify == NULL) ? NULL : (self->priv->_bar_target_destroy_notify 
(self->priv->_bar_target), NULL);
+       self->priv->_bar = NULL;
+       self->priv->_bar_target = NULL;
+       self->priv->_bar_target_destroy_notify = NULL;
+       (self->priv->_foo_target_destroy_notify == NULL) ? NULL : (self->priv->_foo_target_destroy_notify 
(self->priv->_foo_target), NULL);
+       self->priv->_foo = NULL;
+       self->priv->_foo_target = NULL;
+       self->priv->_foo_target_destroy_notify = NULL;
+       FOO_CLASS (bar_parent_class)->finalize (obj);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (TYPE_FOO, "Bar", &g_define_type_info, 0);
+       Bar_private_offset = g_type_add_instance_private (bar_type_id, sizeof (BarPrivate));
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       FooFunc _tmp1_ = NULL;
+       gpointer _tmp1__target = NULL;
+       FooFunc _tmp2_;
+       gpointer _tmp2__target;
+       Bar* bar = NULL;
+       Bar* _tmp3_;
+       FooFunc _tmp4_ = NULL;
+       gpointer _tmp4__target = NULL;
+       FooFunc _tmp5_;
+       gpointer _tmp5__target;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       _tmp1_ = foo_get_foo (foo, &_tmp1__target);
+       _tmp2_ = _tmp1_;
+       _tmp2__target = _tmp1__target;
+       _tmp2_ (_tmp2__target);
+       _tmp3_ = bar_new ();
+       bar = _tmp3_;
+       _tmp4_ = foo_get_bar (G_TYPE_CHECK_INSTANCE_CAST (bar, TYPE_FOO, Foo), &_tmp4__target);
+       _tmp5_ = _tmp4_;
+       _tmp5__target = _tmp4__target;
+       _tmp5_ (_tmp5__target);
+       _foo_unref0 (bar);
+       _foo_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/property-delegate.c-expected b/tests/objects/property-delegate.c-expected
new file mode 100644
index 000000000..95a415a57
--- /dev/null
+++ b/tests/objects/property-delegate.c-expected
@@ -0,0 +1,947 @@
+/* objects_property_delegate.c generated by valac, the Vala compiler
+ * generated from objects_property_delegate.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+#include <glib-object.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef const gchar* (*Manam) (gpointer user_data);
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+enum  {
+       BAR_0_PROPERTY,
+       BAR_DELEG_PROPERTY,
+       BAR_DELEG_V_PROPERTY,
+       BAR_NUM_PROPERTIES
+};
+static GParamSpec* bar_properties[BAR_NUM_PROPERTIES];
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+       Manam (*get_deleg_v) (Foo* self, gpointer* result_target);
+       void (*set_deleg_v) (Foo* self, Manam value, gpointer value_target);
+       Manam (*get_deleg_no_target_v) (Foo* self);
+       void (*set_deleg_no_target_v) (Foo* self, Manam value);
+};
+
+struct _FooPrivate {
+       Manam _deleg;
+       gpointer _deleg_target;
+       GDestroyNotify _deleg_target_destroy_notify;
+       Manam _deleg_v;
+       gpointer _deleg_v_target;
+       GDestroyNotify _deleg_v_target_destroy_notify;
+       Manam _deleg_no_target;
+       gpointer _deleg_no_target_target;
+       GDestroyNotify _deleg_no_target_target_destroy_notify;
+       Manam _deleg_no_target_v;
+       gpointer _deleg_no_target_v_target;
+       GDestroyNotify _deleg_no_target_v_target_destroy_notify;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+struct _Bar {
+       GObject parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       GObjectClass parent_class;
+       Manam (*get_deleg_v) (Bar* self);
+       void (*set_deleg_v) (Bar* self, Manam value);
+};
+
+struct _BarPrivate {
+       Manam _deleg;
+       gpointer _deleg_target;
+       GDestroyNotify _deleg_target_destroy_notify;
+       Manam _deleg_v;
+       gpointer _deleg_v_target;
+       GDestroyNotify _deleg_v_target_destroy_notify;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+static gint Bar_private_offset;
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Manam foo_get_deleg_v (Foo* self,
+                       gpointer* result_target);
+VALA_EXTERN void foo_set_deleg_v (Foo* self,
+                      Manam value,
+                      gpointer value_target);
+VALA_EXTERN Manam foo_get_deleg_no_target_v (Foo* self);
+VALA_EXTERN void foo_set_deleg_no_target_v (Foo* self,
+                                Manam value);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+VALA_EXTERN Manam foo_get_deleg (Foo* self,
+                     gpointer* result_target);
+VALA_EXTERN void foo_set_deleg (Foo* self,
+                    Manam value,
+                    gpointer value_target);
+VALA_EXTERN Manam foo_get_deleg_no_target (Foo* self);
+VALA_EXTERN void foo_set_deleg_no_target (Foo* self,
+                              Manam value);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
+VALA_EXTERN Manam bar_get_deleg_v (Bar* self);
+VALA_EXTERN void bar_set_deleg_v (Bar* self,
+                      Manam value);
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+VALA_EXTERN Manam bar_get_deleg (Bar* self);
+VALA_EXTERN void bar_set_deleg (Bar* self,
+                    Manam value);
+static void bar_finalize (GObject * obj);
+static GType bar_get_type_once (void);
+static void _vala_bar_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_bar_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec);
+VALA_EXTERN const gchar* manam (void);
+static void _vala_main (void);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+Manam
+foo_get_deleg (Foo* self,
+               gpointer* result_target)
+{
+       Manam result;
+       Manam _tmp0_;
+       gpointer _tmp0__target;
+       Manam _tmp1_;
+       gpointer _tmp1__target;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = self->priv->_deleg;
+       _tmp0__target = self->priv->_deleg_target;
+       _tmp1_ = _tmp0_;
+       _tmp1__target = _tmp0__target;
+       *result_target = _tmp1__target;
+       result = _tmp1_;
+       return result;
+}
+
+void
+foo_set_deleg (Foo* self,
+               Manam value,
+               gpointer value_target)
+{
+       g_return_if_fail (IS_FOO (self));
+       (self->priv->_deleg_target_destroy_notify == NULL) ? NULL : (self->priv->_deleg_target_destroy_notify 
(self->priv->_deleg_target), NULL);
+       self->priv->_deleg = NULL;
+       self->priv->_deleg_target = NULL;
+       self->priv->_deleg_target_destroy_notify = NULL;
+       self->priv->_deleg = value;
+       self->priv->_deleg_target = value_target;
+       self->priv->_deleg_target_destroy_notify = NULL;
+}
+
+Manam
+foo_get_deleg_v (Foo* self,
+                 gpointer* result_target)
+{
+       FooClass* _klass_;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->get_deleg_v) {
+               return _klass_->get_deleg_v (self, result_target);
+       }
+       return NULL;
+}
+
+static Manam
+foo_real_get_deleg_v (Foo* base,
+                      gpointer* result_target)
+{
+       Manam result;
+       Foo* self;
+       Manam _tmp0_;
+       gpointer _tmp0__target;
+       Manam _tmp1_;
+       gpointer _tmp1__target;
+       self = base;
+       _tmp0_ = self->priv->_deleg_v;
+       _tmp0__target = self->priv->_deleg_v_target;
+       _tmp1_ = _tmp0_;
+       _tmp1__target = _tmp0__target;
+       *result_target = _tmp1__target;
+       result = _tmp1_;
+       return result;
+}
+
+void
+foo_set_deleg_v (Foo* self,
+                 Manam value,
+                 gpointer value_target)
+{
+       FooClass* _klass_;
+       g_return_if_fail (IS_FOO (self));
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->set_deleg_v) {
+               _klass_->set_deleg_v (self, value, value_target);
+       }
+}
+
+static void
+foo_real_set_deleg_v (Foo* base,
+                      Manam value,
+                      gpointer value_target)
+{
+       Foo* self;
+       self = base;
+       (self->priv->_deleg_v_target_destroy_notify == NULL) ? NULL : 
(self->priv->_deleg_v_target_destroy_notify (self->priv->_deleg_v_target), NULL);
+       self->priv->_deleg_v = NULL;
+       self->priv->_deleg_v_target = NULL;
+       self->priv->_deleg_v_target_destroy_notify = NULL;
+       self->priv->_deleg_v = value;
+       self->priv->_deleg_v_target = value_target;
+       self->priv->_deleg_v_target_destroy_notify = NULL;
+}
+
+Manam
+foo_get_deleg_no_target (Foo* self)
+{
+       Manam result;
+       Manam _tmp0_;
+       gpointer _tmp0__target;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = self->priv->_deleg_no_target;
+       _tmp0__target = self->priv->_deleg_no_target_target;
+       result = _tmp0_;
+       return result;
+}
+
+void
+foo_set_deleg_no_target (Foo* self,
+                         Manam value)
+{
+       g_return_if_fail (IS_FOO (self));
+       (self->priv->_deleg_no_target_target_destroy_notify == NULL) ? NULL : 
(self->priv->_deleg_no_target_target_destroy_notify (self->priv->_deleg_no_target_target), NULL);
+       self->priv->_deleg_no_target = NULL;
+       self->priv->_deleg_no_target_target = NULL;
+       self->priv->_deleg_no_target_target_destroy_notify = NULL;
+       self->priv->_deleg_no_target = value;
+       self->priv->_deleg_no_target_target = NULL;
+       self->priv->_deleg_no_target_target_destroy_notify = NULL;
+}
+
+Manam
+foo_get_deleg_no_target_v (Foo* self)
+{
+       FooClass* _klass_;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->get_deleg_no_target_v) {
+               return _klass_->get_deleg_no_target_v (self);
+       }
+       return NULL;
+}
+
+static Manam
+foo_real_get_deleg_no_target_v (Foo* base)
+{
+       Manam result;
+       Foo* self;
+       Manam _tmp0_;
+       gpointer _tmp0__target;
+       self = base;
+       _tmp0_ = self->priv->_deleg_no_target_v;
+       _tmp0__target = self->priv->_deleg_no_target_v_target;
+       result = _tmp0_;
+       return result;
+}
+
+void
+foo_set_deleg_no_target_v (Foo* self,
+                           Manam value)
+{
+       FooClass* _klass_;
+       g_return_if_fail (IS_FOO (self));
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->set_deleg_no_target_v) {
+               _klass_->set_deleg_no_target_v (self, value);
+       }
+}
+
+static void
+foo_real_set_deleg_no_target_v (Foo* base,
+                                Manam value)
+{
+       Foo* self;
+       self = base;
+       (self->priv->_deleg_no_target_v_target_destroy_notify == NULL) ? NULL : 
(self->priv->_deleg_no_target_v_target_destroy_notify (self->priv->_deleg_no_target_v_target), NULL);
+       self->priv->_deleg_no_target_v = NULL;
+       self->priv->_deleg_no_target_v_target = NULL;
+       self->priv->_deleg_no_target_v_target_destroy_notify = NULL;
+       self->priv->_deleg_no_target_v = value;
+       self->priv->_deleg_no_target_v_target = NULL;
+       self->priv->_deleg_no_target_v_target_destroy_notify = NULL;
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+       FOO_CLASS (klass)->get_deleg_v = foo_real_get_deleg_v;
+       FOO_CLASS (klass)->set_deleg_v = foo_real_set_deleg_v;
+       FOO_CLASS (klass)->get_deleg_no_target_v = foo_real_get_deleg_no_target_v;
+       FOO_CLASS (klass)->set_deleg_no_target_v = foo_real_set_deleg_no_target_v;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+       (self->priv->_deleg_target_destroy_notify == NULL) ? NULL : (self->priv->_deleg_target_destroy_notify 
(self->priv->_deleg_target), NULL);
+       self->priv->_deleg = NULL;
+       self->priv->_deleg_target = NULL;
+       self->priv->_deleg_target_destroy_notify = NULL;
+       (self->priv->_deleg_v_target_destroy_notify == NULL) ? NULL : 
(self->priv->_deleg_v_target_destroy_notify (self->priv->_deleg_v_target), NULL);
+       self->priv->_deleg_v = NULL;
+       self->priv->_deleg_v_target = NULL;
+       self->priv->_deleg_v_target_destroy_notify = NULL;
+       (self->priv->_deleg_no_target_target_destroy_notify == NULL) ? NULL : 
(self->priv->_deleg_no_target_target_destroy_notify (self->priv->_deleg_no_target_target), NULL);
+       self->priv->_deleg_no_target = NULL;
+       self->priv->_deleg_no_target_target = NULL;
+       self->priv->_deleg_no_target_target_destroy_notify = NULL;
+       (self->priv->_deleg_no_target_v_target_destroy_notify == NULL) ? NULL : 
(self->priv->_deleg_no_target_v_target_destroy_notify (self->priv->_deleg_no_target_v_target), NULL);
+       self->priv->_deleg_no_target_v = NULL;
+       self->priv->_deleg_no_target_v_target = NULL;
+       self->priv->_deleg_no_target_v_target_destroy_notify = NULL;
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static inline gpointer
+bar_get_instance_private (Bar* self)
+{
+       return G_STRUCT_MEMBER_P (self, Bar_private_offset);
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar * self = NULL;
+       self = (Bar*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+Manam
+bar_get_deleg (Bar* self)
+{
+       Manam result;
+       Manam _tmp0_;
+       gpointer _tmp0__target;
+       g_return_val_if_fail (IS_BAR (self), NULL);
+       _tmp0_ = self->priv->_deleg;
+       _tmp0__target = self->priv->_deleg_target;
+       result = _tmp0_;
+       return result;
+}
+
+void
+bar_set_deleg (Bar* self,
+               Manam value)
+{
+       Manam old_value;
+       g_return_if_fail (IS_BAR (self));
+       old_value = bar_get_deleg (self);
+       if (old_value != value) {
+               (self->priv->_deleg_target_destroy_notify == NULL) ? NULL : 
(self->priv->_deleg_target_destroy_notify (self->priv->_deleg_target), NULL);
+               self->priv->_deleg = NULL;
+               self->priv->_deleg_target = NULL;
+               self->priv->_deleg_target_destroy_notify = NULL;
+               self->priv->_deleg = value;
+               self->priv->_deleg_target = NULL;
+               self->priv->_deleg_target_destroy_notify = NULL;
+               g_object_notify_by_pspec ((GObject *) self, bar_properties[BAR_DELEG_PROPERTY]);
+       }
+}
+
+Manam
+bar_get_deleg_v (Bar* self)
+{
+       BarClass* _klass_;
+       g_return_val_if_fail (IS_BAR (self), NULL);
+       _klass_ = BAR_GET_CLASS (self);
+       if (_klass_->get_deleg_v) {
+               return _klass_->get_deleg_v (self);
+       }
+       return NULL;
+}
+
+static Manam
+bar_real_get_deleg_v (Bar* base)
+{
+       Manam result;
+       Bar* self;
+       Manam _tmp0_;
+       gpointer _tmp0__target;
+       self = base;
+       _tmp0_ = self->priv->_deleg_v;
+       _tmp0__target = self->priv->_deleg_v_target;
+       result = _tmp0_;
+       return result;
+}
+
+void
+bar_set_deleg_v (Bar* self,
+                 Manam value)
+{
+       BarClass* _klass_;
+       g_return_if_fail (IS_BAR (self));
+       _klass_ = BAR_GET_CLASS (self);
+       if (_klass_->set_deleg_v) {
+               _klass_->set_deleg_v (self, value);
+       }
+}
+
+static void
+bar_real_set_deleg_v (Bar* base,
+                      Manam value)
+{
+       Bar* self;
+       Manam old_value;
+       self = base;
+       old_value = bar_real_get_deleg_v (base);
+       if (old_value != value) {
+               (self->priv->_deleg_v_target_destroy_notify == NULL) ? NULL : 
(self->priv->_deleg_v_target_destroy_notify (self->priv->_deleg_v_target), NULL);
+               self->priv->_deleg_v = NULL;
+               self->priv->_deleg_v_target = NULL;
+               self->priv->_deleg_v_target_destroy_notify = NULL;
+               self->priv->_deleg_v = value;
+               self->priv->_deleg_v_target = NULL;
+               self->priv->_deleg_v_target_destroy_notify = NULL;
+               g_object_notify_by_pspec ((GObject *) self, bar_properties[BAR_DELEG_V_PROPERTY]);
+       }
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Bar_private_offset);
+       BAR_CLASS (klass)->get_deleg_v = bar_real_get_deleg_v;
+       BAR_CLASS (klass)->set_deleg_v = bar_real_set_deleg_v;
+       G_OBJECT_CLASS (klass)->get_property = _vala_bar_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_bar_set_property;
+       G_OBJECT_CLASS (klass)->finalize = bar_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), BAR_DELEG_PROPERTY, 
bar_properties[BAR_DELEG_PROPERTY] = g_param_spec_pointer ("deleg", "deleg", "deleg", G_PARAM_STATIC_STRINGS 
| G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), BAR_DELEG_V_PROPERTY, 
bar_properties[BAR_DELEG_V_PROPERTY] = g_param_spec_pointer ("deleg-v", "deleg-v", "deleg-v", 
G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+       self->priv = bar_get_instance_private (self);
+}
+
+static void
+bar_finalize (GObject * obj)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       (self->priv->_deleg_target_destroy_notify == NULL) ? NULL : (self->priv->_deleg_target_destroy_notify 
(self->priv->_deleg_target), NULL);
+       self->priv->_deleg = NULL;
+       self->priv->_deleg_target = NULL;
+       self->priv->_deleg_target_destroy_notify = NULL;
+       (self->priv->_deleg_v_target_destroy_notify == NULL) ? NULL : 
(self->priv->_deleg_v_target_destroy_notify (self->priv->_deleg_v_target), NULL);
+       self->priv->_deleg_v = NULL;
+       self->priv->_deleg_v_target = NULL;
+       self->priv->_deleg_v_target_destroy_notify = NULL;
+       G_OBJECT_CLASS (bar_parent_class)->finalize (obj);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (G_TYPE_OBJECT, "Bar", &g_define_type_info, 0);
+       Bar_private_offset = g_type_add_instance_private (bar_type_id, sizeof (BarPrivate));
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_bar_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_BAR, Bar);
+       switch (property_id) {
+               case BAR_DELEG_PROPERTY:
+               g_value_set_pointer (value, bar_get_deleg (self));
+               break;
+               case BAR_DELEG_V_PROPERTY:
+               g_value_set_pointer (value, bar_get_deleg_v (self));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_bar_set_property (GObject * object,
+                        guint property_id,
+                        const GValue * value,
+                        GParamSpec * pspec)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_BAR, Bar);
+       switch (property_id) {
+               case BAR_DELEG_PROPERTY:
+               bar_set_deleg (self, g_value_get_pointer (value));
+               break;
+               case BAR_DELEG_V_PROPERTY:
+               bar_set_deleg_v (self, g_value_get_pointer (value));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+const gchar*
+manam (void)
+{
+       const gchar* result = NULL;
+       result = "manam";
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       {
+               Foo* foo = NULL;
+               Foo* _tmp0_;
+               Manam _tmp1_ = NULL;
+               gpointer _tmp1__target = NULL;
+               Manam _tmp2_;
+               gpointer _tmp2__target;
+               const gchar* _tmp3_;
+               Manam _tmp4_ = NULL;
+               gpointer _tmp4__target = NULL;
+               Manam _tmp5_;
+               gpointer _tmp5__target;
+               const gchar* _tmp6_;
+               Manam _tmp7_ = NULL;
+               gpointer _tmp7__target = NULL;
+               Manam _tmp8_;
+               gpointer _tmp8__target;
+               const gchar* _tmp9_;
+               Manam _tmp10_ = NULL;
+               gpointer _tmp10__target = NULL;
+               Manam _tmp11_;
+               gpointer _tmp11__target;
+               const gchar* _tmp12_;
+               _tmp0_ = foo_new ();
+               foo = _tmp0_;
+               foo_set_deleg (foo, (Manam) manam, NULL);
+               _tmp1_ = foo_get_deleg (foo, &_tmp1__target);
+               _tmp2_ = _tmp1_;
+               _tmp2__target = _tmp1__target;
+               _tmp3_ = _tmp2_ (_tmp2__target);
+               _vala_assert (g_strcmp0 (_tmp3_, "manam") == 0, "foo.deleg () == \"manam\"");
+               foo_set_deleg_v (foo, (Manam) manam, NULL);
+               _tmp4_ = foo_get_deleg_v (foo, &_tmp4__target);
+               _tmp5_ = _tmp4_;
+               _tmp5__target = _tmp4__target;
+               _tmp6_ = _tmp5_ (_tmp5__target);
+               _vala_assert (g_strcmp0 (_tmp6_, "manam") == 0, "foo.deleg_v () == \"manam\"");
+               foo_set_deleg_no_target (foo, (Manam) manam);
+               _tmp7_ = foo_get_deleg_no_target (foo);
+               _tmp7__target = NULL;
+               _tmp8_ = _tmp7_;
+               _tmp8__target = _tmp7__target;
+               _tmp9_ = _tmp8_ (_tmp8__target);
+               _vala_assert (g_strcmp0 (_tmp9_, "manam") == 0, "foo.deleg_no_target () == \"manam\"");
+               foo_set_deleg_no_target_v (foo, (Manam) manam);
+               _tmp10_ = foo_get_deleg_no_target_v (foo);
+               _tmp10__target = NULL;
+               _tmp11_ = _tmp10_;
+               _tmp11__target = _tmp10__target;
+               _tmp12_ = _tmp11_ (_tmp11__target);
+               _vala_assert (g_strcmp0 (_tmp12_, "manam") == 0, "foo.deleg_no_target_v () == \"manam\"");
+               _foo_unref0 (foo);
+       }
+       {
+               Bar* bar = NULL;
+               Bar* _tmp13_;
+               Manam _tmp14_ = NULL;
+               gpointer _tmp14__target = NULL;
+               Manam _tmp15_;
+               gpointer _tmp15__target;
+               const gchar* _tmp16_;
+               Manam _tmp17_ = NULL;
+               gpointer _tmp17__target = NULL;
+               Manam _tmp18_;
+               gpointer _tmp18__target;
+               const gchar* _tmp19_;
+               Manam func = NULL;
+               gpointer func_target = NULL;
+               GDestroyNotify func_target_destroy_notify = NULL;
+               Manam _tmp20_ = NULL;
+               Manam _tmp21_;
+               gpointer _tmp21__target;
+               const gchar* _tmp22_;
+               Manam _tmp23_ = NULL;
+               Manam _tmp24_;
+               gpointer _tmp24__target;
+               const gchar* _tmp25_;
+               _tmp13_ = bar_new ();
+               bar = _tmp13_;
+               bar_set_deleg (bar, (Manam) manam);
+               _tmp14_ = bar_get_deleg (bar);
+               _tmp14__target = NULL;
+               _tmp15_ = _tmp14_;
+               _tmp15__target = _tmp14__target;
+               _tmp16_ = _tmp15_ (_tmp15__target);
+               _vala_assert (g_strcmp0 (_tmp16_, "manam") == 0, "bar.deleg () == \"manam\"");
+               bar_set_deleg_v (bar, (Manam) manam);
+               _tmp17_ = bar_get_deleg_v (bar);
+               _tmp17__target = NULL;
+               _tmp18_ = _tmp17_;
+               _tmp18__target = _tmp17__target;
+               _tmp19_ = _tmp18_ (_tmp18__target);
+               _vala_assert (g_strcmp0 (_tmp19_, "manam") == 0, "bar.deleg_v () == \"manam\"");
+               g_object_get (G_TYPE_CHECK_INSTANCE_CAST (bar, G_TYPE_OBJECT, GObject), "deleg", &_tmp20_, 
NULL);
+               (func_target_destroy_notify == NULL) ? NULL : (func_target_destroy_notify (func_target), 
NULL);
+               func = NULL;
+               func_target = NULL;
+               func_target_destroy_notify = NULL;
+               func = _tmp20_;
+               func_target = NULL;
+               func_target_destroy_notify = NULL;
+               _tmp21_ = func;
+               _tmp21__target = func_target;
+               _tmp22_ = _tmp21_ (_tmp21__target);
+               _vala_assert (g_strcmp0 (_tmp22_, "manam") == 0, "func () == \"manam\"");
+               g_object_get (G_TYPE_CHECK_INSTANCE_CAST (bar, G_TYPE_OBJECT, GObject), "deleg-v", &_tmp23_, 
NULL);
+               (func_target_destroy_notify == NULL) ? NULL : (func_target_destroy_notify (func_target), 
NULL);
+               func = NULL;
+               func_target = NULL;
+               func_target_destroy_notify = NULL;
+               func = _tmp23_;
+               func_target = NULL;
+               func_target_destroy_notify = NULL;
+               _tmp24_ = func;
+               _tmp24__target = func_target;
+               _tmp25_ = _tmp24_ (_tmp24__target);
+               _vala_assert (g_strcmp0 (_tmp25_, "manam") == 0, "func () == \"manam\"");
+               (func_target_destroy_notify == NULL) ? NULL : (func_target_destroy_notify (func_target), 
NULL);
+               func = NULL;
+               func_target = NULL;
+               func_target_destroy_notify = NULL;
+               _g_object_unref0 (bar);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/property-enum.c-expected b/tests/objects/property-enum.c-expected
new file mode 100644
index 000000000..7c0570a66
--- /dev/null
+++ b/tests/objects/property-enum.c-expected
@@ -0,0 +1,817 @@
+/* objects_property_enum.c generated by valac, the Vala compiler
+ * generated from objects_property_enum.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef enum  {
+       FOO_ENUM_VALUE1,
+       FOO_ENUM_VALUE2
+} FooEnum;
+
+#define TYPE_FOO_ENUM (foo_enum_get_type ())
+typedef enum  {
+       FOO_FLAG_VALUE1 = 1 << 0,
+       FOO_FLAG_VALUE2 = 1 << 1
+} FooFlag;
+
+#define TYPE_FOO_FLAG (foo_flag_get_type ())
+typedef enum  {
+       BAR_ENUM_VALUE1,
+       BAR_ENUM_VALUE2
+} BarEnum;
+
+typedef enum  {
+       BAR_FLAG_VALUE1 = 1 << 0,
+       BAR_FLAG_VALUE2 = 1 << 1
+} BarFlag;
+
+#define TYPE_MANAM (manam_get_type ())
+#define MANAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MANAM, Manam))
+#define MANAM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MANAM, ManamClass))
+#define IS_MANAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MANAM))
+#define IS_MANAM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MANAM))
+#define MANAM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MANAM, ManamClass))
+
+typedef struct _Manam Manam;
+typedef struct _ManamClass ManamClass;
+typedef struct _ManamPrivate ManamPrivate;
+typedef struct _ParamSpecManam ParamSpecManam;
+
+#define TYPE_MINIM (minim_get_type ())
+#define MINIM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MINIM, Minim))
+#define MINIM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MINIM, MinimClass))
+#define IS_MINIM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MINIM))
+#define IS_MINIM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MINIM))
+#define MINIM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MINIM, MinimClass))
+
+typedef struct _Minim Minim;
+typedef struct _MinimClass MinimClass;
+typedef struct _MinimPrivate MinimPrivate;
+enum  {
+       MINIM_0_PROPERTY,
+       MINIM_PROP1_PROPERTY,
+       MINIM_PROP2_PROPERTY,
+       MINIM_PROP3_PROPERTY,
+       MINIM_PROP4_PROPERTY,
+       MINIM_NUM_PROPERTIES
+};
+static GParamSpec* minim_properties[MINIM_NUM_PROPERTIES];
+#define _manam_unref0(var) ((var == NULL) ? NULL : (var = (manam_unref (var), NULL)))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Manam {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       ManamPrivate * priv;
+};
+
+struct _ManamClass {
+       GTypeClass parent_class;
+       void (*finalize) (Manam *self);
+};
+
+struct _ManamPrivate {
+       FooEnum _prop1;
+       FooFlag _prop2;
+       BarEnum _prop3;
+       BarFlag _prop4;
+};
+
+struct _ParamSpecManam {
+       GParamSpec parent_instance;
+};
+
+struct _Minim {
+       GObject parent_instance;
+       MinimPrivate * priv;
+};
+
+struct _MinimClass {
+       GObjectClass parent_class;
+};
+
+struct _MinimPrivate {
+       FooEnum _prop1;
+       FooFlag _prop2;
+       BarEnum _prop3;
+       BarFlag _prop4;
+};
+
+static gint Manam_private_offset;
+static gpointer manam_parent_class = NULL;
+static gint Minim_private_offset;
+static gpointer minim_parent_class = NULL;
+
+VALA_EXTERN GType foo_enum_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN GType foo_flag_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN gpointer manam_ref (gpointer instance);
+VALA_EXTERN void manam_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_manam (const gchar* name,
+                              const gchar* nick,
+                              const gchar* blurb,
+                              GType object_type,
+                              GParamFlags flags);
+VALA_EXTERN void value_set_manam (GValue* value,
+                      gpointer v_object);
+VALA_EXTERN void value_take_manam (GValue* value,
+                       gpointer v_object);
+VALA_EXTERN gpointer value_get_manam (const GValue* value);
+VALA_EXTERN GType manam_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Manam, manam_unref)
+VALA_EXTERN Manam* manam_new (void);
+VALA_EXTERN Manam* manam_construct (GType object_type);
+VALA_EXTERN FooEnum manam_get_prop1 (Manam* self);
+VALA_EXTERN void manam_set_prop1 (Manam* self,
+                      FooEnum value);
+VALA_EXTERN FooFlag manam_get_prop2 (Manam* self);
+VALA_EXTERN void manam_set_prop2 (Manam* self,
+                      FooFlag value);
+VALA_EXTERN BarEnum manam_get_prop3 (Manam* self);
+VALA_EXTERN void manam_set_prop3 (Manam* self,
+                      BarEnum value);
+VALA_EXTERN BarFlag manam_get_prop4 (Manam* self);
+VALA_EXTERN void manam_set_prop4 (Manam* self,
+                      BarFlag value);
+static void manam_finalize (Manam * obj);
+static GType manam_get_type_once (void);
+VALA_EXTERN GType minim_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Minim, g_object_unref)
+VALA_EXTERN Minim* minim_new (void);
+VALA_EXTERN Minim* minim_construct (GType object_type);
+VALA_EXTERN FooEnum minim_get_prop1 (Minim* self);
+VALA_EXTERN void minim_set_prop1 (Minim* self,
+                      FooEnum value);
+VALA_EXTERN FooFlag minim_get_prop2 (Minim* self);
+VALA_EXTERN void minim_set_prop2 (Minim* self,
+                      FooFlag value);
+VALA_EXTERN BarEnum minim_get_prop3 (Minim* self);
+VALA_EXTERN void minim_set_prop3 (Minim* self,
+                      BarEnum value);
+VALA_EXTERN BarFlag minim_get_prop4 (Minim* self);
+VALA_EXTERN void minim_set_prop4 (Minim* self,
+                      BarFlag value);
+static void minim_finalize (GObject * obj);
+static GType minim_get_type_once (void);
+static void _vala_minim_get_property (GObject * object,
+                               guint property_id,
+                               GValue * value,
+                               GParamSpec * pspec);
+static void _vala_minim_set_property (GObject * object,
+                               guint property_id,
+                               const GValue * value,
+                               GParamSpec * pspec);
+static void _vala_main (void);
+
+static GType
+foo_enum_get_type_once (void)
+{
+       static const GEnumValue values[] = {{FOO_ENUM_VALUE1, "FOO_ENUM_VALUE1", "value1"}, {FOO_ENUM_VALUE2, 
"FOO_ENUM_VALUE2", "value2"}, {0, NULL, NULL}};
+       GType foo_enum_type_id;
+       foo_enum_type_id = g_enum_register_static ("FooEnum", values);
+       return foo_enum_type_id;
+}
+
+GType
+foo_enum_get_type (void)
+{
+       static volatile gsize foo_enum_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_enum_type_id__volatile)) {
+               GType foo_enum_type_id;
+               foo_enum_type_id = foo_enum_get_type_once ();
+               g_once_init_leave (&foo_enum_type_id__volatile, foo_enum_type_id);
+       }
+       return foo_enum_type_id__volatile;
+}
+
+static GType
+foo_flag_get_type_once (void)
+{
+       static const GFlagsValue values[] = {{FOO_FLAG_VALUE1, "FOO_FLAG_VALUE1", "value1"}, 
{FOO_FLAG_VALUE2, "FOO_FLAG_VALUE2", "value2"}, {0, NULL, NULL}};
+       GType foo_flag_type_id;
+       foo_flag_type_id = g_flags_register_static ("FooFlag", values);
+       return foo_flag_type_id;
+}
+
+GType
+foo_flag_get_type (void)
+{
+       static volatile gsize foo_flag_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_flag_type_id__volatile)) {
+               GType foo_flag_type_id;
+               foo_flag_type_id = foo_flag_get_type_once ();
+               g_once_init_leave (&foo_flag_type_id__volatile, foo_flag_type_id);
+       }
+       return foo_flag_type_id__volatile;
+}
+
+static inline gpointer
+manam_get_instance_private (Manam* self)
+{
+       return G_STRUCT_MEMBER_P (self, Manam_private_offset);
+}
+
+Manam*
+manam_construct (GType object_type)
+{
+       Manam* self = NULL;
+       self = (Manam*) g_type_create_instance (object_type);
+       return self;
+}
+
+Manam*
+manam_new (void)
+{
+       return manam_construct (TYPE_MANAM);
+}
+
+FooEnum
+manam_get_prop1 (Manam* self)
+{
+       FooEnum result;
+       FooEnum _tmp0_;
+       g_return_val_if_fail (IS_MANAM (self), 0);
+       _tmp0_ = self->priv->_prop1;
+       result = _tmp0_;
+       return result;
+}
+
+void
+manam_set_prop1 (Manam* self,
+                 FooEnum value)
+{
+       g_return_if_fail (IS_MANAM (self));
+       self->priv->_prop1 = value;
+}
+
+FooFlag
+manam_get_prop2 (Manam* self)
+{
+       FooFlag result;
+       FooFlag _tmp0_;
+       g_return_val_if_fail (IS_MANAM (self), 0U);
+       _tmp0_ = self->priv->_prop2;
+       result = _tmp0_;
+       return result;
+}
+
+void
+manam_set_prop2 (Manam* self,
+                 FooFlag value)
+{
+       g_return_if_fail (IS_MANAM (self));
+       self->priv->_prop2 = value;
+}
+
+BarEnum
+manam_get_prop3 (Manam* self)
+{
+       BarEnum result;
+       BarEnum _tmp0_;
+       g_return_val_if_fail (IS_MANAM (self), 0);
+       _tmp0_ = self->priv->_prop3;
+       result = _tmp0_;
+       return result;
+}
+
+void
+manam_set_prop3 (Manam* self,
+                 BarEnum value)
+{
+       g_return_if_fail (IS_MANAM (self));
+       self->priv->_prop3 = value;
+}
+
+BarFlag
+manam_get_prop4 (Manam* self)
+{
+       BarFlag result;
+       BarFlag _tmp0_;
+       g_return_val_if_fail (IS_MANAM (self), 0U);
+       _tmp0_ = self->priv->_prop4;
+       result = _tmp0_;
+       return result;
+}
+
+void
+manam_set_prop4 (Manam* self,
+                 BarFlag value)
+{
+       g_return_if_fail (IS_MANAM (self));
+       self->priv->_prop4 = value;
+}
+
+static void
+value_manam_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_manam_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               manam_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_manam_copy_value (const GValue* src_value,
+                        GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = manam_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_manam_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_manam_collect_value (GValue* value,
+                           guint n_collect_values,
+                           GTypeCValue* collect_values,
+                           guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Manam * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = manam_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_manam_lcopy_value (const GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       Manam ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = manam_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_manam (const gchar* name,
+                  const gchar* nick,
+                  const gchar* blurb,
+                  GType object_type,
+                  GParamFlags flags)
+{
+       ParamSpecManam* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_MANAM), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_manam (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_MANAM), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_manam (GValue* value,
+                 gpointer v_object)
+{
+       Manam * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_MANAM));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_MANAM));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               manam_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               manam_unref (old);
+       }
+}
+
+void
+value_take_manam (GValue* value,
+                  gpointer v_object)
+{
+       Manam * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_MANAM));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_MANAM));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               manam_unref (old);
+       }
+}
+
+static void
+manam_class_init (ManamClass * klass,
+                  gpointer klass_data)
+{
+       manam_parent_class = g_type_class_peek_parent (klass);
+       ((ManamClass *) klass)->finalize = manam_finalize;
+       g_type_class_adjust_private_offset (klass, &Manam_private_offset);
+}
+
+static void
+manam_instance_init (Manam * self,
+                     gpointer klass)
+{
+       self->priv = manam_get_instance_private (self);
+       self->ref_count = 1;
+}
+
+static void
+manam_finalize (Manam * obj)
+{
+       Manam * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_MANAM, Manam);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+manam_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_manam_init, value_manam_free_value, 
value_manam_copy_value, value_manam_peek_pointer, "p", value_manam_collect_value, "p", 
value_manam_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (ManamClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) manam_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Manam), 
0, (GInstanceInitFunc) manam_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType manam_type_id;
+       manam_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Manam", 
&g_define_type_info, &g_define_type_fundamental_info, 0);
+       Manam_private_offset = g_type_add_instance_private (manam_type_id, sizeof (ManamPrivate));
+       return manam_type_id;
+}
+
+GType
+manam_get_type (void)
+{
+       static volatile gsize manam_type_id__volatile = 0;
+       if (g_once_init_enter (&manam_type_id__volatile)) {
+               GType manam_type_id;
+               manam_type_id = manam_get_type_once ();
+               g_once_init_leave (&manam_type_id__volatile, manam_type_id);
+       }
+       return manam_type_id__volatile;
+}
+
+gpointer
+manam_ref (gpointer instance)
+{
+       Manam * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+manam_unref (gpointer instance)
+{
+       Manam * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               MANAM_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static inline gpointer
+minim_get_instance_private (Minim* self)
+{
+       return G_STRUCT_MEMBER_P (self, Minim_private_offset);
+}
+
+Minim*
+minim_construct (GType object_type)
+{
+       Minim * self = NULL;
+       self = (Minim*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Minim*
+minim_new (void)
+{
+       return minim_construct (TYPE_MINIM);
+}
+
+FooEnum
+minim_get_prop1 (Minim* self)
+{
+       FooEnum result;
+       FooEnum _tmp0_;
+       g_return_val_if_fail (IS_MINIM (self), 0);
+       _tmp0_ = self->priv->_prop1;
+       result = _tmp0_;
+       return result;
+}
+
+void
+minim_set_prop1 (Minim* self,
+                 FooEnum value)
+{
+       FooEnum old_value;
+       g_return_if_fail (IS_MINIM (self));
+       old_value = minim_get_prop1 (self);
+       if (old_value != value) {
+               self->priv->_prop1 = value;
+               g_object_notify_by_pspec ((GObject *) self, minim_properties[MINIM_PROP1_PROPERTY]);
+       }
+}
+
+FooFlag
+minim_get_prop2 (Minim* self)
+{
+       FooFlag result;
+       FooFlag _tmp0_;
+       g_return_val_if_fail (IS_MINIM (self), 0U);
+       _tmp0_ = self->priv->_prop2;
+       result = _tmp0_;
+       return result;
+}
+
+void
+minim_set_prop2 (Minim* self,
+                 FooFlag value)
+{
+       FooFlag old_value;
+       g_return_if_fail (IS_MINIM (self));
+       old_value = minim_get_prop2 (self);
+       if (old_value != value) {
+               self->priv->_prop2 = value;
+               g_object_notify_by_pspec ((GObject *) self, minim_properties[MINIM_PROP2_PROPERTY]);
+       }
+}
+
+BarEnum
+minim_get_prop3 (Minim* self)
+{
+       BarEnum result;
+       BarEnum _tmp0_;
+       g_return_val_if_fail (IS_MINIM (self), 0);
+       _tmp0_ = self->priv->_prop3;
+       result = _tmp0_;
+       return result;
+}
+
+void
+minim_set_prop3 (Minim* self,
+                 BarEnum value)
+{
+       BarEnum old_value;
+       g_return_if_fail (IS_MINIM (self));
+       old_value = minim_get_prop3 (self);
+       if (old_value != value) {
+               self->priv->_prop3 = value;
+               g_object_notify_by_pspec ((GObject *) self, minim_properties[MINIM_PROP3_PROPERTY]);
+       }
+}
+
+BarFlag
+minim_get_prop4 (Minim* self)
+{
+       BarFlag result;
+       BarFlag _tmp0_;
+       g_return_val_if_fail (IS_MINIM (self), 0U);
+       _tmp0_ = self->priv->_prop4;
+       result = _tmp0_;
+       return result;
+}
+
+void
+minim_set_prop4 (Minim* self,
+                 BarFlag value)
+{
+       BarFlag old_value;
+       g_return_if_fail (IS_MINIM (self));
+       old_value = minim_get_prop4 (self);
+       if (old_value != value) {
+               self->priv->_prop4 = value;
+               g_object_notify_by_pspec ((GObject *) self, minim_properties[MINIM_PROP4_PROPERTY]);
+       }
+}
+
+static void
+minim_class_init (MinimClass * klass,
+                  gpointer klass_data)
+{
+       minim_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Minim_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_minim_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_minim_set_property;
+       G_OBJECT_CLASS (klass)->finalize = minim_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), MINIM_PROP1_PROPERTY, 
minim_properties[MINIM_PROP1_PROPERTY] = g_param_spec_enum ("prop1", "prop1", "prop1", TYPE_FOO_ENUM, 0, 
G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), MINIM_PROP2_PROPERTY, 
minim_properties[MINIM_PROP2_PROPERTY] = g_param_spec_flags ("prop2", "prop2", "prop2", TYPE_FOO_FLAG, 0U, 
G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), MINIM_PROP3_PROPERTY, 
minim_properties[MINIM_PROP3_PROPERTY] = g_param_spec_int ("prop3", "prop3", "prop3", G_MININT, G_MAXINT, 0, 
G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), MINIM_PROP4_PROPERTY, 
minim_properties[MINIM_PROP4_PROPERTY] = g_param_spec_uint ("prop4", "prop4", "prop4", 0, G_MAXUINT, 0U, 
G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+}
+
+static void
+minim_instance_init (Minim * self,
+                     gpointer klass)
+{
+       self->priv = minim_get_instance_private (self);
+}
+
+static void
+minim_finalize (GObject * obj)
+{
+       Minim * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_MINIM, Minim);
+       G_OBJECT_CLASS (minim_parent_class)->finalize (obj);
+}
+
+static GType
+minim_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (MinimClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) minim_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Minim), 
0, (GInstanceInitFunc) minim_instance_init, NULL };
+       GType minim_type_id;
+       minim_type_id = g_type_register_static (G_TYPE_OBJECT, "Minim", &g_define_type_info, 0);
+       Minim_private_offset = g_type_add_instance_private (minim_type_id, sizeof (MinimPrivate));
+       return minim_type_id;
+}
+
+GType
+minim_get_type (void)
+{
+       static volatile gsize minim_type_id__volatile = 0;
+       if (g_once_init_enter (&minim_type_id__volatile)) {
+               GType minim_type_id;
+               minim_type_id = minim_get_type_once ();
+               g_once_init_leave (&minim_type_id__volatile, minim_type_id);
+       }
+       return minim_type_id__volatile;
+}
+
+static void
+_vala_minim_get_property (GObject * object,
+                          guint property_id,
+                          GValue * value,
+                          GParamSpec * pspec)
+{
+       Minim * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_MINIM, Minim);
+       switch (property_id) {
+               case MINIM_PROP1_PROPERTY:
+               g_value_set_enum (value, minim_get_prop1 (self));
+               break;
+               case MINIM_PROP2_PROPERTY:
+               g_value_set_flags (value, minim_get_prop2 (self));
+               break;
+               case MINIM_PROP3_PROPERTY:
+               g_value_set_int (value, minim_get_prop3 (self));
+               break;
+               case MINIM_PROP4_PROPERTY:
+               g_value_set_uint (value, minim_get_prop4 (self));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_minim_set_property (GObject * object,
+                          guint property_id,
+                          const GValue * value,
+                          GParamSpec * pspec)
+{
+       Minim * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_MINIM, Minim);
+       switch (property_id) {
+               case MINIM_PROP1_PROPERTY:
+               minim_set_prop1 (self, g_value_get_enum (value));
+               break;
+               case MINIM_PROP2_PROPERTY:
+               minim_set_prop2 (self, g_value_get_flags (value));
+               break;
+               case MINIM_PROP3_PROPERTY:
+               minim_set_prop3 (self, g_value_get_int (value));
+               break;
+               case MINIM_PROP4_PROPERTY:
+               minim_set_prop4 (self, g_value_get_uint (value));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_main (void)
+{
+       {
+               Manam* manam = NULL;
+               Manam* _tmp0_;
+               FooEnum _tmp1_;
+               FooEnum _tmp2_;
+               FooFlag _tmp3_;
+               FooFlag _tmp4_;
+               BarEnum _tmp5_;
+               BarEnum _tmp6_;
+               BarFlag _tmp7_;
+               BarFlag _tmp8_;
+               _tmp0_ = manam_new ();
+               manam = _tmp0_;
+               manam_set_prop1 (manam, FOO_ENUM_VALUE2);
+               _tmp1_ = manam_get_prop1 (manam);
+               _tmp2_ = _tmp1_;
+               _vala_assert (_tmp2_ == FOO_ENUM_VALUE2, "manam.prop1 == FooEnum.VALUE2");
+               manam_set_prop2 (manam, FOO_FLAG_VALUE2);
+               _tmp3_ = manam_get_prop2 (manam);
+               _tmp4_ = _tmp3_;
+               _vala_assert (_tmp4_ == FOO_FLAG_VALUE2, "manam.prop2 == FooFlag.VALUE2");
+               manam_set_prop3 (manam, BAR_ENUM_VALUE2);
+               _tmp5_ = manam_get_prop3 (manam);
+               _tmp6_ = _tmp5_;
+               _vala_assert (_tmp6_ == BAR_ENUM_VALUE2, "manam.prop3 == BarEnum.VALUE2");
+               manam_set_prop4 (manam, BAR_FLAG_VALUE2);
+               _tmp7_ = manam_get_prop4 (manam);
+               _tmp8_ = _tmp7_;
+               _vala_assert (_tmp8_ == BAR_FLAG_VALUE2, "manam.prop4 == BarFlag.VALUE2");
+               _manam_unref0 (manam);
+       }
+       {
+               Minim* minim = NULL;
+               Minim* _tmp9_;
+               FooEnum _tmp10_;
+               FooEnum _tmp11_;
+               FooFlag _tmp12_;
+               FooFlag _tmp13_;
+               BarEnum _tmp14_;
+               BarEnum _tmp15_;
+               BarFlag _tmp16_;
+               BarFlag _tmp17_;
+               _tmp9_ = minim_new ();
+               minim = _tmp9_;
+               minim_set_prop1 (minim, FOO_ENUM_VALUE2);
+               _tmp10_ = minim_get_prop1 (minim);
+               _tmp11_ = _tmp10_;
+               _vala_assert (_tmp11_ == FOO_ENUM_VALUE2, "minim.prop1 == FooEnum.VALUE2");
+               minim_set_prop2 (minim, FOO_FLAG_VALUE2);
+               _tmp12_ = minim_get_prop2 (minim);
+               _tmp13_ = _tmp12_;
+               _vala_assert (_tmp13_ == FOO_FLAG_VALUE2, "minim.prop2 == FooFlag.VALUE2");
+               minim_set_prop3 (minim, BAR_ENUM_VALUE2);
+               _tmp14_ = minim_get_prop3 (minim);
+               _tmp15_ = _tmp14_;
+               _vala_assert (_tmp15_ == BAR_ENUM_VALUE2, "minim.prop3 == BarEnum.VALUE2");
+               minim_set_prop4 (minim, BAR_FLAG_VALUE2);
+               _tmp16_ = minim_get_prop4 (minim);
+               _tmp17_ = _tmp16_;
+               _vala_assert (_tmp17_ == BAR_FLAG_VALUE2, "minim.prop4 == BarFlag.VALUE2");
+               _g_object_unref0 (minim);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/property-gboxed-nullable.c-expected 
b/tests/objects/property-gboxed-nullable.c-expected
new file mode 100644
index 000000000..f81eac927
--- /dev/null
+++ b/tests/objects/property-gboxed-nullable.c-expected
@@ -0,0 +1,651 @@
+/* objects_property_gboxed_nullable.c generated by valac, the Vala compiler
+ * generated from objects_property_gboxed_nullable.vala, do not modify */
+
+#include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_BAR (bar_get_type ())
+typedef struct _Bar Bar;
+#define _g_free0(var) (var = (g_free (var), NULL))
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_BAR_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _bar_free0(var) ((var == NULL) ? NULL : (var = (bar_free (var), NULL)))
+
+#define TYPE_FAZ (faz_get_type ())
+#define FAZ(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FAZ, Faz))
+#define FAZ_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FAZ, FazClass))
+#define IS_FAZ(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FAZ))
+#define IS_FAZ_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FAZ))
+#define FAZ_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FAZ, FazClass))
+
+typedef struct _Faz Faz;
+typedef struct _FazClass FazClass;
+typedef struct _FazPrivate FazPrivate;
+enum  {
+       FAZ_0_PROPERTY,
+       FAZ_BAZ_PROPERTY,
+       FAZ_NUM_PROPERTIES
+};
+static GParamSpec* faz_properties[FAZ_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Bar {
+       gchar* s;
+};
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _FooPrivate {
+       Bar* _bar;
+};
+
+struct _Faz {
+       GObject parent_instance;
+       FazPrivate * priv;
+};
+
+struct _FazClass {
+       GObjectClass parent_class;
+};
+
+struct _FazPrivate {
+       Bar* _baz;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+static gint Faz_private_offset;
+static gpointer faz_parent_class = NULL;
+
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Bar* bar_dup (const Bar* self);
+VALA_EXTERN void bar_free (Bar* self);
+VALA_EXTERN void bar_copy (const Bar* self,
+               Bar* dest);
+VALA_EXTERN void bar_destroy (Bar* self);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (Bar* bar);
+VALA_EXTERN Foo* foo_construct (GType object_type,
+                    Bar* bar);
+VALA_EXTERN Bar* foo_get_bar (Foo* self);
+VALA_EXTERN void foo_set_bar (Foo* self,
+                  Bar* value);
+static gboolean _bar_equal (const Bar * s1,
+                     const Bar * s2);
+static void foo_finalize (GObject * obj);
+static GType foo_get_type_once (void);
+static void _vala_foo_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_foo_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec);
+VALA_EXTERN GType faz_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Faz, g_object_unref)
+VALA_EXTERN Faz* faz_new (void);
+VALA_EXTERN Faz* faz_construct (GType object_type);
+VALA_EXTERN Bar* faz_get_baz (Faz* self);
+VALA_EXTERN void faz_set_baz (Faz* self,
+                  Bar* value);
+static void faz_finalize (GObject * obj);
+static GType faz_get_type_once (void);
+static void _vala_faz_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_faz_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec);
+static void _vala_main (void);
+
+void
+bar_copy (const Bar* self,
+          Bar* dest)
+{
+       const gchar* _tmp0_;
+       gchar* _tmp1_;
+       _tmp0_ = (*self).s;
+       _tmp1_ = g_strdup (_tmp0_);
+       _g_free0 ((*dest).s);
+       (*dest).s = _tmp1_;
+}
+
+void
+bar_destroy (Bar* self)
+{
+       _g_free0 ((*self).s);
+}
+
+Bar*
+bar_dup (const Bar* self)
+{
+       Bar* dup;
+       dup = g_new0 (Bar, 1);
+       bar_copy (self, dup);
+       return dup;
+}
+
+void
+bar_free (Bar* self)
+{
+       bar_destroy (self);
+       g_free (self);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       GType bar_type_id;
+       bar_type_id = g_boxed_type_register_static ("Bar", (GBoxedCopyFunc) bar_dup, (GBoxedFreeFunc) 
bar_free);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct (GType object_type,
+               Bar* bar)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, "bar", bar, NULL);
+       return self;
+}
+
+Foo*
+foo_new (Bar* bar)
+{
+       return foo_construct (TYPE_FOO, bar);
+}
+
+Bar*
+foo_get_bar (Foo* self)
+{
+       Bar* result;
+       Bar* _tmp0_;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = self->priv->_bar;
+       result = _tmp0_;
+       return result;
+}
+
+static gboolean
+_bar_equal (const Bar * s1,
+            const Bar * s2)
+{
+       if (s1 == s2) {
+               return TRUE;
+       }
+       if (s1 == NULL) {
+               return FALSE;
+       }
+       if (s2 == NULL) {
+               return FALSE;
+       }
+       if (g_strcmp0 (s1->s, s2->s)) {
+               return FALSE;
+       }
+       return TRUE;
+}
+
+static gpointer
+_bar_dup0 (gpointer self)
+{
+       return self ? bar_dup (self) : NULL;
+}
+
+void
+foo_set_bar (Foo* self,
+             Bar* value)
+{
+       Bar* old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_bar (self);
+       if (_bar_equal (value, old_value) != TRUE) {
+               Bar* _tmp0_;
+               _tmp0_ = _bar_dup0 (value);
+               _bar_free0 (self->priv->_bar);
+               self->priv->_bar = _tmp0_;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_BAR_PROPERTY]);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_foo_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_foo_set_property;
+       G_OBJECT_CLASS (klass)->finalize = foo_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_BAR_PROPERTY, 
foo_properties[FOO_BAR_PROPERTY] = g_param_spec_boxed ("bar", "bar", "bar", TYPE_BAR, G_PARAM_STATIC_STRINGS 
| G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+}
+
+static void
+foo_finalize (GObject * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       _bar_free0 (self->priv->_bar);
+       G_OBJECT_CLASS (foo_parent_class)->finalize (obj);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_foo_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_BAR_PROPERTY:
+               {
+                       Bar* boxed;
+                       boxed = foo_get_bar (self);
+                       g_value_set_boxed (value, boxed);
+               }
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_foo_set_property (GObject * object,
+                        guint property_id,
+                        const GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_BAR_PROPERTY:
+               foo_set_bar (self, g_value_get_boxed (value));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static inline gpointer
+faz_get_instance_private (Faz* self)
+{
+       return G_STRUCT_MEMBER_P (self, Faz_private_offset);
+}
+
+Faz*
+faz_construct (GType object_type)
+{
+       Faz * self = NULL;
+       self = (Faz*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Faz*
+faz_new (void)
+{
+       return faz_construct (TYPE_FAZ);
+}
+
+Bar*
+faz_get_baz (Faz* self)
+{
+       Bar* result;
+       Bar* _tmp0_;
+       Bar* _tmp1_;
+       g_return_val_if_fail (IS_FAZ (self), NULL);
+       _tmp0_ = self->priv->_baz;
+       _tmp1_ = _bar_dup0 (_tmp0_);
+       result = _tmp1_;
+       return result;
+}
+
+void
+faz_set_baz (Faz* self,
+             Bar* value)
+{
+       Bar* old_value;
+       g_return_if_fail (IS_FAZ (self));
+       old_value = faz_get_baz (self);
+       if (_bar_equal (value, old_value) != TRUE) {
+               Bar* _tmp0_;
+               _tmp0_ = _bar_dup0 (value);
+               _bar_free0 (self->priv->_baz);
+               self->priv->_baz = _tmp0_;
+               g_object_notify_by_pspec ((GObject *) self, faz_properties[FAZ_BAZ_PROPERTY]);
+       }
+       _bar_free0 (old_value);
+}
+
+static void
+faz_class_init (FazClass * klass,
+                gpointer klass_data)
+{
+       faz_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Faz_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_faz_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_faz_set_property;
+       G_OBJECT_CLASS (klass)->finalize = faz_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FAZ_BAZ_PROPERTY, 
faz_properties[FAZ_BAZ_PROPERTY] = g_param_spec_boxed ("baz", "baz", "baz", TYPE_BAR, G_PARAM_STATIC_STRINGS 
| G_PARAM_READABLE | G_PARAM_WRITABLE));
+}
+
+static void
+faz_instance_init (Faz * self,
+                   gpointer klass)
+{
+       self->priv = faz_get_instance_private (self);
+}
+
+static void
+faz_finalize (GObject * obj)
+{
+       Faz * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FAZ, Faz);
+       _bar_free0 (self->priv->_baz);
+       G_OBJECT_CLASS (faz_parent_class)->finalize (obj);
+}
+
+static GType
+faz_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FazClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) faz_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Faz), 0, 
(GInstanceInitFunc) faz_instance_init, NULL };
+       GType faz_type_id;
+       faz_type_id = g_type_register_static (G_TYPE_OBJECT, "Faz", &g_define_type_info, 0);
+       Faz_private_offset = g_type_add_instance_private (faz_type_id, sizeof (FazPrivate));
+       return faz_type_id;
+}
+
+GType
+faz_get_type (void)
+{
+       static volatile gsize faz_type_id__volatile = 0;
+       if (g_once_init_enter (&faz_type_id__volatile)) {
+               GType faz_type_id;
+               faz_type_id = faz_get_type_once ();
+               g_once_init_leave (&faz_type_id__volatile, faz_type_id);
+       }
+       return faz_type_id__volatile;
+}
+
+static void
+_vala_faz_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Faz * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FAZ, Faz);
+       switch (property_id) {
+               case FAZ_BAZ_PROPERTY:
+               {
+                       Bar* boxed;
+                       boxed = faz_get_baz (self);
+                       g_value_set_boxed (value, boxed);
+                       _bar_free0 (boxed);
+               }
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_faz_set_property (GObject * object,
+                        guint property_id,
+                        const GValue * value,
+                        GParamSpec * pspec)
+{
+       Faz * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FAZ, Faz);
+       switch (property_id) {
+               case FAZ_BAZ_PROPERTY:
+               faz_set_baz (self, g_value_get_boxed (value));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_main (void)
+{
+       {
+               Foo* foo = NULL;
+               Foo* _tmp0_;
+               Bar* _tmp1_;
+               Bar* _tmp2_;
+               _tmp0_ = foo_new (NULL);
+               foo = _tmp0_;
+               _tmp1_ = foo_get_bar (foo);
+               _tmp2_ = _tmp1_;
+               _vala_assert (_tmp2_ == NULL, "foo.bar == null");
+               _g_object_unref0 (foo);
+       }
+       {
+               Bar bar = {0};
+               gchar* _tmp3_;
+               Bar _tmp4_ = {0};
+               Foo* foo = NULL;
+               Bar _tmp5_;
+               GObject* _tmp6_;
+               GObject* _tmp7_;
+               Bar* _tmp8_;
+               Bar* _tmp9_;
+               Bar _tmp10_;
+               Bar* _tmp11_;
+               Bar* _tmp12_;
+               const gchar* _tmp13_;
+               Bar* _tmp14_;
+               Bar* _tmp15_;
+               _tmp3_ = g_strdup ("foo");
+               _g_free0 (_tmp4_.s);
+               _tmp4_.s = _tmp3_;
+               bar = _tmp4_;
+               _tmp5_ = bar;
+               _tmp6_ = g_object_new (TYPE_FOO, "bar", &_tmp5_, NULL);
+               _tmp7_ = G_IS_INITIALLY_UNOWNED (_tmp6_) ? g_object_ref_sink (_tmp6_) : _tmp6_;
+               foo = G_TYPE_CHECK_INSTANCE_CAST (_tmp7_, TYPE_FOO, Foo);
+               _tmp8_ = foo_get_bar (foo);
+               _tmp9_ = _tmp8_;
+               _tmp10_ = bar;
+               _vala_assert (_bar_equal (_tmp9_, &_tmp10_) == TRUE, "foo.bar == bar");
+               _tmp11_ = foo_get_bar (foo);
+               _tmp12_ = _tmp11_;
+               _tmp13_ = (*_tmp12_).s;
+               _vala_assert (g_strcmp0 (_tmp13_, "foo") == 0, "foo.bar.s == \"foo\"");
+               foo_set_bar (foo, NULL);
+               _tmp14_ = foo_get_bar (foo);
+               _tmp15_ = _tmp14_;
+               _vala_assert (_tmp15_ == NULL, "foo.bar == null");
+               _g_object_unref0 (foo);
+               bar_destroy (&bar);
+       }
+       {
+               Bar bar = {0};
+               gchar* _tmp16_;
+               Bar _tmp17_ = {0};
+               Foo* foo = NULL;
+               GObject* _tmp18_;
+               GObject* _tmp19_;
+               Bar* _tmp20_;
+               Bar* _tmp21_;
+               Bar _tmp22_;
+               Bar* _tmp23_;
+               Bar* _tmp24_;
+               Bar _tmp25_;
+               _tmp16_ = g_strdup ("foo");
+               _g_free0 (_tmp17_.s);
+               _tmp17_.s = _tmp16_;
+               bar = _tmp17_;
+               _tmp18_ = g_object_new (TYPE_FOO, "bar", NULL, NULL);
+               _tmp19_ = G_IS_INITIALLY_UNOWNED (_tmp18_) ? g_object_ref_sink (_tmp18_) : _tmp18_;
+               foo = G_TYPE_CHECK_INSTANCE_CAST (_tmp19_, TYPE_FOO, Foo);
+               _tmp20_ = foo_get_bar (foo);
+               _tmp21_ = _tmp20_;
+               _vala_assert (_tmp21_ == NULL, "foo.bar == null");
+               _tmp22_ = bar;
+               foo_set_bar (foo, &_tmp22_);
+               _tmp23_ = foo_get_bar (foo);
+               _tmp24_ = _tmp23_;
+               _tmp25_ = bar;
+               _vala_assert (_bar_equal (_tmp24_, &_tmp25_) == TRUE, "foo.bar == bar");
+               _g_object_unref0 (foo);
+               bar_destroy (&bar);
+       }
+       {
+               Bar bar = {0};
+               gchar* _tmp26_;
+               Bar _tmp27_ = {0};
+               Faz* faz = NULL;
+               Faz* _tmp28_;
+               Bar* _tmp29_;
+               Bar* _tmp30_;
+               Bar* _tmp31_;
+               Bar _tmp32_;
+               Bar* _tmp33_;
+               Bar* _tmp34_;
+               Bar* _tmp35_;
+               Bar _tmp36_;
+               Bar* _tmp37_;
+               Bar* _tmp38_;
+               Bar* _tmp39_;
+               const gchar* _tmp40_;
+               Bar* _tmp41_;
+               Bar* _tmp42_;
+               Bar* _tmp43_;
+               _tmp26_ = g_strdup ("foo");
+               _g_free0 (_tmp27_.s);
+               _tmp27_.s = _tmp26_;
+               bar = _tmp27_;
+               _tmp28_ = faz_new ();
+               faz = _tmp28_;
+               g_object_get (faz, "baz", &_tmp29_, NULL);
+               _tmp30_ = _tmp29_;
+               _tmp31_ = _tmp30_;
+               _vala_assert (_tmp31_ == NULL, "faz.baz == null");
+               _bar_free0 (_tmp31_);
+               _tmp32_ = bar;
+               g_object_set (faz, "baz", &_tmp32_, NULL);
+               g_object_get (faz, "baz", &_tmp33_, NULL);
+               _tmp34_ = _tmp33_;
+               _tmp35_ = _tmp34_;
+               _tmp36_ = bar;
+               _vala_assert (_bar_equal (_tmp35_, &_tmp36_) == TRUE, "faz.baz == bar");
+               _bar_free0 (_tmp35_);
+               g_object_get (faz, "baz", &_tmp37_, NULL);
+               _tmp38_ = _tmp37_;
+               _tmp39_ = _tmp38_;
+               _tmp40_ = (*_tmp39_).s;
+               _vala_assert (g_strcmp0 (_tmp40_, "foo") == 0, "faz.baz.s == \"foo\"");
+               _bar_free0 (_tmp39_);
+               g_object_set (faz, "baz", NULL, NULL);
+               g_object_get (faz, "baz", &_tmp41_, NULL);
+               _tmp42_ = _tmp41_;
+               _tmp43_ = _tmp42_;
+               _vala_assert (_tmp43_ == NULL, "faz.baz == null");
+               _bar_free0 (_tmp43_);
+               _g_object_unref0 (faz);
+               bar_destroy (&bar);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/property-notify-owned-getter.c-expected 
b/tests/objects/property-notify-owned-getter.c-expected
new file mode 100644
index 000000000..ee1031f9b
--- /dev/null
+++ b/tests/objects/property-notify-owned-getter.c-expected
@@ -0,0 +1,873 @@
+/* objects_property_notify_owned_getter.c generated by valac, the Vala compiler
+ * generated from objects_property_notify_owned_getter.vala, do not modify */
+
+#include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+enum  {
+       BAR_0_PROPERTY,
+       BAR_NUM_PROPERTIES
+};
+static GParamSpec* bar_properties[BAR_NUM_PROPERTIES];
+
+#define TYPE_MANAM (manam_get_type ())
+typedef struct _Manam Manam;
+#define _g_free0(var) (var = (g_free (var), NULL))
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_O_PROPERTY,
+       FOO_ST_PROPERTY,
+       FOO_STN_PROPERTY,
+       FOO_S_PROPERTY,
+       FOO_STRV_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _manam_free0(var) ((var == NULL) ? NULL : (var = (manam_free (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Bar {
+       GObject parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       GObjectClass parent_class;
+};
+
+struct _Manam {
+       gchar* s;
+};
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _FooPrivate {
+       Bar* _o;
+       Manam _st;
+       Manam* _stn;
+       gchar* _s;
+       gchar** _strv;
+       gint _strv_length1;
+       gint __strv_size_;
+};
+
+static gpointer bar_parent_class = NULL;
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+VALA_EXTERN Bar* bar;
+Bar* bar = NULL;
+
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static GType bar_get_type_once (void);
+VALA_EXTERN GType manam_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Manam* manam_dup (const Manam* self);
+VALA_EXTERN void manam_free (Manam* self);
+VALA_EXTERN void manam_copy (const Manam* self,
+                 Manam* dest);
+VALA_EXTERN void manam_destroy (Manam* self);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+VALA_EXTERN Bar* foo_get_o (Foo* self);
+VALA_EXTERN void foo_set_o (Foo* self,
+                Bar* value);
+VALA_EXTERN void foo_get_st (Foo* self,
+                 Manam * result);
+VALA_EXTERN void foo_set_st (Foo* self,
+                 Manam * value);
+static gboolean _manam_equal (const Manam * s1,
+                       const Manam * s2);
+VALA_EXTERN Manam* foo_get_stn (Foo* self);
+VALA_EXTERN void foo_set_stn (Foo* self,
+                  Manam* value);
+VALA_EXTERN gchar* foo_get_s (Foo* self);
+VALA_EXTERN void foo_set_s (Foo* self,
+                const gchar* value);
+VALA_EXTERN gchar** foo_get_strv (Foo* self,
+                      gint* result_length1);
+static gchar** _vala_array_dup1 (gchar** self,
+                          gssize length);
+VALA_EXTERN void foo_set_strv (Foo* self,
+                   gchar** value,
+                   gint value_length1);
+static gchar** _vala_array_dup2 (gchar** self,
+                          gssize length);
+static GObject * foo_constructor (GType type,
+                           guint n_construct_properties,
+                           GObjectConstructParam * construct_properties);
+static void foo_finalize (GObject * obj);
+static GType foo_get_type_once (void);
+static void _vala_foo_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_foo_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec);
+static void _vala_main (void);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar * self = NULL;
+       self = (Bar*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (G_TYPE_OBJECT, "Bar", &g_define_type_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+void
+manam_copy (const Manam* self,
+            Manam* dest)
+{
+       const gchar* _tmp0_;
+       gchar* _tmp1_;
+       _tmp0_ = (*self).s;
+       _tmp1_ = g_strdup (_tmp0_);
+       _g_free0 ((*dest).s);
+       (*dest).s = _tmp1_;
+}
+
+void
+manam_destroy (Manam* self)
+{
+       _g_free0 ((*self).s);
+}
+
+Manam*
+manam_dup (const Manam* self)
+{
+       Manam* dup;
+       dup = g_new0 (Manam, 1);
+       manam_copy (self, dup);
+       return dup;
+}
+
+void
+manam_free (Manam* self)
+{
+       manam_destroy (self);
+       g_free (self);
+}
+
+static GType
+manam_get_type_once (void)
+{
+       GType manam_type_id;
+       manam_type_id = g_boxed_type_register_static ("Manam", (GBoxedCopyFunc) manam_dup, (GBoxedFreeFunc) 
manam_free);
+       return manam_type_id;
+}
+
+GType
+manam_get_type (void)
+{
+       static volatile gsize manam_type_id__volatile = 0;
+       if (g_once_init_enter (&manam_type_id__volatile)) {
+               GType manam_type_id;
+               manam_type_id = manam_get_type_once ();
+               g_once_init_leave (&manam_type_id__volatile, manam_type_id);
+       }
+       return manam_type_id__volatile;
+}
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static gpointer
+_g_object_ref0 (gpointer self)
+{
+       return self ? g_object_ref (self) : NULL;
+}
+
+Bar*
+foo_get_o (Foo* self)
+{
+       Bar* result;
+       Bar* _tmp0_;
+       Bar* _tmp1_;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = self->priv->_o;
+       _tmp1_ = _g_object_ref0 (_tmp0_);
+       result = _tmp1_;
+       return result;
+}
+
+void
+foo_set_o (Foo* self,
+           Bar* value)
+{
+       Bar* old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_o (self);
+       if (old_value != value) {
+               Bar* _tmp0_;
+               _tmp0_ = _g_object_ref0 (value);
+               _g_object_unref0 (self->priv->_o);
+               self->priv->_o = _tmp0_;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_O_PROPERTY]);
+       }
+       _g_object_unref0 (old_value);
+}
+
+void
+foo_get_st (Foo* self,
+            Manam * result)
+{
+       Manam _tmp0_;
+       Manam _tmp1_;
+       Manam _tmp2_ = {0};
+       g_return_if_fail (IS_FOO (self));
+       _tmp0_ = self->priv->_st;
+       _tmp1_ = _tmp0_;
+       manam_copy (&_tmp1_, &_tmp2_);
+       *result = _tmp2_;
+       return;
+}
+
+static gboolean
+_manam_equal (const Manam * s1,
+              const Manam * s2)
+{
+       if (s1 == s2) {
+               return TRUE;
+       }
+       if (s1 == NULL) {
+               return FALSE;
+       }
+       if (s2 == NULL) {
+               return FALSE;
+       }
+       if (g_strcmp0 (s1->s, s2->s)) {
+               return FALSE;
+       }
+       return TRUE;
+}
+
+void
+foo_set_st (Foo* self,
+            Manam * value)
+{
+       Manam old_value;
+       g_return_if_fail (IS_FOO (self));
+       foo_get_st (self, &old_value);
+       if (_manam_equal (value, &old_value) != TRUE) {
+               Manam _tmp0_;
+               Manam _tmp1_;
+               Manam _tmp2_ = {0};
+               _tmp0_ = *value;
+               _tmp1_ = _tmp0_;
+               manam_copy (&_tmp1_, &_tmp2_);
+               manam_destroy (&self->priv->_st);
+               self->priv->_st = _tmp2_;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_ST_PROPERTY]);
+       }
+       manam_destroy (&old_value);
+}
+
+static gpointer
+_manam_dup0 (gpointer self)
+{
+       return self ? manam_dup (self) : NULL;
+}
+
+Manam*
+foo_get_stn (Foo* self)
+{
+       Manam* result;
+       Manam* _tmp0_;
+       Manam* _tmp1_;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = self->priv->_stn;
+       _tmp1_ = _manam_dup0 (_tmp0_);
+       result = _tmp1_;
+       return result;
+}
+
+void
+foo_set_stn (Foo* self,
+             Manam* value)
+{
+       Manam* old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_stn (self);
+       if (_manam_equal (value, old_value) != TRUE) {
+               Manam* _tmp0_;
+               _tmp0_ = _manam_dup0 (value);
+               _manam_free0 (self->priv->_stn);
+               self->priv->_stn = _tmp0_;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_STN_PROPERTY]);
+       }
+       _manam_free0 (old_value);
+}
+
+gchar*
+foo_get_s (Foo* self)
+{
+       gchar* result;
+       const gchar* _tmp0_;
+       gchar* _tmp1_;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = self->priv->_s;
+       _tmp1_ = g_strdup (_tmp0_);
+       result = _tmp1_;
+       return result;
+}
+
+void
+foo_set_s (Foo* self,
+           const gchar* value)
+{
+       gchar* old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_s (self);
+       if (g_strcmp0 (value, old_value) != 0) {
+               gchar* _tmp0_;
+               _tmp0_ = g_strdup (value);
+               _g_free0 (self->priv->_s);
+               self->priv->_s = _tmp0_;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_S_PROPERTY]);
+       }
+       _g_free0 (old_value);
+}
+
+static gchar**
+_vala_array_dup1 (gchar** self,
+                  gssize length)
+{
+       if (length >= 0) {
+               gchar** result;
+               gssize i;
+               result = g_new0 (gchar*, length + 1);
+               for (i = 0; i < length; i++) {
+                       gchar* _tmp0_;
+                       _tmp0_ = g_strdup (self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+gchar**
+foo_get_strv (Foo* self,
+              gint* result_length1)
+{
+       gchar** result;
+       gchar** _tmp0_;
+       gint _tmp0__length1;
+       gchar** _tmp1_;
+       gint _tmp1__length1;
+       gchar** _tmp2_;
+       gint _tmp2__length1;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = self->priv->_strv;
+       _tmp0__length1 = self->priv->_strv_length1;
+       _tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup1 (_tmp0_, _tmp0__length1) : _tmp0_;
+       _tmp1__length1 = _tmp0__length1;
+       _tmp2_ = _tmp1_;
+       _tmp2__length1 = _tmp1__length1;
+       if (result_length1) {
+               *result_length1 = _tmp2__length1;
+       }
+       result = _tmp2_;
+       return result;
+}
+
+static gchar**
+_vala_array_dup2 (gchar** self,
+                  gssize length)
+{
+       if (length >= 0) {
+               gchar** result;
+               gssize i;
+               result = g_new0 (gchar*, length + 1);
+               for (i = 0; i < length; i++) {
+                       gchar* _tmp0_;
+                       _tmp0_ = g_strdup (self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+void
+foo_set_strv (Foo* self,
+              gchar** value,
+              gint value_length1)
+{
+       gchar** old_value;
+       gint old_value_length;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_strv (self, &old_value_length);
+       if (old_value != value) {
+               gchar** _tmp0_;
+               gint _tmp0__length1;
+               _tmp0_ = (value != NULL) ? _vala_array_dup2 (value, value_length1) : value;
+               _tmp0__length1 = value_length1;
+               self->priv->_strv = (_vala_array_free (self->priv->_strv, self->priv->_strv_length1, 
(GDestroyNotify) g_free), NULL);
+               self->priv->_strv = _tmp0_;
+               self->priv->_strv_length1 = _tmp0__length1;
+               self->priv->__strv_size_ = self->priv->_strv_length1;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_STRV_PROPERTY]);
+       }
+       old_value = (_vala_array_free (old_value, old_value_length, (GDestroyNotify) g_free), NULL);
+}
+
+static GObject *
+foo_constructor (GType type,
+                 guint n_construct_properties,
+                 GObjectConstructParam * construct_properties)
+{
+       GObject * obj;
+       GObjectClass * parent_class;
+       Foo * self;
+       Bar* _tmp0_;
+       Manam _tmp1_ = {0};
+       Manam _tmp2_ = {0};
+       gchar* _tmp3_;
+       gchar* _tmp4_;
+       gchar** _tmp5_;
+       gchar** _tmp6_;
+       gint _tmp6__length1;
+       parent_class = G_OBJECT_CLASS (foo_parent_class);
+       obj = parent_class->constructor (type, n_construct_properties, construct_properties);
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       _tmp0_ = bar;
+       foo_set_o (self, _tmp0_);
+       _g_free0 (_tmp1_.s);
+       _tmp1_.s = "foo";
+       foo_set_st (self, &_tmp1_);
+       _g_free0 (_tmp2_.s);
+       _tmp2_.s = "bar";
+       foo_set_stn (self, &_tmp2_);
+       foo_set_s (self, "foo");
+       _tmp3_ = g_strdup ("foo");
+       _tmp4_ = g_strdup ("bar");
+       _tmp5_ = g_new0 (gchar*, 2 + 1);
+       _tmp5_[0] = _tmp3_;
+       _tmp5_[1] = _tmp4_;
+       _tmp6_ = _tmp5_;
+       _tmp6__length1 = 2;
+       foo_set_strv (self, _tmp6_, 2);
+       _tmp6_ = (_vala_array_free (_tmp6_, _tmp6__length1, (GDestroyNotify) g_free), NULL);
+       return obj;
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_foo_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_foo_set_property;
+       G_OBJECT_CLASS (klass)->constructor = foo_constructor;
+       G_OBJECT_CLASS (klass)->finalize = foo_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_O_PROPERTY, 
foo_properties[FOO_O_PROPERTY] = g_param_spec_object ("o", "o", "o", TYPE_BAR, G_PARAM_STATIC_STRINGS | 
G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_ST_PROPERTY, 
foo_properties[FOO_ST_PROPERTY] = g_param_spec_boxed ("st", "st", "st", TYPE_MANAM, G_PARAM_STATIC_STRINGS | 
G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_STN_PROPERTY, 
foo_properties[FOO_STN_PROPERTY] = g_param_spec_boxed ("stn", "stn", "stn", TYPE_MANAM, 
G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_S_PROPERTY, 
foo_properties[FOO_S_PROPERTY] = g_param_spec_string ("s", "s", "s", NULL, G_PARAM_STATIC_STRINGS | 
G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_STRV_PROPERTY, 
foo_properties[FOO_STRV_PROPERTY] = g_param_spec_boxed ("strv", "strv", "strv", G_TYPE_STRV, 
G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+}
+
+static void
+foo_finalize (GObject * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       _g_object_unref0 (self->priv->_o);
+       manam_destroy (&self->priv->_st);
+       _manam_free0 (self->priv->_stn);
+       _g_free0 (self->priv->_s);
+       self->priv->_strv = (_vala_array_free (self->priv->_strv, self->priv->_strv_length1, (GDestroyNotify) 
g_free), NULL);
+       G_OBJECT_CLASS (foo_parent_class)->finalize (obj);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_foo_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_O_PROPERTY:
+               g_value_take_object (value, foo_get_o (self));
+               break;
+               case FOO_ST_PROPERTY:
+               {
+                       Manam boxed;
+                       foo_get_st (self, &boxed);
+                       g_value_set_boxed (value, &boxed);
+                       manam_destroy (&boxed);
+               }
+               break;
+               case FOO_STN_PROPERTY:
+               {
+                       Manam* boxed;
+                       boxed = foo_get_stn (self);
+                       g_value_set_boxed (value, boxed);
+                       _manam_free0 (boxed);
+               }
+               break;
+               case FOO_S_PROPERTY:
+               g_value_take_string (value, foo_get_s (self));
+               break;
+               case FOO_STRV_PROPERTY:
+               {
+                       int length;
+                       g_value_take_boxed (value, foo_get_strv (self, &length));
+               }
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_foo_set_property (GObject * object,
+                        guint property_id,
+                        const GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_O_PROPERTY:
+               foo_set_o (self, g_value_get_object (value));
+               break;
+               case FOO_ST_PROPERTY:
+               foo_set_st (self, g_value_get_boxed (value));
+               break;
+               case FOO_STN_PROPERTY:
+               foo_set_stn (self, g_value_get_boxed (value));
+               break;
+               case FOO_S_PROPERTY:
+               foo_set_s (self, g_value_get_string (value));
+               break;
+               case FOO_STRV_PROPERTY:
+               {
+                       gpointer boxed;
+                       boxed = g_value_get_boxed (value);
+                       foo_set_strv (self, boxed, (boxed == NULL) ? 0 : g_strv_length (boxed));
+               }
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Bar* _tmp0_;
+       Bar* _tmp1_;
+       Foo* foo = NULL;
+       Foo* _tmp2_;
+       Bar* _tmp3_;
+       Bar* _tmp4_;
+       Bar* _tmp5_;
+       Manam _tmp6_ = {0};
+       Manam _tmp7_;
+       Manam _tmp8_;
+       const gchar* _tmp9_;
+       Manam _tmp10_ = {0};
+       Manam _tmp11_ = {0};
+       Manam _tmp12_;
+       Manam _tmp13_;
+       const gchar* _tmp14_;
+       Manam* _tmp15_;
+       Manam* _tmp16_;
+       Manam* _tmp17_;
+       const gchar* _tmp18_;
+       Manam _tmp19_ = {0};
+       Manam* _tmp20_;
+       Manam* _tmp21_;
+       Manam* _tmp22_;
+       const gchar* _tmp23_;
+       gchar* _tmp24_;
+       gchar* _tmp25_;
+       gchar* _tmp26_;
+       gchar* _tmp27_;
+       gchar* _tmp28_;
+       gchar* _tmp29_;
+       gchar** _tmp30_;
+       gint _tmp30__length1;
+       gint _tmp31_ = 0;
+       gchar** _tmp32_;
+       gint _tmp32__length1;
+       gchar** _tmp33_;
+       gint _tmp33__length1;
+       const gchar* _tmp34_;
+       gchar* _tmp35_;
+       gchar* _tmp36_;
+       gchar** _tmp37_;
+       gchar** _tmp38_;
+       gint _tmp38__length1;
+       gchar** _tmp39_;
+       gint _tmp39__length1;
+       gint _tmp40_ = 0;
+       gchar** _tmp41_;
+       gint _tmp41__length1;
+       gchar** _tmp42_;
+       gint _tmp42__length1;
+       const gchar* _tmp43_;
+       _tmp0_ = bar_new ();
+       _g_object_unref0 (bar);
+       bar = _tmp0_;
+       _tmp1_ = bar;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"bar.ref_count == 1");
+       _tmp2_ = foo_new ();
+       foo = _tmp2_;
+       _tmp3_ = bar;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 2), 
"bar.ref_count == 2");
+       _tmp4_ = bar;
+       foo_set_o (foo, _tmp4_);
+       _tmp5_ = bar;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 2), 
"bar.ref_count == 2");
+       foo_get_st (foo, &_tmp6_);
+       _tmp7_ = _tmp6_;
+       _tmp8_ = _tmp7_;
+       _tmp9_ = _tmp8_.s;
+       _vala_assert (g_strcmp0 (_tmp9_, "foo") == 0, "foo.st.s == \"foo\"");
+       manam_destroy (&_tmp8_);
+       _g_free0 (_tmp10_.s);
+       _tmp10_.s = "manam";
+       foo_set_st (foo, &_tmp10_);
+       foo_get_st (foo, &_tmp11_);
+       _tmp12_ = _tmp11_;
+       _tmp13_ = _tmp12_;
+       _tmp14_ = _tmp13_.s;
+       _vala_assert (g_strcmp0 (_tmp14_, "manam") == 0, "foo.st.s == \"manam\"");
+       manam_destroy (&_tmp13_);
+       _tmp15_ = foo_get_stn (foo);
+       _tmp16_ = _tmp15_;
+       _tmp17_ = _tmp16_;
+       _tmp18_ = (*_tmp17_).s;
+       _vala_assert (g_strcmp0 (_tmp18_, "bar") == 0, "foo.stn.s == \"bar\"");
+       _manam_free0 (_tmp17_);
+       _g_free0 (_tmp19_.s);
+       _tmp19_.s = "minim";
+       foo_set_stn (foo, &_tmp19_);
+       _tmp20_ = foo_get_stn (foo);
+       _tmp21_ = _tmp20_;
+       _tmp22_ = _tmp21_;
+       _tmp23_ = (*_tmp22_).s;
+       _vala_assert (g_strcmp0 (_tmp23_, "minim") == 0, "foo.stn.s == \"minim\"");
+       _manam_free0 (_tmp22_);
+       _tmp24_ = foo_get_s (foo);
+       _tmp25_ = _tmp24_;
+       _tmp26_ = _tmp25_;
+       _vala_assert (g_strcmp0 (_tmp26_, "foo") == 0, "foo.s == \"foo\"");
+       _g_free0 (_tmp26_);
+       foo_set_s (foo, "manam");
+       _tmp27_ = foo_get_s (foo);
+       _tmp28_ = _tmp27_;
+       _tmp29_ = _tmp28_;
+       _vala_assert (g_strcmp0 (_tmp29_, "manam") == 0, "foo.s == \"manam\"");
+       _g_free0 (_tmp29_);
+       _tmp30_ = foo_get_strv (foo, &_tmp31_);
+       _tmp30__length1 = _tmp31_;
+       _tmp32_ = _tmp30_;
+       _tmp32__length1 = _tmp30__length1;
+       _tmp33_ = _tmp32_;
+       _tmp33__length1 = _tmp32__length1;
+       _tmp34_ = _tmp33_[1];
+       _vala_assert (g_strcmp0 (_tmp34_, "bar") == 0, "foo.strv[1] == \"bar\"");
+       _tmp33_ = (_vala_array_free (_tmp33_, _tmp33__length1, (GDestroyNotify) g_free), NULL);
+       _tmp35_ = g_strdup ("manam");
+       _tmp36_ = g_strdup ("minim");
+       _tmp37_ = g_new0 (gchar*, 2 + 1);
+       _tmp37_[0] = _tmp35_;
+       _tmp37_[1] = _tmp36_;
+       _tmp38_ = _tmp37_;
+       _tmp38__length1 = 2;
+       foo_set_strv (foo, _tmp38_, 2);
+       _tmp38_ = (_vala_array_free (_tmp38_, _tmp38__length1, (GDestroyNotify) g_free), NULL);
+       _tmp39_ = foo_get_strv (foo, &_tmp40_);
+       _tmp39__length1 = _tmp40_;
+       _tmp41_ = _tmp39_;
+       _tmp41__length1 = _tmp39__length1;
+       _tmp42_ = _tmp41_;
+       _tmp42__length1 = _tmp41__length1;
+       _tmp43_ = _tmp42_[1];
+       _vala_assert (g_strcmp0 (_tmp43_, "minim") == 0, "foo.strv[1] == \"minim\"");
+       _tmp42_ = (_vala_array_free (_tmp42_, _tmp42__length1, (GDestroyNotify) g_free), NULL);
+       _g_object_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/objects/property-notify.c-expected b/tests/objects/property-notify.c-expected
new file mode 100644
index 000000000..bc7ff100f
--- /dev/null
+++ b/tests/objects/property-notify.c-expected
@@ -0,0 +1,356 @@
+/* objects_property_notify.c generated by valac, the Vala compiler
+ * generated from objects_property_notify.vala, do not modify */
+
+#include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_FOO_PROPERTY,
+       FOO_BAR_PROPERTY,
+       FOO_MANAM_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _FooPrivate {
+       gchar* _foo;
+       gchar* _bar;
+       gchar* _manam;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+VALA_EXTERN gint counter;
+gint counter = 0;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+VALA_EXTERN const gchar* foo_get_foo (Foo* self);
+VALA_EXTERN void foo_set_foo (Foo* self,
+                  const gchar* value);
+VALA_EXTERN const gchar* foo_get_bar (Foo* self);
+VALA_EXTERN void foo_set_bar (Foo* self,
+                  const gchar* value);
+VALA_EXTERN const gchar* foo_get_manam (Foo* self);
+VALA_EXTERN void foo_set_manam (Foo* self,
+                    const gchar* value);
+static void foo_finalize (GObject * obj);
+static GType foo_get_type_once (void);
+static void _vala_foo_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_foo_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec);
+VALA_EXTERN void fail (void);
+VALA_EXTERN void count (void);
+static void _vala_main (void);
+static void _fail_g_object_notify (GObject* _sender,
+                            GParamSpec* pspec,
+                            gpointer self);
+static void _count_g_object_notify (GObject* _sender,
+                             GParamSpec* pspec,
+                             gpointer self);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+const gchar*
+foo_get_foo (Foo* self)
+{
+       const gchar* result;
+       const gchar* _tmp0_;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = self->priv->_foo;
+       result = _tmp0_;
+       return result;
+}
+
+void
+foo_set_foo (Foo* self,
+             const gchar* value)
+{
+       gchar* _tmp0_;
+       g_return_if_fail (IS_FOO (self));
+       _tmp0_ = g_strdup (value);
+       _g_free0 (self->priv->_foo);
+       self->priv->_foo = _tmp0_;
+}
+
+const gchar*
+foo_get_bar (Foo* self)
+{
+       const gchar* result;
+       const gchar* _tmp0_;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = self->priv->_bar;
+       result = _tmp0_;
+       return result;
+}
+
+void
+foo_set_bar (Foo* self,
+             const gchar* value)
+{
+       gchar* old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_bar (self);
+       if (g_strcmp0 (value, old_value) != 0) {
+               gchar* _tmp0_;
+               _tmp0_ = g_strdup (value);
+               _g_free0 (self->priv->_bar);
+               self->priv->_bar = _tmp0_;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_BAR_PROPERTY]);
+       }
+}
+
+const gchar*
+foo_get_manam (Foo* self)
+{
+       const gchar* result;
+       const gchar* _tmp0_;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = self->priv->_manam;
+       result = _tmp0_;
+       return result;
+}
+
+void
+foo_set_manam (Foo* self,
+               const gchar* value)
+{
+       gchar* old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_manam (self);
+       if (g_strcmp0 (value, old_value) != 0) {
+               gchar* _tmp0_;
+               _tmp0_ = g_strdup (value);
+               _g_free0 (self->priv->_manam);
+               self->priv->_manam = _tmp0_;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_MANAM_PROPERTY]);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_foo_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_foo_set_property;
+       G_OBJECT_CLASS (klass)->finalize = foo_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_FOO_PROPERTY, 
foo_properties[FOO_FOO_PROPERTY] = g_param_spec_string ("foo", "foo", "foo", NULL, G_PARAM_STATIC_STRINGS | 
G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_EXPLICIT_NOTIFY));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_BAR_PROPERTY, 
foo_properties[FOO_BAR_PROPERTY] = g_param_spec_string ("bar", "bar", "bar", NULL, G_PARAM_STATIC_STRINGS | 
G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_MANAM_PROPERTY, 
foo_properties[FOO_MANAM_PROPERTY] = g_param_spec_string ("manam", "manam", "manam", NULL, 
G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+}
+
+static void
+foo_finalize (GObject * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       _g_free0 (self->priv->_foo);
+       _g_free0 (self->priv->_bar);
+       _g_free0 (self->priv->_manam);
+       G_OBJECT_CLASS (foo_parent_class)->finalize (obj);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_foo_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_FOO_PROPERTY:
+               g_value_set_string (value, foo_get_foo (self));
+               break;
+               case FOO_BAR_PROPERTY:
+               g_value_set_string (value, foo_get_bar (self));
+               break;
+               case FOO_MANAM_PROPERTY:
+               g_value_set_string (value, foo_get_manam (self));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_foo_set_property (GObject * object,
+                        guint property_id,
+                        const GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_FOO_PROPERTY:
+               foo_set_foo (self, g_value_get_string (value));
+               break;
+               case FOO_BAR_PROPERTY:
+               foo_set_bar (self, g_value_get_string (value));
+               break;
+               case FOO_MANAM_PROPERTY:
+               foo_set_manam (self, g_value_get_string (value));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+void
+fail (void)
+{
+       g_assert_not_reached ();
+}
+
+void
+count (void)
+{
+       gint _tmp0_;
+       _tmp0_ = counter;
+       counter = _tmp0_ + 1;
+}
+
+static void
+_fail_g_object_notify (GObject* _sender,
+                       GParamSpec* pspec,
+                       gpointer self)
+{
+       fail ();
+}
+
+static void
+_count_g_object_notify (GObject* _sender,
+                        GParamSpec* pspec,
+                        gpointer self)
+{
+       count ();
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       GValue _tmp1_ = {0};
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       g_signal_connect (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject), "notify::foo", 
(GCallback) _fail_g_object_notify, NULL);
+       foo_set_foo (foo, "foo");
+       counter = 0;
+       g_signal_connect (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject), "notify::bar", 
(GCallback) _count_g_object_notify, NULL);
+       foo_set_bar (foo, "bar");
+       _vala_assert (counter == 1, "counter == 1");
+       counter = 0;
+       g_signal_connect (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject), "notify::manam", 
(GCallback) _count_g_object_notify, NULL);
+       g_value_init (&_tmp1_, G_TYPE_STRING);
+       g_value_set_string (&_tmp1_, "manam");
+       g_object_set_property (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject), "manam", &_tmp1_);
+       G_IS_VALUE (&_tmp1_) ? (g_value_unset (&_tmp1_), NULL) : NULL;
+       _vala_assert (counter == 1, "counter == 1");
+       _g_object_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/property-ownership.c-expected b/tests/objects/property-ownership.c-expected
new file mode 100644
index 000000000..767ea0e24
--- /dev/null
+++ b/tests/objects/property-ownership.c-expected
@@ -0,0 +1,946 @@
+/* objects_property_ownership.c generated by valac, the Vala compiler
+ * generated from objects_property_ownership.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+enum  {
+       BAR_0_PROPERTY,
+       BAR_FOO_PROPERTY,
+       BAR_FOO_OWNED_PROPERTY,
+       BAR_FOO_WEAK_PROPERTY,
+       BAR_FOO_WEAK_OWNED_PROPERTY,
+       BAR_NUM_PROPERTIES
+};
+static GParamSpec* bar_properties[BAR_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+
+#define TYPE_MANAM (manam_get_type ())
+#define MANAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MANAM, Manam))
+#define MANAM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MANAM, ManamClass))
+#define IS_MANAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MANAM))
+#define IS_MANAM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MANAM))
+#define MANAM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MANAM, ManamClass))
+
+typedef struct _Manam Manam;
+typedef struct _ManamClass ManamClass;
+typedef struct _ManamPrivate ManamPrivate;
+typedef struct _ParamSpecManam ParamSpecManam;
+#define _manam_unref0(var) ((var == NULL) ? NULL : (var = (manam_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _Bar {
+       GObject parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       GObjectClass parent_class;
+};
+
+struct _BarPrivate {
+       Foo* _foo;
+       Foo* _foo_owned;
+       Foo* _foo_weak;
+       Foo* _foo_weak_owned;
+};
+
+struct _Manam {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       ManamPrivate * priv;
+};
+
+struct _ManamClass {
+       GTypeClass parent_class;
+       void (*finalize) (Manam *self);
+};
+
+struct _ManamPrivate {
+       Foo* _foo;
+       Foo* _foo_owned;
+       Foo* _foo_weak;
+       Foo* _foo_weak_owned;
+};
+
+struct _ParamSpecManam {
+       GParamSpec parent_instance;
+};
+
+static gpointer foo_parent_class = NULL;
+static gint Bar_private_offset;
+static gpointer bar_parent_class = NULL;
+static gint Manam_private_offset;
+static gpointer manam_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static GType foo_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+VALA_EXTERN Foo* bar_get_foo (Bar* self);
+VALA_EXTERN void bar_set_foo (Bar* self,
+                  Foo* value);
+VALA_EXTERN Foo* bar_get_foo_owned (Bar* self);
+VALA_EXTERN void bar_set_foo_owned (Bar* self,
+                        Foo* value);
+VALA_EXTERN Foo* bar_get_foo_weak (Bar* self);
+VALA_EXTERN void bar_set_foo_weak (Bar* self,
+                       Foo* value);
+VALA_EXTERN Foo* bar_get_foo_weak_owned (Bar* self);
+VALA_EXTERN void bar_set_foo_weak_owned (Bar* self,
+                             Foo* value);
+static void bar_finalize (GObject * obj);
+static GType bar_get_type_once (void);
+static void _vala_bar_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_bar_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec);
+VALA_EXTERN gpointer manam_ref (gpointer instance);
+VALA_EXTERN void manam_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_manam (const gchar* name,
+                              const gchar* nick,
+                              const gchar* blurb,
+                              GType object_type,
+                              GParamFlags flags);
+VALA_EXTERN void value_set_manam (GValue* value,
+                      gpointer v_object);
+VALA_EXTERN void value_take_manam (GValue* value,
+                       gpointer v_object);
+VALA_EXTERN gpointer value_get_manam (const GValue* value);
+VALA_EXTERN GType manam_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Manam, manam_unref)
+VALA_EXTERN Manam* manam_new (void);
+VALA_EXTERN Manam* manam_construct (GType object_type);
+VALA_EXTERN Foo* manam_get_foo (Manam* self);
+VALA_EXTERN void manam_set_foo (Manam* self,
+                    Foo* value);
+VALA_EXTERN Foo* manam_get_foo_owned (Manam* self);
+VALA_EXTERN void manam_set_foo_owned (Manam* self,
+                          Foo* value);
+VALA_EXTERN Foo* manam_get_foo_weak (Manam* self);
+VALA_EXTERN void manam_set_foo_weak (Manam* self,
+                         Foo* value);
+VALA_EXTERN Foo* manam_get_foo_weak_owned (Manam* self);
+VALA_EXTERN void manam_set_foo_weak_owned (Manam* self,
+                               Foo* value);
+static void manam_finalize (Manam * obj);
+static GType manam_get_type_once (void);
+static void _vala_main (void);
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static inline gpointer
+bar_get_instance_private (Bar* self)
+{
+       return G_STRUCT_MEMBER_P (self, Bar_private_offset);
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar * self = NULL;
+       self = (Bar*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+Foo*
+bar_get_foo (Bar* self)
+{
+       Foo* result;
+       Foo* _tmp0_;
+       g_return_val_if_fail (IS_BAR (self), NULL);
+       _tmp0_ = self->priv->_foo;
+       result = _tmp0_;
+       return result;
+}
+
+static gpointer
+_g_object_ref0 (gpointer self)
+{
+       return self ? g_object_ref (self) : NULL;
+}
+
+void
+bar_set_foo (Bar* self,
+             Foo* value)
+{
+       Foo* old_value;
+       g_return_if_fail (IS_BAR (self));
+       old_value = bar_get_foo (self);
+       if (old_value != value) {
+               Foo* _tmp0_;
+               _tmp0_ = _g_object_ref0 (value);
+               _g_object_unref0 (self->priv->_foo);
+               self->priv->_foo = _tmp0_;
+               g_object_notify_by_pspec ((GObject *) self, bar_properties[BAR_FOO_PROPERTY]);
+       }
+}
+
+Foo*
+bar_get_foo_owned (Bar* self)
+{
+       Foo* result;
+       Foo* _tmp0_;
+       Foo* _tmp1_;
+       g_return_val_if_fail (IS_BAR (self), NULL);
+       _tmp0_ = self->priv->_foo_owned;
+       _tmp1_ = _g_object_ref0 (_tmp0_);
+       result = _tmp1_;
+       return result;
+}
+
+void
+bar_set_foo_owned (Bar* self,
+                   Foo* value)
+{
+       Foo* old_value;
+       g_return_if_fail (IS_BAR (self));
+       old_value = bar_get_foo_owned (self);
+       if (old_value != value) {
+               Foo* _tmp0_;
+               _tmp0_ = _g_object_ref0 (value);
+               _g_object_unref0 (self->priv->_foo_owned);
+               self->priv->_foo_owned = _tmp0_;
+               g_object_notify_by_pspec ((GObject *) self, bar_properties[BAR_FOO_OWNED_PROPERTY]);
+       }
+       _g_object_unref0 (old_value);
+}
+
+Foo*
+bar_get_foo_weak (Bar* self)
+{
+       Foo* result;
+       Foo* _tmp0_;
+       g_return_val_if_fail (IS_BAR (self), NULL);
+       _tmp0_ = self->priv->_foo_weak;
+       result = _tmp0_;
+       return result;
+}
+
+void
+bar_set_foo_weak (Bar* self,
+                  Foo* value)
+{
+       Foo* old_value;
+       g_return_if_fail (IS_BAR (self));
+       old_value = bar_get_foo_weak (self);
+       if (old_value != value) {
+               self->priv->_foo_weak = value;
+               g_object_notify_by_pspec ((GObject *) self, bar_properties[BAR_FOO_WEAK_PROPERTY]);
+       }
+}
+
+Foo*
+bar_get_foo_weak_owned (Bar* self)
+{
+       Foo* result;
+       Foo* _tmp0_;
+       Foo* _tmp1_;
+       g_return_val_if_fail (IS_BAR (self), NULL);
+       _tmp0_ = self->priv->_foo_weak_owned;
+       _tmp1_ = _g_object_ref0 (_tmp0_);
+       result = _tmp1_;
+       return result;
+}
+
+void
+bar_set_foo_weak_owned (Bar* self,
+                        Foo* value)
+{
+       Foo* old_value;
+       g_return_if_fail (IS_BAR (self));
+       old_value = bar_get_foo_weak_owned (self);
+       if (old_value != value) {
+               self->priv->_foo_weak_owned = value;
+               g_object_notify_by_pspec ((GObject *) self, bar_properties[BAR_FOO_WEAK_OWNED_PROPERTY]);
+       }
+       _g_object_unref0 (old_value);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Bar_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_bar_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_bar_set_property;
+       G_OBJECT_CLASS (klass)->finalize = bar_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), BAR_FOO_PROPERTY, 
bar_properties[BAR_FOO_PROPERTY] = g_param_spec_object ("foo", "foo", "foo", TYPE_FOO, G_PARAM_STATIC_STRINGS 
| G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), BAR_FOO_OWNED_PROPERTY, 
bar_properties[BAR_FOO_OWNED_PROPERTY] = g_param_spec_object ("foo-owned", "foo-owned", "foo-owned", 
TYPE_FOO, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), BAR_FOO_WEAK_PROPERTY, 
bar_properties[BAR_FOO_WEAK_PROPERTY] = g_param_spec_object ("foo-weak", "foo-weak", "foo-weak", TYPE_FOO, 
G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), BAR_FOO_WEAK_OWNED_PROPERTY, 
bar_properties[BAR_FOO_WEAK_OWNED_PROPERTY] = g_param_spec_object ("foo-weak-owned", "foo-weak-owned", 
"foo-weak-owned", TYPE_FOO, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+       self->priv = bar_get_instance_private (self);
+}
+
+static void
+bar_finalize (GObject * obj)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       _g_object_unref0 (self->priv->_foo);
+       _g_object_unref0 (self->priv->_foo_owned);
+       G_OBJECT_CLASS (bar_parent_class)->finalize (obj);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (G_TYPE_OBJECT, "Bar", &g_define_type_info, 0);
+       Bar_private_offset = g_type_add_instance_private (bar_type_id, sizeof (BarPrivate));
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_bar_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_BAR, Bar);
+       switch (property_id) {
+               case BAR_FOO_PROPERTY:
+               g_value_set_object (value, bar_get_foo (self));
+               break;
+               case BAR_FOO_OWNED_PROPERTY:
+               g_value_take_object (value, bar_get_foo_owned (self));
+               break;
+               case BAR_FOO_WEAK_PROPERTY:
+               g_value_set_object (value, bar_get_foo_weak (self));
+               break;
+               case BAR_FOO_WEAK_OWNED_PROPERTY:
+               g_value_take_object (value, bar_get_foo_weak_owned (self));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_bar_set_property (GObject * object,
+                        guint property_id,
+                        const GValue * value,
+                        GParamSpec * pspec)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_BAR, Bar);
+       switch (property_id) {
+               case BAR_FOO_PROPERTY:
+               bar_set_foo (self, g_value_get_object (value));
+               break;
+               case BAR_FOO_OWNED_PROPERTY:
+               bar_set_foo_owned (self, g_value_get_object (value));
+               break;
+               case BAR_FOO_WEAK_PROPERTY:
+               bar_set_foo_weak (self, g_value_get_object (value));
+               break;
+               case BAR_FOO_WEAK_OWNED_PROPERTY:
+               bar_set_foo_weak_owned (self, g_value_get_object (value));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static inline gpointer
+manam_get_instance_private (Manam* self)
+{
+       return G_STRUCT_MEMBER_P (self, Manam_private_offset);
+}
+
+Manam*
+manam_construct (GType object_type)
+{
+       Manam* self = NULL;
+       self = (Manam*) g_type_create_instance (object_type);
+       return self;
+}
+
+Manam*
+manam_new (void)
+{
+       return manam_construct (TYPE_MANAM);
+}
+
+Foo*
+manam_get_foo (Manam* self)
+{
+       Foo* result;
+       Foo* _tmp0_;
+       g_return_val_if_fail (IS_MANAM (self), NULL);
+       _tmp0_ = self->priv->_foo;
+       result = _tmp0_;
+       return result;
+}
+
+void
+manam_set_foo (Manam* self,
+               Foo* value)
+{
+       Foo* _tmp0_;
+       g_return_if_fail (IS_MANAM (self));
+       _tmp0_ = _g_object_ref0 (value);
+       _g_object_unref0 (self->priv->_foo);
+       self->priv->_foo = _tmp0_;
+}
+
+Foo*
+manam_get_foo_owned (Manam* self)
+{
+       Foo* result;
+       Foo* _tmp0_;
+       Foo* _tmp1_;
+       g_return_val_if_fail (IS_MANAM (self), NULL);
+       _tmp0_ = self->priv->_foo_owned;
+       _tmp1_ = _g_object_ref0 (_tmp0_);
+       result = _tmp1_;
+       return result;
+}
+
+void
+manam_set_foo_owned (Manam* self,
+                     Foo* value)
+{
+       Foo* _tmp0_;
+       g_return_if_fail (IS_MANAM (self));
+       _tmp0_ = _g_object_ref0 (value);
+       _g_object_unref0 (self->priv->_foo_owned);
+       self->priv->_foo_owned = _tmp0_;
+}
+
+Foo*
+manam_get_foo_weak (Manam* self)
+{
+       Foo* result;
+       Foo* _tmp0_;
+       g_return_val_if_fail (IS_MANAM (self), NULL);
+       _tmp0_ = self->priv->_foo_weak;
+       result = _tmp0_;
+       return result;
+}
+
+void
+manam_set_foo_weak (Manam* self,
+                    Foo* value)
+{
+       g_return_if_fail (IS_MANAM (self));
+       self->priv->_foo_weak = value;
+}
+
+Foo*
+manam_get_foo_weak_owned (Manam* self)
+{
+       Foo* result;
+       Foo* _tmp0_;
+       Foo* _tmp1_;
+       g_return_val_if_fail (IS_MANAM (self), NULL);
+       _tmp0_ = self->priv->_foo_weak_owned;
+       _tmp1_ = _g_object_ref0 (_tmp0_);
+       result = _tmp1_;
+       return result;
+}
+
+void
+manam_set_foo_weak_owned (Manam* self,
+                          Foo* value)
+{
+       g_return_if_fail (IS_MANAM (self));
+       self->priv->_foo_weak_owned = value;
+}
+
+static void
+value_manam_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_manam_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               manam_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_manam_copy_value (const GValue* src_value,
+                        GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = manam_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_manam_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_manam_collect_value (GValue* value,
+                           guint n_collect_values,
+                           GTypeCValue* collect_values,
+                           guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Manam * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = manam_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_manam_lcopy_value (const GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       Manam ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = manam_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_manam (const gchar* name,
+                  const gchar* nick,
+                  const gchar* blurb,
+                  GType object_type,
+                  GParamFlags flags)
+{
+       ParamSpecManam* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_MANAM), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_manam (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_MANAM), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_manam (GValue* value,
+                 gpointer v_object)
+{
+       Manam * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_MANAM));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_MANAM));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               manam_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               manam_unref (old);
+       }
+}
+
+void
+value_take_manam (GValue* value,
+                  gpointer v_object)
+{
+       Manam * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_MANAM));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_MANAM));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               manam_unref (old);
+       }
+}
+
+static void
+manam_class_init (ManamClass * klass,
+                  gpointer klass_data)
+{
+       manam_parent_class = g_type_class_peek_parent (klass);
+       ((ManamClass *) klass)->finalize = manam_finalize;
+       g_type_class_adjust_private_offset (klass, &Manam_private_offset);
+}
+
+static void
+manam_instance_init (Manam * self,
+                     gpointer klass)
+{
+       self->priv = manam_get_instance_private (self);
+       self->ref_count = 1;
+}
+
+static void
+manam_finalize (Manam * obj)
+{
+       Manam * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_MANAM, Manam);
+       g_signal_handlers_destroy (self);
+       _g_object_unref0 (self->priv->_foo);
+       _g_object_unref0 (self->priv->_foo_owned);
+}
+
+static GType
+manam_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_manam_init, value_manam_free_value, 
value_manam_copy_value, value_manam_peek_pointer, "p", value_manam_collect_value, "p", 
value_manam_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (ManamClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) manam_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Manam), 
0, (GInstanceInitFunc) manam_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType manam_type_id;
+       manam_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Manam", 
&g_define_type_info, &g_define_type_fundamental_info, 0);
+       Manam_private_offset = g_type_add_instance_private (manam_type_id, sizeof (ManamPrivate));
+       return manam_type_id;
+}
+
+GType
+manam_get_type (void)
+{
+       static volatile gsize manam_type_id__volatile = 0;
+       if (g_once_init_enter (&manam_type_id__volatile)) {
+               GType manam_type_id;
+               manam_type_id = manam_get_type_once ();
+               g_once_init_leave (&manam_type_id__volatile, manam_type_id);
+       }
+       return manam_type_id__volatile;
+}
+
+gpointer
+manam_ref (gpointer instance)
+{
+       Manam * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+manam_unref (gpointer instance)
+{
+       Manam * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               MANAM_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"foo.ref_count == 1");
+       {
+               Bar* bar = NULL;
+               Bar* _tmp1_;
+               Foo* f = NULL;
+               Foo* _tmp2_;
+               Foo* _tmp3_;
+               _tmp1_ = bar_new ();
+               bar = _tmp1_;
+               bar_set_foo (bar, foo);
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 
2), "foo.ref_count == 2");
+               _tmp2_ = bar_get_foo (bar);
+               _tmp3_ = _tmp2_;
+               f = _tmp3_;
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 
2), "foo.ref_count == 2");
+               _g_object_unref0 (bar);
+       }
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"foo.ref_count == 1");
+       {
+               Bar* bar = NULL;
+               Bar* _tmp4_;
+               Foo* f = NULL;
+               Foo* _tmp5_;
+               Foo* _tmp6_;
+               _tmp4_ = bar_new ();
+               bar = _tmp4_;
+               bar_set_foo_owned (bar, foo);
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 
2), "foo.ref_count == 2");
+               _tmp5_ = bar_get_foo_owned (bar);
+               _tmp6_ = _tmp5_;
+               f = _tmp6_;
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 
3), "foo.ref_count == 3");
+               _g_object_unref0 (f);
+               _g_object_unref0 (bar);
+       }
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"foo.ref_count == 1");
+       {
+               Bar* bar = NULL;
+               Bar* _tmp7_;
+               Foo* f_weak = NULL;
+               Foo* _tmp8_;
+               Foo* _tmp9_;
+               _tmp7_ = bar_new ();
+               bar = _tmp7_;
+               bar_set_foo_weak (bar, foo);
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 
1), "foo.ref_count == 1");
+               _tmp8_ = bar_get_foo_weak (bar);
+               _tmp9_ = _tmp8_;
+               f_weak = _tmp9_;
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 
1), "foo.ref_count == 1");
+               _g_object_unref0 (bar);
+       }
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"foo.ref_count == 1");
+       {
+               Bar* bar = NULL;
+               Bar* _tmp10_;
+               Foo* f_weak_owned = NULL;
+               Foo* _tmp11_;
+               Foo* _tmp12_;
+               _tmp10_ = bar_new ();
+               bar = _tmp10_;
+               bar_set_foo_weak_owned (bar, foo);
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 
1), "foo.ref_count == 1");
+               _tmp11_ = bar_get_foo_weak_owned (bar);
+               _tmp12_ = _tmp11_;
+               f_weak_owned = _tmp12_;
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 
2), "foo.ref_count == 2");
+               _g_object_unref0 (f_weak_owned);
+               _g_object_unref0 (bar);
+       }
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"foo.ref_count == 1");
+       {
+               Manam* manam = NULL;
+               Manam* _tmp13_;
+               Foo* f = NULL;
+               Foo* _tmp14_;
+               Foo* _tmp15_;
+               _tmp13_ = manam_new ();
+               manam = _tmp13_;
+               manam_set_foo (manam, foo);
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 
2), "foo.ref_count == 2");
+               _tmp14_ = manam_get_foo (manam);
+               _tmp15_ = _tmp14_;
+               f = _tmp15_;
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 
2), "foo.ref_count == 2");
+               _manam_unref0 (manam);
+       }
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"foo.ref_count == 1");
+       {
+               Manam* manam = NULL;
+               Manam* _tmp16_;
+               Foo* f = NULL;
+               Foo* _tmp17_;
+               Foo* _tmp18_;
+               _tmp16_ = manam_new ();
+               manam = _tmp16_;
+               manam_set_foo_owned (manam, foo);
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 
2), "foo.ref_count == 2");
+               _tmp17_ = manam_get_foo_owned (manam);
+               _tmp18_ = _tmp17_;
+               f = _tmp18_;
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 
3), "foo.ref_count == 3");
+               _g_object_unref0 (f);
+               _manam_unref0 (manam);
+       }
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"foo.ref_count == 1");
+       {
+               Manam* manam = NULL;
+               Manam* _tmp19_;
+               Foo* f_weak = NULL;
+               Foo* _tmp20_;
+               Foo* _tmp21_;
+               _tmp19_ = manam_new ();
+               manam = _tmp19_;
+               manam_set_foo_weak (manam, foo);
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 
1), "foo.ref_count == 1");
+               _tmp20_ = manam_get_foo_weak (manam);
+               _tmp21_ = _tmp20_;
+               f_weak = _tmp21_;
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 
1), "foo.ref_count == 1");
+               _manam_unref0 (manam);
+       }
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"foo.ref_count == 1");
+       {
+               Manam* manam = NULL;
+               Manam* _tmp22_;
+               Foo* f_weak_owned = NULL;
+               Foo* _tmp23_;
+               Foo* _tmp24_;
+               _tmp22_ = manam_new ();
+               manam = _tmp22_;
+               manam_set_foo_weak_owned (manam, foo);
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 
1), "foo.ref_count == 1");
+               _tmp23_ = manam_get_foo_weak_owned (manam);
+               _tmp24_ = _tmp23_;
+               f_weak_owned = _tmp24_;
+               _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 
2), "foo.ref_count == 2");
+               _g_object_unref0 (f_weak_owned);
+               _manam_unref0 (manam);
+       }
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"foo.ref_count == 1");
+       _g_object_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/property-read-only-auto.c-expected 
b/tests/objects/property-read-only-auto.c-expected
new file mode 100644
index 000000000..ac3eb981e
--- /dev/null
+++ b/tests/objects/property-read-only-auto.c-expected
@@ -0,0 +1,699 @@
+/* objects_property_read_only_auto.c generated by valac, the Vala compiler
+ * generated from objects_property_read_only_auto.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+enum  {
+       BAR_0_PROPERTY,
+       BAR_READ_ONLY_PROPERTY,
+       BAR_NUM_PROPERTIES
+};
+static GParamSpec* bar_properties[BAR_NUM_PROPERTIES];
+
+#define TYPE_IBAZ (ibaz_get_type ())
+#define IBAZ(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IBAZ, IBaz))
+#define IS_IBAZ(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IBAZ))
+#define IBAZ_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_IBAZ, IBazIface))
+
+typedef struct _IBaz IBaz;
+typedef struct _IBazIface IBazIface;
+
+#define TYPE_BAZ (baz_get_type ())
+#define BAZ(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAZ, Baz))
+#define BAZ_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAZ, BazClass))
+#define IS_BAZ(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAZ))
+#define IS_BAZ_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAZ))
+#define BAZ_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAZ, BazClass))
+
+typedef struct _Baz Baz;
+typedef struct _BazClass BazClass;
+typedef struct _BazPrivate BazPrivate;
+enum  {
+       BAZ_0_PROPERTY,
+       BAZ_READ_ONLY_PROPERTY,
+       BAZ_NUM_PROPERTIES
+};
+static GParamSpec* baz_properties[BAZ_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _FooPrivate {
+       gint _read_only;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+struct _Bar {
+       GObject parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       GObjectClass parent_class;
+};
+
+struct _BarPrivate {
+       gint _read_only;
+};
+
+struct _IBazIface {
+       GTypeInterface parent_iface;
+       gint (*get_read_only) (IBaz* self);
+};
+
+struct _Baz {
+       GObject parent_instance;
+       BazPrivate * priv;
+};
+
+struct _BazClass {
+       GObjectClass parent_class;
+};
+
+struct _BazPrivate {
+       gint _read_only;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+static gint Bar_private_offset;
+static gpointer bar_parent_class = NULL;
+static gint Baz_private_offset;
+static gpointer baz_parent_class = NULL;
+static IBazIface * baz_ibaz_parent_iface = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+VALA_EXTERN gint foo_get_read_only (Foo* self);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+VALA_EXTERN gint bar_get_read_only (Bar* self);
+static void bar_finalize (GObject * obj);
+static GType bar_get_type_once (void);
+static void _vala_bar_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+VALA_EXTERN GType ibaz_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN gint ibaz_get_read_only (IBaz* self);
+static GType ibaz_get_type_once (void);
+VALA_EXTERN GType baz_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Baz, g_object_unref)
+VALA_EXTERN Baz* baz_new (void);
+VALA_EXTERN Baz* baz_construct (GType object_type);
+static void baz_finalize (GObject * obj);
+static GType baz_get_type_once (void);
+static void _vala_baz_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_main (void);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+gint
+foo_get_read_only (Foo* self)
+{
+       gint result;
+       g_return_val_if_fail (IS_FOO (self), 0);
+       result = self->priv->_read_only;
+       return result;
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+       self->priv->_read_only = 42;
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static inline gpointer
+bar_get_instance_private (Bar* self)
+{
+       return G_STRUCT_MEMBER_P (self, Bar_private_offset);
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar * self = NULL;
+       self = (Bar*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+gint
+bar_get_read_only (Bar* self)
+{
+       gint result;
+       g_return_val_if_fail (IS_BAR (self), 0);
+       result = self->priv->_read_only;
+       return result;
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Bar_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_bar_get_property;
+       G_OBJECT_CLASS (klass)->finalize = bar_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), BAR_READ_ONLY_PROPERTY, 
bar_properties[BAR_READ_ONLY_PROPERTY] = g_param_spec_int ("read-only", "read-only", "read-only", G_MININT, 
G_MAXINT, 23, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+       self->priv = bar_get_instance_private (self);
+       self->priv->_read_only = 23;
+}
+
+static void
+bar_finalize (GObject * obj)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       G_OBJECT_CLASS (bar_parent_class)->finalize (obj);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (G_TYPE_OBJECT, "Bar", &g_define_type_info, 0);
+       Bar_private_offset = g_type_add_instance_private (bar_type_id, sizeof (BarPrivate));
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_bar_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_BAR, Bar);
+       switch (property_id) {
+               case BAR_READ_ONLY_PROPERTY:
+               g_value_set_int (value, bar_get_read_only (self));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+gint
+ibaz_get_read_only (IBaz* self)
+{
+       IBazIface* _iface_;
+       g_return_val_if_fail (IS_IBAZ (self), 0);
+       _iface_ = IBAZ_GET_INTERFACE (self);
+       if (_iface_->get_read_only) {
+               return _iface_->get_read_only (self);
+       }
+       return -1;
+}
+
+static void
+ibaz_default_init (IBazIface * iface,
+                   gpointer iface_data)
+{
+       g_object_interface_install_property (iface, g_param_spec_int ("read-only", "read-only", "read-only", 
G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
+}
+
+static GType
+ibaz_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (IBazIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) ibaz_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType ibaz_type_id;
+       ibaz_type_id = g_type_register_static (G_TYPE_INTERFACE, "IBaz", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (ibaz_type_id, G_TYPE_OBJECT);
+       return ibaz_type_id;
+}
+
+GType
+ibaz_get_type (void)
+{
+       static volatile gsize ibaz_type_id__volatile = 0;
+       if (g_once_init_enter (&ibaz_type_id__volatile)) {
+               GType ibaz_type_id;
+               ibaz_type_id = ibaz_get_type_once ();
+               g_once_init_leave (&ibaz_type_id__volatile, ibaz_type_id);
+       }
+       return ibaz_type_id__volatile;
+}
+
+static inline gpointer
+baz_get_instance_private (Baz* self)
+{
+       return G_STRUCT_MEMBER_P (self, Baz_private_offset);
+}
+
+Baz*
+baz_construct (GType object_type)
+{
+       Baz * self = NULL;
+       self = (Baz*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Baz*
+baz_new (void)
+{
+       return baz_construct (TYPE_BAZ);
+}
+
+static gint
+baz_real_get_read_only (IBaz* base)
+{
+       gint result;
+       Baz* self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAZ, Baz);
+       result = self->priv->_read_only;
+       return result;
+}
+
+static void
+baz_class_init (BazClass * klass,
+                gpointer klass_data)
+{
+       baz_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Baz_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_baz_get_property;
+       G_OBJECT_CLASS (klass)->finalize = baz_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), BAZ_READ_ONLY_PROPERTY, 
baz_properties[BAZ_READ_ONLY_PROPERTY] = g_param_spec_int ("read-only", "read-only", "read-only", G_MININT, 
G_MAXINT, 4711, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
+}
+
+static void
+baz_ibaz_interface_init (IBazIface * iface,
+                         gpointer iface_data)
+{
+       baz_ibaz_parent_iface = g_type_interface_peek_parent (iface);
+       iface->get_read_only = baz_real_get_read_only;
+}
+
+static void
+baz_instance_init (Baz * self,
+                   gpointer klass)
+{
+       self->priv = baz_get_instance_private (self);
+       self->priv->_read_only = 4711;
+}
+
+static void
+baz_finalize (GObject * obj)
+{
+       Baz * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAZ, Baz);
+       G_OBJECT_CLASS (baz_parent_class)->finalize (obj);
+}
+
+static GType
+baz_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BazClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) baz_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Baz), 0, 
(GInstanceInitFunc) baz_instance_init, NULL };
+       static const GInterfaceInfo ibaz_info = { (GInterfaceInitFunc) baz_ibaz_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       GType baz_type_id;
+       baz_type_id = g_type_register_static (G_TYPE_OBJECT, "Baz", &g_define_type_info, 0);
+       g_type_add_interface_static (baz_type_id, TYPE_IBAZ, &ibaz_info);
+       Baz_private_offset = g_type_add_instance_private (baz_type_id, sizeof (BazPrivate));
+       return baz_type_id;
+}
+
+GType
+baz_get_type (void)
+{
+       static volatile gsize baz_type_id__volatile = 0;
+       if (g_once_init_enter (&baz_type_id__volatile)) {
+               GType baz_type_id;
+               baz_type_id = baz_get_type_once ();
+               g_once_init_leave (&baz_type_id__volatile, baz_type_id);
+       }
+       return baz_type_id__volatile;
+}
+
+static void
+_vala_baz_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Baz * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_BAZ, Baz);
+       switch (property_id) {
+               case BAZ_READ_ONLY_PROPERTY:
+               g_value_set_int (value, ibaz_get_read_only (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_IBAZ, 
IBaz)));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       gint _tmp1_;
+       gint _tmp2_;
+       Bar* bar = NULL;
+       Bar* _tmp3_;
+       gint _tmp4_;
+       gint _tmp5_;
+       Baz* baz = NULL;
+       Baz* _tmp6_;
+       gint _tmp7_;
+       gint _tmp8_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       _tmp1_ = foo_get_read_only (foo);
+       _tmp2_ = _tmp1_;
+       _vala_assert (_tmp2_ == 42, "foo.read_only == 42");
+       _tmp3_ = bar_new ();
+       bar = _tmp3_;
+       _tmp4_ = bar_get_read_only (bar);
+       _tmp5_ = _tmp4_;
+       _vala_assert (_tmp5_ == 23, "bar.read_only == 23");
+       _tmp6_ = baz_new ();
+       baz = _tmp6_;
+       _tmp7_ = ibaz_get_read_only (G_TYPE_CHECK_INSTANCE_CAST (baz, TYPE_IBAZ, IBaz));
+       _tmp8_ = _tmp7_;
+       _vala_assert (_tmp8_ == 4711, "baz.read_only == 4711");
+       _g_object_unref0 (baz);
+       _g_object_unref0 (bar);
+       _foo_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/property-real-struct-assignment.c-expected 
b/tests/objects/property-real-struct-assignment.c-expected
new file mode 100644
index 000000000..d1e3524ea
--- /dev/null
+++ b/tests/objects/property-real-struct-assignment.c-expected
@@ -0,0 +1,666 @@
+/* objects_property_real_struct_assignment.c generated by valac, the Vala compiler
+ * generated from objects_property_real_struct_assignment.vala, do not modify */
+
+#include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+#define _g_free0(var) (var = (g_free (var), NULL))
+
+#define TYPE_MANAM (manam_get_type ())
+#define MANAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MANAM, Manam))
+#define MANAM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MANAM, ManamClass))
+#define IS_MANAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MANAM))
+#define IS_MANAM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MANAM))
+#define MANAM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MANAM, ManamClass))
+
+typedef struct _Manam Manam;
+typedef struct _ManamClass ManamClass;
+typedef struct _ManamPrivate ManamPrivate;
+enum  {
+       MANAM_0_PROPERTY,
+       MANAM_FAZ_PROPERTY,
+       MANAM_NUM_PROPERTIES
+};
+static GParamSpec* manam_properties[MANAM_NUM_PROPERTIES];
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+enum  {
+       BAR_0_PROPERTY,
+       BAR_FOO_PROPERTY,
+       BAR_NUM_PROPERTIES
+};
+static GParamSpec* bar_properties[BAR_NUM_PROPERTIES];
+#define _foo_free0(var) ((var == NULL) ? NULL : (var = (foo_free (var), NULL)))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+
+struct _Foo {
+       gchar* s;
+};
+
+struct _Manam {
+       GObject parent_instance;
+       ManamPrivate * priv;
+};
+
+struct _ManamClass {
+       GObjectClass parent_class;
+       void (*get_faz) (Manam* self, Foo * result);
+       void (*set_faz) (Manam* self, Foo * value);
+};
+
+struct _ManamPrivate {
+       Foo _faz;
+};
+
+struct _Bar {
+       Manam parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       ManamClass parent_class;
+};
+
+struct _BarPrivate {
+       Foo _foo;
+};
+
+static gint Manam_private_offset;
+static gpointer manam_parent_class = NULL;
+static gint Bar_private_offset;
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN void foo_copy (const Foo* self,
+               Foo* dest);
+VALA_EXTERN void foo_destroy (Foo* self);
+VALA_EXTERN Foo* get_foo (void);
+VALA_EXTERN GType manam_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Manam, g_object_unref)
+VALA_EXTERN void manam_get_faz (Manam* self,
+                    Foo * result);
+VALA_EXTERN void manam_set_faz (Manam* self,
+                    Foo * value);
+VALA_EXTERN Manam* manam_new (void);
+VALA_EXTERN Manam* manam_construct (GType object_type);
+static gboolean _foo_equal (const Foo * s1,
+                     const Foo * s2);
+static void manam_finalize (GObject * obj);
+static GType manam_get_type_once (void);
+static void _vala_manam_get_property (GObject * object,
+                               guint property_id,
+                               GValue * value,
+                               GParamSpec * pspec);
+static void _vala_manam_set_property (GObject * object,
+                               guint property_id,
+                               const GValue * value,
+                               GParamSpec * pspec);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+VALA_EXTERN void bar_set_foo (Bar* self,
+                  Foo * value);
+VALA_EXTERN void bar_get_foo (Bar* self,
+                  Foo * result);
+static void bar_finalize (GObject * obj);
+static GType bar_get_type_once (void);
+static void _vala_bar_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_bar_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec);
+static void _vala_main (void);
+
+void
+foo_copy (const Foo* self,
+          Foo* dest)
+{
+       const gchar* _tmp0_;
+       gchar* _tmp1_;
+       _tmp0_ = (*self).s;
+       _tmp1_ = g_strdup (_tmp0_);
+       _g_free0 ((*dest).s);
+       (*dest).s = _tmp1_;
+}
+
+void
+foo_destroy (Foo* self)
+{
+       _g_free0 ((*self).s);
+}
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       foo_copy (self, dup);
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       foo_destroy (self);
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static gpointer
+_foo_dup0 (gpointer self)
+{
+       return self ? foo_dup (self) : NULL;
+}
+
+Foo*
+get_foo (void)
+{
+       gchar* _tmp0_;
+       Foo _tmp1_ = {0};
+       Foo _tmp2_;
+       Foo* _tmp3_;
+       Foo* _tmp4_;
+       Foo* result = NULL;
+       _tmp0_ = g_strdup ("foo");
+       _g_free0 (_tmp1_.s);
+       _tmp1_.s = _tmp0_;
+       _tmp2_ = _tmp1_;
+       _tmp3_ = _foo_dup0 (&_tmp2_);
+       _tmp4_ = _tmp3_;
+       foo_destroy (&_tmp2_);
+       result = _tmp4_;
+       return result;
+}
+
+static inline gpointer
+manam_get_instance_private (Manam* self)
+{
+       return G_STRUCT_MEMBER_P (self, Manam_private_offset);
+}
+
+Manam*
+manam_construct (GType object_type)
+{
+       Manam * self = NULL;
+       self = (Manam*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Manam*
+manam_new (void)
+{
+       return manam_construct (TYPE_MANAM);
+}
+
+void
+manam_get_faz (Manam* self,
+               Foo * result)
+{
+       ManamClass* _klass_;
+       g_return_if_fail (IS_MANAM (self));
+       _klass_ = MANAM_GET_CLASS (self);
+       if (_klass_->get_faz) {
+               _klass_->get_faz (self, result);
+       }
+       return;
+}
+
+static void
+manam_real_get_faz (Manam* base,
+                    Foo * result)
+{
+       Manam* self;
+       Foo _tmp0_;
+       self = base;
+       _tmp0_ = self->priv->_faz;
+       *result = _tmp0_;
+       return;
+}
+
+void
+manam_set_faz (Manam* self,
+               Foo * value)
+{
+       ManamClass* _klass_;
+       g_return_if_fail (IS_MANAM (self));
+       _klass_ = MANAM_GET_CLASS (self);
+       if (_klass_->set_faz) {
+               _klass_->set_faz (self, value);
+       }
+}
+
+static gboolean
+_foo_equal (const Foo * s1,
+            const Foo * s2)
+{
+       if (s1 == s2) {
+               return TRUE;
+       }
+       if (s1 == NULL) {
+               return FALSE;
+       }
+       if (s2 == NULL) {
+               return FALSE;
+       }
+       if (g_strcmp0 (s1->s, s2->s)) {
+               return FALSE;
+       }
+       return TRUE;
+}
+
+static void
+manam_real_set_faz (Manam* base,
+                    Foo * value)
+{
+       Manam* self;
+       Foo old_value;
+       self = base;
+       manam_real_get_faz (base, &old_value);
+       if (_foo_equal (value, &old_value) != TRUE) {
+               Foo _tmp0_;
+               Foo _tmp1_;
+               Foo _tmp2_ = {0};
+               _tmp0_ = *value;
+               _tmp1_ = _tmp0_;
+               foo_copy (&_tmp1_, &_tmp2_);
+               foo_destroy (&self->priv->_faz);
+               self->priv->_faz = _tmp2_;
+               g_object_notify_by_pspec ((GObject *) self, manam_properties[MANAM_FAZ_PROPERTY]);
+       }
+}
+
+static void
+manam_class_init (ManamClass * klass,
+                  gpointer klass_data)
+{
+       manam_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Manam_private_offset);
+       MANAM_CLASS (klass)->get_faz = manam_real_get_faz;
+       MANAM_CLASS (klass)->set_faz = manam_real_set_faz;
+       G_OBJECT_CLASS (klass)->get_property = _vala_manam_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_manam_set_property;
+       G_OBJECT_CLASS (klass)->finalize = manam_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), MANAM_FAZ_PROPERTY, 
manam_properties[MANAM_FAZ_PROPERTY] = g_param_spec_boxed ("faz", "faz", "faz", TYPE_FOO, 
G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+}
+
+static void
+manam_instance_init (Manam * self,
+                     gpointer klass)
+{
+       self->priv = manam_get_instance_private (self);
+}
+
+static void
+manam_finalize (GObject * obj)
+{
+       Manam * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_MANAM, Manam);
+       foo_destroy (&self->priv->_faz);
+       G_OBJECT_CLASS (manam_parent_class)->finalize (obj);
+}
+
+static GType
+manam_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (ManamClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) manam_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Manam), 
0, (GInstanceInitFunc) manam_instance_init, NULL };
+       GType manam_type_id;
+       manam_type_id = g_type_register_static (G_TYPE_OBJECT, "Manam", &g_define_type_info, 0);
+       Manam_private_offset = g_type_add_instance_private (manam_type_id, sizeof (ManamPrivate));
+       return manam_type_id;
+}
+
+GType
+manam_get_type (void)
+{
+       static volatile gsize manam_type_id__volatile = 0;
+       if (g_once_init_enter (&manam_type_id__volatile)) {
+               GType manam_type_id;
+               manam_type_id = manam_get_type_once ();
+               g_once_init_leave (&manam_type_id__volatile, manam_type_id);
+       }
+       return manam_type_id__volatile;
+}
+
+static void
+_vala_manam_get_property (GObject * object,
+                          guint property_id,
+                          GValue * value,
+                          GParamSpec * pspec)
+{
+       Manam * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_MANAM, Manam);
+       switch (property_id) {
+               case MANAM_FAZ_PROPERTY:
+               {
+                       Foo boxed;
+                       manam_get_faz (self, &boxed);
+                       g_value_set_boxed (value, &boxed);
+               }
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_manam_set_property (GObject * object,
+                          guint property_id,
+                          const GValue * value,
+                          GParamSpec * pspec)
+{
+       Manam * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_MANAM, Manam);
+       switch (property_id) {
+               case MANAM_FAZ_PROPERTY:
+               manam_set_faz (self, g_value_get_boxed (value));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static inline gpointer
+bar_get_instance_private (Bar* self)
+{
+       return G_STRUCT_MEMBER_P (self, Bar_private_offset);
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar * self = NULL;
+       self = (Bar*) manam_construct (object_type);
+       {
+               Foo* _tmp0_;
+               Foo* _tmp1_;
+               Foo _tmp2_;
+               _tmp0_ = get_foo ();
+               _tmp1_ = _tmp0_;
+               _tmp2_ = *_tmp1_;
+               bar_set_foo (self, &_tmp2_);
+               _foo_free0 (_tmp1_);
+       }
+       {
+               Foo* _tmp3_;
+               Foo* _tmp4_;
+               Foo _tmp5_;
+               _tmp3_ = get_foo ();
+               _tmp4_ = _tmp3_;
+               _tmp5_ = *_tmp4_;
+               MANAM_CLASS (bar_parent_class)->set_faz (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_MANAM, 
Manam), &_tmp5_);
+               _foo_free0 (_tmp4_);
+       }
+       {
+               Foo* _tmp6_;
+               Foo _tmp7_;
+               _tmp6_ = get_foo ();
+               _tmp7_ = (Foo) (*_tmp6_);
+               bar_set_foo (self, &_tmp7_);
+               foo_destroy (&_tmp7_);
+               _g_free0 (_tmp6_);
+       }
+       {
+               Foo* _tmp8_;
+               Foo _tmp9_;
+               _tmp8_ = get_foo ();
+               _tmp9_ = (Foo) (*_tmp8_);
+               MANAM_CLASS (bar_parent_class)->set_faz (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_MANAM, 
Manam), &_tmp9_);
+               foo_destroy (&_tmp9_);
+               _g_free0 (_tmp8_);
+       }
+       {
+               Foo* _tmp10_;
+               Foo _tmp11_;
+               _tmp10_ = get_foo ();
+               _tmp11_ = (Foo) (*_tmp10_);
+               bar_set_foo (self, &_tmp11_);
+               foo_destroy (&_tmp11_);
+               _g_free0 (_tmp10_);
+       }
+       {
+               Foo* _tmp12_;
+               Foo _tmp13_;
+               _tmp12_ = get_foo ();
+               _tmp13_ = (Foo) (*_tmp12_);
+               MANAM_CLASS (bar_parent_class)->set_faz (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_MANAM, 
Manam), &_tmp13_);
+               foo_destroy (&_tmp13_);
+               _g_free0 (_tmp12_);
+       }
+       {
+               Foo* f = NULL;
+               Foo* _tmp14_;
+               Foo _tmp15_;
+               _tmp14_ = get_foo ();
+               f = _tmp14_;
+               _tmp15_ = (Foo) (*f);
+               bar_set_foo (self, &_tmp15_);
+               _foo_free0 (f);
+       }
+       {
+               Foo* f = NULL;
+               Foo* _tmp16_;
+               Foo _tmp17_;
+               _tmp16_ = get_foo ();
+               f = _tmp16_;
+               _tmp17_ = (Foo) (*f);
+               MANAM_CLASS (bar_parent_class)->set_faz (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_MANAM, 
Manam), &_tmp17_);
+               _foo_free0 (f);
+       }
+       {
+               Foo* f = NULL;
+               Foo* _tmp18_;
+               Foo _tmp19_;
+               _tmp18_ = get_foo ();
+               f = _tmp18_;
+               _tmp19_ = (Foo) (*f);
+               bar_set_foo (self, &_tmp19_);
+               _foo_free0 (f);
+       }
+       {
+               Foo* f = NULL;
+               Foo* _tmp20_;
+               Foo _tmp21_;
+               _tmp20_ = get_foo ();
+               f = _tmp20_;
+               _tmp21_ = (Foo) (*f);
+               MANAM_CLASS (bar_parent_class)->set_faz (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_MANAM, 
Manam), &_tmp21_);
+               _foo_free0 (f);
+       }
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+void
+bar_get_foo (Bar* self,
+             Foo * result)
+{
+       Foo _tmp0_;
+       g_return_if_fail (IS_BAR (self));
+       _tmp0_ = self->priv->_foo;
+       *result = _tmp0_;
+       return;
+}
+
+void
+bar_set_foo (Bar* self,
+             Foo * value)
+{
+       Foo old_value;
+       g_return_if_fail (IS_BAR (self));
+       bar_get_foo (self, &old_value);
+       if (_foo_equal (value, &old_value) != TRUE) {
+               Foo _tmp0_;
+               Foo _tmp1_;
+               Foo _tmp2_ = {0};
+               _tmp0_ = *value;
+               _tmp1_ = _tmp0_;
+               foo_copy (&_tmp1_, &_tmp2_);
+               foo_destroy (&self->priv->_foo);
+               self->priv->_foo = _tmp2_;
+               g_object_notify_by_pspec ((GObject *) self, bar_properties[BAR_FOO_PROPERTY]);
+       }
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Bar_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_bar_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_bar_set_property;
+       G_OBJECT_CLASS (klass)->finalize = bar_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), BAR_FOO_PROPERTY, 
bar_properties[BAR_FOO_PROPERTY] = g_param_spec_boxed ("foo", "foo", "foo", TYPE_FOO, G_PARAM_STATIC_STRINGS 
| G_PARAM_READABLE | G_PARAM_WRITABLE));
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+       self->priv = bar_get_instance_private (self);
+}
+
+static void
+bar_finalize (GObject * obj)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       foo_destroy (&self->priv->_foo);
+       G_OBJECT_CLASS (bar_parent_class)->finalize (obj);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (TYPE_MANAM, "Bar", &g_define_type_info, 0);
+       Bar_private_offset = g_type_add_instance_private (bar_type_id, sizeof (BarPrivate));
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_bar_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_BAR, Bar);
+       switch (property_id) {
+               case BAR_FOO_PROPERTY:
+               {
+                       Foo boxed;
+                       bar_get_foo (self, &boxed);
+                       g_value_set_boxed (value, &boxed);
+               }
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_bar_set_property (GObject * object,
+                        guint property_id,
+                        const GValue * value,
+                        GParamSpec * pspec)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_BAR, Bar);
+       switch (property_id) {
+               case BAR_FOO_PROPERTY:
+               bar_set_foo (self, g_value_get_boxed (value));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Bar* bar = NULL;
+       Bar* _tmp0_;
+       _tmp0_ = bar_new ();
+       bar = _tmp0_;
+       _g_object_unref0 (bar);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/property-simple-type-struct-nullable.c-expected 
b/tests/objects/property-simple-type-struct-nullable.c-expected
new file mode 100644
index 000000000..dc3d505d4
--- /dev/null
+++ b/tests/objects/property-simple-type-struct-nullable.c-expected
@@ -0,0 +1,221 @@
+/* objects_property_simple_type_struct_nullable.c generated by valac, the Vala compiler
+ * generated from objects_property_simple_type_struct_nullable.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_free0(var) ((var == NULL) ? NULL : (var = (g_free (var), NULL)))
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _FooPrivate {
+       gboolean* _bar;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+VALA_EXTERN gboolean* foo_get_bar (Foo* self);
+static gboolean* _bool_dup (gboolean* self);
+VALA_EXTERN void foo_set_bar (Foo* self,
+                  gboolean* value);
+static void foo_finalize (GObject * obj);
+static GType foo_get_type_once (void);
+static void _vala_foo_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_foo_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec);
+static void _vala_main (void);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static gboolean*
+_bool_dup (gboolean* self)
+{
+       gboolean* dup;
+       dup = g_new0 (gboolean, 1);
+       memcpy (dup, self, sizeof (gboolean));
+       return dup;
+}
+
+static gpointer
+__bool_dup0 (gpointer self)
+{
+       return self ? _bool_dup (self) : NULL;
+}
+
+gboolean*
+foo_get_bar (Foo* self)
+{
+       gboolean* result;
+       gboolean* _tmp0_;
+       gboolean* _tmp1_;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = self->priv->_bar;
+       _tmp1_ = __bool_dup0 (_tmp0_);
+       result = _tmp1_;
+       return result;
+}
+
+void
+foo_set_bar (Foo* self,
+             gboolean* value)
+{
+       gboolean* _tmp0_;
+       g_return_if_fail (IS_FOO (self));
+       _tmp0_ = __bool_dup0 (value);
+       _g_free0 (self->priv->_bar);
+       self->priv->_bar = _tmp0_;
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_foo_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_foo_set_property;
+       G_OBJECT_CLASS (klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+}
+
+static void
+foo_finalize (GObject * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       _g_free0 (self->priv->_bar);
+       G_OBJECT_CLASS (foo_parent_class)->finalize (obj);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_foo_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_foo_set_property (GObject * object,
+                        guint property_id,
+                        const GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/property-static.c-expected b/tests/objects/property-static.c-expected
new file mode 100644
index 000000000..0eb0c5771
--- /dev/null
+++ b/tests/objects/property-static.c-expected
@@ -0,0 +1,420 @@
+/* objects_property_static.c generated by valac, the Vala compiler
+ * generated from objects_property_static.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+#define TYPE_BAR (bar_get_type ())
+typedef struct _Bar Bar;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+struct _Bar {
+       gint foo;
+};
+
+static gpointer foo_parent_class = NULL;
+static gint foo__bar;
+static gint foo__bar = 0;
+static gint foo__baz;
+static gint foo__baz = 0;
+static gint foo__boo;
+static gint foo__boo = 0;
+VALA_EXTERN gint bar__bar;
+gint bar__bar = 0;
+VALA_EXTERN gint bar__baz;
+gint bar__baz = 0;
+VALA_EXTERN gint bar__boo;
+gint bar__boo = 0;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+VALA_EXTERN gint foo_get_bar (void);
+VALA_EXTERN void foo_set_bar (gint value);
+VALA_EXTERN void foo_set_baz (gint value);
+VALA_EXTERN void foo_set_boo (gint value);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Bar* bar_dup (const Bar* self);
+VALA_EXTERN void bar_free (Bar* self);
+VALA_EXTERN gint bar_get_bar (void);
+VALA_EXTERN void bar_set_bar (gint value);
+VALA_EXTERN void bar_set_baz (gint value);
+VALA_EXTERN void bar_set_boo (gint value);
+static void _vala_main (void);
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+gint
+foo_get_bar (void)
+{
+       g_assert_not_reached ();
+}
+
+void
+foo_set_bar (gint value)
+{
+       foo__bar = value;
+       _vala_assert (foo__bar == 23, "_bar == 23");
+}
+
+void
+foo_set_baz (gint value)
+{
+       foo__baz = value;
+       _vala_assert (foo__baz == 42, "_baz == 42");
+}
+
+void
+foo_set_boo (gint value)
+{
+       foo__boo = value;
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+gint
+bar_get_bar (void)
+{
+       g_assert_not_reached ();
+}
+
+void
+bar_set_bar (gint value)
+{
+       bar__bar = value;
+       _vala_assert (bar__bar == 23, "_bar == 23");
+}
+
+void
+bar_set_baz (gint value)
+{
+       bar__baz = value;
+       _vala_assert (bar__baz == 42, "_baz == 42");
+}
+
+void
+bar_set_boo (gint value)
+{
+       bar__boo = value;
+}
+
+Bar*
+bar_dup (const Bar* self)
+{
+       Bar* dup;
+       dup = g_new0 (Bar, 1);
+       memcpy (dup, self, sizeof (Bar));
+       return dup;
+}
+
+void
+bar_free (Bar* self)
+{
+       g_free (self);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       GType bar_type_id;
+       bar_type_id = g_boxed_type_register_static ("Bar", (GBoxedCopyFunc) bar_dup, (GBoxedFreeFunc) 
bar_free);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       foo_set_bar (23);
+       foo_set_baz (42);
+       foo_set_boo (4711);
+       bar_set_bar (23);
+       bar_set_baz (42);
+       bar_set_boo (4711);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/property-struct-no-gtype.c-expected 
b/tests/objects/property-struct-no-gtype.c-expected
new file mode 100644
index 000000000..d7f7faafd
--- /dev/null
+++ b/tests/objects/property-struct-no-gtype.c-expected
@@ -0,0 +1,242 @@
+/* objects_property_struct_no_gtype.c generated by valac, the Vala compiler
+ * generated from objects_property_struct_no_gtype.vala, do not modify */
+
+#include <glib.h>
+#include <string.h>
+#include <glib-object.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef struct _Bar Bar;
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Bar {
+       gint i;
+};
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _FooPrivate {
+       Bar _bar;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN Bar* bar_dup (const Bar* self);
+VALA_EXTERN void bar_free (Bar* self);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+VALA_EXTERN void foo_get_bar (Foo* self,
+                  Bar * result);
+VALA_EXTERN void foo_set_bar (Foo* self,
+                  Bar * value);
+static void foo_finalize (GObject * obj);
+static GType foo_get_type_once (void);
+static void _vala_foo_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_foo_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec);
+static void _vala_main (void);
+
+Bar*
+bar_dup (const Bar* self)
+{
+       Bar* dup;
+       dup = g_new0 (Bar, 1);
+       memcpy (dup, self, sizeof (Bar));
+       return dup;
+}
+
+void
+bar_free (Bar* self)
+{
+       g_free (self);
+}
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+void
+foo_get_bar (Foo* self,
+             Bar * result)
+{
+       Bar _tmp0_;
+       g_return_if_fail (IS_FOO (self));
+       _tmp0_ = self->priv->_bar;
+       *result = _tmp0_;
+       return;
+}
+
+void
+foo_set_bar (Foo* self,
+             Bar * value)
+{
+       Bar _tmp0_;
+       g_return_if_fail (IS_FOO (self));
+       _tmp0_ = *value;
+       self->priv->_bar = _tmp0_;
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_foo_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_foo_set_property;
+       G_OBJECT_CLASS (klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+}
+
+static void
+foo_finalize (GObject * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       G_OBJECT_CLASS (foo_parent_class)->finalize (obj);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_foo_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_foo_set_property (GObject * object,
+                        guint property_id,
+                        const GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       Bar _tmp1_ = {0};
+       Bar _tmp2_ = {0};
+       Bar _tmp3_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       _tmp1_.i = 23;
+       foo_set_bar (foo, &_tmp1_);
+       foo_get_bar (foo, &_tmp2_);
+       _tmp3_ = _tmp2_;
+       _vala_assert (_tmp3_.i == 23, "foo.bar.i == 23");
+       _g_object_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/regex.c-expected b/tests/objects/regex.c-expected
new file mode 100644
index 000000000..073c7238e
--- /dev/null
+++ b/tests/objects/regex.c-expected
@@ -0,0 +1,616 @@
+/* objects_regex.c generated by valac, the Vala compiler
+ * generated from objects_regex.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TEST, TestClass))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define IS_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TEST))
+#define TEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TEST, TestClass))
+
+typedef struct _Test Test;
+typedef struct _TestClass TestClass;
+typedef struct _TestPrivate TestPrivate;
+enum  {
+       TEST_0_PROPERTY,
+       TEST_NUM_PROPERTIES
+};
+static GParamSpec* test_properties[TEST_NUM_PROPERTIES];
+enum  {
+       TEST_REGEX_TEST_SIGNAL,
+       TEST_NUM_SIGNALS
+};
+static guint test_signals[TEST_NUM_SIGNALS] = {0};
+typedef struct _Block1Data Block1Data;
+#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
+#define _g_match_info_unref0(var) ((var == NULL) ? NULL : (var = (g_match_info_unref (var), NULL)))
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Test {
+       GObject parent_instance;
+       TestPrivate * priv;
+};
+
+struct _TestClass {
+       GObjectClass parent_class;
+};
+
+struct _Block1Data {
+       int _ref_count_;
+       GMatchInfo* info;
+       GRegex* rc;
+};
+
+static gpointer test_parent_class = NULL;
+
+VALA_EXTERN GRegex* get_from_array (gint index);
+VALA_EXTERN GRegex* get_fixed (void);
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
+VALA_EXTERN void test_run (Test* self,
+               const gchar* s);
+VALA_EXTERN Test* test_new (void);
+VALA_EXTERN Test* test_construct (GType object_type);
+static GType test_get_type_once (void);
+static void _vala_main (void);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static void __lambda4_ (Block1Data* _data1_,
+                 const gchar* s);
+static void ___lambda4__test_regex_test (Test* _sender,
+                                  const gchar* str,
+                                  gpointer self);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static GRegex* _tmp_regex_0 = NULL;
+static GRegex* _tmp_regex_1 = NULL;
+static GRegex* _tmp_regex_2 = NULL;
+static GRegex* _tmp_regex_3 = NULL;
+static GRegex* _tmp_regex_4 = NULL;
+static GRegex* _tmp_regex_5 = NULL;
+static GRegex* _tmp_regex_6 = NULL;
+static GRegex* _tmp_regex_7 = NULL;
+static GRegex* _tmp_regex_8 = NULL;
+static GRegex* _tmp_regex_9 = NULL;
+static GRegex* _tmp_regex_10 = NULL;
+static GRegex* _tmp_regex_11 = NULL;
+
+static inline GRegex*
+_thread_safe_regex_init (GRegex** re,
+                         const gchar * pattern,
+                         GRegexCompileFlags compile_flags)
+{
+       if (g_once_init_enter ((volatile gsize*) re)) {
+               GRegex* val = g_regex_new (pattern, compile_flags, 0, NULL);
+               g_once_init_leave ((volatile gsize*) re, (gsize) val);
+       }
+       return *re;
+}
+
+static gpointer
+_g_regex_ref0 (gpointer self)
+{
+       return self ? g_regex_ref (self) : NULL;
+}
+
+GRegex*
+get_from_array (gint index)
+{
+       GRegex** arr = NULL;
+       GRegex* _tmp0_;
+       GRegex* _tmp1_;
+       GRegex* _tmp2_;
+       GRegex* _tmp3_;
+       GRegex** _tmp4_;
+       gint arr_length1;
+       gint _arr_size_;
+       gint _tmp5_;
+       GRegex* _tmp6_;
+       GRegex* _tmp7_;
+       GRegex* result = NULL;
+       _tmp0_ = _g_regex_ref0 (_thread_safe_regex_init (&_tmp_regex_0, "(\\d+\\.\\d+\\.\\d+)", 0));
+       _tmp1_ = _g_regex_ref0 (_thread_safe_regex_init (&_tmp_regex_1, "(\\d+)\\.\\d+\\.\\d+", 0));
+       _tmp2_ = _g_regex_ref0 (_thread_safe_regex_init (&_tmp_regex_2, "\\d+\\.(\\d+)\\.\\d+", 0));
+       _tmp3_ = _g_regex_ref0 (_thread_safe_regex_init (&_tmp_regex_3, "(\\d+)\\.\\d+\\.(\\d+)", 0));
+       _tmp4_ = g_new0 (GRegex*, 4 + 1);
+       _tmp4_[0] = _tmp0_;
+       _tmp4_[1] = _tmp1_;
+       _tmp4_[2] = _tmp2_;
+       _tmp4_[3] = _tmp3_;
+       arr = _tmp4_;
+       arr_length1 = 4;
+       _arr_size_ = arr_length1;
+       _tmp5_ = index;
+       _vala_assert ((0 <= _tmp5_) && (_tmp5_ <= 3), "0 <= index <= 3");
+       _tmp6_ = arr[index];
+       _tmp7_ = _g_regex_ref0 (_tmp6_);
+       result = _tmp7_;
+       arr = (_vala_array_free (arr, arr_length1, (GDestroyNotify) g_regex_unref), NULL);
+       return result;
+}
+
+GRegex*
+get_fixed (void)
+{
+       GRegex* _tmp0_;
+       GRegex* result = NULL;
+       _tmp0_ = _g_regex_ref0 (_thread_safe_regex_init (&_tmp_regex_4, "(is.*ip)", 0));
+       result = _tmp0_;
+       return result;
+}
+
+void
+test_run (Test* self,
+          const gchar* s)
+{
+       g_return_if_fail (IS_TEST (self));
+       g_return_if_fail (s != NULL);
+       g_signal_emit (self, test_signals[TEST_REGEX_TEST_SIGNAL], 0, s);
+}
+
+Test*
+test_construct (GType object_type)
+{
+       Test * self = NULL;
+       self = (Test*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Test*
+test_new (void)
+{
+       return test_construct (TYPE_TEST);
+}
+
+static void
+test_class_init (TestClass * klass,
+                 gpointer klass_data)
+{
+       test_parent_class = g_type_class_peek_parent (klass);
+       test_signals[TEST_REGEX_TEST_SIGNAL] = g_signal_new ("regex-test", TYPE_TEST, G_SIGNAL_RUN_LAST, 0, 
NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
+}
+
+static void
+test_instance_init (Test * self,
+                    gpointer klass)
+{
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (TestClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Test), 
0, (GInstanceInitFunc) test_instance_init, NULL };
+       GType test_type_id;
+       test_type_id = g_type_register_static (G_TYPE_OBJECT, "Test", &g_define_type_info, 0);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               _g_regex_unref0 (_data1_->rc);
+               _g_match_info_unref0 (_data1_->info);
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static void
+__lambda4_ (Block1Data* _data1_,
+            const gchar* s)
+{
+       GMatchInfo* _tmp0_ = NULL;
+       gboolean _tmp1_;
+       GMatchInfo* _tmp7_ = NULL;
+       gboolean _tmp8_;
+       g_return_if_fail (s != NULL);
+       _tmp1_ = g_regex_match (_data1_->rc, s, 0, &_tmp0_);
+       _g_match_info_unref0 (_data1_->info);
+       _data1_->info = _tmp0_;
+       if (_tmp1_) {
+               FILE* _tmp2_;
+               GMatchInfo* _tmp3_;
+               gchar* _tmp4_;
+               gchar* _tmp5_;
+               _tmp2_ = stdout;
+               _tmp3_ = _data1_->info;
+               _tmp4_ = g_match_info_fetch (_tmp3_, 1);
+               _tmp5_ = _tmp4_;
+               fprintf (_tmp2_, "Lambda (closure var.): %s -> %s\n", s, _tmp5_);
+               _g_free0 (_tmp5_);
+       } else {
+               FILE* _tmp6_;
+               _tmp6_ = stdout;
+               fprintf (_tmp6_, "Does not match.\n");
+       }
+       _tmp8_ = g_regex_match (_thread_safe_regex_init (&_tmp_regex_11, "foo(bar)", 0 | G_REGEX_CASELESS), 
s, 0, &_tmp7_);
+       _g_match_info_unref0 (_data1_->info);
+       _data1_->info = _tmp7_;
+       if (_tmp8_) {
+               FILE* _tmp9_;
+               GMatchInfo* _tmp10_;
+               gchar* _tmp11_;
+               gchar* _tmp12_;
+               _tmp9_ = stdout;
+               _tmp10_ = _data1_->info;
+               _tmp11_ = g_match_info_fetch (_tmp10_, 1);
+               _tmp12_ = _tmp11_;
+               fprintf (_tmp9_, "Lambda (lit.): %s -> %s\n", s, _tmp12_);
+               _g_free0 (_tmp12_);
+       } else {
+               FILE* _tmp13_;
+               _tmp13_ = stdout;
+               fprintf (_tmp13_, "Does not match.\n");
+       }
+}
+
+static void
+___lambda4__test_regex_test (Test* _sender,
+                             const gchar* str,
+                             gpointer self)
+{
+       __lambda4_ (self, str);
+}
+
+static void
+_vala_main (void)
+{
+       Block1Data* _data1_;
+       gchar* str1 = NULL;
+       gchar* _tmp0_;
+       GRegex* _tmp1_;
+       GRegex* _tmp2_;
+       const gchar* _tmp3_;
+       GMatchInfo* _tmp4_ = NULL;
+       gboolean _tmp5_;
+       gboolean _tmp6_;
+       gchar* str2 = NULL;
+       gchar* _tmp13_;
+       const gchar* _tmp14_;
+       GMatchInfo* _tmp15_ = NULL;
+       gboolean _tmp16_;
+       gchar* ts = NULL;
+       gchar* _tmp24_;
+       const gchar* _tmp25_;
+       GMatchInfo* _tmp26_ = NULL;
+       gboolean _tmp27_;
+       GRegex* r = NULL;
+       GRegex* r1 = NULL;
+       GRegex* r2 = NULL;
+       GRegex* _tmp56_ = NULL;
+       GRegex* _tmp57_;
+       GRegex* _tmp60_;
+       GRegex* _tmp61_;
+       GMatchInfo* _tmp62_ = NULL;
+       gboolean _tmp63_;
+       GRegex* _tmp70_;
+       Test* test = NULL;
+       Test* _tmp71_;
+       GError* _inner_error0_ = NULL;
+       _data1_ = g_slice_new0 (Block1Data);
+       _data1_->_ref_count_ = 1;
+       _tmp0_ = g_strdup ("mississippi");
+       str1 = _tmp0_;
+       _tmp1_ = get_fixed ();
+       _tmp2_ = _tmp1_;
+       _tmp3_ = str1;
+       _tmp5_ = g_regex_match (_tmp2_, _tmp3_, 0, &_tmp4_);
+       _g_match_info_unref0 (_data1_->info);
+       _data1_->info = _tmp4_;
+       _tmp6_ = _tmp5_;
+       _g_regex_unref0 (_tmp2_);
+       if (_tmp6_) {
+               FILE* _tmp7_;
+               const gchar* _tmp8_;
+               GMatchInfo* _tmp9_;
+               gchar* _tmp10_;
+               gchar* _tmp11_;
+               _tmp7_ = stdout;
+               _tmp8_ = str1;
+               _tmp9_ = _data1_->info;
+               _tmp10_ = g_match_info_fetch (_tmp9_, 1);
+               _tmp11_ = _tmp10_;
+               fprintf (_tmp7_, "Part of %s is '%s'...\n", _tmp8_, _tmp11_);
+               _g_free0 (_tmp11_);
+       } else {
+               FILE* _tmp12_;
+               _tmp12_ = stdout;
+               fprintf (_tmp12_, "Did not match at all.\n");
+       }
+       _tmp13_ = g_strdup ("demonStration");
+       str2 = _tmp13_;
+       _tmp14_ = str2;
+       _tmp16_ = g_regex_match (_thread_safe_regex_init (&_tmp_regex_5, "mon(str.*o)n", 0 | 
G_REGEX_CASELESS), _tmp14_, 0, &_tmp15_);
+       _g_match_info_unref0 (_data1_->info);
+       _data1_->info = _tmp15_;
+       if (_tmp16_) {
+               FILE* _tmp17_;
+               const gchar* _tmp18_;
+               GMatchInfo* _tmp19_;
+               gchar* _tmp20_;
+               gchar* _tmp21_;
+               _tmp17_ = stdout;
+               _tmp18_ = str2;
+               _tmp19_ = _data1_->info;
+               _tmp20_ = g_match_info_fetch (_tmp19_, 1);
+               _tmp21_ = _tmp20_;
+               fprintf (_tmp17_, "Part of %s is '%s'...\n", _tmp18_, _tmp21_);
+               _g_free0 (_tmp21_);
+       } else {
+               FILE* _tmp22_;
+               const gchar* _tmp23_;
+               _tmp22_ = stdout;
+               _tmp23_ = str2;
+               fprintf (_tmp22_, "%s did not match at all.\n", _tmp23_);
+       }
+       _tmp24_ = g_strdup ("Time: 10:42:12");
+       ts = _tmp24_;
+       _tmp25_ = ts;
+       _tmp27_ = g_regex_match (_thread_safe_regex_init (&_tmp_regex_6, "Time: (..):(..):(..)", 0), _tmp25_, 
0, &_tmp26_);
+       _g_match_info_unref0 (_data1_->info);
+       _data1_->info = _tmp26_;
+       if (_tmp27_) {
+               FILE* _tmp28_;
+               const gchar* _tmp29_;
+               GMatchInfo* _tmp30_;
+               gchar* _tmp31_;
+               gchar* _tmp32_;
+               GMatchInfo* _tmp33_;
+               gchar* _tmp34_;
+               gchar* _tmp35_;
+               GMatchInfo* _tmp36_;
+               gchar* _tmp37_;
+               gchar* _tmp38_;
+               _tmp28_ = stdout;
+               _tmp29_ = ts;
+               _tmp30_ = _data1_->info;
+               _tmp31_ = g_match_info_fetch (_tmp30_, 1);
+               _tmp32_ = _tmp31_;
+               _tmp33_ = _data1_->info;
+               _tmp34_ = g_match_info_fetch (_tmp33_, 2);
+               _tmp35_ = _tmp34_;
+               _tmp36_ = _data1_->info;
+               _tmp37_ = g_match_info_fetch (_tmp36_, 3);
+               _tmp38_ = _tmp37_;
+               fprintf (_tmp28_, "%s\n\thours = %s\n\tminutes = %s\n\tseconds = %s\n\n", _tmp29_, _tmp32_, 
_tmp35_, _tmp38_);
+               _g_free0 (_tmp38_);
+               _g_free0 (_tmp35_);
+               _g_free0 (_tmp32_);
+       }
+       {
+               gchar* str = NULL;
+               gchar* _tmp39_;
+               gchar* _tmp40_ = NULL;
+               gchar* _tmp41_;
+               FILE* _tmp42_;
+               _tmp39_ = g_strdup ("apple grape");
+               str = _tmp39_;
+               _tmp41_ = g_regex_replace (_thread_safe_regex_init (&_tmp_regex_7, "^([^ ]*) *([^ ]*)", 0), 
str, (gssize) -1, 0, "\\2 \\1", 0, &_inner_error0_);
+               _tmp40_ = _tmp41_;
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       _g_free0 (str);
+                       if (_inner_error0_->domain == G_REGEX_ERROR) {
+                               goto __catch0_g_regex_error;
+                       }
+                       _g_free0 (ts);
+                       _g_free0 (str2);
+                       _g_free0 (str1);
+                       block1_data_unref (_data1_);
+                       _data1_ = NULL;
+                       g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+               _tmp42_ = stdout;
+               fprintf (_tmp42_, "'%s' becomes '%s'\n", str, _tmp40_);
+               _g_free0 (_tmp40_);
+               _g_free0 (str);
+       }
+       goto __finally0;
+       __catch0_g_regex_error:
+       {
+               GError* err = NULL;
+               GError* _tmp43_;
+               const gchar* _tmp44_;
+               err = _inner_error0_;
+               _inner_error0_ = NULL;
+               _tmp43_ = err;
+               _tmp44_ = _tmp43_->message;
+               g_message ("objects_regex.vala:62: %s", _tmp44_);
+               _g_error_free0 (err);
+       }
+       __finally0:
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               _g_free0 (ts);
+               _g_free0 (str2);
+               _g_free0 (str1);
+               block1_data_unref (_data1_);
+               _data1_ = NULL;
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       {
+               gint i = 0;
+               i = 0;
+               {
+                       gboolean _tmp45_ = FALSE;
+                       _tmp45_ = TRUE;
+                       while (TRUE) {
+                               GRegex* _tmp47_;
+                               GRegex* _tmp48_;
+                               GMatchInfo* _tmp49_ = NULL;
+                               gboolean _tmp50_;
+                               gboolean _tmp51_;
+                               if (!_tmp45_) {
+                                       gint _tmp46_;
+                                       _tmp46_ = i;
+                                       i = _tmp46_ + 1;
+                               }
+                               _tmp45_ = FALSE;
+                               if (!(i < 4)) {
+                                       break;
+                               }
+                               _tmp47_ = get_from_array (i);
+                               _tmp48_ = _tmp47_;
+                               _tmp50_ = g_regex_match (_tmp48_, "23.3.2010", 0, &_tmp49_);
+                               _g_match_info_unref0 (_data1_->info);
+                               _data1_->info = _tmp49_;
+                               _tmp51_ = _tmp50_;
+                               _g_regex_unref0 (_tmp48_);
+                               if (_tmp51_) {
+                                       FILE* _tmp52_;
+                                       GMatchInfo* _tmp53_;
+                                       gchar* _tmp54_;
+                                       gchar* _tmp55_;
+                                       _tmp52_ = stdout;
+                                       _tmp53_ = _data1_->info;
+                                       _tmp54_ = g_match_info_fetch (_tmp53_, 1);
+                                       _tmp55_ = _tmp54_;
+                                       fprintf (_tmp52_, "Round %d: %s\n", i, _tmp55_);
+                                       _g_free0 (_tmp55_);
+                               }
+                       }
+               }
+       }
+       r = NULL;
+       r1 = NULL;
+       r2 = NULL;
+       _tmp57_ = r1;
+       _tmp56_ = _tmp57_;
+       if (_tmp56_ == NULL) {
+               GRegex* _tmp58_ = NULL;
+               GRegex* _tmp59_;
+               _tmp59_ = r2;
+               _tmp58_ = _tmp59_;
+               if (_tmp58_ == NULL) {
+                       _tmp58_ = _thread_safe_regex_init (&_tmp_regex_8, "match (this)", 0 | 
G_REGEX_CASELESS);
+               }
+               _tmp56_ = _tmp58_;
+       }
+       _tmp60_ = _g_regex_ref0 (_tmp56_);
+       _g_regex_unref0 (r);
+       r = _tmp60_;
+       _tmp61_ = r;
+       _tmp63_ = g_regex_match (_tmp61_, "match THIS", 0, &_tmp62_);
+       _g_match_info_unref0 (_data1_->info);
+       _data1_->info = _tmp62_;
+       if (_tmp63_) {
+               FILE* _tmp64_;
+               GMatchInfo* _tmp65_;
+               gchar* _tmp66_;
+               gchar* _tmp67_;
+               _tmp64_ = stdout;
+               _tmp65_ = _data1_->info;
+               _tmp66_ = g_match_info_fetch (_tmp65_, 1);
+               _tmp67_ = _tmp66_;
+               fprintf (_tmp64_, "Match: %s\n", _tmp67_);
+               _g_free0 (_tmp67_);
+       }
+       if (g_regex_match (_thread_safe_regex_init (&_tmp_regex_9, 
"\\.\\+\\(\\)\\-\\?\\/\\\"\\$\\[\\]\\*\\^", 0), ".+()-?/\"$[]*^", 0, NULL)) {
+               FILE* _tmp68_;
+               _tmp68_ = stdout;
+               fprintf (_tmp68_, "Matches\n");
+       } else {
+               FILE* _tmp69_;
+               _tmp69_ = stdout;
+               fprintf (_tmp69_, "Does not match.\n");
+       }
+       _tmp70_ = _g_regex_ref0 (_thread_safe_regex_init (&_tmp_regex_10, "foo(bar)", 0 | G_REGEX_CASELESS));
+       _data1_->rc = _tmp70_;
+       _tmp71_ = test_new ();
+       test = _tmp71_;
+       g_signal_connect_data (test, "regex-test", (GCallback) ___lambda4__test_regex_test, block1_data_ref 
(_data1_), (GClosureNotify) block1_data_unref, 0);
+       test_run (test, "fooBar");
+       test_run (test, "foobAr");
+       _g_object_unref0 (test);
+       _g_regex_unref0 (r2);
+       _g_regex_unref0 (r1);
+       _g_regex_unref0 (r);
+       _g_free0 (ts);
+       _g_free0 (str2);
+       _g_free0 (str1);
+       block1_data_unref (_data1_);
+       _data1_ = NULL;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/objects/signals-default-class-handler.c-expected 
b/tests/objects/signals-default-class-handler.c-expected
new file mode 100644
index 000000000..ebef4b852
--- /dev/null
+++ b/tests/objects/signals-default-class-handler.c-expected
@@ -0,0 +1,341 @@
+/* objects_signals_default_class_handler.c generated by valac, the Vala compiler
+ * generated from objects_signals_default_class_handler.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+enum  {
+       FOO_FOO_SIGNAL,
+       FOO_FOO_WITH_EMITTER_SIGNAL,
+       FOO_NUM_SIGNALS
+};
+static guint foo_signals[FOO_NUM_SIGNALS] = {0};
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+VALA_EXTERN gboolean success;
+gboolean success = FALSE;
+VALA_EXTERN gboolean success2;
+gboolean success2 = FALSE;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+static void foo_foo (Foo* self);
+static void foo_foo_with_emitter (Foo* self);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+foo_real_foo (Foo* self)
+{
+       g_return_if_fail (IS_FOO (self));
+       success = TRUE;
+}
+
+static void
+foo_real_foo_with_emitter (Foo* self)
+{
+       g_return_if_fail (IS_FOO (self));
+       success2 = TRUE;
+}
+
+void
+foo_foo_with_emitter (Foo* self)
+{
+       g_return_if_fail (IS_FOO (self));
+       g_signal_emit (self, foo_signals[FOO_FOO_WITH_EMITTER_SIGNAL], 0);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       foo_signals[FOO_FOO_SIGNAL] = g_signal_new_class_handler ("foo", TYPE_FOO, G_SIGNAL_RUN_LAST, 
(GCallback) foo_real_foo, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+       foo_signals[FOO_FOO_WITH_EMITTER_SIGNAL] = g_signal_new_class_handler ("foo-with-emitter", TYPE_FOO, 
G_SIGNAL_RUN_LAST, (GCallback) foo_real_foo_with_emitter, NULL, NULL, g_cclosure_marshal_VOID__VOID, 
G_TYPE_NONE, 0);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       g_signal_emit (foo, foo_signals[FOO_FOO_SIGNAL], 0);
+       _vala_assert (success, "success");
+       g_signal_emit (foo, foo_signals[FOO_FOO_WITH_EMITTER_SIGNAL], 0);
+       _vala_assert (success2, "success2");
+       _foo_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/signals-delegate-parameter.c-expected 
b/tests/objects/signals-delegate-parameter.c-expected
new file mode 100644
index 000000000..be8df91d9
--- /dev/null
+++ b/tests/objects/signals-delegate-parameter.c-expected
@@ -0,0 +1,473 @@
+/* objects_signals_delegate_parameter.c generated by valac, the Vala compiler
+ * generated from objects_signals_delegate_parameter.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef void (*FooFunc) (gpointer user_data);
+typedef void (*BarFunc) (void);
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+enum  {
+       FOO_DELEGATE_PARAM_NO_TARGET_SIGNAL,
+       FOO_DELEGATE_PARAM_WITH_TARGET_SIGNAL,
+       FOO_DELEGATE_PARAM_WITH_DESTROY_SIGNAL,
+       FOO_NUM_SIGNALS
+};
+static guint foo_signals[FOO_NUM_SIGNALS] = {0};
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+enum  {
+       BAR_0_PROPERTY,
+       BAR_NUM_PROPERTIES
+};
+static GParamSpec* bar_properties[BAR_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _Bar {
+       GObject parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       GObjectClass parent_class;
+};
+
+struct _BarPrivate {
+       Foo* foo;
+       gboolean success2;
+       gboolean success3;
+};
+
+static gpointer foo_parent_class = NULL;
+VALA_EXTERN gboolean success1;
+gboolean success1 = FALSE;
+static gint Bar_private_offset;
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void g_cclosure_user_marshal_VOID__POINTER_POINTER (GClosure * closure,
+                                                    GValue * return_value,
+                                                    guint n_param_values,
+                                                    const GValue * param_values,
+                                                    gpointer invocation_hint,
+                                                    gpointer marshal_data);
+static void g_cclosure_user_marshal_VOID__POINTER_POINTER_POINTER (GClosure * closure,
+                                                            GValue * return_value,
+                                                            guint n_param_values,
+                                                            const GValue * param_values,
+                                                            gpointer invocation_hint,
+                                                            gpointer marshal_data);
+static GType foo_get_type_once (void);
+VALA_EXTERN void no_target_cb (BarFunc f);
+VALA_EXTERN void with_target_cb (FooFunc f,
+                     gpointer f_target);
+VALA_EXTERN void with_destroy_cb (FooFunc f,
+                      gpointer f_target,
+                      GDestroyNotify f_target_destroy_notify);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+VALA_EXTERN void bar_test_no_target (Bar* self);
+static void _no_target_cb_foo_delegate_param_no_target (Foo* _sender,
+                                                 BarFunc f,
+                                                 gpointer self);
+static void __lambda4_ (void);
+static void ___lambda4__bar_func (void);
+VALA_EXTERN void bar_test_with_target (Bar* self);
+static void _with_target_cb_foo_delegate_param_with_target (Foo* _sender,
+                                                     FooFunc f,
+                                                     gpointer f_target,
+                                                     gpointer self);
+static void __lambda5_ (Bar* self);
+static void ___lambda5__foo_func (gpointer self);
+VALA_EXTERN void bar_test_with_destroy (Bar* self);
+static void _with_destroy_cb_foo_delegate_param_with_destroy (Foo* _sender,
+                                                       FooFunc f,
+                                                       gpointer f_target,
+                                                       GDestroyNotify f_target_destroy_notify,
+                                                       gpointer self);
+static void __lambda6_ (Bar* self);
+static void ___lambda6__foo_func (gpointer self);
+static void bar_finalize (GObject * obj);
+static GType bar_get_type_once (void);
+static void _vala_main (void);
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+g_cclosure_user_marshal_VOID__POINTER_POINTER (GClosure * closure,
+                                               GValue * return_value,
+                                               guint n_param_values,
+                                               const GValue * param_values,
+                                               gpointer invocation_hint,
+                                               gpointer marshal_data)
+{
+       typedef void (*GMarshalFunc_VOID__POINTER_POINTER) (gpointer data1, gpointer arg_1, gpointer arg_2, 
gpointer data2);
+       register GMarshalFunc_VOID__POINTER_POINTER callback;
+       register GCClosure * cc;
+       register gpointer data1;
+       register gpointer data2;
+       cc = (GCClosure *) closure;
+       g_return_if_fail (n_param_values == 3);
+       if (G_CCLOSURE_SWAP_DATA (closure)) {
+               data1 = closure->data;
+               data2 = param_values->data[0].v_pointer;
+       } else {
+               data1 = param_values->data[0].v_pointer;
+               data2 = closure->data;
+       }
+       callback = (GMarshalFunc_VOID__POINTER_POINTER) (marshal_data ? marshal_data : cc->callback);
+       callback (data1, g_value_get_pointer (param_values + 1), g_value_get_pointer (param_values + 2), 
data2);
+}
+
+static void
+g_cclosure_user_marshal_VOID__POINTER_POINTER_POINTER (GClosure * closure,
+                                                       GValue * return_value,
+                                                       guint n_param_values,
+                                                       const GValue * param_values,
+                                                       gpointer invocation_hint,
+                                                       gpointer marshal_data)
+{
+       typedef void (*GMarshalFunc_VOID__POINTER_POINTER_POINTER) (gpointer data1, gpointer arg_1, gpointer 
arg_2, GDestroyNotify arg_3, gpointer data2);
+       register GMarshalFunc_VOID__POINTER_POINTER_POINTER callback;
+       register GCClosure * cc;
+       register gpointer data1;
+       register gpointer data2;
+       cc = (GCClosure *) closure;
+       g_return_if_fail (n_param_values == 4);
+       if (G_CCLOSURE_SWAP_DATA (closure)) {
+               data1 = closure->data;
+               data2 = param_values->data[0].v_pointer;
+       } else {
+               data1 = param_values->data[0].v_pointer;
+               data2 = closure->data;
+       }
+       callback = (GMarshalFunc_VOID__POINTER_POINTER_POINTER) (marshal_data ? marshal_data : cc->callback);
+       callback (data1, g_value_get_pointer (param_values + 1), g_value_get_pointer (param_values + 2), 
g_value_get_pointer (param_values + 3), data2);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       foo_signals[FOO_DELEGATE_PARAM_NO_TARGET_SIGNAL] = g_signal_new ("delegate-param-no-target", 
TYPE_FOO, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER);
+       foo_signals[FOO_DELEGATE_PARAM_WITH_TARGET_SIGNAL] = g_signal_new ("delegate-param-with-target", 
TYPE_FOO, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__POINTER_POINTER, G_TYPE_NONE, 2, 
G_TYPE_POINTER, G_TYPE_POINTER);
+       foo_signals[FOO_DELEGATE_PARAM_WITH_DESTROY_SIGNAL] = g_signal_new ("delegate-param-with-destroy", 
TYPE_FOO, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__POINTER_POINTER_POINTER, 
G_TYPE_NONE, 3, G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_POINTER);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+void
+no_target_cb (BarFunc f)
+{
+       f ();
+}
+
+void
+with_target_cb (FooFunc f,
+                gpointer f_target)
+{
+       f (f_target);
+}
+
+void
+with_destroy_cb (FooFunc f,
+                 gpointer f_target,
+                 GDestroyNotify f_target_destroy_notify)
+{
+       f (f_target);
+       (f_target_destroy_notify == NULL) ? NULL : (f_target_destroy_notify (f_target), NULL);
+       f = NULL;
+       f_target = NULL;
+       f_target_destroy_notify = NULL;
+}
+
+static inline gpointer
+bar_get_instance_private (Bar* self)
+{
+       return G_STRUCT_MEMBER_P (self, Bar_private_offset);
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar * self = NULL;
+       Foo* _tmp0_;
+       self = (Bar*) g_object_new (object_type, NULL);
+       _tmp0_ = foo_new ();
+       _g_object_unref0 (self->priv->foo);
+       self->priv->foo = _tmp0_;
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+_no_target_cb_foo_delegate_param_no_target (Foo* _sender,
+                                            BarFunc f,
+                                            gpointer self)
+{
+       no_target_cb (f);
+}
+
+static void
+__lambda4_ (void)
+{
+       success1 = TRUE;
+}
+
+static void
+___lambda4__bar_func (void)
+{
+       __lambda4_ ();
+}
+
+void
+bar_test_no_target (Bar* self)
+{
+       Foo* _tmp0_;
+       Foo* _tmp1_;
+       g_return_if_fail (IS_BAR (self));
+       _tmp0_ = self->priv->foo;
+       g_signal_connect (_tmp0_, "delegate-param-no-target", (GCallback) 
_no_target_cb_foo_delegate_param_no_target, NULL);
+       _tmp1_ = self->priv->foo;
+       g_signal_emit (_tmp1_, foo_signals[FOO_DELEGATE_PARAM_NO_TARGET_SIGNAL], 0, ___lambda4__bar_func);
+       _vala_assert (success1, "success1");
+}
+
+static void
+_with_target_cb_foo_delegate_param_with_target (Foo* _sender,
+                                                FooFunc f,
+                                                gpointer f_target,
+                                                gpointer self)
+{
+       with_target_cb (f, f_target);
+}
+
+static void
+__lambda5_ (Bar* self)
+{
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (self, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"this.ref_count == 1");
+       self->priv->success2 = TRUE;
+}
+
+static void
+___lambda5__foo_func (gpointer self)
+{
+       __lambda5_ ((Bar*) self);
+}
+
+void
+bar_test_with_target (Bar* self)
+{
+       Foo* _tmp0_;
+       Foo* _tmp1_;
+       g_return_if_fail (IS_BAR (self));
+       _tmp0_ = self->priv->foo;
+       g_signal_connect (_tmp0_, "delegate-param-with-target", (GCallback) 
_with_target_cb_foo_delegate_param_with_target, NULL);
+       _tmp1_ = self->priv->foo;
+       g_signal_emit (_tmp1_, foo_signals[FOO_DELEGATE_PARAM_WITH_TARGET_SIGNAL], 0, ___lambda5__foo_func, 
self);
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (self, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"this.ref_count == 1");
+       _vala_assert (self->priv->success2, "success2");
+}
+
+static void
+_with_destroy_cb_foo_delegate_param_with_destroy (Foo* _sender,
+                                                  FooFunc f,
+                                                  gpointer f_target,
+                                                  GDestroyNotify f_target_destroy_notify,
+                                                  gpointer self)
+{
+       with_destroy_cb (f, f_target, f_target_destroy_notify);
+}
+
+static void
+__lambda6_ (Bar* self)
+{
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (self, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 2), 
"this.ref_count == 2");
+       self->priv->success3 = TRUE;
+}
+
+static void
+___lambda6__foo_func (gpointer self)
+{
+       __lambda6_ ((Bar*) self);
+}
+
+void
+bar_test_with_destroy (Bar* self)
+{
+       Foo* _tmp0_;
+       Foo* _tmp1_;
+       g_return_if_fail (IS_BAR (self));
+       _tmp0_ = self->priv->foo;
+       g_signal_connect (_tmp0_, "delegate-param-with-destroy", (GCallback) 
_with_destroy_cb_foo_delegate_param_with_destroy, NULL);
+       _tmp1_ = self->priv->foo;
+       g_signal_emit (_tmp1_, foo_signals[FOO_DELEGATE_PARAM_WITH_DESTROY_SIGNAL], 0, ___lambda6__foo_func, 
g_object_ref (self), g_object_unref);
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (self, G_TYPE_OBJECT, GObject)->ref_count == ((guint) 1), 
"this.ref_count == 1");
+       _vala_assert (self->priv->success3, "success3");
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Bar_private_offset);
+       G_OBJECT_CLASS (klass)->finalize = bar_finalize;
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+       self->priv = bar_get_instance_private (self);
+       self->priv->success2 = FALSE;
+       self->priv->success3 = FALSE;
+}
+
+static void
+bar_finalize (GObject * obj)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       _g_object_unref0 (self->priv->foo);
+       G_OBJECT_CLASS (bar_parent_class)->finalize (obj);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (G_TYPE_OBJECT, "Bar", &g_define_type_info, 0);
+       Bar_private_offset = g_type_add_instance_private (bar_type_id, sizeof (BarPrivate));
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Bar* bar = NULL;
+       Bar* _tmp0_;
+       _tmp0_ = bar_new ();
+       bar = _tmp0_;
+       bar_test_no_target (bar);
+       bar_test_with_target (bar);
+       bar_test_with_destroy (bar);
+       _g_object_unref0 (bar);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/signals-delegate.c-expected b/tests/objects/signals-delegate.c-expected
new file mode 100644
index 000000000..88f0a214a
--- /dev/null
+++ b/tests/objects/signals-delegate.c-expected
@@ -0,0 +1,578 @@
+/* objects_signals_delegate.c generated by valac, the Vala compiler
+ * generated from objects_signals_delegate.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+#include <glib-object.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef gchar* (*FooFunc) (Foo* foo, const gchar* s, gpointer user_data);
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_free0(var) (var = (g_free (var), NULL))
+enum  {
+       FOO_TEST_SIGNAL,
+       FOO_NUM_SIGNALS
+};
+static guint foo_signals[FOO_NUM_SIGNALS] = {0};
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+enum  {
+       BAR_0_PROPERTY,
+       BAR_NUM_PROPERTIES
+};
+static GParamSpec* bar_properties[BAR_NUM_PROPERTIES];
+enum  {
+       BAR_TEST_SIGNAL,
+       BAR_NUM_SIGNALS
+};
+static guint bar_signals[BAR_NUM_SIGNALS] = {0};
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _Bar {
+       GObject parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       GObjectClass parent_class;
+};
+
+struct _BarPrivate {
+       gint i;
+};
+
+static gpointer foo_parent_class = NULL;
+static gint Bar_private_offset;
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN void foo_add (Foo* self,
+              FooFunc func,
+              gpointer func_target);
+VALA_EXTERN void foo_add_owned (Foo* self,
+                    FooFunc func,
+                    gpointer func_target,
+                    GDestroyNotify func_target_destroy_notify);
+VALA_EXTERN void foo_add_remove (Foo* self,
+                     FooFunc func,
+                     gpointer func_target);
+VALA_EXTERN void foo_add_remove_owned (Foo* self,
+                           FooFunc func,
+                           gpointer func_target,
+                           GDestroyNotify func_target_destroy_notify);
+VALA_EXTERN void foo_invoke_test (Foo* self);
+VALA_EXTERN void foo_invoke_test_empty (Foo* self);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void g_cclosure_user_marshal_STRING__STRING (GClosure * closure,
+                                             GValue * return_value,
+                                             guint n_param_values,
+                                             const GValue * param_values,
+                                             gpointer invocation_hint,
+                                             gpointer marshal_data);
+static GType foo_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
+VALA_EXTERN Bar* bar_new (Foo* foo);
+VALA_EXTERN Bar* bar_construct (GType object_type,
+                    Foo* foo);
+static gchar* bar_instance_callback (Bar* self,
+                              Foo* foo,
+                              const gchar* s);
+static gchar* _bar_instance_callback_foo_func (Foo* foo,
+                                        const gchar* s,
+                                        gpointer self);
+VALA_EXTERN Bar* bar_new_owned (Foo* foo);
+VALA_EXTERN Bar* bar_construct_owned (GType object_type,
+                          Foo* foo);
+VALA_EXTERN Bar* bar_new_remove (Foo* foo);
+VALA_EXTERN Bar* bar_construct_remove (GType object_type,
+                           Foo* foo);
+VALA_EXTERN Bar* bar_new_remove_owned (Foo* foo);
+VALA_EXTERN Bar* bar_construct_remove_owned (GType object_type,
+                                 Foo* foo);
+static void bar_finalize (GObject * obj);
+static GType bar_get_type_once (void);
+VALA_EXTERN gchar* callback_static (Foo* foo,
+                        const gchar* s);
+static void _vala_main (void);
+
+void
+foo_add (Foo* self,
+         FooFunc func,
+         gpointer func_target)
+{
+       g_return_if_fail (IS_FOO (self));
+       g_signal_connect (self, "test", (GCallback) func, func_target);
+}
+
+void
+foo_add_owned (Foo* self,
+               FooFunc func,
+               gpointer func_target,
+               GDestroyNotify func_target_destroy_notify)
+{
+       g_return_if_fail (IS_FOO (self));
+       g_signal_connect_data (self, "test", (GCallback) func, func_target, (GClosureNotify) NULL, 0);
+       (func_target_destroy_notify == NULL) ? NULL : (func_target_destroy_notify (func_target), NULL);
+       func = NULL;
+       func_target = NULL;
+       func_target_destroy_notify = NULL;
+}
+
+void
+foo_add_remove (Foo* self,
+                FooFunc func,
+                gpointer func_target)
+{
+       guint _tmp0_;
+       g_return_if_fail (IS_FOO (self));
+       g_signal_connect (self, "test", (GCallback) func, func_target);
+       g_signal_parse_name ("test", TYPE_FOO, &_tmp0_, NULL, FALSE);
+       g_signal_handlers_disconnect_matched (self, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | 
G_SIGNAL_MATCH_DATA, _tmp0_, 0, NULL, (GCallback) func, func_target);
+}
+
+void
+foo_add_remove_owned (Foo* self,
+                      FooFunc func,
+                      gpointer func_target,
+                      GDestroyNotify func_target_destroy_notify)
+{
+       guint _tmp0_;
+       g_return_if_fail (IS_FOO (self));
+       g_signal_connect_data (self, "test", (GCallback) func, func_target, (GClosureNotify) NULL, 0);
+       g_signal_parse_name ("test", TYPE_FOO, &_tmp0_, NULL, FALSE);
+       g_signal_handlers_disconnect_matched (self, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | 
G_SIGNAL_MATCH_DATA, _tmp0_, 0, NULL, (GCallback) func, func_target);
+       (func_target_destroy_notify == NULL) ? NULL : (func_target_destroy_notify (func_target), NULL);
+       func = NULL;
+       func_target = NULL;
+       func_target_destroy_notify = NULL;
+}
+
+void
+foo_invoke_test (Foo* self)
+{
+       gchar* _tmp0_ = NULL;
+       gchar* _tmp1_;
+       g_return_if_fail (IS_FOO (self));
+       g_signal_emit (self, foo_signals[FOO_TEST_SIGNAL], 0, "bar", &_tmp0_);
+       _tmp1_ = _tmp0_;
+       _vala_assert (g_strcmp0 (_tmp1_, "foo") == 0, "test (\"bar\") == \"foo\"");
+       _g_free0 (_tmp1_);
+}
+
+void
+foo_invoke_test_empty (Foo* self)
+{
+       gchar* _tmp0_ = NULL;
+       gchar* _tmp1_;
+       g_return_if_fail (IS_FOO (self));
+       g_signal_emit (self, foo_signals[FOO_TEST_SIGNAL], 0, "bar", &_tmp0_);
+       _tmp1_ = _tmp0_;
+       _vala_assert (_tmp1_ == NULL, "test (\"bar\") == null");
+       _g_free0 (_tmp1_);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+g_cclosure_user_marshal_STRING__STRING (GClosure * closure,
+                                        GValue * return_value,
+                                        guint n_param_values,
+                                        const GValue * param_values,
+                                        gpointer invocation_hint,
+                                        gpointer marshal_data)
+{
+       typedef const char* (*GMarshalFunc_STRING__STRING) (gpointer data1, const char* arg_1, gpointer 
data2);
+       register GMarshalFunc_STRING__STRING callback;
+       register GCClosure * cc;
+       register gpointer data1;
+       register gpointer data2;
+       const char* v_return;
+       cc = (GCClosure *) closure;
+       g_return_if_fail (return_value != NULL);
+       g_return_if_fail (n_param_values == 2);
+       if (G_CCLOSURE_SWAP_DATA (closure)) {
+               data1 = closure->data;
+               data2 = param_values->data[0].v_pointer;
+       } else {
+               data1 = param_values->data[0].v_pointer;
+               data2 = closure->data;
+       }
+       callback = (GMarshalFunc_STRING__STRING) (marshal_data ? marshal_data : cc->callback);
+       v_return = callback (data1, g_value_get_string (param_values + 1), data2);
+       g_value_take_string (return_value, v_return);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       foo_signals[FOO_TEST_SIGNAL] = g_signal_new ("test", TYPE_FOO, G_SIGNAL_RUN_LAST, 0, NULL, NULL, 
g_cclosure_user_marshal_STRING__STRING, G_TYPE_STRING, 1, G_TYPE_STRING);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static inline gpointer
+bar_get_instance_private (Bar* self)
+{
+       return G_STRUCT_MEMBER_P (self, Bar_private_offset);
+}
+
+static gchar*
+_bar_instance_callback_foo_func (Foo* foo,
+                                 const gchar* s,
+                                 gpointer self)
+{
+       gchar* result;
+       result = bar_instance_callback ((Bar*) self, foo, s);
+       return result;
+}
+
+Bar*
+bar_construct (GType object_type,
+               Foo* foo)
+{
+       Bar * self = NULL;
+       g_return_val_if_fail (IS_FOO (foo), NULL);
+       self = (Bar*) g_object_new (object_type, NULL);
+       self->priv->i = 42;
+       foo_add (foo, _bar_instance_callback_foo_func, self);
+       return self;
+}
+
+Bar*
+bar_new (Foo* foo)
+{
+       return bar_construct (TYPE_BAR, foo);
+}
+
+Bar*
+bar_construct_owned (GType object_type,
+                     Foo* foo)
+{
+       Bar * self = NULL;
+       g_return_val_if_fail (IS_FOO (foo), NULL);
+       self = (Bar*) g_object_new (object_type, NULL);
+       self->priv->i = 42;
+       foo_add_owned (foo, _bar_instance_callback_foo_func, g_object_ref (self), g_object_unref);
+       return self;
+}
+
+Bar*
+bar_new_owned (Foo* foo)
+{
+       return bar_construct_owned (TYPE_BAR, foo);
+}
+
+Bar*
+bar_construct_remove (GType object_type,
+                      Foo* foo)
+{
+       Bar * self = NULL;
+       g_return_val_if_fail (IS_FOO (foo), NULL);
+       self = (Bar*) g_object_new (object_type, NULL);
+       self->priv->i = 42;
+       foo_add_remove (foo, _bar_instance_callback_foo_func, self);
+       return self;
+}
+
+Bar*
+bar_new_remove (Foo* foo)
+{
+       return bar_construct_remove (TYPE_BAR, foo);
+}
+
+Bar*
+bar_construct_remove_owned (GType object_type,
+                            Foo* foo)
+{
+       Bar * self = NULL;
+       g_return_val_if_fail (IS_FOO (foo), NULL);
+       self = (Bar*) g_object_new (object_type, NULL);
+       self->priv->i = 42;
+       foo_add_remove_owned (foo, _bar_instance_callback_foo_func, g_object_ref (self), g_object_unref);
+       return self;
+}
+
+Bar*
+bar_new_remove_owned (Foo* foo)
+{
+       return bar_construct_remove_owned (TYPE_BAR, foo);
+}
+
+static gchar*
+bar_instance_callback (Bar* self,
+                       Foo* foo,
+                       const gchar* s)
+{
+       gchar* _tmp0_;
+       gchar* result = NULL;
+       g_return_val_if_fail (IS_BAR (self), NULL);
+       g_return_val_if_fail (IS_FOO (foo), NULL);
+       g_return_val_if_fail (s != NULL, NULL);
+       _vala_assert (IS_FOO (foo), "foo is Foo");
+       _vala_assert (IS_BAR (self), "this is Bar");
+       _vala_assert (g_strcmp0 (s, "bar") == 0, "s == \"bar\"");
+       _vala_assert (self->priv->i == 42, "i == 42");
+       _tmp0_ = g_strdup ("foo");
+       result = _tmp0_;
+       return result;
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Bar_private_offset);
+       G_OBJECT_CLASS (klass)->finalize = bar_finalize;
+       bar_signals[BAR_TEST_SIGNAL] = g_signal_new ("test", TYPE_BAR, G_SIGNAL_RUN_LAST, 0, NULL, NULL, 
g_cclosure_user_marshal_STRING__STRING, G_TYPE_STRING, 1, G_TYPE_STRING);
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+       self->priv = bar_get_instance_private (self);
+}
+
+static void
+bar_finalize (GObject * obj)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       G_OBJECT_CLASS (bar_parent_class)->finalize (obj);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (G_TYPE_OBJECT, "Bar", &g_define_type_info, 0);
+       Bar_private_offset = g_type_add_instance_private (bar_type_id, sizeof (BarPrivate));
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+gchar*
+callback_static (Foo* foo,
+                 const gchar* s)
+{
+       gchar* _tmp0_;
+       gchar* result = NULL;
+       g_return_val_if_fail (IS_FOO (foo), NULL);
+       g_return_val_if_fail (s != NULL, NULL);
+       _vala_assert (IS_FOO (foo), "foo is Foo");
+       _vala_assert (g_strcmp0 (s, "bar") == 0, "s == \"bar\"");
+       _tmp0_ = g_strdup ("foo");
+       result = _tmp0_;
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Bar* bar = NULL;
+       Foo* _tmp0_;
+       Foo* _tmp1_;
+       Foo* _tmp2_;
+       Foo* _tmp3_;
+       Foo* _tmp4_;
+       Foo* _tmp5_;
+       Foo* _tmp6_;
+       Foo* _tmp7_;
+       Foo* _tmp8_;
+       Foo* _tmp9_;
+       Foo* _tmp10_;
+       Foo* _tmp11_;
+       Foo* _tmp12_;
+       Foo* _tmp13_;
+       Bar* _tmp14_;
+       Foo* _tmp15_;
+       Foo* _tmp16_;
+       Foo* _tmp17_;
+       Bar* _tmp18_;
+       Foo* _tmp19_;
+       Foo* _tmp20_;
+       Foo* _tmp21_;
+       Bar* _tmp22_;
+       Foo* _tmp23_;
+       Foo* _tmp24_;
+       Foo* _tmp25_;
+       Bar* _tmp26_;
+       Foo* _tmp27_;
+       _tmp0_ = foo_new ();
+       _g_object_unref0 (foo);
+       foo = _tmp0_;
+       _tmp1_ = foo;
+       foo_add (_tmp1_, (FooFunc) callback_static, NULL);
+       _tmp2_ = foo;
+       foo_invoke_test (_tmp2_);
+       _tmp3_ = foo_new ();
+       _g_object_unref0 (foo);
+       foo = _tmp3_;
+       _tmp4_ = foo;
+       foo_add_owned (_tmp4_, (FooFunc) callback_static, NULL, NULL);
+       _tmp5_ = foo;
+       foo_invoke_test (_tmp5_);
+       _tmp6_ = foo_new ();
+       _g_object_unref0 (foo);
+       foo = _tmp6_;
+       _tmp7_ = foo;
+       foo_add_remove (_tmp7_, (FooFunc) callback_static, NULL);
+       _tmp8_ = foo;
+       foo_invoke_test_empty (_tmp8_);
+       _tmp9_ = foo_new ();
+       _g_object_unref0 (foo);
+       foo = _tmp9_;
+       _tmp10_ = foo;
+       foo_add_remove_owned (_tmp10_, (FooFunc) callback_static, NULL, NULL);
+       _tmp11_ = foo;
+       foo_invoke_test_empty (_tmp11_);
+       _tmp12_ = foo_new ();
+       _g_object_unref0 (foo);
+       foo = _tmp12_;
+       _tmp13_ = foo;
+       _tmp14_ = bar_new (_tmp13_);
+       _g_object_unref0 (bar);
+       bar = _tmp14_;
+       _tmp15_ = foo;
+       foo_invoke_test (_tmp15_);
+       _tmp16_ = foo_new ();
+       _g_object_unref0 (foo);
+       foo = _tmp16_;
+       _tmp17_ = foo;
+       _tmp18_ = bar_new_owned (_tmp17_);
+       _g_object_unref0 (bar);
+       bar = _tmp18_;
+       _tmp19_ = foo;
+       foo_invoke_test (_tmp19_);
+       _tmp20_ = foo_new ();
+       _g_object_unref0 (foo);
+       foo = _tmp20_;
+       _tmp21_ = foo;
+       _tmp22_ = bar_new_remove (_tmp21_);
+       _g_object_unref0 (bar);
+       bar = _tmp22_;
+       _tmp23_ = foo;
+       foo_invoke_test_empty (_tmp23_);
+       _tmp24_ = foo_new ();
+       _g_object_unref0 (foo);
+       foo = _tmp24_;
+       _tmp25_ = foo;
+       _tmp26_ = bar_new_remove_owned (_tmp25_);
+       _g_object_unref0 (bar);
+       bar = _tmp26_;
+       _tmp27_ = foo;
+       foo_invoke_test_empty (_tmp27_);
+       _g_object_unref0 (bar);
+       _g_object_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/signals-enum-marshal.c-expected b/tests/objects/signals-enum-marshal.c-expected
new file mode 100644
index 000000000..53d57f1e4
--- /dev/null
+++ b/tests/objects/signals-enum-marshal.c-expected
@@ -0,0 +1,288 @@
+/* objects_signals_enum_marshal.c generated by valac, the Vala compiler
+ * generated from objects_signals_enum_marshal.vala, do not modify */
+
+#include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef enum  {
+       FOO_FOO
+} Foo;
+
+#define TYPE_FOO (foo_get_type ())
+typedef enum  {
+       BAR_BAR = 1 << 0
+} Bar;
+
+#define TYPE_BAR (bar_get_type ())
+
+#define TYPE_MANAM (manam_get_type ())
+#define MANAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MANAM, Manam))
+#define MANAM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MANAM, ManamClass))
+#define IS_MANAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MANAM))
+#define IS_MANAM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MANAM))
+#define MANAM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MANAM, ManamClass))
+
+typedef struct _Manam Manam;
+typedef struct _ManamClass ManamClass;
+typedef struct _ManamPrivate ManamPrivate;
+enum  {
+       MANAM_0_PROPERTY,
+       MANAM_NUM_PROPERTIES
+};
+static GParamSpec* manam_properties[MANAM_NUM_PROPERTIES];
+enum  {
+       MANAM_FOO_SIGNAL,
+       MANAM_BAR_SIGNAL,
+       MANAM_NUM_SIGNALS
+};
+static guint manam_signals[MANAM_NUM_SIGNALS] = {0};
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+
+struct _Manam {
+       GObject parent_instance;
+       ManamPrivate * priv;
+};
+
+struct _ManamClass {
+       GObjectClass parent_class;
+};
+
+static gpointer manam_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN GType manam_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Manam, g_object_unref)
+VALA_EXTERN Manam* manam_new (void);
+VALA_EXTERN Manam* manam_construct (GType object_type);
+static void g_cclosure_user_marshal_VOID__ENUM_STRING (GClosure * closure,
+                                                GValue * return_value,
+                                                guint n_param_values,
+                                                const GValue * param_values,
+                                                gpointer invocation_hint,
+                                                gpointer marshal_data);
+static void g_cclosure_user_marshal_VOID__FLAGS_STRING (GClosure * closure,
+                                                 GValue * return_value,
+                                                 guint n_param_values,
+                                                 const GValue * param_values,
+                                                 gpointer invocation_hint,
+                                                 gpointer marshal_data);
+static GType manam_get_type_once (void);
+static void _vala_main (void);
+static void __lambda4_ (void);
+static void ___lambda4__manam_foo (Manam* _sender,
+                            Foo f,
+                            const gchar* s,
+                            gpointer self);
+static void __lambda5_ (void);
+static void ___lambda5__manam_bar (Manam* _sender,
+                            Bar b,
+                            const gchar* s,
+                            gpointer self);
+
+static GType
+foo_get_type_once (void)
+{
+       static const GEnumValue values[] = {{FOO_FOO, "FOO_FOO", "foo"}, {0, NULL, NULL}};
+       GType foo_type_id;
+       foo_type_id = g_enum_register_static ("Foo", values);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GFlagsValue values[] = {{BAR_BAR, "BAR_BAR", "bar"}, {0, NULL, NULL}};
+       GType bar_type_id;
+       bar_type_id = g_flags_register_static ("Bar", values);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+Manam*
+manam_construct (GType object_type)
+{
+       Manam * self = NULL;
+       self = (Manam*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Manam*
+manam_new (void)
+{
+       return manam_construct (TYPE_MANAM);
+}
+
+static void
+g_cclosure_user_marshal_VOID__ENUM_STRING (GClosure * closure,
+                                           GValue * return_value,
+                                           guint n_param_values,
+                                           const GValue * param_values,
+                                           gpointer invocation_hint,
+                                           gpointer marshal_data)
+{
+       typedef void (*GMarshalFunc_VOID__ENUM_STRING) (gpointer data1, gint arg_1, const char* arg_2, 
gpointer data2);
+       register GMarshalFunc_VOID__ENUM_STRING callback;
+       register GCClosure * cc;
+       register gpointer data1;
+       register gpointer data2;
+       cc = (GCClosure *) closure;
+       g_return_if_fail (n_param_values == 3);
+       if (G_CCLOSURE_SWAP_DATA (closure)) {
+               data1 = closure->data;
+               data2 = param_values->data[0].v_pointer;
+       } else {
+               data1 = param_values->data[0].v_pointer;
+               data2 = closure->data;
+       }
+       callback = (GMarshalFunc_VOID__ENUM_STRING) (marshal_data ? marshal_data : cc->callback);
+       callback (data1, g_value_get_enum (param_values + 1), g_value_get_string (param_values + 2), data2);
+}
+
+static void
+g_cclosure_user_marshal_VOID__FLAGS_STRING (GClosure * closure,
+                                            GValue * return_value,
+                                            guint n_param_values,
+                                            const GValue * param_values,
+                                            gpointer invocation_hint,
+                                            gpointer marshal_data)
+{
+       typedef void (*GMarshalFunc_VOID__FLAGS_STRING) (gpointer data1, guint arg_1, const char* arg_2, 
gpointer data2);
+       register GMarshalFunc_VOID__FLAGS_STRING callback;
+       register GCClosure * cc;
+       register gpointer data1;
+       register gpointer data2;
+       cc = (GCClosure *) closure;
+       g_return_if_fail (n_param_values == 3);
+       if (G_CCLOSURE_SWAP_DATA (closure)) {
+               data1 = closure->data;
+               data2 = param_values->data[0].v_pointer;
+       } else {
+               data1 = param_values->data[0].v_pointer;
+               data2 = closure->data;
+       }
+       callback = (GMarshalFunc_VOID__FLAGS_STRING) (marshal_data ? marshal_data : cc->callback);
+       callback (data1, g_value_get_flags (param_values + 1), g_value_get_string (param_values + 2), data2);
+}
+
+static void
+manam_class_init (ManamClass * klass,
+                  gpointer klass_data)
+{
+       manam_parent_class = g_type_class_peek_parent (klass);
+       manam_signals[MANAM_FOO_SIGNAL] = g_signal_new ("foo", TYPE_MANAM, G_SIGNAL_RUN_LAST, 0, NULL, NULL, 
g_cclosure_user_marshal_VOID__ENUM_STRING, G_TYPE_NONE, 2, TYPE_FOO, G_TYPE_STRING);
+       manam_signals[MANAM_BAR_SIGNAL] = g_signal_new ("bar", TYPE_MANAM, G_SIGNAL_RUN_LAST, 0, NULL, NULL, 
g_cclosure_user_marshal_VOID__FLAGS_STRING, G_TYPE_NONE, 2, TYPE_BAR, G_TYPE_STRING);
+}
+
+static void
+manam_instance_init (Manam * self,
+                     gpointer klass)
+{
+}
+
+static GType
+manam_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (ManamClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) manam_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Manam), 
0, (GInstanceInitFunc) manam_instance_init, NULL };
+       GType manam_type_id;
+       manam_type_id = g_type_register_static (G_TYPE_OBJECT, "Manam", &g_define_type_info, 0);
+       return manam_type_id;
+}
+
+GType
+manam_get_type (void)
+{
+       static volatile gsize manam_type_id__volatile = 0;
+       if (g_once_init_enter (&manam_type_id__volatile)) {
+               GType manam_type_id;
+               manam_type_id = manam_get_type_once ();
+               g_once_init_leave (&manam_type_id__volatile, manam_type_id);
+       }
+       return manam_type_id__volatile;
+}
+
+static void
+__lambda4_ (void)
+{
+}
+
+static void
+___lambda4__manam_foo (Manam* _sender,
+                       Foo f,
+                       const gchar* s,
+                       gpointer self)
+{
+       __lambda4_ ();
+}
+
+static void
+__lambda5_ (void)
+{
+}
+
+static void
+___lambda5__manam_bar (Manam* _sender,
+                       Bar b,
+                       const gchar* s,
+                       gpointer self)
+{
+       __lambda5_ ();
+}
+
+static void
+_vala_main (void)
+{
+       Manam* manam = NULL;
+       Manam* _tmp0_;
+       _tmp0_ = manam_new ();
+       manam = _tmp0_;
+       g_signal_connect (manam, "foo", (GCallback) ___lambda4__manam_foo, NULL);
+       g_signal_emit (manam, manam_signals[MANAM_FOO_SIGNAL], 0, FOO_FOO, "foo");
+       g_signal_connect (manam, "bar", (GCallback) ___lambda5__manam_bar, NULL);
+       g_signal_emit (manam, manam_signals[MANAM_BAR_SIGNAL], 0, BAR_BAR, "bar");
+       _g_object_unref0 (manam);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/signals-error-marshal.c-expected b/tests/objects/signals-error-marshal.c-expected
new file mode 100644
index 000000000..e9d2451ad
--- /dev/null
+++ b/tests/objects/signals-error-marshal.c-expected
@@ -0,0 +1,285 @@
+/* objects_signals_error_marshal.c generated by valac, the Vala compiler
+ * generated from objects_signals_error_marshal.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_BAR (bar_get_type ())
+typedef struct _Bar Bar;
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
+enum  {
+       FOO_FOO_SIGNAL,
+       FOO_BAR_SIGNAL,
+       FOO_NUM_SIGNALS
+};
+static guint foo_signals[FOO_NUM_SIGNALS] = {0};
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+typedef enum  {
+       FOO_ERROR_BAD
+} FooError;
+#define FOO_ERROR foo_error_quark ()
+struct _Bar {
+       gint i;
+};
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GQuark foo_error_quark (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Bar* bar_dup (const Bar* self);
+VALA_EXTERN void bar_free (Bar* self);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_callback (Foo* self,
+                   void* p,
+                   GError* e);
+static void _foo_callback_foo_bar (Foo* _sender,
+                            void* p,
+                            GError* e,
+                            gpointer self);
+static void g_cclosure_user_marshal_VOID__POINTER_BOXED (GClosure * closure,
+                                                  GValue * return_value,
+                                                  guint n_param_values,
+                                                  const GValue * param_values,
+                                                  gpointer invocation_hint,
+                                                  gpointer marshal_data);
+static void g_cclosure_user_marshal_VOID__POINTER_POINTER (GClosure * closure,
+                                                    GValue * return_value,
+                                                    guint n_param_values,
+                                                    const GValue * param_values,
+                                                    gpointer invocation_hint,
+                                                    gpointer marshal_data);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+GQuark
+foo_error_quark (void)
+{
+       return g_quark_from_static_string ("foo-error-quark");
+}
+
+Bar*
+bar_dup (const Bar* self)
+{
+       Bar* dup;
+       dup = g_new0 (Bar, 1);
+       memcpy (dup, self, sizeof (Bar));
+       return dup;
+}
+
+void
+bar_free (Bar* self)
+{
+       g_free (self);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       GType bar_type_id;
+       bar_type_id = g_boxed_type_register_static ("Bar", (GBoxedCopyFunc) bar_dup, (GBoxedFreeFunc) 
bar_free);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_foo_callback_foo_bar (Foo* _sender,
+                       void* p,
+                       GError* e,
+                       gpointer self)
+{
+       foo_callback ((Foo*) self, p, e);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       GError* _tmp0_;
+       GError* _tmp1_;
+       self = (Foo*) g_object_new (object_type, NULL);
+       g_signal_connect_object (self, "bar", (GCallback) _foo_callback_foo_bar, self, 0);
+       _tmp0_ = g_error_new_literal (FOO_ERROR, FOO_ERROR_BAD, "bad");
+       _tmp1_ = _tmp0_;
+       g_signal_emit (self, foo_signals[FOO_BAR_SIGNAL], 0, NULL, _tmp1_);
+       _g_error_free0 (_tmp1_);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+foo_callback (Foo* self,
+              void* p,
+              GError* e)
+{
+       g_return_if_fail (IS_FOO (self));
+       g_return_if_fail (e != NULL);
+       _vala_assert (p == NULL, "p == null");
+       _vala_assert (e->code == FOO_ERROR_BAD, "e.code == FooError.BAD");
+}
+
+static void
+g_cclosure_user_marshal_VOID__POINTER_BOXED (GClosure * closure,
+                                             GValue * return_value,
+                                             guint n_param_values,
+                                             const GValue * param_values,
+                                             gpointer invocation_hint,
+                                             gpointer marshal_data)
+{
+       typedef void (*GMarshalFunc_VOID__POINTER_BOXED) (gpointer data1, gpointer arg_1, gpointer arg_2, 
gpointer data2);
+       register GMarshalFunc_VOID__POINTER_BOXED callback;
+       register GCClosure * cc;
+       register gpointer data1;
+       register gpointer data2;
+       cc = (GCClosure *) closure;
+       g_return_if_fail (n_param_values == 3);
+       if (G_CCLOSURE_SWAP_DATA (closure)) {
+               data1 = closure->data;
+               data2 = param_values->data[0].v_pointer;
+       } else {
+               data1 = param_values->data[0].v_pointer;
+               data2 = closure->data;
+       }
+       callback = (GMarshalFunc_VOID__POINTER_BOXED) (marshal_data ? marshal_data : cc->callback);
+       callback (data1, g_value_get_pointer (param_values + 1), g_value_get_boxed (param_values + 2), data2);
+}
+
+static void
+g_cclosure_user_marshal_VOID__POINTER_POINTER (GClosure * closure,
+                                               GValue * return_value,
+                                               guint n_param_values,
+                                               const GValue * param_values,
+                                               gpointer invocation_hint,
+                                               gpointer marshal_data)
+{
+       typedef void (*GMarshalFunc_VOID__POINTER_POINTER) (gpointer data1, gpointer arg_1, gpointer arg_2, 
gpointer data2);
+       register GMarshalFunc_VOID__POINTER_POINTER callback;
+       register GCClosure * cc;
+       register gpointer data1;
+       register gpointer data2;
+       cc = (GCClosure *) closure;
+       g_return_if_fail (n_param_values == 3);
+       if (G_CCLOSURE_SWAP_DATA (closure)) {
+               data1 = closure->data;
+               data2 = param_values->data[0].v_pointer;
+       } else {
+               data1 = param_values->data[0].v_pointer;
+               data2 = closure->data;
+       }
+       callback = (GMarshalFunc_VOID__POINTER_POINTER) (marshal_data ? marshal_data : cc->callback);
+       callback (data1, g_value_get_pointer (param_values + 1), g_value_get_pointer (param_values + 2), 
data2);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       foo_signals[FOO_FOO_SIGNAL] = g_signal_new ("foo", TYPE_FOO, G_SIGNAL_RUN_LAST, 0, NULL, NULL, 
g_cclosure_user_marshal_VOID__POINTER_BOXED, G_TYPE_NONE, 2, G_TYPE_POINTER, TYPE_BAR);
+       foo_signals[FOO_BAR_SIGNAL] = g_signal_new ("bar", TYPE_FOO, G_SIGNAL_RUN_LAST, 0, NULL, NULL, 
g_cclosure_user_marshal_VOID__POINTER_POINTER, G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_POINTER);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       _g_object_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/signals-fundamental-return.c-expected 
b/tests/objects/signals-fundamental-return.c-expected
new file mode 100644
index 000000000..290075d8f
--- /dev/null
+++ b/tests/objects/signals-fundamental-return.c-expected
@@ -0,0 +1,824 @@
+/* objects_signals_fundamental_return.c generated by valac, the Vala compiler
+ * generated from objects_signals_fundamental_return.vala, do not modify */
+
+#include <glib-object.h>
+#include <gobject/gvaluecollector.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_MAMAN (maman_get_type ())
+#define MAMAN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MAMAN, Maman))
+#define MAMAN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MAMAN, MamanClass))
+#define IS_MAMAN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MAMAN))
+#define IS_MAMAN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MAMAN))
+#define MAMAN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MAMAN, MamanClass))
+
+typedef struct _Maman Maman;
+typedef struct _MamanClass MamanClass;
+typedef struct _MamanPrivate MamanPrivate;
+typedef struct _ParamSpecMaman ParamSpecMaman;
+
+#define TYPE_IBAR (ibar_get_type ())
+#define IBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IBAR, IBar))
+#define IS_IBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IBAR))
+#define IBAR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_IBAR, IBarIface))
+
+typedef struct _IBar IBar;
+typedef struct _IBarIface IBarIface;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+enum  {
+       FOO_ON_FOO_SIGNAL,
+       FOO_ON_BAR_SIGNAL,
+       FOO_NUM_SIGNALS
+};
+static guint foo_signals[FOO_NUM_SIGNALS] = {0};
+#define _maman_unref0(var) ((var == NULL) ? NULL : (var = (maman_unref (var), NULL)))
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Maman {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       MamanPrivate * priv;
+};
+
+struct _MamanClass {
+       GTypeClass parent_class;
+       void (*finalize) (Maman *self);
+};
+
+struct _ParamSpecMaman {
+       GParamSpec parent_instance;
+};
+
+struct _IBarIface {
+       GTypeInterface parent_iface;
+};
+
+struct _Bar {
+       Maman parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       MamanClass parent_class;
+};
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gpointer maman_parent_class = NULL;
+static gpointer bar_parent_class = NULL;
+static IBarIface * bar_ibar_parent_iface = NULL;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer maman_ref (gpointer instance);
+VALA_EXTERN void maman_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_maman (const gchar* name,
+                              const gchar* nick,
+                              const gchar* blurb,
+                              GType object_type,
+                              GParamFlags flags);
+VALA_EXTERN void value_set_maman (GValue* value,
+                      gpointer v_object);
+VALA_EXTERN void value_take_maman (GValue* value,
+                       gpointer v_object);
+VALA_EXTERN gpointer value_get_maman (const GValue* value);
+VALA_EXTERN GType maman_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Maman, maman_unref)
+VALA_EXTERN Maman* maman_new (void);
+VALA_EXTERN Maman* maman_construct (GType object_type);
+static void maman_finalize (Maman * obj);
+static GType maman_get_type_once (void);
+VALA_EXTERN GType ibar_get_type (void) G_GNUC_CONST ;
+static GType ibar_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, maman_unref)
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static GType bar_get_type_once (void);
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void g_cclosure_user_marshal_FOO__VOID (GClosure * closure,
+                                        GValue * return_value,
+                                        guint n_param_values,
+                                        const GValue * param_values,
+                                        gpointer invocation_hint,
+                                        gpointer marshal_data);
+static void g_cclosure_user_marshal_MAMAN__VOID (GClosure * closure,
+                                          GValue * return_value,
+                                          guint n_param_values,
+                                          const GValue * param_values,
+                                          gpointer invocation_hint,
+                                          gpointer marshal_data);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+static Foo* __lambda4_ (void);
+static Foo* ___lambda4__foo_on_foo (Foo* _sender,
+                             gpointer self);
+static IBar* __lambda5_ (void);
+static IBar* ___lambda5__foo_on_bar (Foo* _sender,
+                              gpointer self);
+
+Maman*
+maman_construct (GType object_type)
+{
+       Maman* self = NULL;
+       self = (Maman*) g_type_create_instance (object_type);
+       return self;
+}
+
+Maman*
+maman_new (void)
+{
+       return maman_construct (TYPE_MAMAN);
+}
+
+static void
+value_maman_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_maman_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               maman_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_maman_copy_value (const GValue* src_value,
+                        GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = maman_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_maman_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_maman_collect_value (GValue* value,
+                           guint n_collect_values,
+                           GTypeCValue* collect_values,
+                           guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Maman * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = maman_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_maman_lcopy_value (const GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       Maman ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = maman_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_maman (const gchar* name,
+                  const gchar* nick,
+                  const gchar* blurb,
+                  GType object_type,
+                  GParamFlags flags)
+{
+       ParamSpecMaman* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_MAMAN), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_maman (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_MAMAN), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_maman (GValue* value,
+                 gpointer v_object)
+{
+       Maman * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_MAMAN));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_MAMAN));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               maman_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               maman_unref (old);
+       }
+}
+
+void
+value_take_maman (GValue* value,
+                  gpointer v_object)
+{
+       Maman * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_MAMAN));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_MAMAN));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               maman_unref (old);
+       }
+}
+
+static void
+maman_class_init (MamanClass * klass,
+                  gpointer klass_data)
+{
+       maman_parent_class = g_type_class_peek_parent (klass);
+       ((MamanClass *) klass)->finalize = maman_finalize;
+}
+
+static void
+maman_instance_init (Maman * self,
+                     gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+maman_finalize (Maman * obj)
+{
+       Maman * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_MAMAN, Maman);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+maman_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_maman_init, value_maman_free_value, 
value_maman_copy_value, value_maman_peek_pointer, "p", value_maman_collect_value, "p", 
value_maman_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (MamanClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Maman), 
0, (GInstanceInitFunc) maman_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType maman_type_id;
+       maman_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Maman", 
&g_define_type_info, &g_define_type_fundamental_info, 0);
+       return maman_type_id;
+}
+
+GType
+maman_get_type (void)
+{
+       static volatile gsize maman_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_type_id__volatile)) {
+               GType maman_type_id;
+               maman_type_id = maman_get_type_once ();
+               g_once_init_leave (&maman_type_id__volatile, maman_type_id);
+       }
+       return maman_type_id__volatile;
+}
+
+gpointer
+maman_ref (gpointer instance)
+{
+       Maman * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+maman_unref (gpointer instance)
+{
+       Maman * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               MAMAN_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+ibar_default_init (IBarIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+ibar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (IBarIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) ibar_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType ibar_type_id;
+       ibar_type_id = g_type_register_static (G_TYPE_INTERFACE, "IBar", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (ibar_type_id, TYPE_MAMAN);
+       return ibar_type_id;
+}
+
+GType
+ibar_get_type (void)
+{
+       static volatile gsize ibar_type_id__volatile = 0;
+       if (g_once_init_enter (&ibar_type_id__volatile)) {
+               GType ibar_type_id;
+               ibar_type_id = ibar_get_type_once ();
+               g_once_init_leave (&ibar_type_id__volatile, ibar_type_id);
+       }
+       return ibar_type_id__volatile;
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar* self = NULL;
+       self = (Bar*) maman_construct (object_type);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+bar_ibar_interface_init (IBarIface * iface,
+                         gpointer iface_data)
+{
+       bar_ibar_parent_iface = g_type_interface_peek_parent (iface);
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       static const GInterfaceInfo ibar_info = { (GInterfaceInitFunc) bar_ibar_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (TYPE_MAMAN, "Bar", &g_define_type_info, 0);
+       g_type_add_interface_static (bar_type_id, TYPE_IBAR, &ibar_info);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+g_cclosure_user_marshal_FOO__VOID (GClosure * closure,
+                                   GValue * return_value,
+                                   guint n_param_values,
+                                   const GValue * param_values,
+                                   gpointer invocation_hint,
+                                   gpointer marshal_data)
+{
+       typedef gpointer (*GMarshalFunc_FOO__VOID) (gpointer data1, gpointer data2);
+       register GMarshalFunc_FOO__VOID callback;
+       register GCClosure * cc;
+       register gpointer data1;
+       register gpointer data2;
+       gpointer v_return;
+       cc = (GCClosure *) closure;
+       g_return_if_fail (return_value != NULL);
+       g_return_if_fail (n_param_values == 1);
+       if (G_CCLOSURE_SWAP_DATA (closure)) {
+               data1 = closure->data;
+               data2 = param_values->data[0].v_pointer;
+       } else {
+               data1 = param_values->data[0].v_pointer;
+               data2 = closure->data;
+       }
+       callback = (GMarshalFunc_FOO__VOID) (marshal_data ? marshal_data : cc->callback);
+       v_return = callback (data1, data2);
+       value_take_foo (return_value, v_return);
+}
+
+static void
+g_cclosure_user_marshal_MAMAN__VOID (GClosure * closure,
+                                     GValue * return_value,
+                                     guint n_param_values,
+                                     const GValue * param_values,
+                                     gpointer invocation_hint,
+                                     gpointer marshal_data)
+{
+       typedef gpointer (*GMarshalFunc_MAMAN__VOID) (gpointer data1, gpointer data2);
+       register GMarshalFunc_MAMAN__VOID callback;
+       register GCClosure * cc;
+       register gpointer data1;
+       register gpointer data2;
+       gpointer v_return;
+       cc = (GCClosure *) closure;
+       g_return_if_fail (return_value != NULL);
+       g_return_if_fail (n_param_values == 1);
+       if (G_CCLOSURE_SWAP_DATA (closure)) {
+               data1 = closure->data;
+               data2 = param_values->data[0].v_pointer;
+       } else {
+               data1 = param_values->data[0].v_pointer;
+               data2 = closure->data;
+       }
+       callback = (GMarshalFunc_MAMAN__VOID) (marshal_data ? marshal_data : cc->callback);
+       v_return = callback (data1, data2);
+       value_take_maman (return_value, v_return);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       foo_signals[FOO_ON_FOO_SIGNAL] = g_signal_new ("on-foo", TYPE_FOO, G_SIGNAL_RUN_LAST, 0, NULL, NULL, 
g_cclosure_user_marshal_FOO__VOID, TYPE_FOO, 0);
+       foo_signals[FOO_ON_BAR_SIGNAL] = g_signal_new ("on-bar", TYPE_FOO, G_SIGNAL_RUN_LAST, 0, NULL, NULL, 
g_cclosure_user_marshal_MAMAN__VOID, TYPE_IBAR, 0);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static Foo*
+__lambda4_ (void)
+{
+       Foo* _tmp0_;
+       Foo* result = NULL;
+       _tmp0_ = foo_new ();
+       result = _tmp0_;
+       return result;
+}
+
+static Foo*
+___lambda4__foo_on_foo (Foo* _sender,
+                        gpointer self)
+{
+       Foo* result;
+       result = __lambda4_ ();
+       return result;
+}
+
+static IBar*
+__lambda5_ (void)
+{
+       Bar* _tmp0_;
+       IBar* result = NULL;
+       _tmp0_ = bar_new ();
+       result = G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, TYPE_IBAR, IBar);
+       return result;
+}
+
+static IBar*
+___lambda5__foo_on_bar (Foo* _sender,
+                        gpointer self)
+{
+       IBar* result;
+       result = __lambda5_ ();
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       Foo* bar = NULL;
+       Foo* _tmp1_ = NULL;
+       IBar* bar2 = NULL;
+       IBar* _tmp2_ = NULL;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       g_signal_connect (foo, "on-foo", (GCallback) ___lambda4__foo_on_foo, NULL);
+       g_signal_connect (foo, "on-bar", (GCallback) ___lambda5__foo_on_bar, NULL);
+       g_signal_emit (foo, foo_signals[FOO_ON_FOO_SIGNAL], 0, &_tmp1_);
+       bar = _tmp1_;
+       _vala_assert (IS_FOO (bar), "bar is Foo");
+       g_signal_emit (foo, foo_signals[FOO_ON_BAR_SIGNAL], 0, &_tmp2_);
+       bar2 = _tmp2_;
+       _vala_assert (IS_IBAR (bar2), "bar2 is IBar");
+       _maman_unref0 (bar2);
+       _foo_unref0 (bar);
+       _foo_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/signals-gobject-return.c-expected b/tests/objects/signals-gobject-return.c-expected
new file mode 100644
index 000000000..a056b3f01
--- /dev/null
+++ b/tests/objects/signals-gobject-return.c-expected
@@ -0,0 +1,274 @@
+/* objects_signals_gobject_return.c generated by valac, the Vala compiler
+ * generated from objects_signals_gobject_return.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_IBAR (ibar_get_type ())
+#define IBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IBAR, IBar))
+#define IS_IBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IBAR))
+#define IBAR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_IBAR, IBarIface))
+
+typedef struct _IBar IBar;
+typedef struct _IBarIface IBarIface;
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+enum  {
+       FOO_ON_FOO_SIGNAL,
+       FOO_ON_BAR_SIGNAL,
+       FOO_NUM_SIGNALS
+};
+static guint foo_signals[FOO_NUM_SIGNALS] = {0};
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _IBarIface {
+       GTypeInterface parent_iface;
+};
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+static gpointer foo_parent_class = NULL;
+static IBarIface * foo_ibar_parent_iface = NULL;
+
+VALA_EXTERN GType ibar_get_type (void) G_GNUC_CONST ;
+static GType ibar_get_type_once (void);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void g_cclosure_user_marshal_OBJECT__VOID (GClosure * closure,
+                                           GValue * return_value,
+                                           guint n_param_values,
+                                           const GValue * param_values,
+                                           gpointer invocation_hint,
+                                           gpointer marshal_data);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+static Foo* __lambda4_ (void);
+static Foo* ___lambda4__foo_on_foo (Foo* _sender,
+                             gpointer self);
+static IBar* __lambda5_ (void);
+static IBar* ___lambda5__foo_on_bar (Foo* _sender,
+                              gpointer self);
+
+static void
+ibar_default_init (IBarIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+ibar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (IBarIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) ibar_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType ibar_type_id;
+       ibar_type_id = g_type_register_static (G_TYPE_INTERFACE, "IBar", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (ibar_type_id, G_TYPE_OBJECT);
+       return ibar_type_id;
+}
+
+GType
+ibar_get_type (void)
+{
+       static volatile gsize ibar_type_id__volatile = 0;
+       if (g_once_init_enter (&ibar_type_id__volatile)) {
+               GType ibar_type_id;
+               ibar_type_id = ibar_get_type_once ();
+               g_once_init_leave (&ibar_type_id__volatile, ibar_type_id);
+       }
+       return ibar_type_id__volatile;
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+g_cclosure_user_marshal_OBJECT__VOID (GClosure * closure,
+                                      GValue * return_value,
+                                      guint n_param_values,
+                                      const GValue * param_values,
+                                      gpointer invocation_hint,
+                                      gpointer marshal_data)
+{
+       typedef gpointer (*GMarshalFunc_OBJECT__VOID) (gpointer data1, gpointer data2);
+       register GMarshalFunc_OBJECT__VOID callback;
+       register GCClosure * cc;
+       register gpointer data1;
+       register gpointer data2;
+       gpointer v_return;
+       cc = (GCClosure *) closure;
+       g_return_if_fail (return_value != NULL);
+       g_return_if_fail (n_param_values == 1);
+       if (G_CCLOSURE_SWAP_DATA (closure)) {
+               data1 = closure->data;
+               data2 = param_values->data[0].v_pointer;
+       } else {
+               data1 = param_values->data[0].v_pointer;
+               data2 = closure->data;
+       }
+       callback = (GMarshalFunc_OBJECT__VOID) (marshal_data ? marshal_data : cc->callback);
+       v_return = callback (data1, data2);
+       g_value_take_object (return_value, v_return);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       foo_signals[FOO_ON_FOO_SIGNAL] = g_signal_new ("on-foo", TYPE_FOO, G_SIGNAL_RUN_LAST, 0, NULL, NULL, 
g_cclosure_user_marshal_OBJECT__VOID, TYPE_FOO, 0);
+       foo_signals[FOO_ON_BAR_SIGNAL] = g_signal_new ("on-bar", TYPE_FOO, G_SIGNAL_RUN_LAST, 0, NULL, NULL, 
g_cclosure_user_marshal_OBJECT__VOID, TYPE_IBAR, 0);
+}
+
+static void
+foo_ibar_interface_init (IBarIface * iface,
+                         gpointer iface_data)
+{
+       foo_ibar_parent_iface = g_type_interface_peek_parent (iface);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       static const GInterfaceInfo ibar_info = { (GInterfaceInitFunc) foo_ibar_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       g_type_add_interface_static (foo_type_id, TYPE_IBAR, &ibar_info);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static Foo*
+__lambda4_ (void)
+{
+       Foo* _tmp0_;
+       Foo* result = NULL;
+       _tmp0_ = foo_new ();
+       result = _tmp0_;
+       return result;
+}
+
+static Foo*
+___lambda4__foo_on_foo (Foo* _sender,
+                        gpointer self)
+{
+       Foo* result;
+       result = __lambda4_ ();
+       return result;
+}
+
+static IBar*
+__lambda5_ (void)
+{
+       Foo* _tmp0_;
+       IBar* result = NULL;
+       _tmp0_ = foo_new ();
+       result = G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, TYPE_IBAR, IBar);
+       return result;
+}
+
+static IBar*
+___lambda5__foo_on_bar (Foo* _sender,
+                        gpointer self)
+{
+       IBar* result;
+       result = __lambda5_ ();
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       Foo* bar = NULL;
+       Foo* _tmp1_ = NULL;
+       IBar* bar2 = NULL;
+       IBar* _tmp2_ = NULL;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       g_signal_connect (foo, "on-foo", (GCallback) ___lambda4__foo_on_foo, NULL);
+       g_signal_connect (foo, "on-bar", (GCallback) ___lambda5__foo_on_bar, NULL);
+       g_signal_emit (foo, foo_signals[FOO_ON_FOO_SIGNAL], 0, &_tmp1_);
+       bar = _tmp1_;
+       _vala_assert (IS_FOO (bar), "bar is Foo");
+       g_signal_emit (foo, foo_signals[FOO_ON_BAR_SIGNAL], 0, &_tmp2_);
+       bar2 = _tmp2_;
+       _vala_assert (IS_IBAR (bar2), "bar2 is IBar");
+       _g_object_unref0 (bar2);
+       _g_object_unref0 (bar);
+       _g_object_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/signals-lambda-delegate.c-expected 
b/tests/objects/signals-lambda-delegate.c-expected
new file mode 100644
index 000000000..0df69f8cc
--- /dev/null
+++ b/tests/objects/signals-lambda-delegate.c-expected
@@ -0,0 +1,229 @@
+/* objects_signals_lambda_delegate.c generated by valac, the Vala compiler
+ * generated from objects_signals_lambda_delegate.vala, do not modify */
+
+#include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+enum  {
+       FOO_BAR_SIGNAL,
+       FOO_BAZ_SIGNAL,
+       FOO_NUM_SIGNALS
+};
+static guint foo_signals[FOO_NUM_SIGNALS] = {0};
+typedef void (*FooFunc) (Foo* foo, const gchar* s, gpointer user_data);
+typedef struct _Block1Data Block1Data;
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _Block1Data {
+       int _ref_count_;
+       gulong bar_id;
+       gulong baz_id;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static void ___lambda4_ (Block1Data* _data1_,
+                  Foo* f,
+                  const gchar* s);
+static void ____lambda4__foo_func (Foo* foo,
+                            const gchar* s,
+                            gpointer self);
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       foo_signals[FOO_BAR_SIGNAL] = g_signal_new ("bar", TYPE_FOO, G_SIGNAL_RUN_LAST, 0, NULL, NULL, 
g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
+       foo_signals[FOO_BAZ_SIGNAL] = g_signal_new ("baz", TYPE_FOO, G_SIGNAL_RUN_LAST, 0, NULL, NULL, 
g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static void
+___lambda4_ (Block1Data* _data1_,
+             Foo* f,
+             const gchar* s)
+{
+       gboolean _tmp0_ = FALSE;
+       g_return_if_fail (IS_FOO (f));
+       g_return_if_fail (s != NULL);
+       if (g_strcmp0 (s, "bar") == 0) {
+               _tmp0_ = TRUE;
+       } else {
+               _tmp0_ = g_strcmp0 (s, "baz") == 0;
+       }
+       _vala_assert (_tmp0_, "s == \"bar\" || s == \"baz\"");
+       if (g_strcmp0 (s, "bar") == 0) {
+               _vala_assert (_data1_->bar_id > ((gulong) 0U), "bar_id > 0U");
+               g_signal_handler_disconnect (G_TYPE_CHECK_INSTANCE_CAST (f, G_TYPE_OBJECT, GObject), 
_data1_->bar_id);
+               _data1_->bar_id = (gulong) 0U;
+       }
+       if (g_strcmp0 (s, "baz") == 0) {
+               _vala_assert (_data1_->baz_id > ((gulong) 0U), "baz_id > 0U");
+               g_signal_handler_disconnect (G_TYPE_CHECK_INSTANCE_CAST (f, G_TYPE_OBJECT, GObject), 
_data1_->baz_id);
+               _data1_->baz_id = (gulong) 0U;
+       }
+}
+
+static void
+____lambda4__foo_func (Foo* foo,
+                       const gchar* s,
+                       gpointer self)
+{
+       ___lambda4_ (self, foo, s);
+}
+
+static void
+_vala_main (void)
+{
+       Block1Data* _data1_;
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       _data1_ = g_slice_new0 (Block1Data);
+       _data1_->_ref_count_ = 1;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       _data1_->bar_id = (gulong) 0U;
+       _data1_->baz_id = (gulong) 0U;
+       {
+               FooFunc callback = NULL;
+               gpointer callback_target;
+               GDestroyNotify callback_target_destroy_notify;
+               gulong _tmp1_;
+               gulong _tmp2_;
+               callback = ____lambda4__foo_func;
+               callback_target = block1_data_ref (_data1_);
+               callback_target_destroy_notify = block1_data_unref;
+               _tmp1_ = g_signal_connect_data (foo, "bar", (GCallback) ____lambda4__foo_func, 
block1_data_ref (_data1_), (GClosureNotify) block1_data_unref, 0);
+               _data1_->bar_id = _tmp1_;
+               _tmp2_ = g_signal_connect_data (foo, "baz", (GCallback) ____lambda4__foo_func, 
block1_data_ref (_data1_), (GClosureNotify) block1_data_unref, 0);
+               _data1_->baz_id = _tmp2_;
+               (callback_target_destroy_notify == NULL) ? NULL : (callback_target_destroy_notify 
(callback_target), NULL);
+               callback = NULL;
+               callback_target = NULL;
+               callback_target_destroy_notify = NULL;
+       }
+       {
+               g_signal_emit (foo, foo_signals[FOO_BAR_SIGNAL], 0, "bar");
+               _vala_assert (_data1_->bar_id == ((gulong) 0U), "bar_id == 0U");
+               g_signal_emit (foo, foo_signals[FOO_BAZ_SIGNAL], 0, "baz");
+               _vala_assert (_data1_->baz_id == ((gulong) 0U), "baz_id == 0U");
+       }
+       _g_object_unref0 (foo);
+       block1_data_unref (_data1_);
+       _data1_ = NULL;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/signals-prototype-access.c-expected 
b/tests/objects/signals-prototype-access.c-expected
new file mode 100644
index 000000000..63ddd5c0e
--- /dev/null
+++ b/tests/objects/signals-prototype-access.c-expected
@@ -0,0 +1,452 @@
+/* objects_signals_prototype_access.c generated by valac, the Vala compiler
+ * generated from objects_signals_prototype_access.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef gint (*FooFunc) (Foo* foo);
+typedef gint (*BarFunc) (gpointer user_data);
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+enum  {
+       FOO_BAR_SIGNAL,
+       FOO_NUM_SIGNALS
+};
+static guint foo_signals[FOO_NUM_SIGNALS] = {0};
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+       gint (*bar) (Foo* self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN void foo_manam (Foo* self,
+                FooFunc func);
+VALA_EXTERN void foo_minim (Foo* self,
+                BarFunc func,
+                gpointer func_target);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static gint foo_real_bar (Foo* self);
+VALA_EXTERN gint foo_bar (Foo* self);
+static void g_cclosure_user_marshal_INT__VOID (GClosure * closure,
+                                        GValue * return_value,
+                                        guint n_param_values,
+                                        const GValue * param_values,
+                                        gpointer invocation_hint,
+                                        gpointer marshal_data);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+static gint _foo_bar_foo_func (Foo* foo);
+static gint _foo_bar_bar_func (gpointer self);
+
+void
+foo_manam (Foo* self,
+           FooFunc func)
+{
+       g_return_if_fail (IS_FOO (self));
+       _vala_assert (func (self) == 23, "func (this) == 23");
+}
+
+void
+foo_minim (Foo* self,
+           BarFunc func,
+           gpointer func_target)
+{
+       g_return_if_fail (IS_FOO (self));
+       _vala_assert (func (func_target) == 23, "func () == 23");
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static gint
+foo_real_bar (Foo* self)
+{
+       gint result = 0;
+       result = 23;
+       return result;
+}
+
+gint
+foo_bar (Foo* self)
+{
+       gint _tmp0_ = 0;
+       gint result = 0;
+       g_return_val_if_fail (IS_FOO (self), 0);
+       g_signal_emit (self, foo_signals[FOO_BAR_SIGNAL], 0, &_tmp0_);
+       result = _tmp0_;
+       return result;
+}
+
+static void
+g_cclosure_user_marshal_INT__VOID (GClosure * closure,
+                                   GValue * return_value,
+                                   guint n_param_values,
+                                   const GValue * param_values,
+                                   gpointer invocation_hint,
+                                   gpointer marshal_data)
+{
+       typedef gint (*GMarshalFunc_INT__VOID) (gpointer data1, gpointer data2);
+       register GMarshalFunc_INT__VOID callback;
+       register GCClosure * cc;
+       register gpointer data1;
+       register gpointer data2;
+       gint v_return;
+       cc = (GCClosure *) closure;
+       g_return_if_fail (return_value != NULL);
+       g_return_if_fail (n_param_values == 1);
+       if (G_CCLOSURE_SWAP_DATA (closure)) {
+               data1 = closure->data;
+               data2 = param_values->data[0].v_pointer;
+       } else {
+               data1 = param_values->data[0].v_pointer;
+               data2 = closure->data;
+       }
+       callback = (GMarshalFunc_INT__VOID) (marshal_data ? marshal_data : cc->callback);
+       v_return = callback (data1, data2);
+       g_value_set_int (return_value, v_return);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       ((FooClass *) klass)->bar = foo_real_bar;
+       foo_signals[FOO_BAR_SIGNAL] = g_signal_new ("bar", TYPE_FOO, G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET 
(FooClass, bar), NULL, NULL, g_cclosure_user_marshal_INT__VOID, G_TYPE_INT, 0);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static gint
+_foo_bar_foo_func (Foo* foo)
+{
+       gint result;
+       result = foo_bar (foo);
+       return result;
+}
+
+static gint
+_foo_bar_bar_func (gpointer self)
+{
+       gint result;
+       result = foo_bar ((Foo*) self);
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       {
+               foo_manam (foo, _foo_bar_foo_func);
+               foo_manam (foo, (FooFunc) foo_bar);
+       }
+       {
+               FooFunc func = NULL;
+               func = _foo_bar_foo_func;
+               _vala_assert (func (foo) == 23, "func (foo) == 23");
+       }
+       {
+               FooFunc func = NULL;
+               func = (FooFunc) foo_bar;
+               _vala_assert (func (foo) == 23, "func (foo) == 23");
+       }
+       {
+               foo_minim (foo, _foo_bar_bar_func, foo);
+               foo_minim (foo, (BarFunc) foo_bar, foo);
+       }
+       {
+               BarFunc func = NULL;
+               gpointer func_target;
+               GDestroyNotify func_target_destroy_notify;
+               func = _foo_bar_bar_func;
+               func_target = foo_ref (foo);
+               func_target_destroy_notify = foo_unref;
+               _vala_assert (func (func_target) == 23, "func () == 23");
+               (func_target_destroy_notify == NULL) ? NULL : (func_target_destroy_notify (func_target), 
NULL);
+               func = NULL;
+               func_target = NULL;
+               func_target_destroy_notify = NULL;
+       }
+       {
+               BarFunc func = NULL;
+               gpointer func_target;
+               GDestroyNotify func_target_destroy_notify;
+               func = (BarFunc) foo_bar;
+               func_target = foo_ref (foo);
+               func_target_destroy_notify = foo_unref;
+               _vala_assert (func (func_target) == 23, "func () == 23");
+               (func_target_destroy_notify == NULL) ? NULL : (func_target_destroy_notify (func_target), 
NULL);
+               func = NULL;
+               func_target = NULL;
+               func_target_destroy_notify = NULL;
+       }
+       _foo_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/signals-struct-return.c-expected b/tests/objects/signals-struct-return.c-expected
new file mode 100644
index 000000000..b87e27883
--- /dev/null
+++ b/tests/objects/signals-struct-return.c-expected
@@ -0,0 +1,497 @@
+/* objects_signals_struct_return.c generated by valac, the Vala compiler
+ * generated from objects_signals_struct_return.vala, do not modify */
+
+#include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+#define _g_free0(var) (var = (g_free (var), NULL))
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+enum  {
+       BAR_0_PROPERTY,
+       BAR_NUM_PROPERTIES
+};
+static GParamSpec* bar_properties[BAR_NUM_PROPERTIES];
+enum  {
+       BAR_ON_FOO_SIGNAL,
+       BAR_ON_FOO_WITH_ARG_SIGNAL,
+       BAR_ON_BAR_SIGNAL,
+       BAR_ON_BAR_WITH_ARG_SIGNAL,
+       BAR_NUM_SIGNALS
+};
+static guint bar_signals[BAR_NUM_SIGNALS] = {0};
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _foo_free0(var) ((var == NULL) ? NULL : (var = (foo_free (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       gchar* s;
+       gint i;
+};
+
+struct _Bar {
+       GObject parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       GObjectClass parent_class;
+};
+
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN void foo_copy (const Foo* self,
+               Foo* dest);
+VALA_EXTERN void foo_destroy (Foo* self);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static void g_cclosure_user_marshal_VOID__STRING_POINTER (GClosure * closure,
+                                                   GValue * return_value,
+                                                   guint n_param_values,
+                                                   const GValue * param_values,
+                                                   gpointer invocation_hint,
+                                                   gpointer marshal_data);
+static void g_cclosure_user_marshal_POINTER__VOID (GClosure * closure,
+                                            GValue * return_value,
+                                            guint n_param_values,
+                                            const GValue * param_values,
+                                            gpointer invocation_hint,
+                                            gpointer marshal_data);
+static void g_cclosure_user_marshal_POINTER__STRING (GClosure * closure,
+                                              GValue * return_value,
+                                              guint n_param_values,
+                                              const GValue * param_values,
+                                              gpointer invocation_hint,
+                                              gpointer marshal_data);
+static GType bar_get_type_once (void);
+static void _vala_main (void);
+static void ___lambda4_ (Foo* result);
+static void ____lambda4__bar_on_foo (Bar* _sender,
+                              Foo* result,
+                              gpointer self);
+static void ___lambda5_ (const gchar* s,
+                  Foo* result);
+static void ____lambda5__bar_on_foo_with_arg (Bar* _sender,
+                                       const gchar* s,
+                                       Foo* result,
+                                       gpointer self);
+static Foo* ___lambda6_ (void);
+static Foo* ____lambda6__bar_on_bar (Bar* _sender,
+                              gpointer self);
+static Foo* ___lambda7_ (const gchar* s);
+static Foo* ____lambda7__bar_on_bar_with_arg (Bar* _sender,
+                                       const gchar* s,
+                                       gpointer self);
+
+void
+foo_copy (const Foo* self,
+          Foo* dest)
+{
+       const gchar* _tmp0_;
+       gchar* _tmp1_;
+       _tmp0_ = (*self).s;
+       _tmp1_ = g_strdup (_tmp0_);
+       _g_free0 ((*dest).s);
+       (*dest).s = _tmp1_;
+       (*dest).i = (*self).i;
+}
+
+void
+foo_destroy (Foo* self)
+{
+       _g_free0 ((*self).s);
+}
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       foo_copy (self, dup);
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       foo_destroy (self);
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar * self = NULL;
+       self = (Bar*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+g_cclosure_user_marshal_VOID__STRING_POINTER (GClosure * closure,
+                                              GValue * return_value,
+                                              guint n_param_values,
+                                              const GValue * param_values,
+                                              gpointer invocation_hint,
+                                              gpointer marshal_data)
+{
+       typedef void (*GMarshalFunc_VOID__STRING_POINTER) (gpointer data1, const char* arg_1, gpointer arg_2, 
gpointer data2);
+       register GMarshalFunc_VOID__STRING_POINTER callback;
+       register GCClosure * cc;
+       register gpointer data1;
+       register gpointer data2;
+       cc = (GCClosure *) closure;
+       g_return_if_fail (n_param_values == 3);
+       if (G_CCLOSURE_SWAP_DATA (closure)) {
+               data1 = closure->data;
+               data2 = param_values->data[0].v_pointer;
+       } else {
+               data1 = param_values->data[0].v_pointer;
+               data2 = closure->data;
+       }
+       callback = (GMarshalFunc_VOID__STRING_POINTER) (marshal_data ? marshal_data : cc->callback);
+       callback (data1, g_value_get_string (param_values + 1), g_value_get_pointer (param_values + 2), 
data2);
+}
+
+static void
+g_cclosure_user_marshal_POINTER__VOID (GClosure * closure,
+                                       GValue * return_value,
+                                       guint n_param_values,
+                                       const GValue * param_values,
+                                       gpointer invocation_hint,
+                                       gpointer marshal_data)
+{
+       typedef gpointer (*GMarshalFunc_POINTER__VOID) (gpointer data1, gpointer data2);
+       register GMarshalFunc_POINTER__VOID callback;
+       register GCClosure * cc;
+       register gpointer data1;
+       register gpointer data2;
+       gpointer v_return;
+       cc = (GCClosure *) closure;
+       g_return_if_fail (return_value != NULL);
+       g_return_if_fail (n_param_values == 1);
+       if (G_CCLOSURE_SWAP_DATA (closure)) {
+               data1 = closure->data;
+               data2 = param_values->data[0].v_pointer;
+       } else {
+               data1 = param_values->data[0].v_pointer;
+               data2 = closure->data;
+       }
+       callback = (GMarshalFunc_POINTER__VOID) (marshal_data ? marshal_data : cc->callback);
+       v_return = callback (data1, data2);
+       g_value_set_pointer (return_value, v_return);
+}
+
+static void
+g_cclosure_user_marshal_POINTER__STRING (GClosure * closure,
+                                         GValue * return_value,
+                                         guint n_param_values,
+                                         const GValue * param_values,
+                                         gpointer invocation_hint,
+                                         gpointer marshal_data)
+{
+       typedef gpointer (*GMarshalFunc_POINTER__STRING) (gpointer data1, const char* arg_1, gpointer data2);
+       register GMarshalFunc_POINTER__STRING callback;
+       register GCClosure * cc;
+       register gpointer data1;
+       register gpointer data2;
+       gpointer v_return;
+       cc = (GCClosure *) closure;
+       g_return_if_fail (return_value != NULL);
+       g_return_if_fail (n_param_values == 2);
+       if (G_CCLOSURE_SWAP_DATA (closure)) {
+               data1 = closure->data;
+               data2 = param_values->data[0].v_pointer;
+       } else {
+               data1 = param_values->data[0].v_pointer;
+               data2 = closure->data;
+       }
+       callback = (GMarshalFunc_POINTER__STRING) (marshal_data ? marshal_data : cc->callback);
+       v_return = callback (data1, g_value_get_string (param_values + 1), data2);
+       g_value_set_pointer (return_value, v_return);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       bar_signals[BAR_ON_FOO_SIGNAL] = g_signal_new ("on-foo", TYPE_BAR, G_SIGNAL_RUN_LAST, 0, NULL, NULL, 
g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER);
+       bar_signals[BAR_ON_FOO_WITH_ARG_SIGNAL] = g_signal_new ("on-foo-with-arg", TYPE_BAR, 
G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__STRING_POINTER, G_TYPE_NONE, 2, 
G_TYPE_STRING, G_TYPE_POINTER);
+       bar_signals[BAR_ON_BAR_SIGNAL] = g_signal_new ("on-bar", TYPE_BAR, G_SIGNAL_RUN_LAST, 0, NULL, NULL, 
g_cclosure_user_marshal_POINTER__VOID, G_TYPE_POINTER, 0);
+       bar_signals[BAR_ON_BAR_WITH_ARG_SIGNAL] = g_signal_new ("on-bar-with-arg", TYPE_BAR, 
G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_POINTER__STRING, G_TYPE_POINTER, 1, G_TYPE_STRING);
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (G_TYPE_OBJECT, "Bar", &g_define_type_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+___lambda4_ (Foo* result)
+{
+       gchar* _tmp0_;
+       Foo _tmp1_ = {0};
+       _tmp0_ = g_strdup ("foo");
+       _g_free0 (_tmp1_.s);
+       _tmp1_.s = _tmp0_;
+       _tmp1_.i = 23;
+       *result = _tmp1_;
+       return;
+}
+
+static void
+____lambda4__bar_on_foo (Bar* _sender,
+                         Foo* result,
+                         gpointer self)
+{
+       ___lambda4_ (result);
+}
+
+static void
+___lambda5_ (const gchar* s,
+             Foo* result)
+{
+       gchar* _tmp0_;
+       Foo _tmp1_ = {0};
+       g_return_if_fail (s != NULL);
+       _vala_assert (g_strcmp0 (s, "foo") == 0, "s == \"foo\"");
+       _tmp0_ = g_strdup ("foo");
+       _g_free0 (_tmp1_.s);
+       _tmp1_.s = _tmp0_;
+       _tmp1_.i = 42;
+       *result = _tmp1_;
+       return;
+}
+
+static void
+____lambda5__bar_on_foo_with_arg (Bar* _sender,
+                                  const gchar* s,
+                                  Foo* result,
+                                  gpointer self)
+{
+       ___lambda5_ (s, result);
+}
+
+static gpointer
+_foo_dup0 (gpointer self)
+{
+       return self ? foo_dup (self) : NULL;
+}
+
+static Foo*
+___lambda6_ (void)
+{
+       gchar* _tmp0_;
+       Foo _tmp1_ = {0};
+       Foo _tmp2_;
+       Foo* _tmp3_;
+       Foo* _tmp4_;
+       Foo* result = NULL;
+       _tmp0_ = g_strdup ("bar");
+       _g_free0 (_tmp1_.s);
+       _tmp1_.s = _tmp0_;
+       _tmp1_.i = 42;
+       _tmp2_ = _tmp1_;
+       _tmp3_ = _foo_dup0 (&_tmp2_);
+       _tmp4_ = _tmp3_;
+       foo_destroy (&_tmp2_);
+       result = _tmp4_;
+       return result;
+}
+
+static Foo*
+____lambda6__bar_on_bar (Bar* _sender,
+                         gpointer self)
+{
+       Foo* result;
+       result = ___lambda6_ ();
+       return result;
+}
+
+static Foo*
+___lambda7_ (const gchar* s)
+{
+       gchar* _tmp0_;
+       Foo _tmp1_ = {0};
+       Foo _tmp2_;
+       Foo* _tmp3_;
+       Foo* _tmp4_;
+       Foo* result = NULL;
+       g_return_val_if_fail (s != NULL, NULL);
+       _vala_assert (g_strcmp0 (s, "bar") == 0, "s == \"bar\"");
+       _tmp0_ = g_strdup ("bar");
+       _g_free0 (_tmp1_.s);
+       _tmp1_.s = _tmp0_;
+       _tmp1_.i = 23;
+       _tmp2_ = _tmp1_;
+       _tmp3_ = _foo_dup0 (&_tmp2_);
+       _tmp4_ = _tmp3_;
+       foo_destroy (&_tmp2_);
+       result = _tmp4_;
+       return result;
+}
+
+static Foo*
+____lambda7__bar_on_bar_with_arg (Bar* _sender,
+                                  const gchar* s,
+                                  gpointer self)
+{
+       Foo* result;
+       result = ___lambda7_ (s);
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       {
+               Bar* bar = NULL;
+               Bar* _tmp0_;
+               Foo foo = {0};
+               Foo _tmp1_ = {0};
+               Foo _tmp2_;
+               const gchar* _tmp3_;
+               Foo _tmp4_;
+               Foo foo2 = {0};
+               Foo _tmp5_ = {0};
+               Foo _tmp6_;
+               const gchar* _tmp7_;
+               Foo _tmp8_;
+               _tmp0_ = bar_new ();
+               bar = _tmp0_;
+               g_signal_connect (bar, "on-foo", (GCallback) ____lambda4__bar_on_foo, NULL);
+               g_signal_connect (bar, "on-foo-with-arg", (GCallback) ____lambda5__bar_on_foo_with_arg, NULL);
+               g_signal_emit (bar, bar_signals[BAR_ON_FOO_SIGNAL], 0, &_tmp1_);
+               foo = _tmp1_;
+               _tmp2_ = foo;
+               _tmp3_ = _tmp2_.s;
+               _vala_assert (g_strcmp0 (_tmp3_, "foo") == 0, "foo.s == \"foo\"");
+               _tmp4_ = foo;
+               _vala_assert (_tmp4_.i == 23, "foo.i == 23");
+               g_signal_emit (bar, bar_signals[BAR_ON_FOO_WITH_ARG_SIGNAL], 0, "foo", &_tmp5_);
+               foo2 = _tmp5_;
+               _tmp6_ = foo2;
+               _tmp7_ = _tmp6_.s;
+               _vala_assert (g_strcmp0 (_tmp7_, "foo") == 0, "foo2.s == \"foo\"");
+               _tmp8_ = foo2;
+               _vala_assert (_tmp8_.i == 42, "foo2.i == 42");
+               foo_destroy (&foo2);
+               foo_destroy (&foo);
+               _g_object_unref0 (bar);
+       }
+       {
+               Bar* bar = NULL;
+               Bar* _tmp9_;
+               Foo* foo = NULL;
+               Foo* _tmp10_ = NULL;
+               const gchar* _tmp11_;
+               Foo* foo2 = NULL;
+               Foo* _tmp12_ = NULL;
+               const gchar* _tmp13_;
+               _tmp9_ = bar_new ();
+               bar = _tmp9_;
+               g_signal_connect (bar, "on-bar", (GCallback) ____lambda6__bar_on_bar, NULL);
+               g_signal_connect (bar, "on-bar-with-arg", (GCallback) ____lambda7__bar_on_bar_with_arg, NULL);
+               g_signal_emit (bar, bar_signals[BAR_ON_BAR_SIGNAL], 0, &_tmp10_);
+               foo = _tmp10_;
+               _tmp11_ = (*foo).s;
+               _vala_assert (g_strcmp0 (_tmp11_, "bar") == 0, "foo.s == \"bar\"");
+               _vala_assert ((*foo).i == 42, "foo.i == 42");
+               g_signal_emit (bar, bar_signals[BAR_ON_BAR_WITH_ARG_SIGNAL], 0, "bar", &_tmp12_);
+               foo2 = _tmp12_;
+               _tmp13_ = (*foo2).s;
+               _vala_assert (g_strcmp0 (_tmp13_, "bar") == 0, "foo2.s == \"bar\"");
+               _vala_assert ((*foo2).i == 23, "foo2.i == 23");
+               _foo_free0 (foo2);
+               _foo_free0 (foo);
+               _g_object_unref0 (bar);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/signals.c-expected b/tests/objects/signals.c-expected
new file mode 100644
index 000000000..64684cc6d
--- /dev/null
+++ b/tests/objects/signals.c-expected
@@ -0,0 +1,932 @@
+/* objects_signals.c generated by valac, the Vala compiler
+ * generated from objects_signals.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define MAMAN_TYPE_FOO (maman_foo_get_type ())
+#define MAMAN_FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_FOO, MamanFoo))
+#define MAMAN_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAMAN_TYPE_FOO, MamanFooClass))
+#define MAMAN_IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_FOO))
+#define MAMAN_IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAMAN_TYPE_FOO))
+#define MAMAN_FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAMAN_TYPE_FOO, MamanFooClass))
+
+typedef struct _MamanFoo MamanFoo;
+typedef struct _MamanFooClass MamanFooClass;
+typedef struct _MamanFooPrivate MamanFooPrivate;
+enum  {
+       MAMAN_FOO_0_PROPERTY,
+       MAMAN_FOO_NUM_PROPERTIES
+};
+static GParamSpec* maman_foo_properties[MAMAN_FOO_NUM_PROPERTIES];
+enum  {
+       MAMAN_FOO_ACTIVATED_SIGNAL,
+       MAMAN_FOO_NUM_SIGNALS
+};
+static guint maman_foo_signals[MAMAN_FOO_NUM_SIGNALS] = {0};
+
+#define MAMAN_TYPE_BAR (maman_bar_get_type ())
+#define MAMAN_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_BAR, MamanBar))
+#define MAMAN_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAMAN_TYPE_BAR, MamanBarClass))
+#define MAMAN_IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_BAR))
+#define MAMAN_IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAMAN_TYPE_BAR))
+#define MAMAN_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAMAN_TYPE_BAR, MamanBarClass))
+
+typedef struct _MamanBar MamanBar;
+typedef struct _MamanBarClass MamanBarClass;
+typedef struct _MamanBarPrivate MamanBarPrivate;
+enum  {
+       MAMAN_BAR_0_PROPERTY,
+       MAMAN_BAR_NUM_PROPERTIES
+};
+static GParamSpec* maman_bar_properties[MAMAN_BAR_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+
+#define MAMAN_TYPE_USER_FOO (maman_user_foo_get_type ())
+#define MAMAN_USER_FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_USER_FOO, MamanUserFoo))
+#define MAMAN_USER_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAMAN_TYPE_USER_FOO, 
MamanUserFooClass))
+#define MAMAN_IS_USER_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_USER_FOO))
+#define MAMAN_IS_USER_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAMAN_TYPE_USER_FOO))
+#define MAMAN_USER_FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAMAN_TYPE_USER_FOO, 
MamanUserFooClass))
+
+typedef struct _MamanUserFoo MamanUserFoo;
+typedef struct _MamanUserFooClass MamanUserFooClass;
+typedef struct _MamanUserFooPrivate MamanUserFooPrivate;
+enum  {
+       MAMAN_USER_FOO_0_PROPERTY,
+       MAMAN_USER_FOO_NUM_PROPERTIES
+};
+static GParamSpec* maman_user_foo_properties[MAMAN_USER_FOO_NUM_PROPERTIES];
+enum  {
+       MAMAN_USER_FOO_ACTIVATED_SIGNAL,
+       MAMAN_USER_FOO_NUM_SIGNALS
+};
+static guint maman_user_foo_signals[MAMAN_USER_FOO_NUM_SIGNALS] = {0};
+
+#define MAMAN_TYPE_USER_BAR (maman_user_bar_get_type ())
+#define MAMAN_USER_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_USER_BAR, MamanUserBar))
+#define MAMAN_USER_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAMAN_TYPE_USER_BAR, 
MamanUserBarClass))
+#define MAMAN_IS_USER_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_USER_BAR))
+#define MAMAN_IS_USER_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAMAN_TYPE_USER_BAR))
+#define MAMAN_USER_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAMAN_TYPE_USER_BAR, 
MamanUserBarClass))
+
+typedef struct _MamanUserBar MamanUserBar;
+typedef struct _MamanUserBarClass MamanUserBarClass;
+typedef struct _MamanUserBarPrivate MamanUserBarPrivate;
+enum  {
+       MAMAN_USER_BAR_0_PROPERTY,
+       MAMAN_USER_BAR_NUM_PROPERTIES
+};
+static GParamSpec* maman_user_bar_properties[MAMAN_USER_BAR_NUM_PROPERTIES];
+
+#define MAMAN_TYPE_RETURN_FOO (maman_return_foo_get_type ())
+#define MAMAN_RETURN_FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_RETURN_FOO, MamanReturnFoo))
+#define MAMAN_RETURN_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAMAN_TYPE_RETURN_FOO, 
MamanReturnFooClass))
+#define MAMAN_IS_RETURN_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_RETURN_FOO))
+#define MAMAN_IS_RETURN_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAMAN_TYPE_RETURN_FOO))
+#define MAMAN_RETURN_FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAMAN_TYPE_RETURN_FOO, 
MamanReturnFooClass))
+
+typedef struct _MamanReturnFoo MamanReturnFoo;
+typedef struct _MamanReturnFooClass MamanReturnFooClass;
+typedef struct _MamanReturnFooPrivate MamanReturnFooPrivate;
+enum  {
+       MAMAN_RETURN_FOO_0_PROPERTY,
+       MAMAN_RETURN_FOO_NUM_PROPERTIES
+};
+static GParamSpec* maman_return_foo_properties[MAMAN_RETURN_FOO_NUM_PROPERTIES];
+enum  {
+       MAMAN_RETURN_FOO_INT_ACTIVATED_SIGNAL,
+       MAMAN_RETURN_FOO_STRING_ACTIVATED_SIGNAL,
+       MAMAN_RETURN_FOO_NUM_SIGNALS
+};
+static guint maman_return_foo_signals[MAMAN_RETURN_FOO_NUM_SIGNALS] = {0};
+
+#define MAMAN_TYPE_RETURN_BAR (maman_return_bar_get_type ())
+#define MAMAN_RETURN_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_RETURN_BAR, MamanReturnBar))
+#define MAMAN_RETURN_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAMAN_TYPE_RETURN_BAR, 
MamanReturnBarClass))
+#define MAMAN_IS_RETURN_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_RETURN_BAR))
+#define MAMAN_IS_RETURN_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAMAN_TYPE_RETURN_BAR))
+#define MAMAN_RETURN_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAMAN_TYPE_RETURN_BAR, 
MamanReturnBarClass))
+
+typedef struct _MamanReturnBar MamanReturnBar;
+typedef struct _MamanReturnBarClass MamanReturnBarClass;
+typedef struct _MamanReturnBarPrivate MamanReturnBarPrivate;
+enum  {
+       MAMAN_RETURN_BAR_0_PROPERTY,
+       MAMAN_RETURN_BAR_NUM_PROPERTIES
+};
+static GParamSpec* maman_return_bar_properties[MAMAN_RETURN_BAR_NUM_PROPERTIES];
+#define _g_free0(var) (var = (g_free (var), NULL))
+
+struct _MamanFoo {
+       GObject parent_instance;
+       MamanFooPrivate * priv;
+};
+
+struct _MamanFooClass {
+       GObjectClass parent_class;
+};
+
+struct _MamanBar {
+       GObject parent_instance;
+       MamanBarPrivate * priv;
+};
+
+struct _MamanBarClass {
+       GObjectClass parent_class;
+};
+
+struct _MamanUserFoo {
+       GObject parent_instance;
+       MamanUserFooPrivate * priv;
+};
+
+struct _MamanUserFooClass {
+       GObjectClass parent_class;
+};
+
+struct _MamanUserBar {
+       GObject parent_instance;
+       MamanUserBarPrivate * priv;
+};
+
+struct _MamanUserBarClass {
+       GObjectClass parent_class;
+};
+
+struct _MamanReturnFoo {
+       GObject parent_instance;
+       MamanReturnFooPrivate * priv;
+};
+
+struct _MamanReturnFooClass {
+       GObjectClass parent_class;
+};
+
+struct _MamanReturnBar {
+       GObject parent_instance;
+       MamanReturnBarPrivate * priv;
+};
+
+struct _MamanReturnBarClass {
+       GObjectClass parent_class;
+};
+
+static gpointer maman_foo_parent_class = NULL;
+static gpointer maman_bar_parent_class = NULL;
+static gpointer maman_user_foo_parent_class = NULL;
+static gpointer maman_user_bar_parent_class = NULL;
+static gpointer maman_return_foo_parent_class = NULL;
+static gpointer maman_return_bar_parent_class = NULL;
+
+VALA_EXTERN GType maman_foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MamanFoo, g_object_unref)
+VALA_EXTERN void maman_foo_do_action (MamanFoo* self,
+                          gboolean b);
+VALA_EXTERN MamanFoo* maman_foo_new (void);
+VALA_EXTERN MamanFoo* maman_foo_construct (GType object_type);
+static GType maman_foo_get_type_once (void);
+VALA_EXTERN GType maman_bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MamanBar, g_object_unref)
+static void maman_bar_activated (MamanBar* self,
+                          MamanFoo* foo,
+                          gboolean b);
+VALA_EXTERN void maman_bar_run (MamanBar* self);
+static void __lambda4_ (MamanBar* self,
+                 MamanFoo* foo,
+                 gboolean b);
+static void ___lambda4__maman_foo_activated (MamanFoo* _sender,
+                                      gboolean b,
+                                      gpointer self);
+static void _maman_bar_activated_maman_foo_activated (MamanFoo* _sender,
+                                               gboolean b,
+                                               gpointer self);
+VALA_EXTERN MamanBar* maman_bar_new (void);
+VALA_EXTERN MamanBar* maman_bar_construct (GType object_type);
+static GType maman_bar_get_type_once (void);
+VALA_EXTERN GType maman_user_foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MamanUserFoo, g_object_unref)
+VALA_EXTERN void maman_user_foo_do_action (MamanUserFoo* self);
+VALA_EXTERN MamanUserFoo* maman_user_foo_new (void);
+VALA_EXTERN MamanUserFoo* maman_user_foo_construct (GType object_type);
+static void g_cclosure_user_marshal_VOID__INT_INT (GClosure * closure,
+                                            GValue * return_value,
+                                            guint n_param_values,
+                                            const GValue * param_values,
+                                            gpointer invocation_hint,
+                                            gpointer marshal_data);
+static GType maman_user_foo_get_type_once (void);
+VALA_EXTERN GType maman_user_bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MamanUserBar, g_object_unref)
+VALA_EXTERN void maman_user_bar_run (MamanUserBar* self);
+static void __lambda5_ (MamanUserBar* self,
+                 MamanUserFoo* foo,
+                 gint i1,
+                 gint i2);
+static void ___lambda5__maman_user_foo_activated (MamanUserFoo* _sender,
+                                           gint i1,
+                                           gint i2,
+                                           gpointer self);
+VALA_EXTERN MamanUserBar* maman_user_bar_new (void);
+VALA_EXTERN MamanUserBar* maman_user_bar_construct (GType object_type);
+static GType maman_user_bar_get_type_once (void);
+VALA_EXTERN GType maman_return_foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MamanReturnFoo, g_object_unref)
+VALA_EXTERN MamanReturnFoo* maman_return_foo_new (void);
+VALA_EXTERN MamanReturnFoo* maman_return_foo_construct (GType object_type);
+static void g_cclosure_user_marshal_INT__INT (GClosure * closure,
+                                       GValue * return_value,
+                                       guint n_param_values,
+                                       const GValue * param_values,
+                                       gpointer invocation_hint,
+                                       gpointer marshal_data);
+static void g_cclosure_user_marshal_STRING__STRING (GClosure * closure,
+                                             GValue * return_value,
+                                             guint n_param_values,
+                                             const GValue * param_values,
+                                             gpointer invocation_hint,
+                                             gpointer marshal_data);
+static GType maman_return_foo_get_type_once (void);
+VALA_EXTERN GType maman_return_bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MamanReturnBar, g_object_unref)
+VALA_EXTERN void maman_return_bar_run (MamanReturnBar* self);
+static gint __lambda6_ (MamanReturnBar* self,
+                 MamanReturnFoo* foo,
+                 gint arg);
+static gint ___lambda6__maman_return_foo_int_activated (MamanReturnFoo* _sender,
+                                                 gint arg,
+                                                 gpointer self);
+static gchar* __lambda7_ (MamanReturnBar* self,
+                   MamanReturnFoo* foo,
+                   const gchar* arg);
+static gchar* ___lambda7__maman_return_foo_string_activated (MamanReturnFoo* _sender,
+                                                      const gchar* arg,
+                                                      gpointer self);
+VALA_EXTERN MamanReturnBar* maman_return_bar_new (void);
+VALA_EXTERN MamanReturnBar* maman_return_bar_construct (GType object_type);
+static GType maman_return_bar_get_type_once (void);
+static void _vala_main (void);
+
+void
+maman_foo_do_action (MamanFoo* self,
+                     gboolean b)
+{
+       g_return_if_fail (MAMAN_IS_FOO (self));
+       g_signal_emit (self, maman_foo_signals[MAMAN_FOO_ACTIVATED_SIGNAL], 0, b);
+}
+
+MamanFoo*
+maman_foo_construct (GType object_type)
+{
+       MamanFoo * self = NULL;
+       self = (MamanFoo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+MamanFoo*
+maman_foo_new (void)
+{
+       return maman_foo_construct (MAMAN_TYPE_FOO);
+}
+
+static void
+maman_foo_class_init (MamanFooClass * klass,
+                      gpointer klass_data)
+{
+       maman_foo_parent_class = g_type_class_peek_parent (klass);
+       maman_foo_signals[MAMAN_FOO_ACTIVATED_SIGNAL] = g_signal_new ("activated", MAMAN_TYPE_FOO, 
G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
+}
+
+static void
+maman_foo_instance_init (MamanFoo * self,
+                         gpointer klass)
+{
+}
+
+static GType
+maman_foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (MamanFooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(MamanFoo), 0, (GInstanceInitFunc) maman_foo_instance_init, NULL };
+       GType maman_foo_type_id;
+       maman_foo_type_id = g_type_register_static (G_TYPE_OBJECT, "MamanFoo", &g_define_type_info, 0);
+       return maman_foo_type_id;
+}
+
+GType
+maman_foo_get_type (void)
+{
+       static volatile gsize maman_foo_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_foo_type_id__volatile)) {
+               GType maman_foo_type_id;
+               maman_foo_type_id = maman_foo_get_type_once ();
+               g_once_init_leave (&maman_foo_type_id__volatile, maman_foo_type_id);
+       }
+       return maman_foo_type_id__volatile;
+}
+
+static void
+maman_bar_activated (MamanBar* self,
+                     MamanFoo* foo,
+                     gboolean b)
+{
+       g_return_if_fail (MAMAN_IS_BAR (self));
+       g_return_if_fail (MAMAN_IS_FOO (foo));
+       if (b) {
+               FILE* _tmp0_;
+               _tmp0_ = stdout;
+               fprintf (_tmp0_, " BAD");
+       } else {
+               FILE* _tmp1_;
+               _tmp1_ = stdout;
+               fprintf (_tmp1_, " 5");
+       }
+}
+
+static void
+__lambda4_ (MamanBar* self,
+            MamanFoo* foo,
+            gboolean b)
+{
+       g_return_if_fail (MAMAN_IS_FOO (foo));
+       if (b) {
+               FILE* _tmp0_;
+               _tmp0_ = stdout;
+               fprintf (_tmp0_, " 8");
+       } else {
+               FILE* _tmp1_;
+               _tmp1_ = stdout;
+               fprintf (_tmp1_, " 4");
+       }
+}
+
+static void
+___lambda4__maman_foo_activated (MamanFoo* _sender,
+                                 gboolean b,
+                                 gpointer self)
+{
+       __lambda4_ ((MamanBar*) self, _sender, b);
+}
+
+static void
+_maman_bar_activated_maman_foo_activated (MamanFoo* _sender,
+                                          gboolean b,
+                                          gpointer self)
+{
+       maman_bar_activated ((MamanBar*) self, _sender, b);
+}
+
+void
+maman_bar_run (MamanBar* self)
+{
+       FILE* _tmp0_;
+       MamanFoo* foo = NULL;
+       MamanFoo* _tmp1_;
+       FILE* _tmp2_;
+       FILE* _tmp3_;
+       guint _tmp4_;
+       FILE* _tmp5_;
+       FILE* _tmp6_;
+       g_return_if_fail (MAMAN_IS_BAR (self));
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, " 2");
+       _tmp1_ = maman_foo_new ();
+       foo = _tmp1_;
+       g_signal_connect_object (foo, "activated", (GCallback) ___lambda4__maman_foo_activated, self, 0);
+       g_signal_connect_object (foo, "activated", (GCallback) _maman_bar_activated_maman_foo_activated, 
self, 0);
+       _tmp2_ = stdout;
+       fprintf (_tmp2_, " 3");
+       maman_foo_do_action (foo, FALSE);
+       _tmp3_ = stdout;
+       fprintf (_tmp3_, " 6");
+       g_signal_parse_name ("activated", MAMAN_TYPE_FOO, &_tmp4_, NULL, FALSE);
+       g_signal_handlers_disconnect_matched (foo, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | 
G_SIGNAL_MATCH_DATA, _tmp4_, 0, NULL, (GCallback) _maman_bar_activated_maman_foo_activated, self);
+       _tmp5_ = stdout;
+       fprintf (_tmp5_, " 7");
+       maman_foo_do_action (foo, TRUE);
+       _tmp6_ = stdout;
+       fprintf (_tmp6_, " 9");
+       _g_object_unref0 (foo);
+}
+
+MamanBar*
+maman_bar_construct (GType object_type)
+{
+       MamanBar * self = NULL;
+       self = (MamanBar*) g_object_new (object_type, NULL);
+       return self;
+}
+
+MamanBar*
+maman_bar_new (void)
+{
+       return maman_bar_construct (MAMAN_TYPE_BAR);
+}
+
+static void
+maman_bar_class_init (MamanBarClass * klass,
+                      gpointer klass_data)
+{
+       maman_bar_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+maman_bar_instance_init (MamanBar * self,
+                         gpointer klass)
+{
+}
+
+static GType
+maman_bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (MamanBarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(MamanBar), 0, (GInstanceInitFunc) maman_bar_instance_init, NULL };
+       GType maman_bar_type_id;
+       maman_bar_type_id = g_type_register_static (G_TYPE_OBJECT, "MamanBar", &g_define_type_info, 0);
+       return maman_bar_type_id;
+}
+
+GType
+maman_bar_get_type (void)
+{
+       static volatile gsize maman_bar_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_bar_type_id__volatile)) {
+               GType maman_bar_type_id;
+               maman_bar_type_id = maman_bar_get_type_once ();
+               g_once_init_leave (&maman_bar_type_id__volatile, maman_bar_type_id);
+       }
+       return maman_bar_type_id__volatile;
+}
+
+void
+maman_user_foo_do_action (MamanUserFoo* self)
+{
+       g_return_if_fail (MAMAN_IS_USER_FOO (self));
+       g_signal_emit (self, maman_user_foo_signals[MAMAN_USER_FOO_ACTIVATED_SIGNAL], 0, 6, -2);
+}
+
+MamanUserFoo*
+maman_user_foo_construct (GType object_type)
+{
+       MamanUserFoo * self = NULL;
+       self = (MamanUserFoo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+MamanUserFoo*
+maman_user_foo_new (void)
+{
+       return maman_user_foo_construct (MAMAN_TYPE_USER_FOO);
+}
+
+static void
+g_cclosure_user_marshal_VOID__INT_INT (GClosure * closure,
+                                       GValue * return_value,
+                                       guint n_param_values,
+                                       const GValue * param_values,
+                                       gpointer invocation_hint,
+                                       gpointer marshal_data)
+{
+       typedef void (*GMarshalFunc_VOID__INT_INT) (gpointer data1, gint arg_1, gint arg_2, gpointer data2);
+       register GMarshalFunc_VOID__INT_INT callback;
+       register GCClosure * cc;
+       register gpointer data1;
+       register gpointer data2;
+       cc = (GCClosure *) closure;
+       g_return_if_fail (n_param_values == 3);
+       if (G_CCLOSURE_SWAP_DATA (closure)) {
+               data1 = closure->data;
+               data2 = param_values->data[0].v_pointer;
+       } else {
+               data1 = param_values->data[0].v_pointer;
+               data2 = closure->data;
+       }
+       callback = (GMarshalFunc_VOID__INT_INT) (marshal_data ? marshal_data : cc->callback);
+       callback (data1, g_value_get_int (param_values + 1), g_value_get_int (param_values + 2), data2);
+}
+
+static void
+maman_user_foo_class_init (MamanUserFooClass * klass,
+                           gpointer klass_data)
+{
+       maman_user_foo_parent_class = g_type_class_peek_parent (klass);
+       maman_user_foo_signals[MAMAN_USER_FOO_ACTIVATED_SIGNAL] = g_signal_new ("activated", 
MAMAN_TYPE_USER_FOO, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__INT_INT, G_TYPE_NONE, 2, 
G_TYPE_INT, G_TYPE_INT);
+}
+
+static void
+maman_user_foo_instance_init (MamanUserFoo * self,
+                              gpointer klass)
+{
+}
+
+static GType
+maman_user_foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (MamanUserFooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_user_foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(MamanUserFoo), 0, (GInstanceInitFunc) maman_user_foo_instance_init, NULL };
+       GType maman_user_foo_type_id;
+       maman_user_foo_type_id = g_type_register_static (G_TYPE_OBJECT, "MamanUserFoo", &g_define_type_info, 
0);
+       return maman_user_foo_type_id;
+}
+
+GType
+maman_user_foo_get_type (void)
+{
+       static volatile gsize maman_user_foo_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_user_foo_type_id__volatile)) {
+               GType maman_user_foo_type_id;
+               maman_user_foo_type_id = maman_user_foo_get_type_once ();
+               g_once_init_leave (&maman_user_foo_type_id__volatile, maman_user_foo_type_id);
+       }
+       return maman_user_foo_type_id__volatile;
+}
+
+static void
+__lambda5_ (MamanUserBar* self,
+            MamanUserFoo* foo,
+            gint i1,
+            gint i2)
+{
+       FILE* _tmp0_;
+       g_return_if_fail (MAMAN_IS_USER_FOO (foo));
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, " %d", i1 + i2);
+}
+
+static void
+___lambda5__maman_user_foo_activated (MamanUserFoo* _sender,
+                                      gint i1,
+                                      gint i2,
+                                      gpointer self)
+{
+       __lambda5_ ((MamanUserBar*) self, _sender, i1, i2);
+}
+
+void
+maman_user_bar_run (MamanUserBar* self)
+{
+       FILE* _tmp0_;
+       MamanUserFoo* foo = NULL;
+       MamanUserFoo* _tmp1_;
+       FILE* _tmp2_;
+       FILE* _tmp3_;
+       g_return_if_fail (MAMAN_IS_USER_BAR (self));
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, " 2");
+       _tmp1_ = maman_user_foo_new ();
+       foo = _tmp1_;
+       g_signal_connect_object (foo, "activated", (GCallback) ___lambda5__maman_user_foo_activated, self, 0);
+       _tmp2_ = stdout;
+       fprintf (_tmp2_, " 3");
+       maman_user_foo_do_action (foo);
+       _tmp3_ = stdout;
+       fprintf (_tmp3_, " 5");
+       _g_object_unref0 (foo);
+}
+
+MamanUserBar*
+maman_user_bar_construct (GType object_type)
+{
+       MamanUserBar * self = NULL;
+       self = (MamanUserBar*) g_object_new (object_type, NULL);
+       return self;
+}
+
+MamanUserBar*
+maman_user_bar_new (void)
+{
+       return maman_user_bar_construct (MAMAN_TYPE_USER_BAR);
+}
+
+static void
+maman_user_bar_class_init (MamanUserBarClass * klass,
+                           gpointer klass_data)
+{
+       maman_user_bar_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+maman_user_bar_instance_init (MamanUserBar * self,
+                              gpointer klass)
+{
+}
+
+static GType
+maman_user_bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (MamanUserBarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_user_bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(MamanUserBar), 0, (GInstanceInitFunc) maman_user_bar_instance_init, NULL };
+       GType maman_user_bar_type_id;
+       maman_user_bar_type_id = g_type_register_static (G_TYPE_OBJECT, "MamanUserBar", &g_define_type_info, 
0);
+       return maman_user_bar_type_id;
+}
+
+GType
+maman_user_bar_get_type (void)
+{
+       static volatile gsize maman_user_bar_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_user_bar_type_id__volatile)) {
+               GType maman_user_bar_type_id;
+               maman_user_bar_type_id = maman_user_bar_get_type_once ();
+               g_once_init_leave (&maman_user_bar_type_id__volatile, maman_user_bar_type_id);
+       }
+       return maman_user_bar_type_id__volatile;
+}
+
+MamanReturnFoo*
+maman_return_foo_construct (GType object_type)
+{
+       MamanReturnFoo * self = NULL;
+       self = (MamanReturnFoo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+MamanReturnFoo*
+maman_return_foo_new (void)
+{
+       return maman_return_foo_construct (MAMAN_TYPE_RETURN_FOO);
+}
+
+static void
+g_cclosure_user_marshal_INT__INT (GClosure * closure,
+                                  GValue * return_value,
+                                  guint n_param_values,
+                                  const GValue * param_values,
+                                  gpointer invocation_hint,
+                                  gpointer marshal_data)
+{
+       typedef gint (*GMarshalFunc_INT__INT) (gpointer data1, gint arg_1, gpointer data2);
+       register GMarshalFunc_INT__INT callback;
+       register GCClosure * cc;
+       register gpointer data1;
+       register gpointer data2;
+       gint v_return;
+       cc = (GCClosure *) closure;
+       g_return_if_fail (return_value != NULL);
+       g_return_if_fail (n_param_values == 2);
+       if (G_CCLOSURE_SWAP_DATA (closure)) {
+               data1 = closure->data;
+               data2 = param_values->data[0].v_pointer;
+       } else {
+               data1 = param_values->data[0].v_pointer;
+               data2 = closure->data;
+       }
+       callback = (GMarshalFunc_INT__INT) (marshal_data ? marshal_data : cc->callback);
+       v_return = callback (data1, g_value_get_int (param_values + 1), data2);
+       g_value_set_int (return_value, v_return);
+}
+
+static void
+g_cclosure_user_marshal_STRING__STRING (GClosure * closure,
+                                        GValue * return_value,
+                                        guint n_param_values,
+                                        const GValue * param_values,
+                                        gpointer invocation_hint,
+                                        gpointer marshal_data)
+{
+       typedef const char* (*GMarshalFunc_STRING__STRING) (gpointer data1, const char* arg_1, gpointer 
data2);
+       register GMarshalFunc_STRING__STRING callback;
+       register GCClosure * cc;
+       register gpointer data1;
+       register gpointer data2;
+       const char* v_return;
+       cc = (GCClosure *) closure;
+       g_return_if_fail (return_value != NULL);
+       g_return_if_fail (n_param_values == 2);
+       if (G_CCLOSURE_SWAP_DATA (closure)) {
+               data1 = closure->data;
+               data2 = param_values->data[0].v_pointer;
+       } else {
+               data1 = param_values->data[0].v_pointer;
+               data2 = closure->data;
+       }
+       callback = (GMarshalFunc_STRING__STRING) (marshal_data ? marshal_data : cc->callback);
+       v_return = callback (data1, g_value_get_string (param_values + 1), data2);
+       g_value_take_string (return_value, v_return);
+}
+
+static void
+maman_return_foo_class_init (MamanReturnFooClass * klass,
+                             gpointer klass_data)
+{
+       maman_return_foo_parent_class = g_type_class_peek_parent (klass);
+       maman_return_foo_signals[MAMAN_RETURN_FOO_INT_ACTIVATED_SIGNAL] = g_signal_new ("int-activated", 
MAMAN_TYPE_RETURN_FOO, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_INT__INT, G_TYPE_INT, 1, 
G_TYPE_INT);
+       maman_return_foo_signals[MAMAN_RETURN_FOO_STRING_ACTIVATED_SIGNAL] = g_signal_new 
("string-activated", MAMAN_TYPE_RETURN_FOO, G_SIGNAL_RUN_LAST, 0, NULL, NULL, 
g_cclosure_user_marshal_STRING__STRING, G_TYPE_STRING, 1, G_TYPE_STRING);
+}
+
+static void
+maman_return_foo_instance_init (MamanReturnFoo * self,
+                                gpointer klass)
+{
+}
+
+static GType
+maman_return_foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (MamanReturnFooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_return_foo_class_init, (GClassFinalizeFunc) NULL, NULL, 
sizeof (MamanReturnFoo), 0, (GInstanceInitFunc) maman_return_foo_instance_init, NULL };
+       GType maman_return_foo_type_id;
+       maman_return_foo_type_id = g_type_register_static (G_TYPE_OBJECT, "MamanReturnFoo", 
&g_define_type_info, 0);
+       return maman_return_foo_type_id;
+}
+
+GType
+maman_return_foo_get_type (void)
+{
+       static volatile gsize maman_return_foo_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_return_foo_type_id__volatile)) {
+               GType maman_return_foo_type_id;
+               maman_return_foo_type_id = maman_return_foo_get_type_once ();
+               g_once_init_leave (&maman_return_foo_type_id__volatile, maman_return_foo_type_id);
+       }
+       return maman_return_foo_type_id__volatile;
+}
+
+static gint
+__lambda6_ (MamanReturnBar* self,
+            MamanReturnFoo* foo,
+            gint arg)
+{
+       FILE* _tmp0_;
+       gint result = 0;
+       g_return_val_if_fail (MAMAN_IS_RETURN_FOO (foo), 0);
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, " %d", arg);
+       result = arg + 1;
+       return result;
+}
+
+static gint
+___lambda6__maman_return_foo_int_activated (MamanReturnFoo* _sender,
+                                            gint arg,
+                                            gpointer self)
+{
+       gint result;
+       result = __lambda6_ ((MamanReturnBar*) self, _sender, arg);
+       return result;
+}
+
+static gchar*
+__lambda7_ (MamanReturnBar* self,
+            MamanReturnFoo* foo,
+            const gchar* arg)
+{
+       FILE* _tmp0_;
+       gchar* _tmp1_;
+       gchar* result = NULL;
+       g_return_val_if_fail (MAMAN_IS_RETURN_FOO (foo), NULL);
+       g_return_val_if_fail (arg != NULL, NULL);
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, "%s", arg);
+       _tmp1_ = g_strdup (" 6");
+       result = _tmp1_;
+       return result;
+}
+
+static gchar*
+___lambda7__maman_return_foo_string_activated (MamanReturnFoo* _sender,
+                                               const gchar* arg,
+                                               gpointer self)
+{
+       gchar* result;
+       result = __lambda7_ ((MamanReturnBar*) self, _sender, arg);
+       return result;
+}
+
+void
+maman_return_bar_run (MamanReturnBar* self)
+{
+       FILE* _tmp0_;
+       MamanReturnFoo* foo = NULL;
+       MamanReturnFoo* _tmp1_;
+       FILE* _tmp2_;
+       gint _tmp3_ = 0;
+       FILE* _tmp4_;
+       gchar* _tmp5_ = NULL;
+       gchar* _tmp6_;
+       FILE* _tmp7_;
+       g_return_if_fail (MAMAN_IS_RETURN_BAR (self));
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, " 2");
+       _tmp1_ = maman_return_foo_new ();
+       foo = _tmp1_;
+       g_signal_connect_object (foo, "int-activated", (GCallback) 
___lambda6__maman_return_foo_int_activated, self, 0);
+       g_signal_connect_object (foo, "string-activated", (GCallback) 
___lambda7__maman_return_foo_string_activated, self, 0);
+       _tmp2_ = stdout;
+       g_signal_emit (foo, maman_return_foo_signals[MAMAN_RETURN_FOO_INT_ACTIVATED_SIGNAL], 0, 3, &_tmp3_);
+       fprintf (_tmp2_, " %d", _tmp3_);
+       _tmp4_ = stdout;
+       g_signal_emit (foo, maman_return_foo_signals[MAMAN_RETURN_FOO_STRING_ACTIVATED_SIGNAL], 0, " 5", 
&_tmp5_);
+       _tmp6_ = _tmp5_;
+       fprintf (_tmp4_, "%s", _tmp6_);
+       _g_free0 (_tmp6_);
+       _tmp7_ = stdout;
+       fprintf (_tmp7_, " 7");
+       _g_object_unref0 (foo);
+}
+
+MamanReturnBar*
+maman_return_bar_construct (GType object_type)
+{
+       MamanReturnBar * self = NULL;
+       self = (MamanReturnBar*) g_object_new (object_type, NULL);
+       return self;
+}
+
+MamanReturnBar*
+maman_return_bar_new (void)
+{
+       return maman_return_bar_construct (MAMAN_TYPE_RETURN_BAR);
+}
+
+static void
+maman_return_bar_class_init (MamanReturnBarClass * klass,
+                             gpointer klass_data)
+{
+       maman_return_bar_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+maman_return_bar_instance_init (MamanReturnBar * self,
+                                gpointer klass)
+{
+}
+
+static GType
+maman_return_bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (MamanReturnBarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_return_bar_class_init, (GClassFinalizeFunc) NULL, NULL, 
sizeof (MamanReturnBar), 0, (GInstanceInitFunc) maman_return_bar_instance_init, NULL };
+       GType maman_return_bar_type_id;
+       maman_return_bar_type_id = g_type_register_static (G_TYPE_OBJECT, "MamanReturnBar", 
&g_define_type_info, 0);
+       return maman_return_bar_type_id;
+}
+
+GType
+maman_return_bar_get_type (void)
+{
+       static volatile gsize maman_return_bar_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_return_bar_type_id__volatile)) {
+               GType maman_return_bar_type_id;
+               maman_return_bar_type_id = maman_return_bar_get_type_once ();
+               g_once_init_leave (&maman_return_bar_type_id__volatile, maman_return_bar_type_id);
+       }
+       return maman_return_bar_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       FILE* _tmp0_;
+       MamanBar* bar = NULL;
+       MamanBar* _tmp1_;
+       FILE* _tmp2_;
+       FILE* _tmp3_;
+       MamanUserBar* user_bar = NULL;
+       MamanUserBar* _tmp4_;
+       FILE* _tmp5_;
+       FILE* _tmp6_;
+       MamanReturnBar* return_bar = NULL;
+       MamanReturnBar* _tmp7_;
+       FILE* _tmp8_;
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, "Signal Test: 1");
+       _tmp1_ = maman_bar_new ();
+       bar = _tmp1_;
+       maman_bar_run (bar);
+       _tmp2_ = stdout;
+       fprintf (_tmp2_, " 10\n");
+       _tmp3_ = stdout;
+       fprintf (_tmp3_, "User Signal Test: 1");
+       _tmp4_ = maman_user_bar_new ();
+       user_bar = _tmp4_;
+       maman_user_bar_run (user_bar);
+       _tmp5_ = stdout;
+       fprintf (_tmp5_, " 6\n");
+       _tmp6_ = stdout;
+       fprintf (_tmp6_, "Signal Return Test: 1");
+       _tmp7_ = maman_return_bar_new ();
+       return_bar = _tmp7_;
+       maman_return_bar_run (return_bar);
+       _tmp8_ = stdout;
+       fprintf (_tmp8_, " 8\n");
+       _g_object_unref0 (return_bar);
+       _g_object_unref0 (user_bar);
+       _g_object_unref0 (bar);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/simple-generics-chainup.c-expected 
b/tests/objects/simple-generics-chainup.c-expected
new file mode 100644
index 000000000..a4831fc33
--- /dev/null
+++ b/tests/objects/simple-generics-chainup.c-expected
@@ -0,0 +1,146 @@
+/* objects_simple_generics_chainup.c generated by valac, the Vala compiler
+ * generated from objects_simple_generics_chainup.vala, do not modify */
+
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef GSequence IntSequence;
+typedef GSequence StringSequence;
+typedef GHashTable StringIntMap;
+#define _g_sequence_free0(var) ((var == NULL) ? NULL : (var = (g_sequence_free (var), NULL)))
+#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (IntSequence, g_sequence_free)
+static void int_sequence_instance_init (IntSequence * self);
+VALA_EXTERN IntSequence* int_sequence_new (void);
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (StringSequence, g_sequence_free)
+static void string_sequence_instance_init (StringSequence * self);
+VALA_EXTERN StringSequence* string_sequence_new (void);
+static void _g_free0_ (gpointer var);
+static void string_int_map_instance_init (StringIntMap * self);
+VALA_EXTERN StringIntMap* string_int_map_new (void);
+static void _vala_main (void);
+
+IntSequence*
+int_sequence_new (void)
+{
+       IntSequence* self;
+       self = (IntSequence*) g_sequence_new (NULL);
+       int_sequence_instance_init (self);
+       return self;
+}
+
+static void
+int_sequence_instance_init (IntSequence * self)
+{
+}
+
+static void
+_g_free0_ (gpointer var)
+{
+       var = (g_free (var), NULL);
+}
+
+StringSequence*
+string_sequence_new (void)
+{
+       StringSequence* self;
+       self = (StringSequence*) g_sequence_new (_g_free0_);
+       string_sequence_instance_init (self);
+       return self;
+}
+
+static void
+string_sequence_instance_init (StringSequence * self)
+{
+}
+
+StringIntMap*
+string_int_map_new (void)
+{
+       StringIntMap* self;
+       GHashFunc _tmp0_;
+       GEqualFunc _tmp1_;
+       _tmp0_ = g_str_hash;
+       _tmp1_ = g_str_equal;
+       self = (StringIntMap*) g_hash_table_new_full (_tmp0_, _tmp1_, _g_free0_, NULL);
+       string_int_map_instance_init (self);
+       return self;
+}
+
+static void
+string_int_map_instance_init (StringIntMap * self)
+{
+}
+
+static void
+_vala_main (void)
+{
+       {
+               IntSequence* seq = NULL;
+               IntSequence* _tmp0_;
+               GSequenceIter* _tmp1_;
+               GSequenceIter* _tmp2_;
+               gconstpointer _tmp3_;
+               _tmp0_ = int_sequence_new ();
+               seq = _tmp0_;
+               _tmp1_ = g_sequence_append ((GSequence*) seq, (gpointer) ((gintptr) 23));
+               _tmp2_ = g_sequence_get_begin_iter ((GSequence*) seq);
+               _tmp3_ = g_sequence_get (_tmp2_);
+               _vala_assert (((gint) ((gintptr) _tmp3_)) == 23, "seq.get_begin_iter ().get () == 23");
+               _g_sequence_free0 (seq);
+       }
+       {
+               StringSequence* seq = NULL;
+               StringSequence* _tmp4_;
+               gchar* _tmp5_;
+               GSequenceIter* _tmp6_;
+               GSequenceIter* _tmp7_;
+               gconstpointer _tmp8_;
+               _tmp4_ = string_sequence_new ();
+               seq = _tmp4_;
+               _tmp5_ = g_strdup ("foo");
+               _tmp6_ = g_sequence_append ((GSequence*) seq, _tmp5_);
+               _tmp7_ = g_sequence_get_begin_iter ((GSequence*) seq);
+               _tmp8_ = g_sequence_get (_tmp7_);
+               _vala_assert (g_strcmp0 ((const gchar*) _tmp8_, "foo") == 0, "seq.get_begin_iter ().get () == 
\"foo\"");
+               _g_sequence_free0 (seq);
+       }
+       {
+               StringIntMap* map = NULL;
+               StringIntMap* _tmp9_;
+               gchar* _tmp10_;
+               gconstpointer _tmp11_;
+               _tmp9_ = string_int_map_new ();
+               map = _tmp9_;
+               _tmp10_ = g_strdup ("foo");
+               g_hash_table_insert ((GHashTable*) map, _tmp10_, (gpointer) ((gintptr) 42));
+               _tmp11_ = g_hash_table_lookup ((GHashTable*) map, "foo");
+               _vala_assert (((gint) ((gintptr) _tmp11_)) == 42, "map[\"foo\"] == 42");
+               _g_hash_table_unref0 (map);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/singleton.c-expected b/tests/objects/singleton.c-expected
new file mode 100644
index 000000000..c8b42dc4b
--- /dev/null
+++ b/tests/objects/singleton.c-expected
@@ -0,0 +1,374 @@
+/* objects_singleton.c generated by valac, the Vala compiler
+ * generated from objects_singleton.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+enum  {
+       BAR_0_PROPERTY,
+       BAR_NUM_PROPERTIES
+};
+static GParamSpec* bar_properties[BAR_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+       gint bar;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _Bar {
+       GObject parent_instance;
+       BarPrivate * priv;
+       gint foo;
+};
+
+struct _BarClass {
+       GObjectClass parent_class;
+};
+
+static gpointer foo_parent_class = NULL;
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static GObject * foo_constructor (GType type,
+                           guint n_construct_properties,
+                           GObjectConstructParam * construct_properties);
+static void foo_finalize (GObject * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static GObject * bar_constructor (GType type,
+                           guint n_construct_properties,
+                           GObjectConstructParam * construct_properties);
+static void bar_finalize (GObject * obj);
+static GType bar_get_type_once (void);
+VALA_EXTERN void lifetime_1 (void);
+VALA_EXTERN void lifetime_2 (void);
+VALA_EXTERN void lifetime_3 (void);
+static void _vala_main (void);
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static GObject *
+foo_constructor (GType type,
+                 guint n_construct_properties,
+                 GObjectConstructParam * construct_properties)
+{
+       GObject * obj;
+       GObjectClass * parent_class;
+       static GObject * Foo_singleton__ref = NULL;
+       static GMutex Foo_singleton__lock;
+       static volatile gsize Foo_singleton__volatile = 0;
+       Foo * self;
+       if (g_once_init_enter (&Foo_singleton__volatile)) {
+               g_mutex_init (&Foo_singleton__lock);
+               g_once_init_leave (&Foo_singleton__volatile, 42);
+       }
+       g_mutex_lock (&Foo_singleton__lock);
+       if (Foo_singleton__ref != NULL) {
+               g_object_ref (Foo_singleton__ref);
+               g_mutex_unlock (&Foo_singleton__lock);
+               return Foo_singleton__ref;
+       }
+       parent_class = G_OBJECT_CLASS (foo_parent_class);
+       obj = parent_class->constructor (type, n_construct_properties, construct_properties);
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       Foo_singleton__ref = obj;
+       g_object_add_weak_pointer (Foo_singleton__ref, (gpointer) (&Foo_singleton__ref));
+       g_mutex_unlock (&Foo_singleton__lock);
+       return obj;
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       G_OBJECT_CLASS (klass)->constructor = foo_constructor;
+       G_OBJECT_CLASS (klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->bar = 42;
+}
+
+static void
+foo_finalize (GObject * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       G_OBJECT_CLASS (foo_parent_class)->finalize (obj);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar * self = NULL;
+       self = (Bar*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static GObject *
+bar_constructor (GType type,
+                 guint n_construct_properties,
+                 GObjectConstructParam * construct_properties)
+{
+       GObject * obj;
+       GObjectClass * parent_class;
+       static GObject * Bar_singleton__ref = NULL;
+       static GMutex Bar_singleton__lock;
+       static volatile gsize Bar_singleton__volatile = 0;
+       Bar * self;
+       if (g_once_init_enter (&Bar_singleton__volatile)) {
+               g_mutex_init (&Bar_singleton__lock);
+               g_once_init_leave (&Bar_singleton__volatile, 42);
+       }
+       g_mutex_lock (&Bar_singleton__lock);
+       if (Bar_singleton__ref != NULL) {
+               g_object_ref (Bar_singleton__ref);
+               g_mutex_unlock (&Bar_singleton__lock);
+               return Bar_singleton__ref;
+       }
+       parent_class = G_OBJECT_CLASS (bar_parent_class);
+       obj = parent_class->constructor (type, n_construct_properties, construct_properties);
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       Bar_singleton__ref = obj;
+       g_object_add_weak_pointer (Bar_singleton__ref, (gpointer) (&Bar_singleton__ref));
+       g_mutex_unlock (&Bar_singleton__lock);
+       return obj;
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       G_OBJECT_CLASS (klass)->constructor = bar_constructor;
+       G_OBJECT_CLASS (klass)->finalize = bar_finalize;
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+       self->foo = 42;
+}
+
+static void
+bar_finalize (GObject * obj)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       G_OBJECT_CLASS (bar_parent_class)->finalize (obj);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (G_TYPE_OBJECT, "Bar", &g_define_type_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+void
+lifetime_1 (void)
+{
+       Foo* a = NULL;
+       Foo* _tmp0_;
+       Foo* b = NULL;
+       GObject* _tmp1_;
+       GObject* _tmp2_;
+       _tmp0_ = foo_new ();
+       a = _tmp0_;
+       _tmp1_ = g_object_new (TYPE_FOO, NULL);
+       _tmp2_ = G_IS_INITIALLY_UNOWNED (_tmp1_) ? g_object_ref_sink (_tmp1_) : _tmp1_;
+       b = G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, TYPE_FOO, Foo);
+       _vala_assert (a == b, "a == b");
+       _vala_assert (a->bar == 23, "a.bar == 23");
+       _g_object_unref0 (b);
+       _g_object_unref0 (a);
+}
+
+void
+lifetime_2 (void)
+{
+       Foo* a = NULL;
+       Foo* _tmp0_;
+       Foo* b = NULL;
+       GObject* _tmp1_;
+       GObject* _tmp2_;
+       _tmp0_ = foo_new ();
+       a = _tmp0_;
+       _tmp1_ = g_object_new (TYPE_FOO, NULL);
+       _tmp2_ = G_IS_INITIALLY_UNOWNED (_tmp1_) ? g_object_ref_sink (_tmp1_) : _tmp1_;
+       b = G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, TYPE_FOO, Foo);
+       _vala_assert (a == b, "a == b");
+       _vala_assert (a->bar == 42, "a.bar == 42");
+       _g_object_unref0 (b);
+       _g_object_unref0 (a);
+}
+
+void
+lifetime_3 (void)
+{
+       Bar* a = NULL;
+       Bar* _tmp0_;
+       Bar* b = NULL;
+       GObject* _tmp1_;
+       GObject* _tmp2_;
+       _tmp0_ = bar_new ();
+       a = _tmp0_;
+       _tmp1_ = g_object_new (TYPE_BAR, NULL);
+       _tmp2_ = G_IS_INITIALLY_UNOWNED (_tmp1_) ? g_object_ref_sink (_tmp1_) : _tmp1_;
+       b = G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, TYPE_BAR, Bar);
+       _vala_assert (a == b, "a == b");
+       _vala_assert (a->foo == 23, "a.foo == 23");
+       _g_object_unref0 (b);
+       _g_object_unref0 (a);
+}
+
+static void
+_vala_main (void)
+{
+       {
+               Foo* singleton = NULL;
+               Foo* _tmp0_;
+               _tmp0_ = foo_new ();
+               singleton = _tmp0_;
+               singleton->bar = 23;
+               lifetime_1 ();
+               _g_object_unref0 (singleton);
+       }
+       {
+               Foo* singleton = NULL;
+               Foo* _tmp1_;
+               _tmp1_ = foo_new ();
+               singleton = _tmp1_;
+               _vala_assert (singleton->bar == 42, "singleton.bar == 42");
+               lifetime_2 ();
+               _g_object_unref0 (singleton);
+       }
+       {
+               Bar* singleton = NULL;
+               Bar* _tmp2_;
+               _tmp2_ = bar_new ();
+               singleton = _tmp2_;
+               singleton->foo = 23;
+               lifetime_3 ();
+               _g_object_unref0 (singleton);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/test-025.c-expected b/tests/objects/test-025.c-expected
new file mode 100644
index 000000000..6218bdced
--- /dev/null
+++ b/tests/objects/test-025.c-expected
@@ -0,0 +1,255 @@
+/* objects_test_025.c generated by valac, the Vala compiler
+ * generated from objects_test_025.vala, do not modify */
+
+#include <glib-object.h>
+#include <stdio.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define MAMAN_TYPE_BAR (maman_bar_get_type ())
+#define MAMAN_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_BAR, MamanBar))
+#define MAMAN_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAMAN_TYPE_BAR, MamanBarClass))
+#define MAMAN_IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_BAR))
+#define MAMAN_IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAMAN_TYPE_BAR))
+#define MAMAN_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAMAN_TYPE_BAR, MamanBarClass))
+
+typedef struct _MamanBar MamanBar;
+typedef struct _MamanBarClass MamanBarClass;
+typedef struct _MamanBarPrivate MamanBarPrivate;
+enum  {
+       MAMAN_BAR_0_PROPERTY,
+       MAMAN_BAR_NUM_PROPERTIES
+};
+static GParamSpec* maman_bar_properties[MAMAN_BAR_NUM_PROPERTIES];
+
+#define MAMAN_TYPE_SUB_BAR (maman_sub_bar_get_type ())
+#define MAMAN_SUB_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_SUB_BAR, MamanSubBar))
+#define MAMAN_SUB_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAMAN_TYPE_SUB_BAR, MamanSubBarClass))
+#define MAMAN_IS_SUB_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_SUB_BAR))
+#define MAMAN_IS_SUB_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAMAN_TYPE_SUB_BAR))
+#define MAMAN_SUB_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAMAN_TYPE_SUB_BAR, 
MamanSubBarClass))
+
+typedef struct _MamanSubBar MamanSubBar;
+typedef struct _MamanSubBarClass MamanSubBarClass;
+typedef struct _MamanSubBarPrivate MamanSubBarPrivate;
+enum  {
+       MAMAN_SUB_BAR_0_PROPERTY,
+       MAMAN_SUB_BAR_NUM_PROPERTIES
+};
+static GParamSpec* maman_sub_bar_properties[MAMAN_SUB_BAR_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+
+struct _MamanBar {
+       GObject parent_instance;
+       MamanBarPrivate * priv;
+};
+
+struct _MamanBarClass {
+       GObjectClass parent_class;
+       void (*do_action) (MamanBar* self);
+};
+
+struct _MamanSubBar {
+       MamanBar parent_instance;
+       MamanSubBarPrivate * priv;
+};
+
+struct _MamanSubBarClass {
+       MamanBarClass parent_class;
+};
+
+static gpointer maman_bar_parent_class = NULL;
+static gpointer maman_sub_bar_parent_class = NULL;
+
+VALA_EXTERN GType maman_bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MamanBar, g_object_unref)
+VALA_EXTERN void maman_bar_do_action (MamanBar* self);
+static void maman_bar_real_do_action (MamanBar* self);
+VALA_EXTERN MamanBar* maman_bar_new (void);
+VALA_EXTERN MamanBar* maman_bar_construct (GType object_type);
+static GType maman_bar_get_type_once (void);
+VALA_EXTERN GType maman_sub_bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MamanSubBar, g_object_unref)
+static void maman_sub_bar_real_do_action (MamanBar* base);
+VALA_EXTERN void maman_sub_bar_run (MamanSubBar* self);
+static gint maman_sub_bar_main (void);
+VALA_EXTERN MamanSubBar* maman_sub_bar_new (void);
+VALA_EXTERN MamanSubBar* maman_sub_bar_construct (GType object_type);
+static GType maman_sub_bar_get_type_once (void);
+
+static void
+maman_bar_real_do_action (MamanBar* self)
+{
+       FILE* _tmp0_;
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, " 3");
+}
+
+void
+maman_bar_do_action (MamanBar* self)
+{
+       MamanBarClass* _klass_;
+       g_return_if_fail (MAMAN_IS_BAR (self));
+       _klass_ = MAMAN_BAR_GET_CLASS (self);
+       if (_klass_->do_action) {
+               _klass_->do_action (self);
+       }
+}
+
+MamanBar*
+maman_bar_construct (GType object_type)
+{
+       MamanBar * self = NULL;
+       self = (MamanBar*) g_object_new (object_type, NULL);
+       return self;
+}
+
+MamanBar*
+maman_bar_new (void)
+{
+       return maman_bar_construct (MAMAN_TYPE_BAR);
+}
+
+static void
+maman_bar_class_init (MamanBarClass * klass,
+                      gpointer klass_data)
+{
+       maman_bar_parent_class = g_type_class_peek_parent (klass);
+       ((MamanBarClass *) klass)->do_action = (void (*) (MamanBar*)) maman_bar_real_do_action;
+}
+
+static void
+maman_bar_instance_init (MamanBar * self,
+                         gpointer klass)
+{
+}
+
+static GType
+maman_bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (MamanBarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(MamanBar), 0, (GInstanceInitFunc) maman_bar_instance_init, NULL };
+       GType maman_bar_type_id;
+       maman_bar_type_id = g_type_register_static (G_TYPE_OBJECT, "MamanBar", &g_define_type_info, 0);
+       return maman_bar_type_id;
+}
+
+GType
+maman_bar_get_type (void)
+{
+       static volatile gsize maman_bar_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_bar_type_id__volatile)) {
+               GType maman_bar_type_id;
+               maman_bar_type_id = maman_bar_get_type_once ();
+               g_once_init_leave (&maman_bar_type_id__volatile, maman_bar_type_id);
+       }
+       return maman_bar_type_id__volatile;
+}
+
+static void
+maman_sub_bar_real_do_action (MamanBar* base)
+{
+       MamanSubBar * self;
+       FILE* _tmp0_;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, MAMAN_TYPE_SUB_BAR, MamanSubBar);
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, " BAD");
+}
+
+void
+maman_sub_bar_run (MamanSubBar* self)
+{
+       FILE* _tmp0_;
+       FILE* _tmp1_;
+       g_return_if_fail (MAMAN_IS_SUB_BAR (self));
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, " 2");
+       MAMAN_BAR_CLASS (maman_sub_bar_parent_class)->do_action (G_TYPE_CHECK_INSTANCE_CAST (self, 
MAMAN_TYPE_BAR, MamanBar));
+       _tmp1_ = stdout;
+       fprintf (_tmp1_, " 4");
+}
+
+static gint
+maman_sub_bar_main (void)
+{
+       FILE* _tmp0_;
+       MamanSubBar* bar = NULL;
+       MamanSubBar* _tmp1_;
+       FILE* _tmp2_;
+       gint result = 0;
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, "Base Access Test: 1");
+       _tmp1_ = maman_sub_bar_new ();
+       bar = _tmp1_;
+       maman_sub_bar_run (bar);
+       _tmp2_ = stdout;
+       fprintf (_tmp2_, " 5\n");
+       result = 0;
+       _g_object_unref0 (bar);
+       return result;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       return maman_sub_bar_main ();
+}
+
+MamanSubBar*
+maman_sub_bar_construct (GType object_type)
+{
+       MamanSubBar * self = NULL;
+       self = (MamanSubBar*) maman_bar_construct (object_type);
+       return self;
+}
+
+MamanSubBar*
+maman_sub_bar_new (void)
+{
+       return maman_sub_bar_construct (MAMAN_TYPE_SUB_BAR);
+}
+
+static void
+maman_sub_bar_class_init (MamanSubBarClass * klass,
+                          gpointer klass_data)
+{
+       maman_sub_bar_parent_class = g_type_class_peek_parent (klass);
+       ((MamanBarClass *) klass)->do_action = (void (*) (MamanBar*)) maman_sub_bar_real_do_action;
+}
+
+static void
+maman_sub_bar_instance_init (MamanSubBar * self,
+                             gpointer klass)
+{
+}
+
+static GType
+maman_sub_bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (MamanSubBarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_sub_bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(MamanSubBar), 0, (GInstanceInitFunc) maman_sub_bar_instance_init, NULL };
+       GType maman_sub_bar_type_id;
+       maman_sub_bar_type_id = g_type_register_static (MAMAN_TYPE_BAR, "MamanSubBar", &g_define_type_info, 
0);
+       return maman_sub_bar_type_id;
+}
+
+GType
+maman_sub_bar_get_type (void)
+{
+       static volatile gsize maman_sub_bar_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_sub_bar_type_id__volatile)) {
+               GType maman_sub_bar_type_id;
+               maman_sub_bar_type_id = maman_sub_bar_get_type_once ();
+               g_once_init_leave (&maman_sub_bar_type_id__volatile, maman_sub_bar_type_id);
+       }
+       return maman_sub_bar_type_id__volatile;
+}
+
diff --git a/tests/objects/test-026.c-expected b/tests/objects/test-026.c-expected
new file mode 100644
index 000000000..32040897f
--- /dev/null
+++ b/tests/objects/test-026.c-expected
@@ -0,0 +1,240 @@
+/* objects_test_026.c generated by valac, the Vala compiler
+ * generated from objects_test_026.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <stdio.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define MAMAN_TYPE_BAR (maman_bar_get_type ())
+#define MAMAN_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_BAR, MamanBar))
+#define MAMAN_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAMAN_TYPE_BAR, MamanBarClass))
+#define MAMAN_IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_BAR))
+#define MAMAN_IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAMAN_TYPE_BAR))
+#define MAMAN_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAMAN_TYPE_BAR, MamanBarClass))
+
+typedef struct _MamanBar MamanBar;
+typedef struct _MamanBarClass MamanBarClass;
+typedef struct _MamanBarPrivate MamanBarPrivate;
+enum  {
+       MAMAN_BAR_0_PROPERTY,
+       MAMAN_BAR_NUM_PROPERTIES
+};
+static GParamSpec* maman_bar_properties[MAMAN_BAR_NUM_PROPERTIES];
+
+#define MAMAN_TYPE_SUB_BAR (maman_sub_bar_get_type ())
+#define MAMAN_SUB_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_SUB_BAR, MamanSubBar))
+#define MAMAN_SUB_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAMAN_TYPE_SUB_BAR, MamanSubBarClass))
+#define MAMAN_IS_SUB_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_SUB_BAR))
+#define MAMAN_IS_SUB_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAMAN_TYPE_SUB_BAR))
+#define MAMAN_SUB_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAMAN_TYPE_SUB_BAR, 
MamanSubBarClass))
+
+typedef struct _MamanSubBar MamanSubBar;
+typedef struct _MamanSubBarClass MamanSubBarClass;
+typedef struct _MamanSubBarPrivate MamanSubBarPrivate;
+enum  {
+       MAMAN_SUB_BAR_0_PROPERTY,
+       MAMAN_SUB_BAR_NUM_PROPERTIES
+};
+static GParamSpec* maman_sub_bar_properties[MAMAN_SUB_BAR_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+
+struct _MamanBar {
+       GObject parent_instance;
+       MamanBarPrivate * priv;
+};
+
+struct _MamanBarClass {
+       GObjectClass parent_class;
+};
+
+struct _MamanSubBar {
+       MamanBar parent_instance;
+       MamanSubBarPrivate * priv;
+};
+
+struct _MamanSubBarClass {
+       MamanBarClass parent_class;
+};
+
+static gpointer maman_bar_parent_class = NULL;
+static gpointer maman_sub_bar_parent_class = NULL;
+
+VALA_EXTERN GType maman_bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MamanBar, g_object_unref)
+VALA_EXTERN void maman_bar_do_action (MamanBar* self);
+VALA_EXTERN MamanBar* maman_bar_new (void);
+VALA_EXTERN MamanBar* maman_bar_construct (GType object_type);
+static GType maman_bar_get_type_once (void);
+VALA_EXTERN GType maman_sub_bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MamanSubBar, g_object_unref)
+VALA_EXTERN void maman_sub_bar_do_action (MamanSubBar* self);
+VALA_EXTERN void maman_sub_bar_run (MamanSubBar* self);
+static gint maman_sub_bar_main (void);
+VALA_EXTERN MamanSubBar* maman_sub_bar_new (void);
+VALA_EXTERN MamanSubBar* maman_sub_bar_construct (GType object_type);
+static GType maman_sub_bar_get_type_once (void);
+
+void
+maman_bar_do_action (MamanBar* self)
+{
+       FILE* _tmp0_;
+       g_return_if_fail (MAMAN_IS_BAR (self));
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, " 3");
+}
+
+MamanBar*
+maman_bar_construct (GType object_type)
+{
+       MamanBar * self = NULL;
+       self = (MamanBar*) g_object_new (object_type, NULL);
+       return self;
+}
+
+MamanBar*
+maman_bar_new (void)
+{
+       return maman_bar_construct (MAMAN_TYPE_BAR);
+}
+
+static void
+maman_bar_class_init (MamanBarClass * klass,
+                      gpointer klass_data)
+{
+       maman_bar_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+maman_bar_instance_init (MamanBar * self,
+                         gpointer klass)
+{
+}
+
+static GType
+maman_bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (MamanBarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(MamanBar), 0, (GInstanceInitFunc) maman_bar_instance_init, NULL };
+       GType maman_bar_type_id;
+       maman_bar_type_id = g_type_register_static (G_TYPE_OBJECT, "MamanBar", &g_define_type_info, 0);
+       return maman_bar_type_id;
+}
+
+GType
+maman_bar_get_type (void)
+{
+       static volatile gsize maman_bar_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_bar_type_id__volatile)) {
+               GType maman_bar_type_id;
+               maman_bar_type_id = maman_bar_get_type_once ();
+               g_once_init_leave (&maman_bar_type_id__volatile, maman_bar_type_id);
+       }
+       return maman_bar_type_id__volatile;
+}
+
+void
+maman_sub_bar_do_action (MamanSubBar* self)
+{
+       FILE* _tmp0_;
+       g_return_if_fail (MAMAN_IS_SUB_BAR (self));
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, " BAD");
+}
+
+void
+maman_sub_bar_run (MamanSubBar* self)
+{
+       FILE* _tmp0_;
+       FILE* _tmp1_;
+       g_return_if_fail (MAMAN_IS_SUB_BAR (self));
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, " 2");
+       maman_bar_do_action (G_TYPE_CHECK_INSTANCE_CAST (self, MAMAN_TYPE_BAR, MamanBar));
+       _tmp1_ = stdout;
+       fprintf (_tmp1_, " 4");
+}
+
+static gint
+maman_sub_bar_main (void)
+{
+       FILE* _tmp0_;
+       MamanSubBar* bar = NULL;
+       MamanSubBar* _tmp1_;
+       FILE* _tmp2_;
+       gint result = 0;
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, "Hidden Base Method Access Test: 1");
+       _tmp1_ = maman_sub_bar_new ();
+       bar = _tmp1_;
+       maman_sub_bar_run (bar);
+       _tmp2_ = stdout;
+       fprintf (_tmp2_, " 5\n");
+       result = 0;
+       _g_object_unref0 (bar);
+       return result;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       return maman_sub_bar_main ();
+}
+
+MamanSubBar*
+maman_sub_bar_construct (GType object_type)
+{
+       MamanSubBar * self = NULL;
+       self = (MamanSubBar*) maman_bar_construct (object_type);
+       return self;
+}
+
+MamanSubBar*
+maman_sub_bar_new (void)
+{
+       return maman_sub_bar_construct (MAMAN_TYPE_SUB_BAR);
+}
+
+static void
+maman_sub_bar_class_init (MamanSubBarClass * klass,
+                          gpointer klass_data)
+{
+       maman_sub_bar_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+maman_sub_bar_instance_init (MamanSubBar * self,
+                             gpointer klass)
+{
+}
+
+static GType
+maman_sub_bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (MamanSubBarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_sub_bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(MamanSubBar), 0, (GInstanceInitFunc) maman_sub_bar_instance_init, NULL };
+       GType maman_sub_bar_type_id;
+       maman_sub_bar_type_id = g_type_register_static (MAMAN_TYPE_BAR, "MamanSubBar", &g_define_type_info, 
0);
+       return maman_sub_bar_type_id;
+}
+
+GType
+maman_sub_bar_get_type (void)
+{
+       static volatile gsize maman_sub_bar_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_sub_bar_type_id__volatile)) {
+               GType maman_sub_bar_type_id;
+               maman_sub_bar_type_id = maman_sub_bar_get_type_once ();
+               g_once_init_leave (&maman_sub_bar_type_id__volatile, maman_sub_bar_type_id);
+       }
+       return maman_sub_bar_type_id__volatile;
+}
+
diff --git a/tests/objects/test-029.c-expected b/tests/objects/test-029.c-expected
new file mode 100644
index 000000000..f9be4cafd
--- /dev/null
+++ b/tests/objects/test-029.c-expected
@@ -0,0 +1,278 @@
+/* objects_test_029.c generated by valac, the Vala compiler
+ * generated from objects_test_029.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <stdio.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define MAMAN_TYPE_FOO (maman_foo_get_type ())
+#define MAMAN_FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_FOO, MamanFoo))
+#define MAMAN_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAMAN_TYPE_FOO, MamanFooClass))
+#define MAMAN_IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_FOO))
+#define MAMAN_IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAMAN_TYPE_FOO))
+#define MAMAN_FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAMAN_TYPE_FOO, MamanFooClass))
+
+typedef struct _MamanFoo MamanFoo;
+typedef struct _MamanFooClass MamanFooClass;
+typedef struct _MamanFooPrivate MamanFooPrivate;
+enum  {
+       MAMAN_FOO_0_PROPERTY,
+       MAMAN_FOO_P1_PROPERTY,
+       MAMAN_FOO_P2_PROPERTY,
+       MAMAN_FOO_NUM_PROPERTIES
+};
+static GParamSpec* maman_foo_properties[MAMAN_FOO_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+
+struct _MamanFoo {
+       GObject parent_instance;
+       MamanFooPrivate * priv;
+};
+
+struct _MamanFooClass {
+       GObjectClass parent_class;
+};
+
+struct _MamanFooPrivate {
+       gint _p1;
+       gint _p2;
+};
+
+static gint MamanFoo_private_offset;
+static gpointer maman_foo_parent_class = NULL;
+
+VALA_EXTERN GType maman_foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MamanFoo, g_object_unref)
+VALA_EXTERN MamanFoo* maman_foo_new (gint i,
+                         gint p2);
+VALA_EXTERN MamanFoo* maman_foo_construct (GType object_type,
+                               gint i,
+                               gint p2);
+VALA_EXTERN void maman_foo_set_p1 (MamanFoo* self,
+                       gint value);
+VALA_EXTERN void maman_foo_set_p2 (MamanFoo* self,
+                       gint value);
+static gint maman_foo_main (void);
+VALA_EXTERN gint maman_foo_get_p2 (MamanFoo* self);
+VALA_EXTERN gint maman_foo_get_p1 (MamanFoo* self);
+static void maman_foo_finalize (GObject * obj);
+static GType maman_foo_get_type_once (void);
+static void _vala_maman_foo_get_property (GObject * object,
+                                   guint property_id,
+                                   GValue * value,
+                                   GParamSpec * pspec);
+static void _vala_maman_foo_set_property (GObject * object,
+                                   guint property_id,
+                                   const GValue * value,
+                                   GParamSpec * pspec);
+
+static inline gpointer
+maman_foo_get_instance_private (MamanFoo* self)
+{
+       return G_STRUCT_MEMBER_P (self, MamanFoo_private_offset);
+}
+
+MamanFoo*
+maman_foo_construct (GType object_type,
+                     gint i,
+                     gint p2)
+{
+       MamanFoo * self = NULL;
+       self = (MamanFoo*) g_object_new (object_type, NULL);
+       maman_foo_set_p1 (self, 2 * i);
+       maman_foo_set_p2 (self, p2);
+       return self;
+}
+
+MamanFoo*
+maman_foo_new (gint i,
+               gint p2)
+{
+       return maman_foo_construct (MAMAN_TYPE_FOO, i, p2);
+}
+
+static gint
+maman_foo_main (void)
+{
+       FILE* _tmp0_;
+       MamanFoo* foo = NULL;
+       MamanFoo* _tmp1_;
+       FILE* _tmp2_;
+       FILE* _tmp3_;
+       gint _tmp4_;
+       FILE* _tmp5_;
+       gint _tmp6_;
+       FILE* _tmp7_;
+       gint result = 0;
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, "Construct Formal Parameter Test: 1");
+       _tmp1_ = maman_foo_new (2, 3);
+       foo = _tmp1_;
+       _tmp2_ = stdout;
+       fprintf (_tmp2_, " 2");
+       _tmp3_ = stdout;
+       _tmp4_ = foo->priv->_p2;
+       fprintf (_tmp3_, " %d", _tmp4_);
+       _tmp5_ = stdout;
+       _tmp6_ = foo->priv->_p1;
+       fprintf (_tmp5_, " %d", _tmp6_);
+       _tmp7_ = stdout;
+       fprintf (_tmp7_, " 5\n");
+       result = 0;
+       _g_object_unref0 (foo);
+       return result;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       return maman_foo_main ();
+}
+
+gint
+maman_foo_get_p1 (MamanFoo* self)
+{
+       gint result;
+       g_return_val_if_fail (MAMAN_IS_FOO (self), 0);
+       result = self->priv->_p1;
+       return result;
+}
+
+void
+maman_foo_set_p1 (MamanFoo* self,
+                  gint value)
+{
+       gint old_value;
+       g_return_if_fail (MAMAN_IS_FOO (self));
+       old_value = maman_foo_get_p1 (self);
+       if (old_value != value) {
+               self->priv->_p1 = value;
+               g_object_notify_by_pspec ((GObject *) self, maman_foo_properties[MAMAN_FOO_P1_PROPERTY]);
+       }
+}
+
+gint
+maman_foo_get_p2 (MamanFoo* self)
+{
+       gint result;
+       g_return_val_if_fail (MAMAN_IS_FOO (self), 0);
+       result = self->priv->_p2;
+       return result;
+}
+
+void
+maman_foo_set_p2 (MamanFoo* self,
+                  gint value)
+{
+       gint old_value;
+       g_return_if_fail (MAMAN_IS_FOO (self));
+       old_value = maman_foo_get_p2 (self);
+       if (old_value != value) {
+               self->priv->_p2 = value;
+               g_object_notify_by_pspec ((GObject *) self, maman_foo_properties[MAMAN_FOO_P2_PROPERTY]);
+       }
+}
+
+static void
+maman_foo_class_init (MamanFooClass * klass,
+                      gpointer klass_data)
+{
+       maman_foo_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &MamanFoo_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_maman_foo_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_maman_foo_set_property;
+       G_OBJECT_CLASS (klass)->finalize = maman_foo_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), MAMAN_FOO_P1_PROPERTY, 
maman_foo_properties[MAMAN_FOO_P1_PROPERTY] = g_param_spec_int ("p1", "p1", "p1", G_MININT, G_MAXINT, 0, 
G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), MAMAN_FOO_P2_PROPERTY, 
maman_foo_properties[MAMAN_FOO_P2_PROPERTY] = g_param_spec_int ("p2", "p2", "p2", G_MININT, G_MAXINT, 0, 
G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+}
+
+static void
+maman_foo_instance_init (MamanFoo * self,
+                         gpointer klass)
+{
+       self->priv = maman_foo_get_instance_private (self);
+}
+
+static void
+maman_foo_finalize (GObject * obj)
+{
+       MamanFoo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, MAMAN_TYPE_FOO, MamanFoo);
+       G_OBJECT_CLASS (maman_foo_parent_class)->finalize (obj);
+}
+
+static GType
+maman_foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (MamanFooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(MamanFoo), 0, (GInstanceInitFunc) maman_foo_instance_init, NULL };
+       GType maman_foo_type_id;
+       maman_foo_type_id = g_type_register_static (G_TYPE_OBJECT, "MamanFoo", &g_define_type_info, 0);
+       MamanFoo_private_offset = g_type_add_instance_private (maman_foo_type_id, sizeof (MamanFooPrivate));
+       return maman_foo_type_id;
+}
+
+GType
+maman_foo_get_type (void)
+{
+       static volatile gsize maman_foo_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_foo_type_id__volatile)) {
+               GType maman_foo_type_id;
+               maman_foo_type_id = maman_foo_get_type_once ();
+               g_once_init_leave (&maman_foo_type_id__volatile, maman_foo_type_id);
+       }
+       return maman_foo_type_id__volatile;
+}
+
+static void
+_vala_maman_foo_get_property (GObject * object,
+                              guint property_id,
+                              GValue * value,
+                              GParamSpec * pspec)
+{
+       MamanFoo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, MAMAN_TYPE_FOO, MamanFoo);
+       switch (property_id) {
+               case MAMAN_FOO_P1_PROPERTY:
+               g_value_set_int (value, maman_foo_get_p1 (self));
+               break;
+               case MAMAN_FOO_P2_PROPERTY:
+               g_value_set_int (value, maman_foo_get_p2 (self));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_maman_foo_set_property (GObject * object,
+                              guint property_id,
+                              const GValue * value,
+                              GParamSpec * pspec)
+{
+       MamanFoo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, MAMAN_TYPE_FOO, MamanFoo);
+       switch (property_id) {
+               case MAMAN_FOO_P1_PROPERTY:
+               maman_foo_set_p1 (self, g_value_get_int (value));
+               break;
+               case MAMAN_FOO_P2_PROPERTY:
+               maman_foo_set_p2 (self, g_value_get_int (value));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
diff --git a/tests/objects/test-034.c-expected b/tests/objects/test-034.c-expected
new file mode 100644
index 000000000..b586b679f
--- /dev/null
+++ b/tests/objects/test-034.c-expected
@@ -0,0 +1,554 @@
+/* objects_test_034.c generated by valac, the Vala compiler
+ * generated from objects_test_034.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <stdio.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define MAMAN_TYPE_A (maman_a_get_type ())
+#define MAMAN_A(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_A, MamanA))
+#define MAMAN_A_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAMAN_TYPE_A, MamanAClass))
+#define MAMAN_IS_A(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_A))
+#define MAMAN_IS_A_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAMAN_TYPE_A))
+#define MAMAN_A_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAMAN_TYPE_A, MamanAClass))
+
+typedef struct _MamanA MamanA;
+typedef struct _MamanAClass MamanAClass;
+typedef struct _MamanAPrivate MamanAPrivate;
+enum  {
+       MAMAN_A_0_PROPERTY,
+       MAMAN_A_NUM_PROPERTIES
+};
+static GParamSpec* maman_a_properties[MAMAN_A_NUM_PROPERTIES];
+
+#define MAMAN_TYPE_B (maman_b_get_type ())
+#define MAMAN_B(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_B, MamanB))
+#define MAMAN_B_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAMAN_TYPE_B, MamanBClass))
+#define MAMAN_IS_B(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_B))
+#define MAMAN_IS_B_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAMAN_TYPE_B))
+#define MAMAN_B_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAMAN_TYPE_B, MamanBClass))
+
+typedef struct _MamanB MamanB;
+typedef struct _MamanBClass MamanBClass;
+typedef struct _MamanBPrivate MamanBPrivate;
+enum  {
+       MAMAN_B_0_PROPERTY,
+       MAMAN_B_NUM_PROPERTIES
+};
+static GParamSpec* maman_b_properties[MAMAN_B_NUM_PROPERTIES];
+
+#define MAMAN_TYPE_C (maman_c_get_type ())
+#define MAMAN_C(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_C, MamanC))
+#define MAMAN_C_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAMAN_TYPE_C, MamanCClass))
+#define MAMAN_IS_C(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_C))
+#define MAMAN_IS_C_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAMAN_TYPE_C))
+#define MAMAN_C_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAMAN_TYPE_C, MamanCClass))
+
+typedef struct _MamanC MamanC;
+typedef struct _MamanCClass MamanCClass;
+typedef struct _MamanCPrivate MamanCPrivate;
+enum  {
+       MAMAN_C_0_PROPERTY,
+       MAMAN_C_NUM_PROPERTIES
+};
+static GParamSpec* maman_c_properties[MAMAN_C_NUM_PROPERTIES];
+
+#define MAMAN_TYPE_BAR (maman_bar_get_type ())
+#define MAMAN_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_BAR, MamanBar))
+#define MAMAN_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAMAN_TYPE_BAR, MamanBarClass))
+#define MAMAN_IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_BAR))
+#define MAMAN_IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAMAN_TYPE_BAR))
+#define MAMAN_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAMAN_TYPE_BAR, MamanBarClass))
+
+typedef struct _MamanBar MamanBar;
+typedef struct _MamanBarClass MamanBarClass;
+typedef struct _MamanBarPrivate MamanBarPrivate;
+enum  {
+       MAMAN_BAR_0_PROPERTY,
+       MAMAN_BAR_NUM_PROPERTIES
+};
+static GParamSpec* maman_bar_properties[MAMAN_BAR_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+
+struct _MamanA {
+       GObject parent_instance;
+       MamanAPrivate * priv;
+};
+
+struct _MamanAClass {
+       GObjectClass parent_class;
+};
+
+struct _MamanB {
+       MamanA parent_instance;
+       MamanBPrivate * priv;
+};
+
+struct _MamanBClass {
+       MamanAClass parent_class;
+};
+
+struct _MamanC {
+       GObject parent_instance;
+       MamanCPrivate * priv;
+};
+
+struct _MamanCClass {
+       GObjectClass parent_class;
+};
+
+struct _MamanBar {
+       GObject parent_instance;
+       MamanBarPrivate * priv;
+};
+
+struct _MamanBarClass {
+       GObjectClass parent_class;
+};
+
+static gpointer maman_a_parent_class = NULL;
+static gpointer maman_b_parent_class = NULL;
+static gpointer maman_c_parent_class = NULL;
+static gpointer maman_bar_parent_class = NULL;
+
+VALA_EXTERN GType maman_a_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MamanA, g_object_unref)
+VALA_EXTERN MamanA* maman_a_new (void);
+VALA_EXTERN MamanA* maman_a_construct (GType object_type);
+static GType maman_a_get_type_once (void);
+VALA_EXTERN GType maman_b_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MamanB, g_object_unref)
+VALA_EXTERN MamanB* maman_b_new (void);
+VALA_EXTERN MamanB* maman_b_construct (GType object_type);
+static GType maman_b_get_type_once (void);
+VALA_EXTERN GType maman_c_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MamanC, g_object_unref)
+VALA_EXTERN MamanC* maman_c_new (void);
+VALA_EXTERN MamanC* maman_c_construct (GType object_type);
+static GType maman_c_get_type_once (void);
+VALA_EXTERN GType maman_bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MamanBar, g_object_unref)
+static void maman_bar_main (void);
+VALA_EXTERN MamanBar* maman_bar_new (void);
+VALA_EXTERN MamanBar* maman_bar_construct (GType object_type);
+static GType maman_bar_get_type_once (void);
+
+MamanA*
+maman_a_construct (GType object_type)
+{
+       MamanA * self = NULL;
+       self = (MamanA*) g_object_new (object_type, NULL);
+       return self;
+}
+
+MamanA*
+maman_a_new (void)
+{
+       return maman_a_construct (MAMAN_TYPE_A);
+}
+
+static void
+maman_a_class_init (MamanAClass * klass,
+                    gpointer klass_data)
+{
+       maman_a_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+maman_a_instance_init (MamanA * self,
+                       gpointer klass)
+{
+}
+
+static GType
+maman_a_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (MamanAClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_a_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(MamanA), 0, (GInstanceInitFunc) maman_a_instance_init, NULL };
+       GType maman_a_type_id;
+       maman_a_type_id = g_type_register_static (G_TYPE_OBJECT, "MamanA", &g_define_type_info, 0);
+       return maman_a_type_id;
+}
+
+GType
+maman_a_get_type (void)
+{
+       static volatile gsize maman_a_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_a_type_id__volatile)) {
+               GType maman_a_type_id;
+               maman_a_type_id = maman_a_get_type_once ();
+               g_once_init_leave (&maman_a_type_id__volatile, maman_a_type_id);
+       }
+       return maman_a_type_id__volatile;
+}
+
+MamanB*
+maman_b_construct (GType object_type)
+{
+       MamanB * self = NULL;
+       self = (MamanB*) maman_a_construct (object_type);
+       return self;
+}
+
+MamanB*
+maman_b_new (void)
+{
+       return maman_b_construct (MAMAN_TYPE_B);
+}
+
+static void
+maman_b_class_init (MamanBClass * klass,
+                    gpointer klass_data)
+{
+       maman_b_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+maman_b_instance_init (MamanB * self,
+                       gpointer klass)
+{
+}
+
+static GType
+maman_b_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (MamanBClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_b_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(MamanB), 0, (GInstanceInitFunc) maman_b_instance_init, NULL };
+       GType maman_b_type_id;
+       maman_b_type_id = g_type_register_static (MAMAN_TYPE_A, "MamanB", &g_define_type_info, 0);
+       return maman_b_type_id;
+}
+
+GType
+maman_b_get_type (void)
+{
+       static volatile gsize maman_b_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_b_type_id__volatile)) {
+               GType maman_b_type_id;
+               maman_b_type_id = maman_b_get_type_once ();
+               g_once_init_leave (&maman_b_type_id__volatile, maman_b_type_id);
+       }
+       return maman_b_type_id__volatile;
+}
+
+MamanC*
+maman_c_construct (GType object_type)
+{
+       MamanC * self = NULL;
+       self = (MamanC*) g_object_new (object_type, NULL);
+       return self;
+}
+
+MamanC*
+maman_c_new (void)
+{
+       return maman_c_construct (MAMAN_TYPE_C);
+}
+
+static void
+maman_c_class_init (MamanCClass * klass,
+                    gpointer klass_data)
+{
+       maman_c_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+maman_c_instance_init (MamanC * self,
+                       gpointer klass)
+{
+}
+
+static GType
+maman_c_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (MamanCClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_c_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(MamanC), 0, (GInstanceInitFunc) maman_c_instance_init, NULL };
+       GType maman_c_type_id;
+       maman_c_type_id = g_type_register_static (G_TYPE_OBJECT, "MamanC", &g_define_type_info, 0);
+       return maman_c_type_id;
+}
+
+GType
+maman_c_get_type (void)
+{
+       static volatile gsize maman_c_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_c_type_id__volatile)) {
+               GType maman_c_type_id;
+               maman_c_type_id = maman_c_get_type_once ();
+               g_once_init_leave (&maman_c_type_id__volatile, maman_c_type_id);
+       }
+       return maman_c_type_id__volatile;
+}
+
+static void
+maman_bar_main (void)
+{
+       MamanA* a = NULL;
+       MamanA* _tmp0_;
+       MamanB* b = NULL;
+       MamanB* _tmp1_;
+       MamanC* c = NULL;
+       MamanC* _tmp2_;
+       gint _tmp3_ = 0;
+       MamanA* _tmp4_;
+       gint _tmp5_ = 0;
+       MamanB* _tmp6_;
+       gint _tmp7_ = 0;
+       MamanC* _tmp8_;
+       FILE* _tmp9_;
+       gint _tmp10_ = 0;
+       MamanA* _tmp11_;
+       gint _tmp12_ = 0;
+       MamanB* _tmp13_;
+       gint _tmp14_ = 0;
+       MamanC* _tmp15_;
+       FILE* _tmp16_;
+       gint _tmp17_ = 0;
+       MamanA* _tmp18_;
+       gint _tmp19_ = 0;
+       MamanB* _tmp20_;
+       gint _tmp21_ = 0;
+       MamanC* _tmp22_;
+       FILE* _tmp23_;
+       gint _tmp24_ = 0;
+       MamanA* _tmp25_;
+       gint _tmp26_ = 0;
+       MamanB* _tmp27_;
+       gint _tmp28_ = 0;
+       MamanC* _tmp29_;
+       FILE* _tmp30_;
+       gint _tmp31_ = 0;
+       MamanA* _tmp32_;
+       gint _tmp33_ = 0;
+       MamanB* _tmp34_;
+       gint _tmp35_ = 0;
+       MamanC* _tmp36_;
+       FILE* _tmp37_;
+       gint _tmp38_ = 0;
+       MamanA* _tmp39_;
+       gint _tmp40_ = 0;
+       MamanB* _tmp41_;
+       gint _tmp42_ = 0;
+       MamanC* _tmp43_;
+       FILE* _tmp44_;
+       gint _tmp45_ = 0;
+       MamanA* _tmp46_;
+       gint _tmp47_ = 0;
+       MamanB* _tmp48_;
+       gint _tmp49_ = 0;
+       MamanC* _tmp50_;
+       FILE* _tmp51_;
+       _tmp0_ = maman_a_new ();
+       a = _tmp0_;
+       _tmp1_ = maman_b_new ();
+       b = _tmp1_;
+       _tmp2_ = maman_c_new ();
+       c = _tmp2_;
+       _tmp4_ = a;
+       if (NULL != _tmp4_) {
+               _tmp3_ = 1;
+       } else {
+               _tmp3_ = 0;
+       }
+       _tmp6_ = b;
+       if (NULL != _tmp6_) {
+               _tmp5_ = 1;
+       } else {
+               _tmp5_ = 0;
+       }
+       _tmp8_ = c;
+       if (NULL != _tmp8_) {
+               _tmp7_ = 1;
+       } else {
+               _tmp7_ = 0;
+       }
+       _tmp9_ = stdout;
+       fprintf (_tmp9_, "init: %d %d %d\n", _tmp3_, _tmp5_, _tmp7_);
+       _tmp11_ = a;
+       if (MAMAN_IS_A (_tmp11_)) {
+               _tmp10_ = 1;
+       } else {
+               _tmp10_ = 0;
+       }
+       _tmp13_ = b;
+       if (MAMAN_IS_A (_tmp13_)) {
+               _tmp12_ = 1;
+       } else {
+               _tmp12_ = 0;
+       }
+       _tmp15_ = c;
+       if (MAMAN_IS_A (_tmp15_)) {
+               _tmp14_ = 1;
+       } else {
+               _tmp14_ = 0;
+       }
+       _tmp16_ = stdout;
+       fprintf (_tmp16_, "is A: %d %d %d\n", _tmp10_, _tmp12_, _tmp14_);
+       _tmp18_ = a;
+       if (MAMAN_IS_B (_tmp18_)) {
+               _tmp17_ = 1;
+       } else {
+               _tmp17_ = 0;
+       }
+       _tmp20_ = b;
+       if (MAMAN_IS_B (_tmp20_)) {
+               _tmp19_ = 1;
+       } else {
+               _tmp19_ = 0;
+       }
+       _tmp22_ = c;
+       if (MAMAN_IS_B (_tmp22_)) {
+               _tmp21_ = 1;
+       } else {
+               _tmp21_ = 0;
+       }
+       _tmp23_ = stdout;
+       fprintf (_tmp23_, "is B: %d %d %d\n", _tmp17_, _tmp19_, _tmp21_);
+       _tmp25_ = a;
+       if (MAMAN_IS_C (_tmp25_)) {
+               _tmp24_ = 1;
+       } else {
+               _tmp24_ = 0;
+       }
+       _tmp27_ = b;
+       if (MAMAN_IS_C (_tmp27_)) {
+               _tmp26_ = 1;
+       } else {
+               _tmp26_ = 0;
+       }
+       _tmp29_ = c;
+       if (MAMAN_IS_C (_tmp29_)) {
+               _tmp28_ = 1;
+       } else {
+               _tmp28_ = 0;
+       }
+       _tmp30_ = stdout;
+       fprintf (_tmp30_, "is C: %d %d %d\n", _tmp24_, _tmp26_, _tmp28_);
+       _tmp32_ = a;
+       if (NULL != (MAMAN_IS_A (_tmp32_) ? ((MamanA*) _tmp32_) : NULL)) {
+               _tmp31_ = 1;
+       } else {
+               _tmp31_ = 0;
+       }
+       _tmp34_ = b;
+       if (NULL != (MAMAN_IS_A (_tmp34_) ? ((MamanA*) _tmp34_) : NULL)) {
+               _tmp33_ = 1;
+       } else {
+               _tmp33_ = 0;
+       }
+       _tmp36_ = c;
+       if (NULL != (MAMAN_IS_A (_tmp36_) ? ((MamanA*) _tmp36_) : NULL)) {
+               _tmp35_ = 1;
+       } else {
+               _tmp35_ = 0;
+       }
+       _tmp37_ = stdout;
+       fprintf (_tmp37_, "as A: %d %d %d\n", _tmp31_, _tmp33_, _tmp35_);
+       _tmp39_ = a;
+       if (NULL != (MAMAN_IS_B (_tmp39_) ? ((MamanB*) _tmp39_) : NULL)) {
+               _tmp38_ = 1;
+       } else {
+               _tmp38_ = 0;
+       }
+       _tmp41_ = b;
+       if (NULL != (MAMAN_IS_B (_tmp41_) ? ((MamanB*) _tmp41_) : NULL)) {
+               _tmp40_ = 1;
+       } else {
+               _tmp40_ = 0;
+       }
+       _tmp43_ = c;
+       if (NULL != (MAMAN_IS_B (_tmp43_) ? ((MamanB*) _tmp43_) : NULL)) {
+               _tmp42_ = 1;
+       } else {
+               _tmp42_ = 0;
+       }
+       _tmp44_ = stdout;
+       fprintf (_tmp44_, "as B: %d %d %d\n", _tmp38_, _tmp40_, _tmp42_);
+       _tmp46_ = a;
+       if (NULL != (MAMAN_IS_C (_tmp46_) ? ((MamanC*) _tmp46_) : NULL)) {
+               _tmp45_ = 1;
+       } else {
+               _tmp45_ = 0;
+       }
+       _tmp48_ = b;
+       if (NULL != (MAMAN_IS_C (_tmp48_) ? ((MamanC*) _tmp48_) : NULL)) {
+               _tmp47_ = 1;
+       } else {
+               _tmp47_ = 0;
+       }
+       _tmp50_ = c;
+       if (NULL != (MAMAN_IS_C (_tmp50_) ? ((MamanC*) _tmp50_) : NULL)) {
+               _tmp49_ = 1;
+       } else {
+               _tmp49_ = 0;
+       }
+       _tmp51_ = stdout;
+       fprintf (_tmp51_, "as C: %d %d %d\n", _tmp45_, _tmp47_, _tmp49_);
+       _g_object_unref0 (c);
+       _g_object_unref0 (b);
+       _g_object_unref0 (a);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       maman_bar_main ();
+       return 0;
+}
+
+MamanBar*
+maman_bar_construct (GType object_type)
+{
+       MamanBar * self = NULL;
+       self = (MamanBar*) g_object_new (object_type, NULL);
+       return self;
+}
+
+MamanBar*
+maman_bar_new (void)
+{
+       return maman_bar_construct (MAMAN_TYPE_BAR);
+}
+
+static void
+maman_bar_class_init (MamanBarClass * klass,
+                      gpointer klass_data)
+{
+       maman_bar_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+maman_bar_instance_init (MamanBar * self,
+                         gpointer klass)
+{
+}
+
+static GType
+maman_bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (MamanBarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(MamanBar), 0, (GInstanceInitFunc) maman_bar_instance_init, NULL };
+       GType maman_bar_type_id;
+       maman_bar_type_id = g_type_register_static (G_TYPE_OBJECT, "MamanBar", &g_define_type_info, 0);
+       return maman_bar_type_id;
+}
+
+GType
+maman_bar_get_type (void)
+{
+       static volatile gsize maman_bar_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_bar_type_id__volatile)) {
+               GType maman_bar_type_id;
+               maman_bar_type_id = maman_bar_get_type_once ();
+               g_once_init_leave (&maman_bar_type_id__volatile, maman_bar_type_id);
+       }
+       return maman_bar_type_id__volatile;
+}
+
diff --git a/tests/objects/type-narrowing-by-precondition.c-expected 
b/tests/objects/type-narrowing-by-precondition.c-expected
new file mode 100644
index 000000000..b62a8e2ae
--- /dev/null
+++ b/tests/objects/type-narrowing-by-precondition.c-expected
@@ -0,0 +1,408 @@
+/* objects_type_narrowing_by_precondition.c generated by valac, the Vala compiler
+ * generated from objects_type_narrowing_by_precondition.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _Bar {
+       Foo parent_instance;
+       BarPrivate * priv;
+       gint i;
+};
+
+struct _BarClass {
+       FooClass parent_class;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gpointer foo_parent_class = NULL;
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN void foo_minim (Foo* self);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, foo_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static void bar_finalize (Foo * obj);
+static GType bar_get_type_once (void);
+VALA_EXTERN void manam (Foo* foo);
+static void _vala_main (void);
+
+void
+foo_minim (Foo* self)
+{
+       g_return_if_fail (IS_FOO (self));
+       _vala_return_if_fail (IS_BAR (self), "this is Bar");
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_BAR, Bar)->i == 42, "this.i == 42");
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar* self = NULL;
+       self = (Bar*) foo_construct (object_type);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = bar_finalize;
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+       self->i = 42;
+}
+
+static void
+bar_finalize (Foo * obj)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       FOO_CLASS (bar_parent_class)->finalize (obj);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (TYPE_FOO, "Bar", &g_define_type_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+void
+manam (Foo* foo)
+{
+       g_return_if_fail (IS_FOO (foo));
+       _vala_return_if_fail (IS_BAR (foo), "foo is Bar");
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, TYPE_BAR, Bar)->i == 42, "foo.i == 42");
+}
+
+static void
+_vala_main (void)
+{
+       Bar* bar = NULL;
+       Bar* _tmp0_;
+       _tmp0_ = bar_new ();
+       bar = _tmp0_;
+       manam (G_TYPE_CHECK_INSTANCE_CAST (bar, TYPE_FOO, Foo));
+       foo_minim (G_TYPE_CHECK_INSTANCE_CAST (bar, TYPE_FOO, Foo));
+       _foo_unref0 (bar);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/type-narrowing-fallback.c-expected 
b/tests/objects/type-narrowing-fallback.c-expected
new file mode 100644
index 000000000..d8b2495c0
--- /dev/null
+++ b/tests/objects/type-narrowing-fallback.c-expected
@@ -0,0 +1,307 @@
+/* objects_type_narrowing_fallback.c generated by valac, the Vala compiler
+ * generated from objects_type_narrowing_fallback.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define FOO_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_FOO, FooIface))
+
+typedef struct _Foo Foo;
+typedef struct _FooIface FooIface;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+enum  {
+       BAR_0_PROPERTY,
+       BAR_NUM_PROPERTIES
+};
+static GParamSpec* bar_properties[BAR_NUM_PROPERTIES];
+
+#define TYPE_MANAM (manam_get_type ())
+#define MANAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MANAM, Manam))
+#define MANAM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MANAM, ManamClass))
+#define IS_MANAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MANAM))
+#define IS_MANAM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MANAM))
+#define MANAM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MANAM, ManamClass))
+
+typedef struct _Manam Manam;
+typedef struct _ManamClass ManamClass;
+typedef struct _ManamPrivate ManamPrivate;
+enum  {
+       MANAM_0_PROPERTY,
+       MANAM_NUM_PROPERTIES
+};
+static GParamSpec* manam_properties[MANAM_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _FooIface {
+       GTypeInterface parent_iface;
+       gint (*get_foo) (Foo* self);
+};
+
+struct _Bar {
+       GObject parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       GObjectClass parent_class;
+};
+
+struct _Manam {
+       Bar parent_instance;
+       ManamPrivate * priv;
+};
+
+struct _ManamClass {
+       BarClass parent_class;
+       gint (*get_foo) (Manam* self);
+};
+
+static gpointer bar_parent_class = NULL;
+static gpointer manam_parent_class = NULL;
+static FooIface * manam_foo_parent_iface = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN gint foo_get_foo (Foo* self);
+static GType foo_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
+VALA_EXTERN gint bar_get_bar (Bar* self);
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static GType bar_get_type_once (void);
+VALA_EXTERN GType manam_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Manam, g_object_unref)
+VALA_EXTERN gint manam_get_foo (Manam* self);
+static gint manam_real_get_foo (Manam* self);
+VALA_EXTERN Manam* manam_new (void);
+VALA_EXTERN Manam* manam_construct (GType object_type);
+static GType manam_get_type_once (void);
+static void _vala_main (void);
+
+gint
+foo_get_foo (Foo* self)
+{
+       FooIface* _iface_;
+       g_return_val_if_fail (IS_FOO (self), 0);
+       _iface_ = FOO_GET_INTERFACE (self);
+       if (_iface_->get_foo) {
+               return _iface_->get_foo (self);
+       }
+       return -1;
+}
+
+static void
+foo_default_init (FooIface * iface,
+                  gpointer iface_data)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_INTERFACE, "Foo", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (foo_type_id, G_TYPE_OBJECT);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gint
+bar_get_bar (Bar* self)
+{
+       gint result = 0;
+       g_return_val_if_fail (IS_BAR (self), 0);
+       result = 23;
+       return result;
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar * self = NULL;
+       self = (Bar*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (G_TYPE_OBJECT, "Bar", &g_define_type_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static gint
+manam_real_get_foo (Manam* self)
+{
+       gint result = 0;
+       result = 42;
+       return result;
+}
+
+gint
+manam_get_foo (Manam* self)
+{
+       ManamClass* _klass_;
+       g_return_val_if_fail (IS_MANAM (self), 0);
+       _klass_ = MANAM_GET_CLASS (self);
+       if (_klass_->get_foo) {
+               return _klass_->get_foo (self);
+       }
+       return -1;
+}
+
+Manam*
+manam_construct (GType object_type)
+{
+       Manam * self = NULL;
+       self = (Manam*) bar_construct (object_type);
+       return self;
+}
+
+Manam*
+manam_new (void)
+{
+       return manam_construct (TYPE_MANAM);
+}
+
+static void
+manam_class_init (ManamClass * klass,
+                  gpointer klass_data)
+{
+       manam_parent_class = g_type_class_peek_parent (klass);
+       ((ManamClass *) klass)->get_foo = (gint (*) (Manam*)) manam_real_get_foo;
+}
+
+static void
+manam_foo_interface_init (FooIface * iface,
+                          gpointer iface_data)
+{
+       manam_foo_parent_iface = g_type_interface_peek_parent (iface);
+       iface->get_foo = (gint (*) (Foo*)) manam_get_foo;
+}
+
+static void
+manam_instance_init (Manam * self,
+                     gpointer klass)
+{
+}
+
+static GType
+manam_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (ManamClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) manam_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Manam), 
0, (GInstanceInitFunc) manam_instance_init, NULL };
+       static const GInterfaceInfo foo_info = { (GInterfaceInitFunc) manam_foo_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       GType manam_type_id;
+       manam_type_id = g_type_register_static (TYPE_BAR, "Manam", &g_define_type_info, 0);
+       g_type_add_interface_static (manam_type_id, TYPE_FOO, &foo_info);
+       return manam_type_id;
+}
+
+GType
+manam_get_type (void)
+{
+       static volatile gsize manam_type_id__volatile = 0;
+       if (g_once_init_enter (&manam_type_id__volatile)) {
+               GType manam_type_id;
+               manam_type_id = manam_get_type_once ();
+               g_once_init_leave (&manam_type_id__volatile, manam_type_id);
+       }
+       return manam_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Manam* _tmp0_;
+       _tmp0_ = manam_new ();
+       foo = G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, TYPE_FOO, Foo);
+       if (IS_BAR (foo)) {
+               _vala_assert (bar_get_bar (G_TYPE_CHECK_INSTANCE_CAST (foo, TYPE_BAR, Bar)) == 23, 
"foo.get_bar () == 23");
+               _vala_assert (foo_get_foo (foo) == 42, "foo.get_foo () == 42");
+       } else {
+               g_assert_not_reached ();
+       }
+       _g_object_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/type-narrowing.c-expected b/tests/objects/type-narrowing.c-expected
new file mode 100644
index 000000000..c7deb869a
--- /dev/null
+++ b/tests/objects/type-narrowing.c-expected
@@ -0,0 +1,582 @@
+/* objects_type_narrowing.c generated by valac, the Vala compiler
+ * generated from objects_type_narrowing.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+#define _g_free0(var) (var = (g_free (var), NULL))
+
+#define TYPE_MANAM (manam_get_type ())
+#define MANAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MANAM, Manam))
+#define MANAM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MANAM, ManamClass))
+#define IS_MANAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MANAM))
+#define IS_MANAM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MANAM))
+#define MANAM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MANAM, ManamClass))
+
+typedef struct _Manam Manam;
+typedef struct _ManamClass ManamClass;
+typedef struct _ManamPrivate ManamPrivate;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _Bar {
+       Foo parent_instance;
+       BarPrivate * priv;
+       gchar* str;
+};
+
+struct _BarClass {
+       FooClass parent_class;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+struct _Manam {
+       Bar parent_instance;
+       ManamPrivate * priv;
+};
+
+struct _ManamClass {
+       BarClass parent_class;
+};
+
+static gpointer foo_parent_class = NULL;
+static gpointer bar_parent_class = NULL;
+static gpointer manam_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN void foo_manam (Foo* self);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, foo_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN Bar* bar_new (const gchar* s);
+VALA_EXTERN Bar* bar_construct (GType object_type,
+                    const gchar* s);
+static void bar_finalize (Foo * obj);
+static GType bar_get_type_once (void);
+VALA_EXTERN GType manam_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Manam, foo_unref)
+VALA_EXTERN Manam* manam_new (const gchar* s);
+VALA_EXTERN Manam* manam_construct (GType object_type,
+                        const gchar* s);
+static GType manam_get_type_once (void);
+VALA_EXTERN void manam (Foo* foo);
+static void _vala_main (void);
+
+void
+foo_manam (Foo* self)
+{
+       const gchar* _tmp1_ = NULL;
+       const gchar* _tmp4_ = NULL;
+       g_return_if_fail (IS_FOO (self));
+       if (IS_BAR (self)) {
+               const gchar* _tmp0_;
+               _tmp0_ = G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_BAR, Bar)->str;
+               _vala_assert (g_strcmp0 (_tmp0_, "bar") == 0, "this.str == \"bar\"");
+       }
+       if (IS_BAR (self)) {
+               const gchar* _tmp2_;
+               _tmp2_ = G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_BAR, Bar)->str;
+               _tmp1_ = _tmp2_;
+       } else {
+               _tmp1_ = "foo";
+       }
+       _vala_assert (g_strcmp0 (_tmp1_, "bar") == 0, "((this is Bar) ? this.str : \"foo\") == \"bar\"");
+       if (!IS_BAR (self)) {
+               g_assert_not_reached ();
+       } else {
+               const gchar* _tmp3_;
+               _tmp3_ = G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_BAR, Bar)->str;
+               _vala_assert (g_strcmp0 (_tmp3_, "bar") == 0, "this.str == \"bar\"");
+       }
+       if (!IS_BAR (self)) {
+               _tmp4_ = "foo";
+       } else {
+               const gchar* _tmp5_;
+               _tmp5_ = G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_BAR, Bar)->str;
+               _tmp4_ = _tmp5_;
+       }
+       _vala_assert (g_strcmp0 (_tmp4_, "bar") == 0, "(!(this is Bar) ? \"foo\" : this.str) == \"bar\"");
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+Bar*
+bar_construct (GType object_type,
+               const gchar* s)
+{
+       Bar* self = NULL;
+       gchar* _tmp0_;
+       g_return_val_if_fail (s != NULL, NULL);
+       self = (Bar*) foo_construct (object_type);
+       _tmp0_ = g_strdup (s);
+       _g_free0 (self->str);
+       self->str = _tmp0_;
+       return self;
+}
+
+Bar*
+bar_new (const gchar* s)
+{
+       return bar_construct (TYPE_BAR, s);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = bar_finalize;
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static void
+bar_finalize (Foo * obj)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       _g_free0 (self->str);
+       FOO_CLASS (bar_parent_class)->finalize (obj);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (TYPE_FOO, "Bar", &g_define_type_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+Manam*
+manam_construct (GType object_type,
+                 const gchar* s)
+{
+       Manam* self = NULL;
+       g_return_val_if_fail (s != NULL, NULL);
+       self = (Manam*) bar_construct (object_type, s);
+       return self;
+}
+
+Manam*
+manam_new (const gchar* s)
+{
+       return manam_construct (TYPE_MANAM, s);
+}
+
+static void
+manam_class_init (ManamClass * klass,
+                  gpointer klass_data)
+{
+       manam_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+manam_instance_init (Manam * self,
+                     gpointer klass)
+{
+}
+
+static GType
+manam_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (ManamClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) manam_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Manam), 
0, (GInstanceInitFunc) manam_instance_init, NULL };
+       GType manam_type_id;
+       manam_type_id = g_type_register_static (TYPE_BAR, "Manam", &g_define_type_info, 0);
+       return manam_type_id;
+}
+
+GType
+manam_get_type (void)
+{
+       static volatile gsize manam_type_id__volatile = 0;
+       if (g_once_init_enter (&manam_type_id__volatile)) {
+               GType manam_type_id;
+               manam_type_id = manam_get_type_once ();
+               g_once_init_leave (&manam_type_id__volatile, manam_type_id);
+       }
+       return manam_type_id__volatile;
+}
+
+void
+manam (Foo* foo)
+{
+       const gchar* _tmp1_ = NULL;
+       const gchar* _tmp4_ = NULL;
+       g_return_if_fail (IS_FOO (foo));
+       if (IS_BAR (foo)) {
+               const gchar* _tmp0_;
+               _tmp0_ = G_TYPE_CHECK_INSTANCE_CAST (foo, TYPE_BAR, Bar)->str;
+               _vala_assert (g_strcmp0 (_tmp0_, "bar") == 0, "foo.str == \"bar\"");
+       }
+       if (IS_BAR (foo)) {
+               const gchar* _tmp2_;
+               _tmp2_ = G_TYPE_CHECK_INSTANCE_CAST (foo, TYPE_BAR, Bar)->str;
+               _tmp1_ = _tmp2_;
+       } else {
+               _tmp1_ = "foo";
+       }
+       _vala_assert (g_strcmp0 (_tmp1_, "bar") == 0, "((foo is Bar) ? foo.str : \"foo\") == \"bar\"");
+       if (!IS_BAR (foo)) {
+               g_assert_not_reached ();
+       } else {
+               const gchar* _tmp3_;
+               _tmp3_ = G_TYPE_CHECK_INSTANCE_CAST (foo, TYPE_BAR, Bar)->str;
+               _vala_assert (g_strcmp0 (_tmp3_, "bar") == 0, "foo.str == \"bar\"");
+       }
+       if (!IS_BAR (foo)) {
+               _tmp4_ = "foo";
+       } else {
+               const gchar* _tmp5_;
+               _tmp5_ = G_TYPE_CHECK_INSTANCE_CAST (foo, TYPE_BAR, Bar)->str;
+               _tmp4_ = _tmp5_;
+       }
+       _vala_assert (g_strcmp0 (_tmp4_, "bar") == 0, "(!(foo is Bar) ? \"foo\" : foo.str) == \"bar\"");
+}
+
+static void
+_vala_main (void)
+{
+       {
+               Bar* bar = NULL;
+               Bar* _tmp0_;
+               Bar* _tmp1_;
+               Bar* _tmp2_;
+               _tmp0_ = bar_new ("bar");
+               bar = _tmp0_;
+               _tmp1_ = bar;
+               foo_manam (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, TYPE_FOO, Foo));
+               _tmp2_ = bar;
+               manam (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, TYPE_FOO, Foo));
+               _foo_unref0 (bar);
+       }
+       {
+               Bar* bar = NULL;
+               Manam* _tmp3_;
+               Bar* _tmp4_;
+               Bar* _tmp8_;
+               const gchar* _tmp9_;
+               _tmp3_ = manam_new ("manam");
+               bar = G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, TYPE_BAR, Bar);
+               _tmp4_ = bar;
+               if (IS_MANAM (_tmp4_)) {
+                       Bar* _tmp5_;
+                       const gchar* _tmp6_;
+                       Bar* _tmp7_;
+                       _tmp5_ = bar;
+                       _tmp6_ = _tmp5_->str;
+                       _vala_assert (g_strcmp0 (_tmp6_, "manam") == 0, "bar.str == \"manam\"");
+                       _tmp7_ = bar_new ("bar");
+                       _foo_unref0 (bar);
+                       bar = _tmp7_;
+               }
+               _tmp8_ = bar;
+               _tmp9_ = _tmp8_->str;
+               _vala_assert (g_strcmp0 (_tmp9_, "bar") == 0, "bar.str == \"bar\"");
+               _foo_unref0 (bar);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/with-expression.c-expected b/tests/objects/with-expression.c-expected
new file mode 100644
index 000000000..aedd1ee9d
--- /dev/null
+++ b/tests/objects/with-expression.c-expected
@@ -0,0 +1,417 @@
+/* objects_with_expression.c generated by valac, the Vala compiler
+ * generated from objects_with_expression.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gpointer foo_parent_class = NULL;
+VALA_EXTERN gint foo_factory_called;
+gint foo_factory_called = 0;
+VALA_EXTERN gint foo_method_called;
+gint foo_method_called = 0;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_factory (void);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+VALA_EXTERN void foo_method (Foo* self);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN void test (void);
+static void _vala_main (void);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+Foo*
+foo_factory (void)
+{
+       gint _tmp0_;
+       Foo* _tmp1_;
+       Foo* result = NULL;
+       _tmp0_ = foo_factory_called;
+       foo_factory_called = _tmp0_ + 1;
+       _tmp1_ = foo_new ();
+       result = _tmp1_;
+       return result;
+}
+
+void
+foo_method (Foo* self)
+{
+       gint _tmp0_;
+       g_return_if_fail (IS_FOO (self));
+       _tmp0_ = foo_method_called;
+       foo_method_called = _tmp0_ + 1;
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static gpointer
+_foo_ref0 (gpointer self)
+{
+       return self ? foo_ref (self) : NULL;
+}
+
+void
+test (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       Foo** arr = NULL;
+       Foo* _tmp5_;
+       Foo* _tmp6_;
+       Foo** _tmp7_;
+       gint arr_length1;
+       gint _arr_size_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       {
+               foo_method (foo);
+       }
+       {
+               Foo* _tmp1_ = NULL;
+               Foo* _tmp2_;
+               _tmp2_ = foo_new ();
+               _tmp1_ = _tmp2_;
+               foo_method (_tmp1_);
+               _foo_unref0 (_tmp1_);
+       }
+       {
+               Foo* _tmp3_ = NULL;
+               Foo* _tmp4_;
+               _tmp4_ = foo_factory ();
+               _tmp3_ = _tmp4_;
+               foo_method (_tmp3_);
+               foo_method (_tmp3_);
+               _foo_unref0 (_tmp3_);
+       }
+       _tmp5_ = _foo_ref0 (foo);
+       _tmp6_ = _foo_ref0 (foo);
+       _tmp7_ = g_new0 (Foo*, 2 + 1);
+       _tmp7_[0] = _tmp5_;
+       _tmp7_[1] = _tmp6_;
+       arr = _tmp7_;
+       arr_length1 = 2;
+       _arr_size_ = arr_length1;
+       {
+               Foo* _tmp8_ = NULL;
+               Foo* _tmp9_;
+               _tmp9_ = arr[0];
+               _tmp8_ = _tmp9_;
+               foo_method (_tmp8_);
+       }
+       _vala_assert (foo_method_called == 5, "Foo.method_called == 5");
+       _vala_assert (foo_factory_called == 1, "Foo.factory_called == 1");
+       arr = (_vala_array_free (arr, arr_length1, (GDestroyNotify) foo_unref), NULL);
+       _foo_unref0 (foo);
+}
+
+static void
+_vala_main (void)
+{
+       test ();
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/objects/with-instance.c-expected b/tests/objects/with-instance.c-expected
new file mode 100644
index 000000000..2b8ed153e
--- /dev/null
+++ b/tests/objects/with-instance.c-expected
@@ -0,0 +1,1027 @@
+/* objects_with_instance.c generated by valac, the Vala compiler
+ * generated from objects_with_instance.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+#define _g_free0(var) (var = (g_free (var), NULL))
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+
+#define TYPE_TEST_FOO (test_foo_get_type ())
+#define TEST_FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST_FOO, TestFoo))
+#define TEST_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TEST_FOO, TestFooClass))
+#define IS_TEST_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST_FOO))
+#define IS_TEST_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TEST_FOO))
+#define TEST_FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TEST_FOO, TestFooClass))
+
+typedef struct _TestFoo TestFoo;
+typedef struct _TestFooClass TestFooClass;
+typedef struct _TestFooPrivate TestFooPrivate;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+typedef struct _ParamSpecTestFoo ParamSpecTestFoo;
+
+#define TYPE_TEST_BAR (test_bar_get_type ())
+#define TEST_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST_BAR, TestBar))
+#define TEST_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TEST_BAR, TestBarClass))
+#define IS_TEST_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST_BAR))
+#define IS_TEST_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TEST_BAR))
+#define TEST_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TEST_BAR, TestBarClass))
+
+typedef struct _TestBar TestBar;
+typedef struct _TestBarClass TestBarClass;
+typedef struct _TestBarPrivate TestBarPrivate;
+typedef struct _ParamSpecTestBar ParamSpecTestBar;
+#define _test_foo_unref0(var) ((var == NULL) ? NULL : (var = (test_foo_unref (var), NULL)))
+#define _test_bar_unref0(var) ((var == NULL) ? NULL : (var = (test_bar_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+       gint field;
+       gboolean method_called;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _FooPrivate {
+       gchar* _prop;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+struct _Bar {
+       Foo parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       FooClass parent_class;
+};
+
+struct _TestFoo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       TestFooPrivate * priv;
+       gint instance_field;
+};
+
+struct _TestFooClass {
+       GTypeClass parent_class;
+       void (*finalize) (TestFoo *self);
+};
+
+struct _ParamSpecTestFoo {
+       GParamSpec parent_instance;
+};
+
+struct _TestBar {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       TestBarPrivate * priv;
+       gint instance_field;
+};
+
+struct _TestBarClass {
+       GTypeClass parent_class;
+       void (*finalize) (TestBar *self);
+};
+
+struct _ParamSpecTestBar {
+       GParamSpec parent_instance;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+static gpointer bar_parent_class = NULL;
+static gpointer test_foo_parent_class = NULL;
+VALA_EXTERN gint test_foo_class_field;
+gint test_foo_class_field = 0;
+static gpointer test_bar_parent_class = NULL;
+VALA_EXTERN gint test_bar_class_field;
+gint test_bar_class_field = 0;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN void foo_method (Foo* self);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+VALA_EXTERN const gchar* foo_get_prop (Foo* self);
+VALA_EXTERN void foo_set_prop (Foo* self,
+                   const gchar* value);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, foo_unref)
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static GType bar_get_type_once (void);
+VALA_EXTERN gpointer test_foo_ref (gpointer instance);
+VALA_EXTERN void test_foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_test_foo (const gchar* name,
+                                 const gchar* nick,
+                                 const gchar* blurb,
+                                 GType object_type,
+                                 GParamFlags flags);
+VALA_EXTERN void value_set_test_foo (GValue* value,
+                         gpointer v_object);
+VALA_EXTERN void value_take_test_foo (GValue* value,
+                          gpointer v_object);
+VALA_EXTERN gpointer value_get_test_foo (const GValue* value);
+VALA_EXTERN GType test_foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (TestFoo, test_foo_unref)
+VALA_EXTERN void test_foo_test (TestFoo* self);
+VALA_EXTERN TestFoo* test_foo_new (void);
+VALA_EXTERN TestFoo* test_foo_construct (GType object_type);
+static void test_foo_finalize (TestFoo * obj);
+static GType test_foo_get_type_once (void);
+VALA_EXTERN gpointer test_bar_ref (gpointer instance);
+VALA_EXTERN void test_bar_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_test_bar (const gchar* name,
+                                 const gchar* nick,
+                                 const gchar* blurb,
+                                 GType object_type,
+                                 GParamFlags flags);
+VALA_EXTERN void value_set_test_bar (GValue* value,
+                         gpointer v_object);
+VALA_EXTERN void value_take_test_bar (GValue* value,
+                          gpointer v_object);
+VALA_EXTERN gpointer value_get_test_bar (const GValue* value);
+VALA_EXTERN GType test_bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (TestBar, test_bar_unref)
+VALA_EXTERN void test_bar_test (TestBar* self);
+VALA_EXTERN TestBar* test_bar_new (void);
+VALA_EXTERN TestBar* test_bar_construct (GType object_type);
+static void test_bar_finalize (TestBar * obj);
+static GType test_bar_get_type_once (void);
+static void _vala_main (void);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+void
+foo_method (Foo* self)
+{
+       g_return_if_fail (IS_FOO (self));
+       self->method_called = TRUE;
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+const gchar*
+foo_get_prop (Foo* self)
+{
+       const gchar* result;
+       const gchar* _tmp0_;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = self->priv->_prop;
+       result = _tmp0_;
+       return result;
+}
+
+void
+foo_set_prop (Foo* self,
+              const gchar* value)
+{
+       gchar* _tmp0_;
+       g_return_if_fail (IS_FOO (self));
+       _tmp0_ = g_strdup (value);
+       _g_free0 (self->priv->_prop);
+       self->priv->_prop = _tmp0_;
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+       self->method_called = FALSE;
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+       _g_free0 (self->priv->_prop);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar* self = NULL;
+       self = (Bar*) foo_construct (object_type);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (TYPE_FOO, "Bar", &g_define_type_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+void
+test_foo_test (TestFoo* self)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       gint local_field = 0;
+       const gchar* _tmp1_;
+       const gchar* _tmp2_;
+       g_return_if_fail (IS_TEST_FOO (self));
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       local_field = 0;
+       {
+               foo->field = 10;
+               foo_set_prop (foo, "prop");
+               foo_method (foo);
+               local_field = 20;
+               test_foo_class_field = 30;
+               self->instance_field = 40;
+       }
+       _vala_assert (foo->field == 10, "foo.field == 10");
+       _tmp1_ = foo_get_prop (foo);
+       _tmp2_ = _tmp1_;
+       _vala_assert (g_strcmp0 (_tmp2_, "prop") == 0, "foo.prop == \"prop\"");
+       _vala_assert (foo->method_called, "foo.method_called");
+       _vala_assert (local_field == 20, "local_field == 20");
+       _vala_assert (test_foo_class_field == 30, "class_field == 30");
+       _vala_assert (self->instance_field == 40, "instance_field == 40");
+       _foo_unref0 (foo);
+}
+
+TestFoo*
+test_foo_construct (GType object_type)
+{
+       TestFoo* self = NULL;
+       self = (TestFoo*) g_type_create_instance (object_type);
+       return self;
+}
+
+TestFoo*
+test_foo_new (void)
+{
+       return test_foo_construct (TYPE_TEST_FOO);
+}
+
+static void
+value_test_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_test_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               test_foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_test_foo_copy_value (const GValue* src_value,
+                           GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = test_foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_test_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_test_foo_collect_value (GValue* value,
+                              guint n_collect_values,
+                              GTypeCValue* collect_values,
+                              guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               TestFoo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = test_foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_test_foo_lcopy_value (const GValue* value,
+                            guint n_collect_values,
+                            GTypeCValue* collect_values,
+                            guint collect_flags)
+{
+       TestFoo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = test_foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_test_foo (const gchar* name,
+                     const gchar* nick,
+                     const gchar* blurb,
+                     GType object_type,
+                     GParamFlags flags)
+{
+       ParamSpecTestFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_TEST_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_test_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_TEST_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_test_foo (GValue* value,
+                    gpointer v_object)
+{
+       TestFoo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_TEST_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_TEST_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               test_foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               test_foo_unref (old);
+       }
+}
+
+void
+value_take_test_foo (GValue* value,
+                     gpointer v_object)
+{
+       TestFoo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_TEST_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_TEST_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               test_foo_unref (old);
+       }
+}
+
+static void
+test_foo_class_init (TestFooClass * klass,
+                     gpointer klass_data)
+{
+       test_foo_parent_class = g_type_class_peek_parent (klass);
+       ((TestFooClass *) klass)->finalize = test_foo_finalize;
+}
+
+static void
+test_foo_instance_init (TestFoo * self,
+                        gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+test_foo_finalize (TestFoo * obj)
+{
+       TestFoo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_TEST_FOO, TestFoo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+test_foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_test_foo_init, 
value_test_foo_free_value, value_test_foo_copy_value, value_test_foo_peek_pointer, "p", 
value_test_foo_collect_value, "p", value_test_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (TestFooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(TestFoo), 0, (GInstanceInitFunc) test_foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType test_foo_type_id;
+       test_foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "TestFoo", 
&g_define_type_info, &g_define_type_fundamental_info, 0);
+       return test_foo_type_id;
+}
+
+GType
+test_foo_get_type (void)
+{
+       static volatile gsize test_foo_type_id__volatile = 0;
+       if (g_once_init_enter (&test_foo_type_id__volatile)) {
+               GType test_foo_type_id;
+               test_foo_type_id = test_foo_get_type_once ();
+               g_once_init_leave (&test_foo_type_id__volatile, test_foo_type_id);
+       }
+       return test_foo_type_id__volatile;
+}
+
+gpointer
+test_foo_ref (gpointer instance)
+{
+       TestFoo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+test_foo_unref (gpointer instance)
+{
+       TestFoo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               TEST_FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+void
+test_bar_test (TestBar* self)
+{
+       Bar* foo = NULL;
+       Bar* _tmp0_;
+       gint local_field = 0;
+       const gchar* _tmp1_;
+       const gchar* _tmp2_;
+       g_return_if_fail (IS_TEST_BAR (self));
+       _tmp0_ = bar_new ();
+       foo = _tmp0_;
+       local_field = 0;
+       {
+               G_TYPE_CHECK_INSTANCE_CAST (foo, TYPE_FOO, Foo)->field = 10;
+               foo_set_prop (G_TYPE_CHECK_INSTANCE_CAST (foo, TYPE_FOO, Foo), "prop");
+               foo_method (G_TYPE_CHECK_INSTANCE_CAST (foo, TYPE_FOO, Foo));
+               local_field = 20;
+               test_bar_class_field = 30;
+               self->instance_field = 40;
+       }
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, TYPE_FOO, Foo)->field == 10, "foo.field == 10");
+       _tmp1_ = foo_get_prop (G_TYPE_CHECK_INSTANCE_CAST (foo, TYPE_FOO, Foo));
+       _tmp2_ = _tmp1_;
+       _vala_assert (g_strcmp0 (_tmp2_, "prop") == 0, "foo.prop == \"prop\"");
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (foo, TYPE_FOO, Foo)->method_called, "foo.method_called");
+       _vala_assert (local_field == 20, "local_field == 20");
+       _vala_assert (test_bar_class_field == 30, "class_field == 30");
+       _vala_assert (self->instance_field == 40, "instance_field == 40");
+       _foo_unref0 (foo);
+}
+
+TestBar*
+test_bar_construct (GType object_type)
+{
+       TestBar* self = NULL;
+       self = (TestBar*) g_type_create_instance (object_type);
+       return self;
+}
+
+TestBar*
+test_bar_new (void)
+{
+       return test_bar_construct (TYPE_TEST_BAR);
+}
+
+static void
+value_test_bar_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_test_bar_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               test_bar_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_test_bar_copy_value (const GValue* src_value,
+                           GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = test_bar_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_test_bar_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_test_bar_collect_value (GValue* value,
+                              guint n_collect_values,
+                              GTypeCValue* collect_values,
+                              guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               TestBar * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = test_bar_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_test_bar_lcopy_value (const GValue* value,
+                            guint n_collect_values,
+                            GTypeCValue* collect_values,
+                            guint collect_flags)
+{
+       TestBar ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = test_bar_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_test_bar (const gchar* name,
+                     const gchar* nick,
+                     const gchar* blurb,
+                     GType object_type,
+                     GParamFlags flags)
+{
+       ParamSpecTestBar* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_TEST_BAR), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_test_bar (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_TEST_BAR), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_test_bar (GValue* value,
+                    gpointer v_object)
+{
+       TestBar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_TEST_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_TEST_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               test_bar_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               test_bar_unref (old);
+       }
+}
+
+void
+value_take_test_bar (GValue* value,
+                     gpointer v_object)
+{
+       TestBar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_TEST_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_TEST_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               test_bar_unref (old);
+       }
+}
+
+static void
+test_bar_class_init (TestBarClass * klass,
+                     gpointer klass_data)
+{
+       test_bar_parent_class = g_type_class_peek_parent (klass);
+       ((TestBarClass *) klass)->finalize = test_bar_finalize;
+}
+
+static void
+test_bar_instance_init (TestBar * self,
+                        gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+test_bar_finalize (TestBar * obj)
+{
+       TestBar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_TEST_BAR, TestBar);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+test_bar_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_test_bar_init, 
value_test_bar_free_value, value_test_bar_copy_value, value_test_bar_peek_pointer, "p", 
value_test_bar_collect_value, "p", value_test_bar_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (TestBarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(TestBar), 0, (GInstanceInitFunc) test_bar_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType test_bar_type_id;
+       test_bar_type_id = g_type_register_fundamental (g_type_fundamental_next (), "TestBar", 
&g_define_type_info, &g_define_type_fundamental_info, 0);
+       return test_bar_type_id;
+}
+
+GType
+test_bar_get_type (void)
+{
+       static volatile gsize test_bar_type_id__volatile = 0;
+       if (g_once_init_enter (&test_bar_type_id__volatile)) {
+               GType test_bar_type_id;
+               test_bar_type_id = test_bar_get_type_once ();
+               g_once_init_leave (&test_bar_type_id__volatile, test_bar_type_id);
+       }
+       return test_bar_type_id__volatile;
+}
+
+gpointer
+test_bar_ref (gpointer instance)
+{
+       TestBar * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+test_bar_unref (gpointer instance)
+{
+       TestBar * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               TEST_BAR_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       TestFoo* _tmp0_;
+       TestFoo* _tmp1_;
+       TestBar* _tmp2_;
+       TestBar* _tmp3_;
+       _tmp0_ = test_foo_new ();
+       _tmp1_ = _tmp0_;
+       test_foo_test (_tmp1_);
+       _test_foo_unref0 (_tmp1_);
+       _tmp2_ = test_bar_new ();
+       _tmp3_ = _tmp2_;
+       test_bar_test (_tmp3_);
+       _test_bar_unref0 (_tmp3_);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/with-nested-in-lambda.c-expected b/tests/objects/with-nested-in-lambda.c-expected
new file mode 100644
index 000000000..69ccd0bbf
--- /dev/null
+++ b/tests/objects/with-nested-in-lambda.c-expected
@@ -0,0 +1,369 @@
+/* objects_with_nested_in_lambda.c generated by valac, the Vala compiler
+ * generated from objects_with_nested_in_lambda.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef void (*FooFunc) (gpointer user_data);
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+typedef struct _Block1Data Block1Data;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+struct _Block1Data {
+       int _ref_count_;
+       Foo* foo;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN gint foo_bar (Foo* self);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN void run (FooFunc func,
+          gpointer func_target);
+static void _vala_main (void);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static void __lambda4_ (Block1Data* _data1_);
+static void ___lambda4__foo_func (gpointer self);
+
+gint
+foo_bar (Foo* self)
+{
+       gint result = 0;
+       g_return_val_if_fail (IS_FOO (self), 0);
+       result = 23;
+       return result;
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+void
+run (FooFunc func,
+     gpointer func_target)
+{
+       func (func_target);
+}
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               _foo_unref0 (_data1_->foo);
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static void
+__lambda4_ (Block1Data* _data1_)
+{
+       {
+               _vala_assert (foo_bar (_data1_->foo) == 23, "bar () == 23");
+       }
+}
+
+static void
+___lambda4__foo_func (gpointer self)
+{
+       __lambda4_ (self);
+}
+
+static void
+_vala_main (void)
+{
+       Block1Data* _data1_;
+       Foo* _tmp0_;
+       _data1_ = g_slice_new0 (Block1Data);
+       _data1_->_ref_count_ = 1;
+       _tmp0_ = foo_new ();
+       _data1_->foo = _tmp0_;
+       run (___lambda4__foo_func, _data1_);
+       block1_data_unref (_data1_);
+       _data1_ = NULL;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/with-nested-method.c-expected b/tests/objects/with-nested-method.c-expected
new file mode 100644
index 000000000..ca1b1ba0c
--- /dev/null
+++ b/tests/objects/with-nested-method.c-expected
@@ -0,0 +1,593 @@
+/* objects_with_nested_method.c generated by valac, the Vala compiler
+ * generated from objects_with_nested_method.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+typedef struct _ParamSpecBar ParamSpecBar;
+#define _bar_unref0(var) ((var == NULL) ? NULL : (var = (bar_unref (var), NULL)))
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+struct _Bar {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       GTypeClass parent_class;
+       void (*finalize) (Bar *self);
+};
+
+struct _ParamSpecBar {
+       GParamSpec parent_instance;
+};
+
+static gpointer foo_parent_class = NULL;
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN gint foo_foo (Foo* self);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN gpointer bar_ref (gpointer instance);
+VALA_EXTERN void bar_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_bar (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_bar (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_bar (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_bar (const GValue* value);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, bar_unref)
+VALA_EXTERN gint bar_foo (Bar* self);
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static void bar_finalize (Bar * obj);
+static GType bar_get_type_once (void);
+static void _vala_main (void);
+
+gint
+foo_foo (Foo* self)
+{
+       gint result = 0;
+       g_return_val_if_fail (IS_FOO (self), 0);
+       result = 23;
+       return result;
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+gint
+bar_foo (Bar* self)
+{
+       gint result = 0;
+       g_return_val_if_fail (IS_BAR (self), 0);
+       result = 42;
+       return result;
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar* self = NULL;
+       self = (Bar*) g_type_create_instance (object_type);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+value_bar_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_bar_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               bar_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_bar_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = bar_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_bar_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_bar_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Bar * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = bar_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_bar_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Bar ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = bar_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_bar (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecBar* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_BAR), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_bar (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_bar (GValue* value,
+               gpointer v_object)
+{
+       Bar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               bar_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_unref (old);
+       }
+}
+
+void
+value_take_bar (GValue* value,
+                gpointer v_object)
+{
+       Bar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_unref (old);
+       }
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       ((BarClass *) klass)->finalize = bar_finalize;
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+bar_finalize (Bar * obj)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_bar_init, value_bar_free_value, 
value_bar_copy_value, value_bar_peek_pointer, "p", value_bar_collect_value, "p", value_bar_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType bar_type_id;
+       bar_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Bar", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+gpointer
+bar_ref (gpointer instance)
+{
+       Bar * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+bar_unref (gpointer instance)
+{
+       Bar * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               BAR_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       Bar* bar = NULL;
+       Bar* _tmp1_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       _tmp1_ = bar_new ();
+       bar = _tmp1_;
+       {
+               _vala_assert (foo_foo (foo) == 23, "foo () == 23");
+               {
+                       _vala_assert (bar_foo (bar) == 42, "foo () == 42");
+               }
+       }
+       _bar_unref0 (bar);
+       _foo_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/with-nested-signal.c-expected b/tests/objects/with-nested-signal.c-expected
new file mode 100644
index 000000000..c6bd27013
--- /dev/null
+++ b/tests/objects/with-nested-signal.c-expected
@@ -0,0 +1,492 @@
+/* objects_with_nested_signal.c generated by valac, the Vala compiler
+ * generated from objects_with_nested_signal.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+enum  {
+       FOO_MANAM_SIGNAL,
+       FOO_NUM_SIGNALS
+};
+static guint foo_signals[FOO_NUM_SIGNALS] = {0};
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+typedef struct _Block1Data Block1Data;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+       gint (*foo) (Foo* self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+struct _Bar {
+       Foo parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       FooClass parent_class;
+};
+
+struct _Block1Data {
+       int _ref_count_;
+       Foo* foo;
+       Bar* bar;
+};
+
+static gpointer foo_parent_class = NULL;
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN gint foo_foo (Foo* self);
+static gint foo_real_foo (Foo* self);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, foo_unref)
+static gint bar_real_foo (Foo* base);
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static GType bar_get_type_once (void);
+static void _vala_main (void);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static void ____lambda4_ (Block1Data* _data1_);
+static void _____lambda4__foo_manam (Foo* _sender,
+                              gpointer self);
+static void ______lambda5_ (Block1Data* _data1_);
+static void _______lambda5__foo_manam (Foo* _sender,
+                                gpointer self);
+
+static gint
+foo_real_foo (Foo* self)
+{
+       gint result = 0;
+       result = 23;
+       return result;
+}
+
+gint
+foo_foo (Foo* self)
+{
+       FooClass* _klass_;
+       g_return_val_if_fail (IS_FOO (self), 0);
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->foo) {
+               return _klass_->foo (self);
+       }
+       return -1;
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       ((FooClass *) klass)->foo = (gint (*) (Foo*)) foo_real_foo;
+       foo_signals[FOO_MANAM_SIGNAL] = g_signal_new ("manam", TYPE_FOO, G_SIGNAL_RUN_LAST, 0, NULL, NULL, 
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static gint
+bar_real_foo (Foo* base)
+{
+       Bar * self;
+       gint result = 0;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAR, Bar);
+       result = 42;
+       return result;
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar* self = NULL;
+       self = (Bar*) foo_construct (object_type);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->foo = (gint (*) (Foo*)) bar_real_foo;
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (TYPE_FOO, "Bar", &g_define_type_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               _foo_unref0 (_data1_->bar);
+               _foo_unref0 (_data1_->foo);
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static void
+____lambda4_ (Block1Data* _data1_)
+{
+       _vala_assert (foo_foo (_data1_->foo) == 23, "foo () == 23");
+}
+
+static void
+_____lambda4__foo_manam (Foo* _sender,
+                         gpointer self)
+{
+       ____lambda4_ (self);
+}
+
+static void
+______lambda5_ (Block1Data* _data1_)
+{
+       _vala_assert (foo_foo (G_TYPE_CHECK_INSTANCE_CAST (_data1_->bar, TYPE_FOO, Foo)) == 42, "foo () == 
42");
+}
+
+static void
+_______lambda5__foo_manam (Foo* _sender,
+                           gpointer self)
+{
+       ______lambda5_ (self);
+}
+
+static void
+_vala_main (void)
+{
+       Block1Data* _data1_;
+       Foo* _tmp0_;
+       Bar* _tmp1_;
+       _data1_ = g_slice_new0 (Block1Data);
+       _data1_->_ref_count_ = 1;
+       _tmp0_ = foo_new ();
+       _data1_->foo = _tmp0_;
+       _tmp1_ = bar_new ();
+       _data1_->bar = _tmp1_;
+       {
+               g_signal_connect_data (_data1_->foo, "manam", (GCallback) _____lambda4__foo_manam, 
block1_data_ref (_data1_), (GClosureNotify) block1_data_unref, 0);
+               {
+                       g_signal_connect_data (G_TYPE_CHECK_INSTANCE_CAST (_data1_->bar, TYPE_FOO, Foo), 
"manam", (GCallback) _______lambda5__foo_manam, block1_data_ref (_data1_), (GClosureNotify) 
block1_data_unref, 0);
+               }
+       }
+       g_signal_emit (_data1_->foo, foo_signals[FOO_MANAM_SIGNAL], 0);
+       g_signal_emit (G_TYPE_CHECK_INSTANCE_CAST (_data1_->bar, TYPE_FOO, Foo), 
foo_signals[FOO_MANAM_SIGNAL], 0);
+       block1_data_unref (_data1_);
+       _data1_ = NULL;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/with-nested-unambigous-signal.c-expected 
b/tests/objects/with-nested-unambigous-signal.c-expected
new file mode 100644
index 000000000..9860a1a9a
--- /dev/null
+++ b/tests/objects/with-nested-unambigous-signal.c-expected
@@ -0,0 +1,367 @@
+/* objects_with_nested_unambigous_signal.c generated by valac, the Vala compiler
+ * generated from objects_with_nested_unambigous_signal.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+enum  {
+       FOO_MANAM_SIGNAL,
+       FOO_NUM_SIGNALS
+};
+static guint foo_signals[FOO_NUM_SIGNALS] = {0};
+typedef struct _Block1Data Block1Data;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+struct _Block1Data {
+       int _ref_count_;
+       Foo* foo;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN gint foo_bar (Foo* self);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static void ____lambda4_ (Block1Data* _data1_);
+static void _____lambda4__foo_manam (Foo* _sender,
+                              gpointer self);
+
+gint
+foo_bar (Foo* self)
+{
+       gint result = 0;
+       g_return_val_if_fail (IS_FOO (self), 0);
+       result = 23;
+       return result;
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       foo_signals[FOO_MANAM_SIGNAL] = g_signal_new ("manam", TYPE_FOO, G_SIGNAL_RUN_LAST, 0, NULL, NULL, 
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               _foo_unref0 (_data1_->foo);
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static void
+____lambda4_ (Block1Data* _data1_)
+{
+       _vala_assert (foo_bar (_data1_->foo) == 23, "bar () == 23");
+}
+
+static void
+_____lambda4__foo_manam (Foo* _sender,
+                         gpointer self)
+{
+       ____lambda4_ (self);
+}
+
+static void
+_vala_main (void)
+{
+       Block1Data* _data1_;
+       Foo* _tmp0_;
+       _data1_ = g_slice_new0 (Block1Data);
+       _data1_->_ref_count_ = 1;
+       _tmp0_ = foo_new ();
+       _data1_->foo = _tmp0_;
+       {
+               g_signal_connect_data (_data1_->foo, "manam", (GCallback) _____lambda4__foo_manam, 
block1_data_ref (_data1_), (GClosureNotify) block1_data_unref, 0);
+       }
+       g_signal_emit (_data1_->foo, foo_signals[FOO_MANAM_SIGNAL], 0);
+       block1_data_unref (_data1_);
+       _data1_ = NULL;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/objects/with-nested.c-expected b/tests/objects/with-nested.c-expected
new file mode 100644
index 000000000..596d60839
--- /dev/null
+++ b/tests/objects/with-nested.c-expected
@@ -0,0 +1,867 @@
+/* objects_with_nested.c generated by valac, the Vala compiler
+ * generated from objects_with_nested.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+typedef struct _ParamSpecBar ParamSpecBar;
+
+#define TYPE_TEST (test_get_type ())
+#define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test))
+#define TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TEST, TestClass))
+#define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST))
+#define IS_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TEST))
+#define TEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TEST, TestClass))
+
+typedef struct _Test Test;
+typedef struct _TestClass TestClass;
+typedef struct _TestPrivate TestPrivate;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _bar_unref0(var) ((var == NULL) ? NULL : (var = (bar_unref (var), NULL)))
+#define _test_unref0(var) ((var == NULL) ? NULL : (var = (test_unref (var), NULL)))
+typedef struct _ParamSpecTest ParamSpecTest;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+       gint field;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+struct _Bar {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       BarPrivate * priv;
+       gint field;
+};
+
+struct _BarClass {
+       GTypeClass parent_class;
+       void (*finalize) (Bar *self);
+};
+
+struct _ParamSpecBar {
+       GParamSpec parent_instance;
+};
+
+struct _Test {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       TestPrivate * priv;
+       gint field;
+};
+
+struct _TestClass {
+       GTypeClass parent_class;
+       void (*finalize) (Test *self);
+};
+
+struct _ParamSpecTest {
+       GParamSpec parent_instance;
+};
+
+static gpointer foo_parent_class = NULL;
+static gpointer bar_parent_class = NULL;
+static gpointer test_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN gpointer bar_ref (gpointer instance);
+VALA_EXTERN void bar_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_bar (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_bar (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_bar (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_bar (const GValue* value);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, bar_unref)
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static void bar_finalize (Bar * obj);
+static GType bar_get_type_once (void);
+VALA_EXTERN gpointer test_ref (gpointer instance);
+VALA_EXTERN void test_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_test (const gchar* name,
+                             const gchar* nick,
+                             const gchar* blurb,
+                             GType object_type,
+                             GParamFlags flags);
+VALA_EXTERN void value_set_test (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN void value_take_test (GValue* value,
+                      gpointer v_object);
+VALA_EXTERN gpointer value_get_test (const GValue* value);
+VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, test_unref)
+static void test_nested (Test* self);
+static gint test_main (void);
+VALA_EXTERN Test* test_new (void);
+VALA_EXTERN Test* test_construct (GType object_type);
+static void test_finalize (Test * obj);
+static GType test_get_type_once (void);
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar* self = NULL;
+       self = (Bar*) g_type_create_instance (object_type);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+value_bar_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_bar_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               bar_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_bar_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = bar_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_bar_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_bar_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Bar * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = bar_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_bar_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Bar ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = bar_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_bar (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecBar* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_BAR), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_bar (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_bar (GValue* value,
+               gpointer v_object)
+{
+       Bar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               bar_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_unref (old);
+       }
+}
+
+void
+value_take_bar (GValue* value,
+                gpointer v_object)
+{
+       Bar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_unref (old);
+       }
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       ((BarClass *) klass)->finalize = bar_finalize;
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+bar_finalize (Bar * obj)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_bar_init, value_bar_free_value, 
value_bar_copy_value, value_bar_peek_pointer, "p", value_bar_collect_value, "p", value_bar_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType bar_type_id;
+       bar_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Bar", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+gpointer
+bar_ref (gpointer instance)
+{
+       Bar * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+bar_unref (gpointer instance)
+{
+       Bar * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               BAR_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static gpointer
+_foo_ref0 (gpointer self)
+{
+       return self ? foo_ref (self) : NULL;
+}
+
+static void
+test_nested (Test* self)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       Bar* bar = NULL;
+       Bar* _tmp1_;
+       g_return_if_fail (IS_TEST (self));
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       _tmp1_ = bar_new ();
+       bar = _tmp1_;
+       {
+               Foo* f = NULL;
+               Foo* _tmp2_;
+               _tmp2_ = _foo_ref0 (foo);
+               f = _tmp2_;
+               f->field = 100;
+               {
+                       bar->field = 200;
+                       f->field = 300;
+                       self->field = 400;
+               }
+               _foo_unref0 (f);
+       }
+       _vala_assert (foo->field == 300, "foo.field == 300");
+       _vala_assert (bar->field == 200, "bar.field == 200");
+       _vala_assert (self->field == 400, "this.field == 400");
+       _bar_unref0 (bar);
+       _foo_unref0 (foo);
+}
+
+static gint
+test_main (void)
+{
+       Test* _tmp0_;
+       Test* _tmp1_;
+       gint result = 0;
+       _tmp0_ = test_new ();
+       _tmp1_ = _tmp0_;
+       test_nested (_tmp1_);
+       _test_unref0 (_tmp1_);
+       result = 0;
+       return result;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       return test_main ();
+}
+
+Test*
+test_construct (GType object_type)
+{
+       Test* self = NULL;
+       self = (Test*) g_type_create_instance (object_type);
+       return self;
+}
+
+Test*
+test_new (void)
+{
+       return test_construct (TYPE_TEST);
+}
+
+static void
+value_test_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_test_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               test_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_test_copy_value (const GValue* src_value,
+                       GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = test_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_test_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_test_collect_value (GValue* value,
+                          guint n_collect_values,
+                          GTypeCValue* collect_values,
+                          guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Test * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = test_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_test_lcopy_value (const GValue* value,
+                        guint n_collect_values,
+                        GTypeCValue* collect_values,
+                        guint collect_flags)
+{
+       Test ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = test_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_test (const gchar* name,
+                 const gchar* nick,
+                 const gchar* blurb,
+                 GType object_type,
+                 GParamFlags flags)
+{
+       ParamSpecTest* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_TEST), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_test (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_TEST), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_test (GValue* value,
+                gpointer v_object)
+{
+       Test * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_TEST));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_TEST));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               test_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               test_unref (old);
+       }
+}
+
+void
+value_take_test (GValue* value,
+                 gpointer v_object)
+{
+       Test * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_TEST));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_TEST));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               test_unref (old);
+       }
+}
+
+static void
+test_class_init (TestClass * klass,
+                 gpointer klass_data)
+{
+       test_parent_class = g_type_class_peek_parent (klass);
+       ((TestClass *) klass)->finalize = test_finalize;
+}
+
+static void
+test_instance_init (Test * self,
+                    gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+test_finalize (Test * obj)
+{
+       Test * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_TEST, Test);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+test_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_test_init, value_test_free_value, 
value_test_copy_value, value_test_peek_pointer, "p", value_test_collect_value, "p", value_test_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (TestClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) test_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Test), 
0, (GInstanceInitFunc) test_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType test_type_id;
+       test_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Test", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return test_type_id;
+}
+
+GType
+test_get_type (void)
+{
+       static volatile gsize test_type_id__volatile = 0;
+       if (g_once_init_enter (&test_type_id__volatile)) {
+               GType test_type_id;
+               test_type_id = test_get_type_once ();
+               g_once_init_leave (&test_type_id__volatile, test_type_id);
+       }
+       return test_type_id__volatile;
+}
+
+gpointer
+test_ref (gpointer instance)
+{
+       Test * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+test_unref (gpointer instance)
+{
+       Test * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               TEST_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
diff --git a/tests/ordering/delegate-class.c-expected b/tests/ordering/delegate-class.c-expected
new file mode 100644
index 000000000..c4ac1391c
--- /dev/null
+++ b/tests/ordering/delegate-class.c-expected
@@ -0,0 +1,305 @@
+/* ordering_delegate_class.c generated by valac, the Vala compiler
+ * generated from ordering_delegate_class.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef Foo* (*Func) (Foo* p);
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Func foo_foo (Foo* self,
+              Func p);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+Func
+foo_foo (Foo* self,
+         Func p)
+{
+       Func result = NULL;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       result = p;
+       return result;
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/ordering/delegate-enum.c-expected b/tests/ordering/delegate-enum.c-expected
new file mode 100644
index 000000000..ff128a52b
--- /dev/null
+++ b/tests/ordering/delegate-enum.c-expected
@@ -0,0 +1,59 @@
+/* ordering_delegate_enum.c generated by valac, the Vala compiler
+ * generated from ordering_delegate_enum.vala, do not modify */
+
+#include <glib-object.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef enum  {
+       FOO_BAR
+} Foo;
+
+#define TYPE_FOO (foo_get_type ())
+typedef Foo (*Func) (Foo p);
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+static void _vala_main (void);
+
+static GType
+foo_get_type_once (void)
+{
+       static const GEnumValue values[] = {{FOO_BAR, "FOO_BAR", "bar"}, {0, NULL, NULL}};
+       GType foo_type_id;
+       foo_type_id = g_enum_register_static ("Foo", values);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/ordering/delegate-interface.c-expected b/tests/ordering/delegate-interface.c-expected
new file mode 100644
index 000000000..3a932f3f9
--- /dev/null
+++ b/tests/ordering/delegate-interface.c-expected
@@ -0,0 +1,89 @@
+/* ordering_delegate_interface.c generated by valac, the Vala compiler
+ * generated from ordering_delegate_interface.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define FOO_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_FOO, FooIface))
+
+typedef struct _Foo Foo;
+typedef struct _FooIface FooIface;
+typedef Foo* (*Func) (Foo* p);
+
+struct _FooIface {
+       GTypeInterface parent_iface;
+       Func (*foo) (Foo* self, Func p);
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Func foo_foo (Foo* self,
+              Func p);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+Func
+foo_foo (Foo* self,
+         Func p)
+{
+       FooIface* _iface_;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _iface_ = FOO_GET_INTERFACE (self);
+       if (_iface_->foo) {
+               return _iface_->foo (self, p);
+       }
+       return NULL;
+}
+
+static void
+foo_default_init (FooIface * iface,
+                  gpointer iface_data)
+{
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_INTERFACE, "Foo", &g_define_type_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/ordering/delegate-struct.c-expected b/tests/ordering/delegate-struct.c-expected
new file mode 100644
index 000000000..415f67326
--- /dev/null
+++ b/tests/ordering/delegate-struct.c-expected
@@ -0,0 +1,78 @@
+/* ordering_delegate_struct.c generated by valac, the Vala compiler
+ * generated from ordering_delegate_struct.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+typedef void (*Func) (Foo* p, Foo* result);
+
+struct _Foo {
+       Func f;
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+static void _vala_main (void);
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       memcpy (dup, self, sizeof (Foo));
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/ordering/struct-delegate.c-expected b/tests/ordering/struct-delegate.c-expected
new file mode 100644
index 000000000..e5ae83e1d
--- /dev/null
+++ b/tests/ordering/struct-delegate.c-expected
@@ -0,0 +1,78 @@
+/* ordering_struct_delegate.c generated by valac, the Vala compiler
+ * generated from ordering_struct_delegate.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+typedef gint (*Func) (Foo* foo);
+
+struct _Foo {
+       Func func;
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+static void _vala_main (void);
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       memcpy (dup, self, sizeof (Foo));
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/parser-keep-going/member-initializer.c-expected 
b/tests/parser-keep-going/member-initializer.c-expected
new file mode 100644
index 000000000..30f0cea82
--- /dev/null
+++ b/tests/parser-keep-going/member-initializer.c-expected
@@ -0,0 +1,372 @@
+/* parser_keep_going_member_initializer.c generated by valac, the Vala compiler
+ * generated from parser_keep_going_member_initializer.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+#include <stdlib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+#define _g_free0(var) (var = (g_free (var), NULL))
+typedef struct _ParamSpecBar ParamSpecBar;
+#define _bar_unref0(var) ((var == NULL) ? NULL : (var = (bar_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       guint x;
+       gint y;
+};
+
+struct _Bar {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       BarPrivate * priv;
+       gchar* s;
+};
+
+struct _BarClass {
+       GTypeClass parent_class;
+       void (*finalize) (Bar *self);
+};
+
+struct _ParamSpecBar {
+       GParamSpec parent_instance;
+};
+
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN gpointer bar_ref (gpointer instance);
+VALA_EXTERN void bar_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_bar (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_bar (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_bar (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_bar (const GValue* value);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, bar_unref)
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static void bar_finalize (Bar * obj);
+static GType bar_get_type_once (void);
+static void _vala_main (void);
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       memcpy (dup, self, sizeof (Foo));
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar* self = NULL;
+       self = (Bar*) g_type_create_instance (object_type);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+value_bar_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_bar_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               bar_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_bar_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = bar_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_bar_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_bar_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Bar * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = bar_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_bar_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Bar ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = bar_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_bar (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecBar* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_BAR), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_bar (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_bar (GValue* value,
+               gpointer v_object)
+{
+       Bar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               bar_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_unref (old);
+       }
+}
+
+void
+value_take_bar (GValue* value,
+                gpointer v_object)
+{
+       Bar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_unref (old);
+       }
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       ((BarClass *) klass)->finalize = bar_finalize;
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+bar_finalize (Bar * obj)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       g_signal_handlers_destroy (self);
+       _g_free0 (self->s);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_bar_init, value_bar_free_value, 
value_bar_copy_value, value_bar_peek_pointer, "p", value_bar_collect_value, "p", value_bar_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType bar_type_id;
+       bar_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Bar", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+gpointer
+bar_ref (gpointer instance)
+{
+       Bar * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+bar_unref (gpointer instance)
+{
+       Bar * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               BAR_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Foo foo = {0};
+       Foo _tmp0_ = {0};
+       Foo _tmp1_;
+       Foo _tmp2_;
+       Bar* bar = NULL;
+       gchar* _tmp3_;
+       Bar* _tmp4_ = NULL;
+       const gchar* _tmp5_;
+       memset (&_tmp0_, 0, sizeof (Foo));
+       _tmp0_.x = (guint) 23;
+       _tmp0_.y = 42;
+       foo = _tmp0_;
+       _tmp1_ = foo;
+       _vala_assert (_tmp1_.x == 23U, "foo.x == 23U");
+       _tmp2_ = foo;
+       _vala_assert (_tmp2_.y == 42, "foo.y == 42");
+       _tmp3_ = g_strdup ("bar");
+       _tmp4_ = bar_new ();
+       _g_free0 (_tmp4_->s);
+       _tmp4_->s = _tmp3_;
+       bar = _tmp4_;
+       _tmp5_ = bar->s;
+       _vala_assert (g_strcmp0 (_tmp5_, "bar") == 0, "bar.s == \"bar\"");
+       _bar_unref0 (bar);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/parser/assignment.c-expected b/tests/parser/assignment.c-expected
new file mode 100644
index 000000000..64aa5c6c6
--- /dev/null
+++ b/tests/parser/assignment.c-expected
@@ -0,0 +1,33 @@
+/* parser_assignment.c generated by valac, the Vala compiler
+ * generated from parser_assignment.vala, do not modify */
+
+#include <glib.h>
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+       gint i = 0;
+       i = 1;
+       i += 2;
+       i -= 2;
+       i *= 2;
+       i /= 2;
+       i |= 1;
+       i &= 1;
+       i ^= 1;
+       i %= 1;
+       i = ~1;
+       i <<= 2;
+       i >>= 2;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/parser/bug728574.c-expected b/tests/parser/bug728574.c-expected
new file mode 100644
index 000000000..bbbc95767
--- /dev/null
+++ b/tests/parser/bug728574.c-expected
@@ -0,0 +1,47 @@
+/* parser_bug728574.c generated by valac, the Vala compiler
+ * generated from parser_bug728574.vala, do not modify */
+
+#include <glib.h>
+
+#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
+
+static void _vala_main (void);
+
+static GRegex* _tmp_regex_0 = NULL;
+
+static inline GRegex*
+_thread_safe_regex_init (GRegex** re,
+                         const gchar * pattern,
+                         GRegexCompileFlags compile_flags)
+{
+       if (g_once_init_enter ((volatile gsize*) re)) {
+               GRegex* val = g_regex_new (pattern, compile_flags, 0, NULL);
+               g_once_init_leave ((volatile gsize*) re, (gsize) val);
+       }
+       return *re;
+}
+
+static gpointer
+_g_regex_ref0 (gpointer self)
+{
+       return self ? g_regex_ref (self) : NULL;
+}
+
+static void
+_vala_main (void)
+{
+       GRegex* r = NULL;
+       GRegex* _tmp0_;
+       _tmp0_ = _g_regex_ref0 (_thread_safe_regex_init (&_tmp_regex_0, 
"^([\\+-]?\\d{4}(?!\\d{2}\\b))((-?)((0[1-9]|1[0-2])(\\3([12]\\d|0[1-9]|3[01]))?|W([0-4]\\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\\d|[12]\\d{2}|3([0-5]\\d|6[1-6])))([T\\s]((([01]\\d|2[0-3])((:?)[0-5]\\d)?|24\\:?00)([\\.,]\\d+(?!:))?)?(\\17[0-5]\\d([\\.,]\\d+)?)?([zZ]|([\\+-])([01]\\d|2[0-3]):?([0-5]\\d)?)?)?)?$",
 0));
+       r = _tmp0_;
+       _g_regex_unref0 (r);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/parser/bug749576.c-expected b/tests/parser/bug749576.c-expected
new file mode 100644
index 000000000..b483b0fc8
--- /dev/null
+++ b/tests/parser/bug749576.c-expected
@@ -0,0 +1,144 @@
+/* parser_bug749576.c generated by valac, the Vala compiler
+ * generated from parser_bug749576.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (void);
+
+static GRegex* _tmp_regex_0 = NULL;
+static GRegex* _tmp_regex_1 = NULL;
+static GRegex* _tmp_regex_2 = NULL;
+static GRegex* _tmp_regex_3 = NULL;
+
+static inline GRegex*
+_thread_safe_regex_init (GRegex** re,
+                         const gchar * pattern,
+                         GRegexCompileFlags compile_flags)
+{
+       if (g_once_init_enter ((volatile gsize*) re)) {
+               GRegex* val = g_regex_new (pattern, compile_flags, 0, NULL);
+               g_once_init_leave ((volatile gsize*) re, (gsize) val);
+       }
+       return *re;
+}
+
+static void
+_vala_main (void)
+{
+       const gchar* a = NULL;
+       const gchar* b = NULL;
+       const gchar* c = NULL;
+       const gchar* _tmp0_;
+       const gchar* _tmp1_;
+       const gchar* _tmp2_;
+       const gchar* _tmp9_;
+       GError* _inner_error0_ = NULL;
+       a = "first line\nnext line";
+       b = "first line\rnext line";
+       c = "first \tline\r\nnext \tline";
+       _tmp0_ = a;
+       _vala_assert (g_regex_match (_thread_safe_regex_init (&_tmp_regex_0, "\\Rnext", 0), _tmp0_, 0, NULL), 
"/\\Rnext/.match (a)");
+       _tmp1_ = b;
+       _vala_assert (g_regex_match (_thread_safe_regex_init (&_tmp_regex_1, "\\Rnext", 0), _tmp1_, 0, NULL), 
"/\\Rnext/.match (b)");
+       _tmp2_ = c;
+       _vala_assert (g_regex_match (_thread_safe_regex_init (&_tmp_regex_2, "\\Rnext", 0), _tmp2_, 0, NULL), 
"/\\Rnext/.match (c)");
+       {
+               GRegex* r = NULL;
+               GRegex* _tmp3_;
+               GRegex* _tmp4_;
+               const gchar* _tmp5_;
+               GRegex* r2 = NULL;
+               GRegex* _tmp6_;
+               GRegex* _tmp7_;
+               const gchar* _tmp8_;
+               _tmp3_ = g_regex_new ("\\Rnext", 0, 0, &_inner_error0_);
+               r = _tmp3_;
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       goto __catch0_g_error;
+               }
+               _tmp4_ = r;
+               _tmp5_ = a;
+               _vala_assert (g_regex_match (_tmp4_, _tmp5_, 0, NULL), "r.match (a)");
+               _tmp6_ = g_regex_new ("\\Rnext", 0, 0, &_inner_error0_);
+               r2 = _tmp6_;
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       _g_regex_unref0 (r);
+                       goto __catch0_g_error;
+               }
+               _tmp7_ = r2;
+               _tmp8_ = a;
+               _vala_assert (g_regex_match (_tmp7_, _tmp8_, 0, NULL), "r2.match (a)");
+               _g_regex_unref0 (r2);
+               _g_regex_unref0 (r);
+       }
+       goto __finally0;
+       __catch0_g_error:
+       {
+               g_clear_error (&_inner_error0_);
+       }
+       __finally0:
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _tmp9_ = c;
+       _vala_assert (g_regex_match (_thread_safe_regex_init (&_tmp_regex_3, "\\Nline", 0), _tmp9_, 0, NULL), 
"/\\Nline/.match (c)");
+       {
+               GRegex* r = NULL;
+               GRegex* _tmp10_;
+               GRegex* _tmp11_;
+               const gchar* _tmp12_;
+               GRegex* r2 = NULL;
+               GRegex* _tmp13_;
+               GRegex* _tmp14_;
+               const gchar* _tmp15_;
+               _tmp10_ = g_regex_new ("\\Nline", 0, 0, &_inner_error0_);
+               r = _tmp10_;
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       goto __catch1_g_error;
+               }
+               _tmp11_ = r;
+               _tmp12_ = c;
+               _vala_assert (g_regex_match (_tmp11_, _tmp12_, 0, NULL), "r.match (c)");
+               _tmp13_ = g_regex_new ("\\Nline", 0, 0, &_inner_error0_);
+               r2 = _tmp13_;
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       _g_regex_unref0 (r);
+                       goto __catch1_g_error;
+               }
+               _tmp14_ = r2;
+               _tmp15_ = c;
+               _vala_assert (g_regex_match (_tmp14_, _tmp15_, 0, NULL), "r2.match (c)");
+               _g_regex_unref0 (r2);
+               _g_regex_unref0 (r);
+       }
+       goto __finally1;
+       __catch1_g_error:
+       {
+               g_clear_error (&_inner_error0_);
+       }
+       __finally1:
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/parser/continue-statement.c-expected b/tests/parser/continue-statement.c-expected
new file mode 100644
index 000000000..0c2386d3f
--- /dev/null
+++ b/tests/parser/continue-statement.c-expected
@@ -0,0 +1,35 @@
+/* parser_continue_statement.c generated by valac, the Vala compiler
+ * generated from parser_continue_statement.vala, do not modify */
+
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+       gint i = 0;
+       i = 0;
+       while (TRUE) {
+               if (i == 0) {
+                       i = 42;
+                       continue;
+               }
+               break;
+       }
+       _vala_assert (i == 42, "i == 42");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/parser/do-statement.c-expected b/tests/parser/do-statement.c-expected
new file mode 100644
index 000000000..57682cbb7
--- /dev/null
+++ b/tests/parser/do-statement.c-expected
@@ -0,0 +1,48 @@
+/* parser_do_statement.c generated by valac, the Vala compiler
+ * generated from parser_do_statement.vala, do not modify */
+
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+       gint i = 0;
+       i = 0;
+       {
+               gboolean _tmp0_ = FALSE;
+               _tmp0_ = TRUE;
+               while (TRUE) {
+                       gint _tmp1_;
+                       if (!_tmp0_) {
+                               if (!(i < 2)) {
+                                       break;
+                               }
+                       }
+                       _tmp0_ = FALSE;
+                       _tmp1_ = i;
+                       i = _tmp1_ + 1;
+               }
+       }
+       _vala_assert (i == 2, "i == 2");
+       while (TRUE) {
+               i = 42;
+               break;
+       }
+       _vala_assert (i == 42, "i == 42");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/parser/foreach.c-expected b/tests/parser/foreach.c-expected
new file mode 100644
index 000000000..5d013475a
--- /dev/null
+++ b/tests/parser/foreach.c-expected
@@ -0,0 +1,150 @@
+/* parser_foreach.c generated by valac, the Vala compiler
+ * generated from parser_foreach.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+
+static void _vala_main (void);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static void
+_vala_main (void)
+{
+       gchar** array = NULL;
+       gchar* _tmp0_;
+       gchar* _tmp1_;
+       gchar* _tmp2_;
+       gchar** _tmp3_;
+       gint array_length1;
+       gint _array_size_;
+       gchar** _tmp4_;
+       gint _tmp4__length1;
+       gchar** _tmp6_;
+       gint _tmp6__length1;
+       gchar** _tmp7_;
+       gint _tmp7__length1;
+       gchar** _tmp9_;
+       gint _tmp9__length1;
+       _tmp0_ = g_strdup ("foo");
+       _tmp1_ = g_strdup ("bar");
+       _tmp2_ = g_strdup ("manam");
+       _tmp3_ = g_new0 (gchar*, 3 + 1);
+       _tmp3_[0] = _tmp0_;
+       _tmp3_[1] = _tmp1_;
+       _tmp3_[2] = _tmp2_;
+       array = _tmp3_;
+       array_length1 = 3;
+       _array_size_ = array_length1;
+       _tmp4_ = array;
+       _tmp4__length1 = array_length1;
+       {
+               gchar** s_collection = NULL;
+               gint s_collection_length1 = 0;
+               gint _s_collection_size_ = 0;
+               gint s_it = 0;
+               s_collection = _tmp4_;
+               s_collection_length1 = _tmp4__length1;
+               for (s_it = 0; s_it < s_collection_length1; s_it = s_it + 1) {
+                       gchar* _tmp5_;
+                       gchar* s = NULL;
+                       _tmp5_ = g_strdup (s_collection[s_it]);
+                       s = _tmp5_;
+                       {
+                               _g_free0 (s);
+                       }
+               }
+       }
+       _tmp6_ = array;
+       _tmp6__length1 = array_length1;
+       {
+               gchar** s_collection = NULL;
+               gint s_collection_length1 = 0;
+               gint _s_collection_size_ = 0;
+               gint s_it = 0;
+               s_collection = _tmp6_;
+               s_collection_length1 = _tmp6__length1;
+               for (s_it = 0; s_it < s_collection_length1; s_it = s_it + 1) {
+                       const gchar* s = NULL;
+                       s = s_collection[s_it];
+                       {
+                       }
+               }
+       }
+       _tmp7_ = array;
+       _tmp7__length1 = array_length1;
+       {
+               gchar** s_collection = NULL;
+               gint s_collection_length1 = 0;
+               gint _s_collection_size_ = 0;
+               gint s_it = 0;
+               s_collection = _tmp7_;
+               s_collection_length1 = _tmp7__length1;
+               for (s_it = 0; s_it < s_collection_length1; s_it = s_it + 1) {
+                       gchar* _tmp8_;
+                       gchar* s = NULL;
+                       _tmp8_ = g_strdup (s_collection[s_it]);
+                       s = _tmp8_;
+                       {
+                               _g_free0 (s);
+                       }
+               }
+       }
+       _tmp9_ = array;
+       _tmp9__length1 = array_length1;
+       {
+               gchar** s_collection = NULL;
+               gint s_collection_length1 = 0;
+               gint _s_collection_size_ = 0;
+               gint s_it = 0;
+               s_collection = _tmp9_;
+               s_collection_length1 = _tmp9__length1;
+               for (s_it = 0; s_it < s_collection_length1; s_it = s_it + 1) {
+                       const gchar* s = NULL;
+                       s = s_collection[s_it];
+                       {
+                       }
+               }
+       }
+       array = (_vala_array_free (array, array_length1, (GDestroyNotify) g_free), NULL);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/parser/local-variable.c-expected b/tests/parser/local-variable.c-expected
new file mode 100644
index 000000000..1f8612827
--- /dev/null
+++ b/tests/parser/local-variable.c-expected
@@ -0,0 +1,39 @@
+/* parser_local_variable.c generated by valac, the Vala compiler
+ * generated from parser_local_variable.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+       {
+               gchar* foo = NULL;
+               gchar* _tmp0_;
+               gint bar = 0;
+               _tmp0_ = g_strdup ("foo");
+               foo = _tmp0_;
+               bar = 42;
+               _g_free0 (foo);
+       }
+       {
+               const gchar* foo = NULL;
+               gint bar = 0;
+               foo = "foo";
+               bar = 42;
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/parser/lock-statement.c-expected b/tests/parser/lock-statement.c-expected
new file mode 100644
index 000000000..4b37d7a28
--- /dev/null
+++ b/tests/parser/lock-statement.c-expected
@@ -0,0 +1,340 @@
+/* parser_lock_statement.c generated by valac, the Vala compiler
+ * generated from parser_lock_statement.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _FooPrivate {
+       gint lockable;
+       GRecMutex __lock_lockable;
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN void foo_explicit_unlocking (Foo* self);
+VALA_EXTERN void foo_implicit_unlocking (Foo* self);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+void
+foo_explicit_unlocking (Foo* self)
+{
+       g_return_if_fail (IS_FOO (self));
+       g_rec_mutex_lock (&self->priv->__lock_lockable);
+       g_rec_mutex_unlock (&self->priv->__lock_lockable);
+}
+
+void
+foo_implicit_unlocking (Foo* self)
+{
+       GError* _inner_error0_ = NULL;
+       g_return_if_fail (IS_FOO (self));
+       {
+               g_rec_mutex_lock (&self->priv->__lock_lockable);
+               {
+               }
+               __finally0:
+               {
+                       g_rec_mutex_unlock (&self->priv->__lock_lockable);
+               }
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+       }
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+       g_rec_mutex_init (&self->priv->__lock_lockable);
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+       g_rec_mutex_clear (&self->priv->__lock_lockable);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/parser/main-block.c-expected b/tests/parser/main-block.c-expected
new file mode 100644
index 000000000..fcb0e5748
--- /dev/null
+++ b/tests/parser/main-block.c-expected
@@ -0,0 +1,28 @@
+/* parser_main_block.c generated by valac, the Vala compiler
+ * generated from parser_main_block.vala, do not modify */
+
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+       gint i = 0;
+       i = 42;
+       _vala_assert (i == 42, "i == 42");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/parser/member-access-pointer.c-expected b/tests/parser/member-access-pointer.c-expected
new file mode 100644
index 000000000..c1a2ba795
--- /dev/null
+++ b/tests/parser/member-access-pointer.c-expected
@@ -0,0 +1,119 @@
+/* parser_member_access_pointer.c generated by valac, the Vala compiler
+ * generated from parser_member_access_pointer.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+#include <stdlib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+
+struct _Foo {
+       gint i;
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN void foo_bar (Foo *self,
+              GType g_type,
+              GBoxedCopyFunc g_dup_func,
+              GDestroyNotify g_destroy_func,
+              GType t_type,
+              GBoxedCopyFunc t_dup_func,
+              GDestroyNotify t_destroy_func,
+              gconstpointer g,
+              gconstpointer t);
+static void _vala_main (void);
+static gint* _int_dup (gint* self);
+
+void
+foo_bar (Foo *self,
+         GType g_type,
+         GBoxedCopyFunc g_dup_func,
+         GDestroyNotify g_destroy_func,
+         GType t_type,
+         GBoxedCopyFunc t_dup_func,
+         GDestroyNotify t_destroy_func,
+         gconstpointer g,
+         gconstpointer t)
+{
+}
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       memcpy (dup, self, sizeof (Foo));
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static gint*
+_int_dup (gint* self)
+{
+       gint* dup;
+       dup = g_new0 (gint, 1);
+       memcpy (dup, self, sizeof (gint));
+       return dup;
+}
+
+static void
+_vala_main (void)
+{
+       Foo foo = {0};
+       Foo _tmp0_ = {0};
+       gint _tmp1_;
+       Foo _tmp2_;
+       _tmp0_.i = 42;
+       foo = _tmp0_;
+       _tmp1_ = 23;
+       _tmp2_ = foo;
+       foo_bar (&_tmp2_, G_TYPE_INT, (GBoxedCopyFunc) _int_dup, (GDestroyNotify) g_free, G_TYPE_STRING, 
(GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, &_tmp1_, "foo");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/parser/member-initializer-empty.c-expected 
b/tests/parser/member-initializer-empty.c-expected
new file mode 100644
index 000000000..1f894f513
--- /dev/null
+++ b/tests/parser/member-initializer-empty.c-expected
@@ -0,0 +1,299 @@
+/* parser_member_initializer_empty.c generated by valac, the Vala compiler
+ * generated from parser_member_initializer_empty.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+       gint i;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       _foo_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/parser/member-initializer-trailing-comma.c-expected 
b/tests/parser/member-initializer-trailing-comma.c-expected
new file mode 100644
index 000000000..ce3495329
--- /dev/null
+++ b/tests/parser/member-initializer-trailing-comma.c-expected
@@ -0,0 +1,300 @@
+/* parser_member_initializer_trailing_comma.c generated by valac, the Vala compiler
+ * generated from parser_member_initializer_trailing_comma.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+       gint i;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_ = NULL;
+       _tmp0_ = foo_new ();
+       _tmp0_->i = 42;
+       foo = _tmp0_;
+       _foo_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/parser/member-initializer.c-expected b/tests/parser/member-initializer.c-expected
new file mode 100644
index 000000000..fb619020a
--- /dev/null
+++ b/tests/parser/member-initializer.c-expected
@@ -0,0 +1,300 @@
+/* parser_member_initializer.c generated by valac, the Vala compiler
+ * generated from parser_member_initializer.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+       gint i;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_ = NULL;
+       _tmp0_ = foo_new ();
+       _tmp0_->i = 23;
+       foo = _tmp0_;
+       _foo_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/parser/namespaces.c-expected b/tests/parser/namespaces.c-expected
new file mode 100644
index 000000000..773baadfe
--- /dev/null
+++ b/tests/parser/namespaces.c-expected
@@ -0,0 +1,662 @@
+/* parser_namespaces.c generated by valac, the Vala compiler
+ * generated from parser_namespaces.vala, do not modify */
+
+#include <glib-object.h>
+#include <gobject/gvaluecollector.h>
+#include <stdio.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_GLOBAL_TESTCLASS (global_testclass_get_type ())
+#define GLOBAL_TESTCLASS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_GLOBAL_TESTCLASS, GlobalTestClass))
+#define GLOBAL_TESTCLASS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_GLOBAL_TESTCLASS, 
GlobalTestClassClass))
+#define IS_GLOBAL_TESTCLASS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_GLOBAL_TESTCLASS))
+#define IS_GLOBAL_TESTCLASS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_GLOBAL_TESTCLASS))
+#define GLOBAL_TESTCLASS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_GLOBAL_TESTCLASS, 
GlobalTestClassClass))
+
+typedef struct _GlobalTestClass GlobalTestClass;
+typedef struct _GlobalTestClassClass GlobalTestClassClass;
+typedef struct _GlobalTestClassPrivate GlobalTestClassPrivate;
+typedef struct _ParamSpecGlobalTestClass ParamSpecGlobalTestClass;
+#define _global_testclass_unref0(var) ((var == NULL) ? NULL : (var = (global_testclass_unref (var), NULL)))
+
+#define FOO_SUB_TYPE_CLASS_IN_NESTED_NAMESPACE (foo_sub_class_in_nested_namespace_get_type ())
+#define FOO_SUB_CLASS_IN_NESTED_NAMESPACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
FOO_SUB_TYPE_CLASS_IN_NESTED_NAMESPACE, FooSubClassInNestedNamespace))
+#define FOO_SUB_CLASS_IN_NESTED_NAMESPACE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), 
FOO_SUB_TYPE_CLASS_IN_NESTED_NAMESPACE, FooSubClassInNestedNamespaceClass))
+#define FOO_SUB_IS_CLASS_IN_NESTED_NAMESPACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
FOO_SUB_TYPE_CLASS_IN_NESTED_NAMESPACE))
+#define FOO_SUB_IS_CLASS_IN_NESTED_NAMESPACE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), 
FOO_SUB_TYPE_CLASS_IN_NESTED_NAMESPACE))
+#define FOO_SUB_CLASS_IN_NESTED_NAMESPACE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), 
FOO_SUB_TYPE_CLASS_IN_NESTED_NAMESPACE, FooSubClassInNestedNamespaceClass))
+
+typedef struct _FooSubClassInNestedNamespace FooSubClassInNestedNamespace;
+typedef struct _FooSubClassInNestedNamespaceClass FooSubClassInNestedNamespaceClass;
+#define _foo_sub_class_in_nested_namespace_unref0(var) ((var == NULL) ? NULL : (var = 
(foo_sub_class_in_nested_namespace_unref (var), NULL)))
+
+#define MAMAN_TYPE_BAR (maman_bar_get_type ())
+#define MAMAN_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_BAR, MamanBar))
+#define MAMAN_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAMAN_TYPE_BAR, MamanBarClass))
+#define MAMAN_IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_BAR))
+#define MAMAN_IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAMAN_TYPE_BAR))
+#define MAMAN_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAMAN_TYPE_BAR, MamanBarClass))
+
+typedef struct _MamanBar MamanBar;
+typedef struct _MamanBarClass MamanBarClass;
+typedef struct _MamanBarPrivate MamanBarPrivate;
+enum  {
+       MAMAN_BAR_0_PROPERTY,
+       MAMAN_BAR_NUM_PROPERTIES
+};
+static GParamSpec* maman_bar_properties[MAMAN_BAR_NUM_PROPERTIES];
+typedef struct _FooSubClassInNestedNamespacePrivate FooSubClassInNestedNamespacePrivate;
+typedef struct _FooSubParamSpecClassInNestedNamespace FooSubParamSpecClassInNestedNamespace;
+
+struct _GlobalTestClass {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       GlobalTestClassPrivate * priv;
+};
+
+struct _GlobalTestClassClass {
+       GTypeClass parent_class;
+       void (*finalize) (GlobalTestClass *self);
+};
+
+struct _ParamSpecGlobalTestClass {
+       GParamSpec parent_instance;
+};
+
+struct _MamanBar {
+       GObject parent_instance;
+       MamanBarPrivate * priv;
+};
+
+struct _MamanBarClass {
+       GObjectClass parent_class;
+};
+
+struct _FooSubClassInNestedNamespace {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooSubClassInNestedNamespacePrivate * priv;
+};
+
+struct _FooSubClassInNestedNamespaceClass {
+       GTypeClass parent_class;
+       void (*finalize) (FooSubClassInNestedNamespace *self);
+};
+
+struct _FooSubParamSpecClassInNestedNamespace {
+       GParamSpec parent_instance;
+};
+
+static gpointer global_testclass_parent_class = NULL;
+static gpointer maman_bar_parent_class = NULL;
+static gpointer foo_sub_class_in_nested_namespace_parent_class = NULL;
+
+VALA_EXTERN gpointer global_testclass_ref (gpointer instance);
+VALA_EXTERN void global_testclass_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_global_testclass (const gchar* name,
+                                         const gchar* nick,
+                                         const gchar* blurb,
+                                         GType object_type,
+                                         GParamFlags flags);
+VALA_EXTERN void value_set_global_testclass (GValue* value,
+                                 gpointer v_object);
+VALA_EXTERN void value_take_global_testclass (GValue* value,
+                                  gpointer v_object);
+VALA_EXTERN gpointer value_get_global_testclass (const GValue* value);
+VALA_EXTERN GType global_testclass_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (GlobalTestClass, global_testclass_unref)
+VALA_EXTERN GlobalTestClass* global_testclass_new (void);
+VALA_EXTERN GlobalTestClass* global_testclass_construct (GType object_type);
+static void global_testclass_finalize (GlobalTestClass * obj);
+static GType global_testclass_get_type_once (void);
+VALA_EXTERN void maman_run (void);
+VALA_EXTERN void maman_bar_run (void);
+VALA_EXTERN gpointer foo_sub_class_in_nested_namespace_ref (gpointer instance);
+VALA_EXTERN void foo_sub_class_in_nested_namespace_unref (gpointer instance);
+VALA_EXTERN GParamSpec* foo_sub_param_spec_class_in_nested_namespace (const gchar* name,
+                                                          const gchar* nick,
+                                                          const gchar* blurb,
+                                                          GType object_type,
+                                                          GParamFlags flags);
+VALA_EXTERN void foo_sub_value_set_class_in_nested_namespace (GValue* value,
+                                                  gpointer v_object);
+VALA_EXTERN void foo_sub_value_take_class_in_nested_namespace (GValue* value,
+                                                   gpointer v_object);
+VALA_EXTERN gpointer foo_sub_value_get_class_in_nested_namespace (const GValue* value);
+VALA_EXTERN GType foo_sub_class_in_nested_namespace_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (FooSubClassInNestedNamespace, foo_sub_class_in_nested_namespace_unref)
+VALA_EXTERN FooSubClassInNestedNamespace* foo_sub_class_in_nested_namespace_new (void);
+VALA_EXTERN FooSubClassInNestedNamespace* foo_sub_class_in_nested_namespace_construct (GType object_type);
+VALA_EXTERN GType maman_bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MamanBar, g_object_unref)
+VALA_EXTERN MamanBar* maman_bar_new (void);
+VALA_EXTERN MamanBar* maman_bar_construct (GType object_type);
+static GType maman_bar_get_type_once (void);
+static void foo_sub_class_in_nested_namespace_finalize (FooSubClassInNestedNamespace * obj);
+static GType foo_sub_class_in_nested_namespace_get_type_once (void);
+static void _vala_main (void);
+
+GlobalTestClass*
+global_testclass_construct (GType object_type)
+{
+       GlobalTestClass* self = NULL;
+       self = (GlobalTestClass*) g_type_create_instance (object_type);
+       return self;
+}
+
+GlobalTestClass*
+global_testclass_new (void)
+{
+       return global_testclass_construct (TYPE_GLOBAL_TESTCLASS);
+}
+
+static void
+value_global_testclass_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_global_testclass_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               global_testclass_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_global_testclass_copy_value (const GValue* src_value,
+                                   GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = global_testclass_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_global_testclass_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_global_testclass_collect_value (GValue* value,
+                                      guint n_collect_values,
+                                      GTypeCValue* collect_values,
+                                      guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               GlobalTestClass * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = global_testclass_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_global_testclass_lcopy_value (const GValue* value,
+                                    guint n_collect_values,
+                                    GTypeCValue* collect_values,
+                                    guint collect_flags)
+{
+       GlobalTestClass ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = global_testclass_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_global_testclass (const gchar* name,
+                             const gchar* nick,
+                             const gchar* blurb,
+                             GType object_type,
+                             GParamFlags flags)
+{
+       ParamSpecGlobalTestClass* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_GLOBAL_TESTCLASS), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_global_testclass (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_GLOBAL_TESTCLASS), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_global_testclass (GValue* value,
+                            gpointer v_object)
+{
+       GlobalTestClass * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_GLOBAL_TESTCLASS));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_GLOBAL_TESTCLASS));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               global_testclass_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               global_testclass_unref (old);
+       }
+}
+
+void
+value_take_global_testclass (GValue* value,
+                             gpointer v_object)
+{
+       GlobalTestClass * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_GLOBAL_TESTCLASS));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_GLOBAL_TESTCLASS));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               global_testclass_unref (old);
+       }
+}
+
+static void
+global_testclass_class_init (GlobalTestClassClass * klass,
+                             gpointer klass_data)
+{
+       global_testclass_parent_class = g_type_class_peek_parent (klass);
+       ((GlobalTestClassClass *) klass)->finalize = global_testclass_finalize;
+}
+
+static void
+global_testclass_instance_init (GlobalTestClass * self,
+                                gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+global_testclass_finalize (GlobalTestClass * obj)
+{
+       GlobalTestClass * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_GLOBAL_TESTCLASS, GlobalTestClass);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+global_testclass_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_global_testclass_init, 
value_global_testclass_free_value, value_global_testclass_copy_value, value_global_testclass_peek_pointer, 
"p", value_global_testclass_collect_value, "p", value_global_testclass_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (GlobalTestClassClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) global_testclass_class_init, (GClassFinalizeFunc) NULL, NULL, 
sizeof (GlobalTestClass), 0, (GInstanceInitFunc) global_testclass_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType global_testclass_type_id;
+       global_testclass_type_id = g_type_register_fundamental (g_type_fundamental_next (), 
"GlobalTestClass", &g_define_type_info, &g_define_type_fundamental_info, 0);
+       return global_testclass_type_id;
+}
+
+GType
+global_testclass_get_type (void)
+{
+       static volatile gsize global_testclass_type_id__volatile = 0;
+       if (g_once_init_enter (&global_testclass_type_id__volatile)) {
+               GType global_testclass_type_id;
+               global_testclass_type_id = global_testclass_get_type_once ();
+               g_once_init_leave (&global_testclass_type_id__volatile, global_testclass_type_id);
+       }
+       return global_testclass_type_id__volatile;
+}
+
+gpointer
+global_testclass_ref (gpointer instance)
+{
+       GlobalTestClass * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+global_testclass_unref (gpointer instance)
+{
+       GlobalTestClass * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               GLOBAL_TESTCLASS_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+void
+maman_run (void)
+{
+       FILE* _tmp0_;
+       GlobalTestClass* _tmp1_;
+       GlobalTestClass* _tmp2_;
+       FooSubClassInNestedNamespace* obj = NULL;
+       FooSubClassInNestedNamespace* _tmp3_;
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, "Namespace Test\n");
+       maman_bar_run ();
+       _tmp1_ = global_testclass_new ();
+       _tmp2_ = _tmp1_;
+       _global_testclass_unref0 (_tmp2_);
+       _tmp3_ = foo_sub_class_in_nested_namespace_new ();
+       obj = _tmp3_;
+       _foo_sub_class_in_nested_namespace_unref0 (obj);
+}
+
+void
+maman_bar_run (void)
+{
+       FILE* _tmp0_;
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, "Class in Namespace Test\n");
+}
+
+MamanBar*
+maman_bar_construct (GType object_type)
+{
+       MamanBar * self = NULL;
+       self = (MamanBar*) g_object_new (object_type, NULL);
+       return self;
+}
+
+MamanBar*
+maman_bar_new (void)
+{
+       return maman_bar_construct (MAMAN_TYPE_BAR);
+}
+
+static void
+maman_bar_class_init (MamanBarClass * klass,
+                      gpointer klass_data)
+{
+       maman_bar_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+maman_bar_instance_init (MamanBar * self,
+                         gpointer klass)
+{
+}
+
+static GType
+maman_bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (MamanBarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) maman_bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(MamanBar), 0, (GInstanceInitFunc) maman_bar_instance_init, NULL };
+       GType maman_bar_type_id;
+       maman_bar_type_id = g_type_register_static (G_TYPE_OBJECT, "MamanBar", &g_define_type_info, 0);
+       return maman_bar_type_id;
+}
+
+GType
+maman_bar_get_type (void)
+{
+       static volatile gsize maman_bar_type_id__volatile = 0;
+       if (g_once_init_enter (&maman_bar_type_id__volatile)) {
+               GType maman_bar_type_id;
+               maman_bar_type_id = maman_bar_get_type_once ();
+               g_once_init_leave (&maman_bar_type_id__volatile, maman_bar_type_id);
+       }
+       return maman_bar_type_id__volatile;
+}
+
+FooSubClassInNestedNamespace*
+foo_sub_class_in_nested_namespace_construct (GType object_type)
+{
+       FooSubClassInNestedNamespace* self = NULL;
+       self = (FooSubClassInNestedNamespace*) g_type_create_instance (object_type);
+       return self;
+}
+
+FooSubClassInNestedNamespace*
+foo_sub_class_in_nested_namespace_new (void)
+{
+       return foo_sub_class_in_nested_namespace_construct (FOO_SUB_TYPE_CLASS_IN_NESTED_NAMESPACE);
+}
+
+static void
+foo_sub_value_class_in_nested_namespace_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+foo_sub_value_class_in_nested_namespace_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_sub_class_in_nested_namespace_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+foo_sub_value_class_in_nested_namespace_copy_value (const GValue* src_value,
+                                                    GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_sub_class_in_nested_namespace_ref 
(src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+foo_sub_value_class_in_nested_namespace_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+foo_sub_value_class_in_nested_namespace_collect_value (GValue* value,
+                                                       guint n_collect_values,
+                                                       GTypeCValue* collect_values,
+                                                       guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               FooSubClassInNestedNamespace * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_sub_class_in_nested_namespace_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+foo_sub_value_class_in_nested_namespace_lcopy_value (const GValue* value,
+                                                     guint n_collect_values,
+                                                     GTypeCValue* collect_values,
+                                                     guint collect_flags)
+{
+       FooSubClassInNestedNamespace ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_sub_class_in_nested_namespace_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+foo_sub_param_spec_class_in_nested_namespace (const gchar* name,
+                                              const gchar* nick,
+                                              const gchar* blurb,
+                                              GType object_type,
+                                              GParamFlags flags)
+{
+       FooSubParamSpecClassInNestedNamespace* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, FOO_SUB_TYPE_CLASS_IN_NESTED_NAMESPACE), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+foo_sub_value_get_class_in_nested_namespace (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, FOO_SUB_TYPE_CLASS_IN_NESTED_NAMESPACE), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+foo_sub_value_set_class_in_nested_namespace (GValue* value,
+                                             gpointer v_object)
+{
+       FooSubClassInNestedNamespace * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, FOO_SUB_TYPE_CLASS_IN_NESTED_NAMESPACE));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, 
FOO_SUB_TYPE_CLASS_IN_NESTED_NAMESPACE));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_sub_class_in_nested_namespace_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_sub_class_in_nested_namespace_unref (old);
+       }
+}
+
+void
+foo_sub_value_take_class_in_nested_namespace (GValue* value,
+                                              gpointer v_object)
+{
+       FooSubClassInNestedNamespace * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, FOO_SUB_TYPE_CLASS_IN_NESTED_NAMESPACE));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, 
FOO_SUB_TYPE_CLASS_IN_NESTED_NAMESPACE));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_sub_class_in_nested_namespace_unref (old);
+       }
+}
+
+static void
+foo_sub_class_in_nested_namespace_class_init (FooSubClassInNestedNamespaceClass * klass,
+                                              gpointer klass_data)
+{
+       foo_sub_class_in_nested_namespace_parent_class = g_type_class_peek_parent (klass);
+       ((FooSubClassInNestedNamespaceClass *) klass)->finalize = foo_sub_class_in_nested_namespace_finalize;
+}
+
+static void
+foo_sub_class_in_nested_namespace_instance_init (FooSubClassInNestedNamespace * self,
+                                                 gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_sub_class_in_nested_namespace_finalize (FooSubClassInNestedNamespace * obj)
+{
+       FooSubClassInNestedNamespace * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, FOO_SUB_TYPE_CLASS_IN_NESTED_NAMESPACE, 
FooSubClassInNestedNamespace);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_sub_class_in_nested_namespace_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { 
foo_sub_value_class_in_nested_namespace_init, foo_sub_value_class_in_nested_namespace_free_value, 
foo_sub_value_class_in_nested_namespace_copy_value, foo_sub_value_class_in_nested_namespace_peek_pointer, 
"p", foo_sub_value_class_in_nested_namespace_collect_value, "p", 
foo_sub_value_class_in_nested_namespace_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooSubClassInNestedNamespaceClass), 
(GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) 
foo_sub_class_in_nested_namespace_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(FooSubClassInNestedNamespace), 0, (GInstanceInitFunc) foo_sub_class_in_nested_namespace_instance_init, 
&g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_sub_class_in_nested_namespace_type_id;
+       foo_sub_class_in_nested_namespace_type_id = g_type_register_fundamental (g_type_fundamental_next (), 
"FooSubClassInNestedNamespace", &g_define_type_info, &g_define_type_fundamental_info, 0);
+       return foo_sub_class_in_nested_namespace_type_id;
+}
+
+GType
+foo_sub_class_in_nested_namespace_get_type (void)
+{
+       static volatile gsize foo_sub_class_in_nested_namespace_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_sub_class_in_nested_namespace_type_id__volatile)) {
+               GType foo_sub_class_in_nested_namespace_type_id;
+               foo_sub_class_in_nested_namespace_type_id = foo_sub_class_in_nested_namespace_get_type_once 
();
+               g_once_init_leave (&foo_sub_class_in_nested_namespace_type_id__volatile, 
foo_sub_class_in_nested_namespace_type_id);
+       }
+       return foo_sub_class_in_nested_namespace_type_id__volatile;
+}
+
+gpointer
+foo_sub_class_in_nested_namespace_ref (gpointer instance)
+{
+       FooSubClassInNestedNamespace * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_sub_class_in_nested_namespace_unref (gpointer instance)
+{
+       FooSubClassInNestedNamespace * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_SUB_CLASS_IN_NESTED_NAMESPACE_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       maman_run ();
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/parser/preprocessor-glib.c-expected b/tests/parser/preprocessor-glib.c-expected
new file mode 100644
index 000000000..9300c6d8d
--- /dev/null
+++ b/tests/parser/preprocessor-glib.c-expected
@@ -0,0 +1,26 @@
+/* parser_preprocessor_glib.c generated by valac, the Vala compiler
+ * generated from parser_preprocessor_glib.vala, do not modify */
+
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+       _vala_assert (TRUE, "true");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/parser/preprocessor-vala.c-expected b/tests/parser/preprocessor-vala.c-expected
new file mode 100644
index 000000000..7de470816
--- /dev/null
+++ b/tests/parser/preprocessor-vala.c-expected
@@ -0,0 +1,26 @@
+/* parser_preprocessor_vala.c generated by valac, the Vala compiler
+ * generated from parser_preprocessor_vala.vala, do not modify */
+
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+       _vala_assert (TRUE, "true");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/parser/preprocessor.c-expected b/tests/parser/preprocessor.c-expected
new file mode 100644
index 000000000..0d9cce314
--- /dev/null
+++ b/tests/parser/preprocessor.c-expected
@@ -0,0 +1,26 @@
+/* parser_preprocessor.c generated by valac, the Vala compiler
+ * generated from parser_preprocessor.vala, do not modify */
+
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+       _vala_assert (TRUE, "true");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/parser/qualified-member-access.c-expected b/tests/parser/qualified-member-access.c-expected
new file mode 100644
index 000000000..c18b53b06
--- /dev/null
+++ b/tests/parser/qualified-member-access.c-expected
@@ -0,0 +1,51 @@
+/* parser_qualified_member_access.c generated by valac, the Vala compiler
+ * generated from parser_qualified_member_access.vala, do not modify */
+
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+VALA_EXTERN void bar_foo (void);
+VALA_EXTERN void bar_bar (void);
+VALA_EXTERN void foo (void);
+static void _vala_main (void);
+
+void
+bar_foo (void)
+{
+       g_assert_not_reached ();
+}
+
+void
+bar_bar (void)
+{
+       foo ();
+}
+
+void
+foo (void)
+{
+}
+
+static void
+_vala_main (void)
+{
+       bar_bar ();
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/parser/qualified-symbol-access.c-expected b/tests/parser/qualified-symbol-access.c-expected
new file mode 100644
index 000000000..65434b71f
--- /dev/null
+++ b/tests/parser/qualified-symbol-access.c-expected
@@ -0,0 +1,565 @@
+/* parser_qualified_symbol_access.c generated by valac, the Vala compiler
+ * generated from parser_qualified_symbol_access.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define BAR_TYPE_FOO (bar_foo_get_type ())
+#define BAR_FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BAR_TYPE_FOO, BarFoo))
+#define BAR_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BAR_TYPE_FOO, BarFooClass))
+#define BAR_IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BAR_TYPE_FOO))
+#define BAR_IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BAR_TYPE_FOO))
+#define BAR_FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BAR_TYPE_FOO, BarFooClass))
+
+typedef struct _BarFoo BarFoo;
+typedef struct _BarFooClass BarFooClass;
+typedef struct _BarFooPrivate BarFooPrivate;
+typedef struct _BarParamSpecFoo BarParamSpecFoo;
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+struct _BarFoo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       BarFooPrivate * priv;
+};
+
+struct _BarFooClass {
+       GTypeClass parent_class;
+       void (*finalize) (BarFoo *self);
+};
+
+struct _BarParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gpointer bar_foo_parent_class = NULL;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer bar_foo_ref (gpointer instance);
+VALA_EXTERN void bar_foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* bar_param_spec_foo (const gchar* name,
+                                const gchar* nick,
+                                const gchar* blurb,
+                                GType object_type,
+                                GParamFlags flags);
+VALA_EXTERN void bar_value_set_foo (GValue* value,
+                        gpointer v_object);
+VALA_EXTERN void bar_value_take_foo (GValue* value,
+                         gpointer v_object);
+VALA_EXTERN gpointer bar_value_get_foo (const GValue* value);
+VALA_EXTERN GType bar_foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (BarFoo, bar_foo_unref)
+VALA_EXTERN BarFoo* bar_foo_new (void);
+VALA_EXTERN BarFoo* bar_foo_construct (GType object_type);
+static void bar_foo_finalize (BarFoo * obj);
+static GType bar_foo_get_type_once (void);
+VALA_EXTERN void bar_bar (void);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+BarFoo*
+bar_foo_construct (GType object_type)
+{
+       BarFoo* self = NULL;
+       self = (BarFoo*) g_type_create_instance (object_type);
+       g_assert_not_reached ();
+       return self;
+}
+
+BarFoo*
+bar_foo_new (void)
+{
+       return bar_foo_construct (BAR_TYPE_FOO);
+}
+
+static void
+bar_value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+bar_value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               bar_foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+bar_value_foo_copy_value (const GValue* src_value,
+                          GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = bar_foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+bar_value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+bar_value_foo_collect_value (GValue* value,
+                             guint n_collect_values,
+                             GTypeCValue* collect_values,
+                             guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               BarFoo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = bar_foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+bar_value_foo_lcopy_value (const GValue* value,
+                           guint n_collect_values,
+                           GTypeCValue* collect_values,
+                           guint collect_flags)
+{
+       BarFoo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = bar_foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+bar_param_spec_foo (const gchar* name,
+                    const gchar* nick,
+                    const gchar* blurb,
+                    GType object_type,
+                    GParamFlags flags)
+{
+       BarParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, BAR_TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+bar_value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, BAR_TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+bar_value_set_foo (GValue* value,
+                   gpointer v_object)
+{
+       BarFoo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, BAR_TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, BAR_TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               bar_foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_foo_unref (old);
+       }
+}
+
+void
+bar_value_take_foo (GValue* value,
+                    gpointer v_object)
+{
+       BarFoo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, BAR_TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, BAR_TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_foo_unref (old);
+       }
+}
+
+static void
+bar_foo_class_init (BarFooClass * klass,
+                    gpointer klass_data)
+{
+       bar_foo_parent_class = g_type_class_peek_parent (klass);
+       ((BarFooClass *) klass)->finalize = bar_foo_finalize;
+}
+
+static void
+bar_foo_instance_init (BarFoo * self,
+                       gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+bar_foo_finalize (BarFoo * obj)
+{
+       BarFoo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, BAR_TYPE_FOO, BarFoo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+bar_foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { bar_value_foo_init, 
bar_value_foo_free_value, bar_value_foo_copy_value, bar_value_foo_peek_pointer, "p", 
bar_value_foo_collect_value, "p", bar_value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (BarFooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(BarFoo), 0, (GInstanceInitFunc) bar_foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType bar_foo_type_id;
+       bar_foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "BarFoo", 
&g_define_type_info, &g_define_type_fundamental_info, 0);
+       return bar_foo_type_id;
+}
+
+GType
+bar_foo_get_type (void)
+{
+       static volatile gsize bar_foo_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_foo_type_id__volatile)) {
+               GType bar_foo_type_id;
+               bar_foo_type_id = bar_foo_get_type_once ();
+               g_once_init_leave (&bar_foo_type_id__volatile, bar_foo_type_id);
+       }
+       return bar_foo_type_id__volatile;
+}
+
+gpointer
+bar_foo_ref (gpointer instance)
+{
+       BarFoo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+bar_foo_unref (gpointer instance)
+{
+       BarFoo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               BAR_FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+void
+bar_bar (void)
+{
+       Foo* _tmp0_;
+       Foo* _tmp1_;
+       _tmp0_ = foo_new ();
+       _tmp1_ = _tmp0_;
+       _foo_unref0 (_tmp1_);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       bar_bar ();
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/parser/statement-keyword-as-identifier.c-expected 
b/tests/parser/statement-keyword-as-identifier.c-expected
new file mode 100644
index 000000000..58860adbb
--- /dev/null
+++ b/tests/parser/statement-keyword-as-identifier.c-expected
@@ -0,0 +1,96 @@
+/* parser_statement_keyword_as_identifier.c generated by valac, the Vala compiler
+ * generated from parser_statement_keyword_as_identifier.vala, do not modify */
+
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+       {
+               gint _if_ = 0;
+               _if_ = 1;
+               _vala_assert (_if_ == 1, "if == 1");
+       }
+       {
+               gint _switch_ = 0;
+               _switch_ = 2;
+               _vala_assert (_switch_ == 2, "switch == 2");
+       }
+       {
+               gint _while_ = 0;
+               _while_ = 3;
+               _vala_assert (_while_ == 3, "while == 3");
+       }
+       {
+               gint _do_ = 0;
+               _do_ = 4;
+               _vala_assert (_do_ == 4, "do == 4");
+       }
+       {
+               gint _for_ = 0;
+               _for_ = 5;
+               _vala_assert (_for_ == 5, "for == 5");
+       }
+       {
+               gint foreach = 0;
+               foreach = 6;
+               _vala_assert (foreach == 6, "foreach == 6");
+       }
+       {
+       }
+       {
+       }
+       {
+               gint _return_ = 0;
+               _return_ = 9;
+               _vala_assert (_return_ == 9, "return == 9");
+       }
+       {
+       }
+       {
+               gint throw = 0;
+               throw = 11;
+               _vala_assert (throw == 11, "throw == 11");
+       }
+       {
+               gint try = 0;
+               try = 12;
+               _vala_assert (try == 12, "try == 12");
+       }
+       {
+               gint lock = 0;
+               lock = 13;
+               _vala_assert (lock == 13, "lock == 13");
+       }
+       {
+               gint unlock = 0;
+               unlock = 14;
+               _vala_assert (unlock == 14, "unlock == 14");
+       }
+       {
+               gint delete = 0;
+               delete = 15;
+               _vala_assert (delete == 15, "delete == 15");
+       }
+       {
+               gint with = 0;
+               with = 16;
+               _vala_assert (with == 16, "with == 16");
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/parser/switch-statement.c-expected b/tests/parser/switch-statement.c-expected
new file mode 100644
index 000000000..b1715aab2
--- /dev/null
+++ b/tests/parser/switch-statement.c-expected
@@ -0,0 +1,51 @@
+/* parser_switch_statement.c generated by valac, the Vala compiler
+ * generated from parser_switch_statement.vala, do not modify */
+
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+VALA_EXTERN void case_with_list (void);
+static void _vala_main (void);
+
+void
+case_with_list (void)
+{
+       gint i = 0;
+       i = 1;
+       switch (i) {
+               case 0:
+               case 1:
+               case 2:
+               {
+                       break;
+               }
+               default:
+               {
+                       g_assert_not_reached ();
+               }
+       }
+}
+
+static void
+_vala_main (void)
+{
+       case_with_list ();
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/parser/template.c-expected b/tests/parser/template.c-expected
new file mode 100644
index 000000000..1f3ff9477
--- /dev/null
+++ b/tests/parser/template.c-expected
@@ -0,0 +1,80 @@
+/* parser_template.c generated by valac, the Vala compiler
+ * generated from parser_template.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN const gchar* m (void);
+static void _vala_main (void);
+
+const gchar*
+m (void)
+{
+       const gchar* result = NULL;
+       result = "foo";
+       return result;
+}
+
+static const gchar*
+string_to_string (const gchar* self)
+{
+       const gchar* result = NULL;
+       g_return_val_if_fail (self != NULL, NULL);
+       result = self;
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       gchar* _result_ = NULL;
+       gchar* _tmp0_;
+       gint i = 0;
+       gchar* _tmp1_;
+       gchar* _tmp2_;
+       const gchar* _tmp3_;
+       const gchar* _tmp4_;
+       gchar* _tmp5_;
+       const gchar* _tmp6_;
+       _tmp0_ = g_strdup ("");
+       _g_free0 (_result_);
+       _result_ = _tmp0_;
+       i = 42;
+       _tmp1_ = g_strdup_printf ("%i", i);
+       _tmp2_ = _tmp1_;
+       _tmp3_ = m ();
+       _tmp4_ = string_to_string (_tmp3_);
+       _tmp5_ = g_strconcat ("i=", _tmp2_, " m=", _tmp4_, " ", "$", NULL);
+       _g_free0 (_result_);
+       _result_ = _tmp5_;
+       _g_free0 (_tmp2_);
+       _tmp6_ = _result_;
+       _vala_assert (g_strcmp0 (_tmp6_, "i=42 m=foo $") == 0, "result == \"i=42 m=foo $\"");
+       _g_free0 (_result_);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/parser/tuple.c-expected b/tests/parser/tuple.c-expected
new file mode 100644
index 000000000..6271f3b19
--- /dev/null
+++ b/tests/parser/tuple.c-expected
@@ -0,0 +1,192 @@
+/* parser_tuple.c generated by valac, the Vala compiler
+ * generated from parser_tuple.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (void);
+static gchar** _vala_array_dup1 (gchar** self,
+                          gssize length);
+static gint* _vala_array_dup2 (gint* self,
+                        gssize length);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+static inline gpointer _vala_memdup2 (gconstpointer mem,
+                        gsize byte_size);
+
+static gchar**
+_vala_array_dup1 (gchar** self,
+                  gssize length)
+{
+       if (length >= 0) {
+               gchar** result;
+               gssize i;
+               result = g_new0 (gchar*, length + 1);
+               for (i = 0; i < length; i++) {
+                       gchar* _tmp0_;
+                       _tmp0_ = g_strdup (self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+static gint*
+_vala_array_dup2 (gint* self,
+                  gssize length)
+{
+       if (length > 0) {
+               return _vala_memdup2 (self, length * sizeof (gint));
+       }
+       return NULL;
+}
+
+static void
+_vala_main (void)
+{
+       gchar** FOO = NULL;
+       gchar* _tmp0_;
+       gchar** _tmp1_;
+       gint FOO_length1;
+       gint _FOO_size_;
+       gint* BAR = NULL;
+       gint* _tmp2_;
+       gint BAR_length1;
+       gint _BAR_size_;
+       const gchar* s = NULL;
+       const gchar* n = NULL;
+       gchar** _tmp3_ = NULL;
+       gchar** _tmp4_;
+       gint _tmp4__length1;
+       gint _tmp3__length1;
+       gint __tmp3__size_;
+       const gchar* _tmp5_;
+       const gchar* _tmp6_;
+       gint i = 0;
+       gint j = 0;
+       gint* _tmp7_ = NULL;
+       gint* _tmp8_;
+       gint _tmp8__length1;
+       gint _tmp7__length1;
+       gint __tmp7__size_;
+       gint _tmp9_;
+       gint _tmp10_;
+       gint* _tmp11_ = NULL;
+       gint* _tmp12_;
+       gint _tmp11__length1;
+       gint __tmp11__size_;
+       gint test = 0;
+       gint _tmp13_;
+       gint test2 = 0;
+       gint _tmp14_;
+       _tmp0_ = g_strdup ("foo");
+       _tmp1_ = g_new0 (gchar*, 2 + 1);
+       _tmp1_[0] = _tmp0_;
+       _tmp1_[1] = NULL;
+       FOO = _tmp1_;
+       FOO_length1 = 2;
+       _FOO_size_ = FOO_length1;
+       _tmp2_ = g_new0 (gint, 2);
+       _tmp2_[0] = 42;
+       _tmp2_[1] = 4711;
+       BAR = _tmp2_;
+       BAR_length1 = 2;
+       _BAR_size_ = BAR_length1;
+       _tmp4_ = (FOO != NULL) ? _vala_array_dup1 (FOO, FOO_length1) : FOO;
+       _tmp4__length1 = FOO_length1;
+       _tmp3_ = _tmp4_;
+       _tmp3__length1 = _tmp4__length1;
+       __tmp3__size_ = _tmp3__length1;
+       _tmp5_ = _tmp3_[0];
+       s = _tmp5_;
+       _tmp6_ = _tmp3_[1];
+       n = _tmp6_;
+       _vala_assert (g_strcmp0 (s, "foo") == 0, "s == \"foo\"");
+       _vala_assert (n == NULL, "n == null");
+       _tmp8_ = (BAR != NULL) ? _vala_array_dup2 (BAR, BAR_length1) : BAR;
+       _tmp8__length1 = BAR_length1;
+       _tmp7_ = _tmp8_;
+       _tmp7__length1 = _tmp8__length1;
+       __tmp7__size_ = _tmp7__length1;
+       _tmp9_ = _tmp7_[0];
+       i = _tmp9_;
+       _tmp10_ = _tmp7_[1];
+       j = _tmp10_;
+       _vala_assert (i == 42, "i == 42");
+       _vala_assert (j == 4711, "j == 4711");
+       _tmp12_ = g_new0 (gint, 2);
+       _tmp12_[0] = 23;
+       _tmp12_[1] = 51;
+       _tmp11_ = _tmp12_;
+       _tmp11__length1 = 2;
+       __tmp11__size_ = _tmp11__length1;
+       _tmp13_ = _tmp11_[0];
+       test = _tmp13_;
+       _tmp14_ = _tmp11_[1];
+       test2 = _tmp14_;
+       _vala_assert (test == 23, "test == 23");
+       _vala_assert (test2 == 51, "test2 == 51");
+       _tmp11_ = (g_free (_tmp11_), NULL);
+       _tmp7_ = (g_free (_tmp7_), NULL);
+       _tmp3_ = (_vala_array_free (_tmp3_, _tmp3__length1, (GDestroyNotify) g_free), NULL);
+       BAR = (g_free (BAR), NULL);
+       FOO = (_vala_array_free (FOO, FOO_length1, (GDestroyNotify) g_free), NULL);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
+static inline gpointer
+_vala_memdup2 (gconstpointer mem,
+               gsize byte_size)
+{
+       gpointer new_mem;
+       if (mem && byte_size != 0) {
+               new_mem = g_malloc (byte_size);
+               memcpy (new_mem, mem, byte_size);
+       } else {
+               new_mem = NULL;
+       }
+       return new_mem;
+}
+
diff --git a/tests/parser/using-directive.c-expected b/tests/parser/using-directive.c-expected
new file mode 100644
index 000000000..1f10b8863
--- /dev/null
+++ b/tests/parser/using-directive.c-expected
@@ -0,0 +1,42 @@
+/* parser_using_directive.c generated by valac, the Vala compiler
+ * generated from parser_using_directive.vala, do not modify */
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+VALA_EXTERN void foo_foo (void);
+VALA_EXTERN void bar_bar (void);
+static void _vala_main (void);
+
+void
+foo_foo (void)
+{
+       bar_bar ();
+}
+
+void
+bar_bar (void)
+{
+}
+
+static void
+_vala_main (void)
+{
+       foo_foo ();
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/parser/var-type-nullable.c-expected b/tests/parser/var-type-nullable.c-expected
new file mode 100644
index 000000000..5f86e3499
--- /dev/null
+++ b/tests/parser/var-type-nullable.c-expected
@@ -0,0 +1,118 @@
+/* parser_var_type_nullable.c generated by valac, the Vala compiler
+ * generated from parser_var_type_nullable.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+
+static void _vala_main (void);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static void
+_vala_main (void)
+{
+       {
+               gchar* foo = NULL;
+               gchar* _tmp0_;
+               _tmp0_ = g_strdup ("foo");
+               foo = _tmp0_;
+               _g_free0 (foo);
+       }
+       {
+               const gchar* foo = NULL;
+               foo = "foo";
+       }
+       {
+               gchar* _tmp1_;
+               gchar* _tmp2_;
+               gchar** _tmp3_;
+               _tmp1_ = g_strdup ("foo");
+               _tmp2_ = g_strdup ("bar");
+               _tmp3_ = g_new0 (gchar*, 2 + 1);
+               _tmp3_[0] = _tmp1_;
+               _tmp3_[1] = _tmp2_;
+               {
+                       gchar** foo_collection = NULL;
+                       gint foo_collection_length1 = 0;
+                       gint _foo_collection_size_ = 0;
+                       gint foo_it = 0;
+                       foo_collection = _tmp3_;
+                       foo_collection_length1 = 2;
+                       for (foo_it = 0; foo_it < foo_collection_length1; foo_it = foo_it + 1) {
+                               gchar* _tmp4_;
+                               gchar* foo = NULL;
+                               _tmp4_ = g_strdup (foo_collection[foo_it]);
+                               foo = _tmp4_;
+                               {
+                                       _g_free0 (foo);
+                               }
+                       }
+                       foo_collection = (_vala_array_free (foo_collection, foo_collection_length1, 
(GDestroyNotify) g_free), NULL);
+               }
+       }
+       {
+               gchar* _tmp5_;
+               gchar* _tmp6_;
+               gchar** _tmp7_;
+               _tmp5_ = g_strdup ("foo");
+               _tmp6_ = g_strdup ("bar");
+               _tmp7_ = g_new0 (gchar*, 2 + 1);
+               _tmp7_[0] = _tmp5_;
+               _tmp7_[1] = _tmp6_;
+               {
+                       gchar** foo_collection = NULL;
+                       gint foo_collection_length1 = 0;
+                       gint _foo_collection_size_ = 0;
+                       gint foo_it = 0;
+                       foo_collection = _tmp7_;
+                       foo_collection_length1 = 2;
+                       for (foo_it = 0; foo_it < foo_collection_length1; foo_it = foo_it + 1) {
+                               const gchar* foo = NULL;
+                               foo = foo_collection[foo_it];
+                               {
+                               }
+                       }
+                       foo_collection = (_vala_array_free (foo_collection, foo_collection_length1, 
(GDestroyNotify) g_free), NULL);
+               }
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/parser/with-embedded.c-expected b/tests/parser/with-embedded.c-expected
new file mode 100644
index 000000000..3b8e82ead
--- /dev/null
+++ b/tests/parser/with-embedded.c-expected
@@ -0,0 +1,56 @@
+/* parser_with_embedded.c generated by valac, the Vala compiler
+ * generated from parser_with_embedded.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (void);
+
+static const gchar*
+string_to_string (const gchar* self)
+{
+       const gchar* result = NULL;
+       g_return_val_if_fail (self != NULL, NULL);
+       result = self;
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       if (TRUE) {
+               {
+                       const gchar* _tmp0_ = NULL;
+                       const gchar* _tmp1_;
+                       _tmp0_ = "foo";
+                       _tmp1_ = string_to_string (_tmp0_);
+                       _vala_assert (g_strcmp0 (_tmp1_, "foo") == 0, "to_string () == \"foo\"");
+               }
+       }
+       {
+               gint _tmp2_ = 0;
+               gchar* _tmp3_;
+               gchar* _tmp4_;
+               _tmp2_ = 10;
+               _tmp3_ = g_strdup_printf ("%i", _tmp2_);
+               _tmp4_ = _tmp3_;
+               _vala_assert (g_strcmp0 (_tmp4_, "10") == 0, "to_string () == \"10\"");
+               _g_free0 (_tmp4_);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/parser/with-empty.c-expected b/tests/parser/with-empty.c-expected
new file mode 100644
index 000000000..63149d164
--- /dev/null
+++ b/tests/parser/with-empty.c-expected
@@ -0,0 +1,24 @@
+/* parser_with_empty.c generated by valac, the Vala compiler
+ * generated from parser_with_empty.vala, do not modify */
+
+#include <glib.h>
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+       {
+               gint _tmp0_ = 0;
+               _tmp0_ = 10;
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/pointers/bug590641.c-expected b/tests/pointers/bug590641.c-expected
new file mode 100644
index 000000000..ec0d96a3c
--- /dev/null
+++ b/tests/pointers/bug590641.c-expected
@@ -0,0 +1,79 @@
+/* pointers_bug590641.c generated by valac, the Vala compiler
+ * generated from pointers_bug590641.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN void foo (gchar** s);
+static void _vala_main (void);
+
+const gchar* FOO[2] = {"foo", "bar"};
+
+void
+foo (gchar** s)
+{
+       const gchar* _tmp0_;
+       _tmp0_ = ((gchar**) s)[0];
+       _vala_assert (g_strcmp0 (_tmp0_, "foo") == 0, "((string[]) s)[0] == \"foo\"");
+}
+
+static void
+_vala_main (void)
+{
+       guint i = 0U;
+       gint* p0 = NULL;
+       guint u0 = 0U;
+       gint* p1 = NULL;
+       guint u1 = 0U;
+       gchar** p2 = NULL;
+       gchar* s0 = NULL;
+       gchar* _tmp0_;
+       gchar* _tmp1_;
+       gchar* s1 = NULL;
+       gchar* _tmp2_;
+       i = (guint) 42;
+       p0 = (gint*) (&i);
+       u0 = (guint) (*p0);
+       _vala_assert (u0 == i, "u0 == i");
+       p1 = (gint*) (&i);
+       u1 = (guint) (*p1);
+       _vala_assert (u1 == i, "u1 == i");
+       p2 = (gchar**) FOO;
+       foo ((gchar**) FOO);
+       foo (p2);
+       _tmp0_ = p2[0];
+       _tmp1_ = g_strdup ((const gchar*) _tmp0_);
+       s0 = _tmp1_;
+       _vala_assert (g_strcmp0 (s0, "foo") == 0, "s0 == \"foo\"");
+       _tmp2_ = g_strdup ((const gchar*) (*(p2 + 1)));
+       s1 = _tmp2_;
+       _vala_assert (g_strcmp0 (s1, "bar") == 0, "s1 == \"bar\"");
+       _g_free0 (s1);
+       _g_free0 (s0);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/pointers/delete.c-expected b/tests/pointers/delete.c-expected
new file mode 100644
index 000000000..c08e52758
--- /dev/null
+++ b/tests/pointers/delete.c-expected
@@ -0,0 +1,390 @@
+/* pointers_delete.c generated by valac, the Vala compiler
+ * generated from pointers_delete.vala, do not modify */
+
+#include <glib-object.h>
+#include <gobject/gvaluecollector.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _g_string_free0(var) ((var == NULL) ? NULL : (var = (g_string_free (var, TRUE), NULL)))
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+struct _Bar {
+       Foo parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       FooClass parent_class;
+};
+
+static gpointer foo_parent_class = NULL;
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, foo_unref)
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static GType bar_get_type_once (void);
+static void _vala_main (void);
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar* self = NULL;
+       self = (Bar*) foo_construct (object_type);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (TYPE_FOO, "Bar", &g_define_type_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       {
+               Foo* foo = NULL;
+               Foo* _tmp0_;
+               _tmp0_ = foo_new ();
+               foo = _tmp0_;
+               _foo_unref0 (foo);
+       }
+       {
+               Bar* bar = NULL;
+               Bar* _tmp1_;
+               _tmp1_ = bar_new ();
+               bar = _tmp1_;
+               _foo_unref0 (bar);
+       }
+       {
+               GString* foo = NULL;
+               GString* _tmp2_;
+               _tmp2_ = g_string_new ("");
+               foo = _tmp2_;
+               g_string_append (foo, "foo");
+               _g_string_free0 (foo);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/posix/arrays.c-expected b/tests/posix/arrays.c-expected
new file mode 100644
index 000000000..c4ed3586d
--- /dev/null
+++ b/tests/posix/arrays.c-expected
@@ -0,0 +1,1663 @@
+/* posix_arrays.c generated by valac, the Vala compiler
+ * generated from posix_arrays.vala, do not modify */
+
+#include <stdlib.h>
+#include <assert.h>
+#include <stddef.h>
+#include <sys/types.h>
+#include <string.h>
+#include <stdbool.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _free0(var) ((var == NULL) ? NULL : (var = (free (var), NULL)))
+typedef void (*ValaDestroyNotify) (void* data);
+typedef int (*SimpleFunc) (void);
+typedef struct _Foo Foo;
+typedef struct _Bar Bar;
+typedef struct _Manam Manam;
+#define _manam_free0(var) ((var == NULL) ? NULL : (var = (manam_free (var), NULL)))
+#define VALA_N_ELEMENTS(arr) (sizeof (arr) / sizeof ((arr)[0]))
+
+struct _Foo {
+       const char* array[2];
+       int bar;
+};
+
+struct _Bar {
+       int bar;
+};
+
+struct _Manam {
+       Bar array[1024];
+       Bar manam;
+};
+
+VALA_EXTERN int* foo;
+int* foo = NULL;
+VALA_EXTERN int* bar;
+int* bar = NULL;
+VALA_EXTERN SimpleFunc* simple_delegates;
+VALA_EXTERN int simple_delegates_length1;
+SimpleFunc* simple_delegates = NULL;
+int simple_delegates_length1 = 0;
+static int _simple_delegates_size_ = 0;
+
+VALA_EXTERN void test_integer_array (void);
+static int* _vala_array_dup1 (int* self,
+                       ssize_t length);
+static void _vala_array_add1 (int* * array,
+                       int* length,
+                       int* size,
+                       int value);
+static int* _vala_array_dup2 (int* self,
+                       ssize_t length);
+static int* _vala_array_dup3 (int* self,
+                       ssize_t length);
+static int* _vala_array_dup4 (int* self,
+                       ssize_t length);
+static int* _vala_array_dup5 (int* self,
+                       ssize_t length);
+static int* _vala_array_dup6 (int* self,
+                       ssize_t length);
+static bool _vala_int_array_contains (int * stack,
+                               ssize_t stack_length,
+                               const int needle);
+static int* _int_dup (int* self);
+static bool _int_equal (const int * s1,
+                 const int * s2);
+VALA_EXTERN void test_string_array (void);
+static char** _vala_array_dup7 (char** self,
+                         ssize_t length);
+VALA_EXTERN int* pass_helper (int* a,
+                  int a_length1,
+                  int** b,
+                  int* b_length1,
+                  int* result_length1);
+static int* _vala_array_dup8 (int* self,
+                       ssize_t length);
+VALA_EXTERN void test_array_pass (void);
+#define FOO 2
+VALA_EXTERN void test_static_array (void);
+VALA_EXTERN void test_reference_transfer (void);
+VALA_EXTERN void test_length_assignment (void);
+VALA_EXTERN void test_inline_array (void);
+VALA_EXTERN int* nd_array_pass (int* a,
+                    int a_length1,
+                    int a_length2,
+                    int a_length3,
+                    int** b,
+                    int* b_length1,
+                    int* b_length2,
+                    int* b_length3,
+                    int* result_length1,
+                    int* result_length2,
+                    int* result_length3);
+static int* _vala_array_dup9 (int* self,
+                       ssize_t length);
+static int* _vala_array_dup10 (int* self,
+                        ssize_t length);
+VALA_EXTERN void test_nd_array (void);
+VALA_EXTERN int simple_func (void);
+VALA_EXTERN void test_delegate_array (void);
+static void _vala_array_add2 (SimpleFunc* * array,
+                       int* length,
+                       int* size,
+                       SimpleFunc value);
+static bool _vala_simple_func_array_contains (SimpleFunc * stack,
+                                       ssize_t stack_length,
+                                       const SimpleFunc needle);
+VALA_EXTERN void test_void_array (void);
+static void _vala_array_add3 (void** * array,
+                       int* length,
+                       int* size,
+                       void* value);
+static void _vala_array_add4 (void** * array,
+                       int* length,
+                       int* size,
+                       void* value);
+static bool _vala_valavoid_array_contains (void* * stack,
+                                    ssize_t stack_length,
+                                    const void* needle);
+VALA_EXTERN void test_explicit_copying (void);
+static int* _vala_array_dup11 (int* self,
+                        ssize_t length);
+VALA_EXTERN void test_array_move (void);
+VALA_EXTERN void test_array_resize (void);
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN Bar* bar_dup (const Bar* self);
+VALA_EXTERN void bar_free (Bar* self);
+VALA_EXTERN Manam* manam_dup (const Manam* self);
+VALA_EXTERN void manam_free (Manam* self);
+VALA_EXTERN void test_struct_array (void);
+static bool _bar_equal (const Bar * s1,
+                 const Bar * s2);
+static bool _vala_bar_array_contains (Bar * stack,
+                               ssize_t stack_length,
+                               const Bar * needle);
+VALA_EXTERN void give_fixed_array (int** i);
+VALA_EXTERN void take_fixed_array (int* i);
+VALA_EXTERN void change_fixed_array (int** i);
+VALA_EXTERN void test_fixed_array (void);
+static void _vala_main (void);
+static void _vala_array_destroy (void* array,
+                          ssize_t array_length,
+                          ValaDestroyNotify destroy_func);
+static void _vala_array_free (void* array,
+                       ssize_t array_length,
+                       ValaDestroyNotify destroy_func);
+static void _vala_array_move (void* array,
+                       size_t element_size,
+                       ssize_t src,
+                       ssize_t dest,
+                       ssize_t length);
+static ssize_t _vala_array_length (void* array);
+
+const Foo FOO_ARRAY_CONST[1] = {{{"foo", "bar"}, 42}};
+
+static int*
+_vala_array_dup1 (int* self,
+                  ssize_t length)
+{
+       if (length > 0) {
+               int* result;
+               result = calloc (length, sizeof (int));
+               memcpy (result, self, length * sizeof (int));
+               return result;
+       }
+       return NULL;
+}
+
+static void
+_vala_array_add1 (int* * array,
+                  int* length,
+                  int* size,
+                  int value)
+{
+       if ((*length) == (*size)) {
+               *size = (*size) ? (2 * (*size)) : 4;
+               *array = realloc (*array, (*size) * sizeof (int));
+       }
+       (*array)[(*length)++] = value;
+}
+
+static int*
+_vala_array_dup2 (int* self,
+                  ssize_t length)
+{
+       if (length > 0) {
+               int* result;
+               result = calloc (length, sizeof (int));
+               memcpy (result, self, length * sizeof (int));
+               return result;
+       }
+       return NULL;
+}
+
+static int*
+_vala_array_dup3 (int* self,
+                  ssize_t length)
+{
+       if (length > 0) {
+               int* result;
+               result = calloc (length, sizeof (int));
+               memcpy (result, self, length * sizeof (int));
+               return result;
+       }
+       return NULL;
+}
+
+static int*
+_vala_array_dup4 (int* self,
+                  ssize_t length)
+{
+       if (length > 0) {
+               int* result;
+               result = calloc (length, sizeof (int));
+               memcpy (result, self, length * sizeof (int));
+               return result;
+       }
+       return NULL;
+}
+
+static int*
+_vala_array_dup5 (int* self,
+                  ssize_t length)
+{
+       if (length > 0) {
+               int* result;
+               result = calloc (length, sizeof (int));
+               memcpy (result, self, length * sizeof (int));
+               return result;
+       }
+       return NULL;
+}
+
+static int*
+_vala_array_dup6 (int* self,
+                  ssize_t length)
+{
+       if (length > 0) {
+               int* result;
+               result = calloc (length, sizeof (int));
+               memcpy (result, self, length * sizeof (int));
+               return result;
+       }
+       return NULL;
+}
+
+static bool
+_vala_int_array_contains (int * stack,
+                          ssize_t stack_length,
+                          const int needle)
+{
+       ssize_t i;
+       for (i = 0; i < stack_length; i++) {
+               if (needle == stack[i]) {
+                       return true;
+               }
+       }
+       return false;
+}
+
+static int*
+_int_dup (int* self)
+{
+       int* dup;
+       dup = calloc (1, sizeof (int));
+       memcpy (dup, self, sizeof (int));
+       return dup;
+}
+
+static void*
+__int_dup0 (void* self)
+{
+       return self ? _int_dup (self) : NULL;
+}
+
+static bool
+_int_equal (const int * s1,
+            const int * s2)
+{
+       if (s1 == s2) {
+               return true;
+       }
+       if (s1 == NULL) {
+               return false;
+       }
+       if (s2 == NULL) {
+               return false;
+       }
+       return (*s1) == (*s2);
+}
+
+void
+test_integer_array (void)
+{
+       int* a = NULL;
+       int* _tmp0_;
+       int a_length1;
+       int _a_size_;
+       int* _tmp1_;
+       int _tmp1__length1;
+       int* _tmp2_;
+       int _tmp2__length1;
+       int _tmp3_;
+       int* _tmp4_;
+       int* _tmp5_;
+       int _tmp5__length1;
+       int* _tmp6_;
+       int _tmp6__length1;
+       int _tmp7_;
+       int* _tmp8_;
+       int _tmp8__length1;
+       int _tmp9_;
+       int* b = NULL;
+       int* _tmp10_;
+       int _tmp10__length1;
+       int* _tmp11_;
+       int _tmp11__length1;
+       int b_length1;
+       int _b_size_;
+       int _tmp12_;
+       int _tmp13_;
+       int* _tmp14_;
+       int _tmp14__length1;
+       int* _tmp15_;
+       int _tmp15__length1;
+       int _tmp16_;
+       int* _tmp17_;
+       int _tmp17__length1;
+       int _tmp18_;
+       int* _tmp19_;
+       int _tmp19__length1;
+       int _tmp20_;
+       int _tmp21_;
+       int _tmp22_;
+       int* c = NULL;
+       int* _tmp23_;
+       int _tmp23__length1;
+       int* _tmp24_;
+       int _tmp24__length1;
+       int c_length1;
+       int _c_size_;
+       int _tmp25_;
+       int _tmp26_;
+       int* c0 = NULL;
+       int* _tmp27_;
+       int _tmp27__length1;
+       int* _tmp28_;
+       int _tmp28__length1;
+       int c0_length1;
+       int _c0_size_;
+       int* c1 = NULL;
+       int* _tmp29_;
+       int _tmp29__length1;
+       int* _tmp30_;
+       int _tmp30__length1;
+       int* _tmp31_;
+       int _tmp31__length1;
+       int c1_length1;
+       int _c1_size_;
+       int _tmp32_;
+       int _tmp33_;
+       int* c2 = NULL;
+       int* _tmp34_;
+       int _tmp34__length1;
+       int* _tmp35_;
+       int _tmp35__length1;
+       int c2_length1;
+       int _c2_size_;
+       int _tmp36_;
+       int _tmp37_;
+       int* c3 = NULL;
+       int* _tmp38_;
+       int _tmp38__length1;
+       int* _tmp39_;
+       int _tmp39__length1;
+       int* _tmp40_;
+       int _tmp40__length1;
+       int c3_length1;
+       int _c3_size_;
+       int _tmp41_;
+       int _tmp42_;
+       int _tmp43_;
+       int* _tmp44_;
+       int _tmp44__length1;
+       int* _tmp45_;
+       int _tmp45__length1;
+       int** d = NULL;
+       int** _tmp46_;
+       int d_length1;
+       int _d_size_;
+       int _tmp47_;
+       int* _tmp48_;
+       int* _tmp49_;
+       int _tmp50_;
+       int* _tmp51_;
+       int* e = NULL;
+       int* _tmp52_;
+       int e_length1;
+       int _e_size_;
+       int _tmp53_;
+       int _tmp54_;
+       int _tmp55_;
+       int _tmp56_;
+       int _tmp57_;
+       _tmp0_ = calloc (1, sizeof (int));
+       _tmp0_[0] = 42;
+       a = _tmp0_;
+       a_length1 = 1;
+       _a_size_ = a_length1;
+       _tmp1_ = a;
+       _tmp1__length1 = a_length1;
+       assert (_tmp1__length1 == 1);
+       _tmp2_ = a;
+       _tmp2__length1 = a_length1;
+       _tmp3_ = _tmp2_[0];
+       assert (_tmp3_ == 42);
+       _tmp4_ = calloc (2, sizeof (int));
+       _tmp4_[0] = 42;
+       _tmp4_[1] = 23;
+       a = (free (a), NULL);
+       a = _tmp4_;
+       a_length1 = 2;
+       _a_size_ = a_length1;
+       _tmp5_ = a;
+       _tmp5__length1 = a_length1;
+       assert (_tmp5__length1 == 2);
+       _tmp6_ = a;
+       _tmp6__length1 = a_length1;
+       _tmp7_ = _tmp6_[0];
+       assert (_tmp7_ == 42);
+       _tmp8_ = a;
+       _tmp8__length1 = a_length1;
+       _tmp9_ = _tmp8_[1];
+       assert (_tmp9_ == 23);
+       _tmp10_ = a;
+       _tmp10__length1 = a_length1;
+       _tmp11_ = (_tmp10_ != NULL) ? _vala_array_dup1 (_tmp10_, _tmp10__length1) : _tmp10_;
+       _tmp11__length1 = _tmp10__length1;
+       b = _tmp11_;
+       b_length1 = _tmp11__length1;
+       _b_size_ = b_length1;
+       assert (b_length1 == 2);
+       _tmp12_ = b[0];
+       assert (_tmp12_ == 42);
+       _tmp13_ = b[1];
+       assert (_tmp13_ == 23);
+       _vala_array_add1 (&a, &a_length1, &_a_size_, 11);
+       _tmp14_ = a;
+       _tmp14__length1 = a_length1;
+       assert (_tmp14__length1 == 3);
+       _tmp15_ = a;
+       _tmp15__length1 = a_length1;
+       _tmp16_ = _tmp15_[0];
+       assert (_tmp16_ == 42);
+       _tmp17_ = a;
+       _tmp17__length1 = a_length1;
+       _tmp18_ = _tmp17_[1];
+       assert (_tmp18_ == 23);
+       _tmp19_ = a;
+       _tmp19__length1 = a_length1;
+       _tmp20_ = _tmp19_[2];
+       assert (_tmp20_ == 11);
+       assert (b_length1 == 2);
+       _tmp21_ = b[0];
+       assert (_tmp21_ == 42);
+       _tmp22_ = b[1];
+       assert (_tmp22_ == 23);
+       _tmp23_ = a;
+       _tmp23__length1 = a_length1;
+       _tmp24_ = ((_tmp23_ + 1) != NULL) ? _vala_array_dup2 (_tmp23_ + 1, 3 - 1) : (_tmp23_ + 1);
+       _tmp24__length1 = 3 - 1;
+       c = _tmp24_;
+       c_length1 = _tmp24__length1;
+       _c_size_ = c_length1;
+       assert (c_length1 == 2);
+       _tmp25_ = c[0];
+       assert (_tmp25_ == 23);
+       _tmp26_ = c[1];
+       assert (_tmp26_ == 11);
+       _tmp27_ = a;
+       _tmp27__length1 = a_length1;
+       _tmp28_ = ((_tmp27_ + 0) != NULL) ? _vala_array_dup3 (_tmp27_ + 0, 0 - 0) : (_tmp27_ + 0);
+       _tmp28__length1 = 0 - 0;
+       c0 = _tmp28_;
+       c0_length1 = _tmp28__length1;
+       _c0_size_ = c0_length1;
+       assert (c0 == NULL);
+       assert (c0_length1 == 0);
+       _tmp29_ = a;
+       _tmp29__length1 = a_length1;
+       _tmp30_ = a;
+       _tmp30__length1 = a_length1;
+       _tmp31_ = ((_tmp30_ + 1) != NULL) ? _vala_array_dup4 (_tmp30_ + 1, _tmp30__length1 - 1) : (_tmp30_ + 
1);
+       _tmp31__length1 = _tmp30__length1 - 1;
+       c1 = _tmp31_;
+       c1_length1 = _tmp31__length1;
+       _c1_size_ = c1_length1;
+       assert (c1_length1 == 2);
+       _tmp32_ = c1[0];
+       assert (_tmp32_ == 23);
+       _tmp33_ = c1[1];
+       assert (_tmp33_ == 11);
+       _tmp34_ = a;
+       _tmp34__length1 = a_length1;
+       _tmp35_ = ((_tmp34_ + 0) != NULL) ? _vala_array_dup5 (_tmp34_ + 0, 2 - 0) : (_tmp34_ + 0);
+       _tmp35__length1 = 2 - 0;
+       c2 = _tmp35_;
+       c2_length1 = _tmp35__length1;
+       _c2_size_ = c2_length1;
+       assert (c2_length1 == 2);
+       _tmp36_ = c2[0];
+       assert (_tmp36_ == 42);
+       _tmp37_ = c2[1];
+       assert (_tmp37_ == 23);
+       _tmp38_ = a;
+       _tmp38__length1 = a_length1;
+       _tmp39_ = a;
+       _tmp39__length1 = a_length1;
+       _tmp40_ = ((_tmp39_ + 0) != NULL) ? _vala_array_dup6 (_tmp39_ + 0, _tmp39__length1 - 0) : (_tmp39_ + 
0);
+       _tmp40__length1 = _tmp39__length1 - 0;
+       c3 = _tmp40_;
+       c3_length1 = _tmp40__length1;
+       _c3_size_ = c3_length1;
+       assert (c3_length1 == 3);
+       _tmp41_ = c3[0];
+       assert (_tmp41_ == 42);
+       _tmp42_ = c3[1];
+       assert (_tmp42_ == 23);
+       _tmp43_ = c3[2];
+       assert (_tmp43_ == 11);
+       _tmp44_ = a;
+       _tmp44__length1 = a_length1;
+       assert (_vala_int_array_contains (_tmp44_, _tmp44__length1, 23));
+       _tmp45_ = a;
+       _tmp45__length1 = a_length1;
+       assert (!_vala_int_array_contains (_tmp45_, _tmp45__length1, -1));
+       _tmp46_ = calloc (2, sizeof (int*));
+       d = _tmp46_;
+       d_length1 = 2;
+       _d_size_ = d_length1;
+       _tmp47_ = 10;
+       _tmp48_ = __int_dup0 (&_tmp47_);
+       _free0 (d[0]);
+       d[0] = _tmp48_;
+       _free0 (d[1]);
+       d[1] = NULL;
+       _tmp49_ = d[0];
+       _tmp50_ = 10;
+       assert (_int_equal (_tmp49_, &_tmp50_) == true);
+       _tmp51_ = d[1];
+       assert (_tmp51_ == NULL);
+       _tmp52_ = calloc (2, sizeof (int));
+       _tmp52_[0] = 13;
+       _tmp52_[1] = 47;
+       e = _tmp52_;
+       e_length1 = 2;
+       _e_size_ = e_length1;
+       e[0] = 96;
+       _tmp53_ = e[0];
+       assert (_tmp53_ == 96);
+       e[0] /= 24;
+       _tmp54_ = e[0];
+       assert (_tmp54_ == 4);
+       e[0] += 2;
+       _tmp55_ = e[0];
+       assert (_tmp55_ == 6);
+       e[0] *= 4;
+       _tmp56_ = e[0];
+       assert (_tmp56_ == 24);
+       e[0] -= 23;
+       _tmp57_ = e[0];
+       assert (_tmp57_ == 1);
+       e = (free (e), NULL);
+       d = (_vala_array_free (d, d_length1, (ValaDestroyNotify) free), NULL);
+       c3 = (free (c3), NULL);
+       c2 = (free (c2), NULL);
+       c1 = (free (c1), NULL);
+       c0 = (free (c0), NULL);
+       c = (free (c), NULL);
+       b = (free (b), NULL);
+       a = (free (a), NULL);
+}
+
+static void*
+_strdup0 (void* self)
+{
+       return self ? strdup (self) : NULL;
+}
+
+static int
+_strcmp0 (const void * s1,
+          const void * s2)
+{
+       if (!s1) {
+               return -(s1 != s2);
+       }
+       if (!s2) {
+               return s1 != s2;
+       }
+       return strcmp (s1, s2);
+}
+
+static char**
+_vala_array_dup7 (char** self,
+                  ssize_t length)
+{
+       if (length >= 0) {
+               char** result;
+               ssize_t i;
+               result = calloc (length + 1, sizeof (char*));
+               for (i = 0; i < length; i++) {
+                       char* _tmp0_;
+                       _tmp0_ = _strdup0 (self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+void
+test_string_array (void)
+{
+       char** a = NULL;
+       char* _tmp0_;
+       char** _tmp1_;
+       int a_length1;
+       int _a_size_;
+       char** _tmp2_;
+       int _tmp2__length1;
+       char** _tmp3_;
+       int _tmp3__length1;
+       const char* _tmp4_;
+       char* _tmp5_;
+       char* _tmp6_;
+       char** _tmp7_;
+       char** _tmp8_;
+       int _tmp8__length1;
+       char** _tmp9_;
+       int _tmp9__length1;
+       const char* _tmp10_;
+       char** _tmp11_;
+       int _tmp11__length1;
+       const char* _tmp12_;
+       char** b = NULL;
+       char** _tmp13_;
+       int _tmp13__length1;
+       char** _tmp14_;
+       int _tmp14__length1;
+       int b_length1;
+       int _b_size_;
+       const char* _tmp15_;
+       const char* _tmp16_;
+       _tmp0_ = _strdup0 ("hello");
+       _tmp1_ = calloc (1 + 1, sizeof (char*));
+       _tmp1_[0] = _tmp0_;
+       a = _tmp1_;
+       a_length1 = 1;
+       _a_size_ = a_length1;
+       _tmp2_ = a;
+       _tmp2__length1 = a_length1;
+       assert (_tmp2__length1 == 1);
+       _tmp3_ = a;
+       _tmp3__length1 = a_length1;
+       _tmp4_ = _tmp3_[0];
+       assert (_strcmp0 (_tmp4_, "hello") == 0);
+       _tmp5_ = _strdup0 ("hello");
+       _tmp6_ = _strdup0 ("world");
+       _tmp7_ = calloc (2 + 1, sizeof (char*));
+       _tmp7_[0] = _tmp5_;
+       _tmp7_[1] = _tmp6_;
+       a = (_vala_array_free (a, a_length1, (ValaDestroyNotify) free), NULL);
+       a = _tmp7_;
+       a_length1 = 2;
+       _a_size_ = a_length1;
+       _tmp8_ = a;
+       _tmp8__length1 = a_length1;
+       assert (_tmp8__length1 == 2);
+       _tmp9_ = a;
+       _tmp9__length1 = a_length1;
+       _tmp10_ = _tmp9_[0];
+       assert (_strcmp0 (_tmp10_, "hello") == 0);
+       _tmp11_ = a;
+       _tmp11__length1 = a_length1;
+       _tmp12_ = _tmp11_[1];
+       assert (_strcmp0 (_tmp12_, "world") == 0);
+       _tmp13_ = a;
+       _tmp13__length1 = a_length1;
+       _tmp14_ = (_tmp13_ != NULL) ? _vala_array_dup7 (_tmp13_, _tmp13__length1) : _tmp13_;
+       _tmp14__length1 = _tmp13__length1;
+       b = _tmp14_;
+       b_length1 = _tmp14__length1;
+       _b_size_ = b_length1;
+       assert (b_length1 == 2);
+       _tmp15_ = b[0];
+       assert (_strcmp0 (_tmp15_, "hello") == 0);
+       _tmp16_ = b[1];
+       assert (_strcmp0 (_tmp16_, "world") == 0);
+       b = (_vala_array_free (b, b_length1, (ValaDestroyNotify) free), NULL);
+       a = (_vala_array_free (a, a_length1, (ValaDestroyNotify) free), NULL);
+}
+
+static int*
+_vala_array_dup8 (int* self,
+                  ssize_t length)
+{
+       if (length > 0) {
+               int* result;
+               result = calloc (length, sizeof (int));
+               memcpy (result, self, length * sizeof (int));
+               return result;
+       }
+       return NULL;
+}
+
+int*
+pass_helper (int* a,
+             int a_length1,
+             int** b,
+             int* b_length1,
+             int* result_length1)
+{
+       int* _vala_b = NULL;
+       int _vala_b_length1 = 0;
+       int* _tmp0_;
+       int _tmp0__length1;
+       int* _tmp1_;
+       int* _tmp2_;
+       int _tmp2__length1;
+       int* result = NULL;
+       _tmp0_ = (a != NULL) ? _vala_array_dup8 (a, a_length1) : a;
+       _tmp0__length1 = a_length1;
+       _vala_b = (free (_vala_b), NULL);
+       _vala_b = _tmp0_;
+       _vala_b_length1 = _tmp0__length1;
+       _tmp1_ = calloc (2, sizeof (int));
+       _tmp1_[0] = 42;
+       _tmp1_[1] = 23;
+       _tmp2_ = _tmp1_;
+       _tmp2__length1 = 2;
+       if (result_length1) {
+               *result_length1 = _tmp2__length1;
+       }
+       result = _tmp2_;
+       if (b) {
+               *b = _vala_b;
+       } else {
+               _vala_b = (free (_vala_b), NULL);
+       }
+       if (b_length1) {
+               *b_length1 = _vala_b_length1;
+       }
+       return result;
+}
+
+void
+test_array_pass (void)
+{
+       int* a = NULL;
+       int a_length1 = 0;
+       int _a_size_ = 0;
+       int* b = NULL;
+       int b_length1 = 0;
+       int _b_size_ = 0;
+       int* _tmp0_;
+       int* _tmp1_;
+       int _tmp1__length1;
+       int* _tmp2_ = NULL;
+       int _tmp3_ = 0;
+       int _tmp4_ = 0;
+       int* _tmp5_;
+       int _tmp6_;
+       int _tmp7_;
+       int _tmp8_;
+       _tmp0_ = calloc (1, sizeof (int));
+       _tmp0_[0] = 42;
+       _tmp1_ = _tmp0_;
+       _tmp1__length1 = 1;
+       _tmp5_ = pass_helper (_tmp1_, (int) 1, &_tmp2_, &_tmp3_, &_tmp4_);
+       b = (free (b), NULL);
+       b = _tmp2_;
+       b_length1 = _tmp3_;
+       _b_size_ = b_length1;
+       a = (free (a), NULL);
+       a = _tmp5_;
+       a_length1 = _tmp4_;
+       _a_size_ = a_length1;
+       _tmp1_ = (free (_tmp1_), NULL);
+       assert (a_length1 == 2);
+       _tmp6_ = a[0];
+       assert (_tmp6_ == 42);
+       _tmp7_ = a[1];
+       assert (_tmp7_ == 23);
+       assert (b_length1 == 1);
+       _tmp8_ = b[0];
+       assert (_tmp8_ == 42);
+       b = (free (b), NULL);
+       a = (free (a), NULL);
+}
+
+void
+test_static_array (void)
+{
+       int a[2] = {0};
+       int _tmp0_;
+       int _tmp1_[2] = {0};
+       bool _tmp2_ = false;
+       int _tmp3_;
+       int b[(FOO * 1) << 3];
+       assert (2 == 2);
+       a[1] = 23;
+       _tmp0_ = a[1];
+       assert (_tmp0_ == 23);
+       _tmp1_[0] = 23;
+       _tmp1_[1] = 34;
+       memcpy (a, _tmp1_, 2 * sizeof (int));
+       _tmp3_ = a[0];
+       if (_tmp3_ == 23) {
+               int _tmp4_;
+               _tmp4_ = a[1];
+               _tmp2_ = _tmp4_ == 34;
+       } else {
+               _tmp2_ = false;
+       }
+       assert (_tmp2_);
+       memset (b, 0, ((FOO * 1) << 3) * sizeof (int));
+       assert (((FOO * 1) << 3) == ((FOO * 1) << 3));
+}
+
+void
+test_reference_transfer (void)
+{
+       int* baz = NULL;
+       int* _tmp0_;
+       int _tmp0__length1;
+       int baz_length1;
+       int _baz_size_;
+       int* _tmp1_;
+       int _tmp1__length1;
+       char** data = NULL;
+       char* _tmp2_;
+       char** _tmp3_;
+       int data_length1;
+       int _data_size_;
+       char** data2 = NULL;
+       char** _tmp4_;
+       int _tmp4__length1;
+       int data2_length1;
+       int _data2_size_;
+       char** _tmp5_;
+       int _tmp5__length1;
+       _tmp0_ = foo;
+       _tmp0__length1 = _vala_array_length (foo);
+       foo = NULL;
+       baz = _tmp0_;
+       baz_length1 = _tmp0__length1;
+       _baz_size_ = baz_length1;
+       _tmp1_ = bar;
+       _tmp1__length1 = -1;
+       bar = NULL;
+       baz = (free (baz), NULL);
+       baz = _tmp1_;
+       baz_length1 = _tmp1__length1;
+       _baz_size_ = baz_length1;
+       _tmp2_ = _strdup0 ("foo");
+       _tmp3_ = calloc (1 + 1, sizeof (char*));
+       _tmp3_[0] = _tmp2_;
+       data = _tmp3_;
+       data_length1 = 1;
+       _data_size_ = data_length1;
+       _tmp4_ = data;
+       _tmp4__length1 = data_length1;
+       data = NULL;
+       data_length1 = 0;
+       data2 = _tmp4_;
+       data2_length1 = _tmp4__length1;
+       _data2_size_ = data2_length1;
+       _tmp5_ = data;
+       _tmp5__length1 = data_length1;
+       assert (_tmp5__length1 == 0);
+       data2 = (_vala_array_free (data2, data2_length1, (ValaDestroyNotify) free), NULL);
+       data = (_vala_array_free (data, data_length1, (ValaDestroyNotify) free), NULL);
+       baz = (free (baz), NULL);
+}
+
+void
+test_length_assignment (void)
+{
+       int* a = NULL;
+       int* _tmp0_;
+       int a_length1;
+       int _a_size_;
+       int* b = NULL;
+       int* _tmp1_;
+       int b_length1;
+       int b_length2;
+       int _tmp2_;
+       _tmp0_ = calloc (10, sizeof (int));
+       a = _tmp0_;
+       a_length1 = 10;
+       _a_size_ = a_length1;
+       _tmp1_ = calloc (20 * 30, sizeof (int));
+       b = _tmp1_;
+       b_length1 = 20;
+       b_length2 = 30;
+       a_length1 = 8;
+       b_length1 = 5;
+       assert (a_length1 == 8);
+       _tmp2_ = b_length1;
+       assert (_tmp2_ == 5);
+       b = (free (b), NULL);
+       a = (free (a), NULL);
+}
+
+void
+test_inline_array (void)
+{
+       static const int a[3] = {1, 2, 3};
+       assert (_vala_int_array_contains (a, VALA_N_ELEMENTS (a), 1));
+}
+
+static int*
+_vala_array_dup9 (int* self,
+                  ssize_t length)
+{
+       if (length > 0) {
+               int* result;
+               result = calloc (length, sizeof (int));
+               memcpy (result, self, length * sizeof (int));
+               return result;
+       }
+       return NULL;
+}
+
+static int*
+_vala_array_dup10 (int* self,
+                   ssize_t length)
+{
+       if (length > 0) {
+               int* result;
+               result = calloc (length, sizeof (int));
+               memcpy (result, self, length * sizeof (int));
+               return result;
+       }
+       return NULL;
+}
+
+int*
+nd_array_pass (int* a,
+               int a_length1,
+               int a_length2,
+               int a_length3,
+               int** b,
+               int* b_length1,
+               int* b_length2,
+               int* b_length3,
+               int* result_length1,
+               int* result_length2,
+               int* result_length3)
+{
+       int* _vala_b = NULL;
+       int _vala_b_length1 = 0;
+       int _vala_b_length2 = 0;
+       int _vala_b_length3 = 0;
+       int _tmp0_;
+       int _tmp1_;
+       int _tmp2_;
+       int _tmp3_;
+       int* _tmp4_;
+       int _tmp4__length1;
+       int _tmp4__length2;
+       int _tmp4__length3;
+       int* _tmp5_;
+       int _tmp5__length1;
+       int _tmp5__length2;
+       int _tmp5__length3;
+       int* _tmp6_;
+       int _tmp6__length1;
+       int _tmp6__length2;
+       int _tmp6__length3;
+       int* result = NULL;
+       _tmp0_ = a_length1;
+       assert (_tmp0_ == 2);
+       _tmp1_ = a_length2;
+       assert (_tmp1_ == 2);
+       _tmp2_ = a_length3;
+       assert (_tmp2_ == 2);
+       _tmp3_ = a[(((1 * a_length2) + 1) * a_length3) + 0];
+       assert (_tmp3_ == 7);
+       _tmp4_ = (a != NULL) ? _vala_array_dup9 (a, (a_length1 * a_length2) * a_length3) : a;
+       _tmp4__length1 = a_length1;
+       _tmp4__length2 = a_length2;
+       _tmp4__length3 = a_length3;
+       _vala_b = (free (_vala_b), NULL);
+       _vala_b = _tmp4_;
+       _vala_b_length1 = _tmp4__length1;
+       _vala_b_length2 = _tmp4__length2;
+       _vala_b_length3 = _tmp4__length3;
+       _tmp5_ = (a != NULL) ? _vala_array_dup10 (a, (a_length1 * a_length2) * a_length3) : a;
+       _tmp5__length1 = a_length1;
+       _tmp5__length2 = a_length2;
+       _tmp5__length3 = a_length3;
+       _tmp6_ = _tmp5_;
+       _tmp6__length1 = _tmp5__length1;
+       _tmp6__length2 = _tmp5__length2;
+       _tmp6__length3 = _tmp5__length3;
+       if (result_length1) {
+               *result_length1 = _tmp6__length1;
+       }
+       if (result_length2) {
+               *result_length2 = _tmp6__length2;
+       }
+       if (result_length3) {
+               *result_length3 = _tmp6__length3;
+       }
+       result = _tmp6_;
+       if (b) {
+               *b = _vala_b;
+       } else {
+               _vala_b = (free (_vala_b), NULL);
+       }
+       if (b_length1) {
+               *b_length1 = _vala_b_length1;
+       }
+       if (b_length2) {
+               *b_length2 = _vala_b_length2;
+       }
+       if (b_length3) {
+               *b_length3 = _vala_b_length3;
+       }
+       return result;
+}
+
+void
+test_nd_array (void)
+{
+       int* a = NULL;
+       int* _tmp0_;
+       int a_length1;
+       int a_length2;
+       int a_length3;
+       int _tmp1_;
+       int* b = NULL;
+       int b_length1 = 0;
+       int b_length2 = 0;
+       int b_length3 = 0;
+       int* c = NULL;
+       int c_length1 = 0;
+       int c_length2 = 0;
+       int c_length3 = 0;
+       int* _tmp2_ = NULL;
+       int _tmp3_ = 0;
+       int _tmp4_ = 0;
+       int _tmp5_ = 0;
+       int _tmp6_ = 0;
+       int _tmp7_ = 0;
+       int _tmp8_ = 0;
+       int* _tmp9_;
+       int _tmp10_;
+       int _tmp11_;
+       int _tmp12_;
+       int _tmp13_;
+       int _tmp14_;
+       int _tmp15_;
+       int _tmp16_;
+       int _tmp17_;
+       char** s = NULL;
+       char* _tmp18_;
+       char* _tmp19_;
+       char* _tmp20_;
+       char* _tmp21_;
+       char* _tmp22_;
+       char* _tmp23_;
+       char** _tmp24_;
+       int s_length1;
+       int s_length2;
+       int s_length3;
+       const char* _tmp25_;
+       _tmp0_ = calloc ((2 * 2) * 2, sizeof (int));
+       _tmp0_[0] = 1;
+       _tmp0_[1] = 2;
+       _tmp0_[2] = 3;
+       _tmp0_[3] = 4;
+       _tmp0_[4] = 5;
+       _tmp0_[5] = 6;
+       _tmp0_[6] = 7;
+       _tmp0_[7] = 8;
+       a = _tmp0_;
+       a_length1 = 2;
+       a_length2 = 2;
+       a_length3 = 2;
+       _tmp1_ = a[(((1 * a_length2) + 0) * a_length3) + 1];
+       assert (_tmp1_ == 6);
+       _tmp9_ = nd_array_pass (a, (int) a_length1, (int) a_length2, (int) a_length3, &_tmp2_, &_tmp3_, 
&_tmp4_, &_tmp5_, &_tmp6_, &_tmp7_, &_tmp8_);
+       b = (free (b), NULL);
+       b = _tmp2_;
+       b_length1 = _tmp3_;
+       b_length2 = _tmp4_;
+       b_length3 = _tmp5_;
+       c = (free (c), NULL);
+       c = _tmp9_;
+       c_length1 = _tmp6_;
+       c_length2 = _tmp7_;
+       c_length3 = _tmp8_;
+       _tmp10_ = b_length1;
+       assert (_tmp10_ == 2);
+       _tmp11_ = b_length2;
+       assert (_tmp11_ == 2);
+       _tmp12_ = b_length3;
+       assert (_tmp12_ == 2);
+       _tmp13_ = b[(((0 * b_length2) + 1) * b_length3) + 0];
+       assert (_tmp13_ == 3);
+       _tmp14_ = c_length1;
+       assert (_tmp14_ == 2);
+       _tmp15_ = c_length2;
+       assert (_tmp15_ == 2);
+       _tmp16_ = c_length3;
+       assert (_tmp16_ == 2);
+       _tmp17_ = c[(((0 * c_length2) + 1) * c_length3) + 1];
+       assert (_tmp17_ == 4);
+       _tmp18_ = _strdup0 ("a");
+       _tmp19_ = _strdup0 ("b");
+       _tmp20_ = _strdup0 ("c");
+       _tmp21_ = _strdup0 ("d");
+       _tmp22_ = _strdup0 ("e");
+       _tmp23_ = _strdup0 ("f");
+       _tmp24_ = calloc (((1 * 2) * 3) + 1, sizeof (char*));
+       _tmp24_[0] = _tmp18_;
+       _tmp24_[1] = _tmp19_;
+       _tmp24_[2] = _tmp20_;
+       _tmp24_[3] = _tmp21_;
+       _tmp24_[4] = _tmp22_;
+       _tmp24_[5] = _tmp23_;
+       s = _tmp24_;
+       s_length1 = 1;
+       s_length2 = 2;
+       s_length3 = 3;
+       _tmp25_ = s[(((0 * s_length2) + 0) * s_length3) + 2];
+       assert (_strcmp0 (_tmp25_, "c") == 0);
+       s = (_vala_array_free (s, (s_length1 * s_length2) * s_length3, (ValaDestroyNotify) free), NULL);
+       c = (free (c), NULL);
+       b = (free (b), NULL);
+       a = (free (a), NULL);
+}
+
+int
+simple_func (void)
+{
+       int result = 0;
+       result = 0;
+       return result;
+}
+
+static void
+_vala_array_add2 (SimpleFunc* * array,
+                  int* length,
+                  int* size,
+                  SimpleFunc value)
+{
+       if ((*length) == (*size)) {
+               *size = (*size) ? (2 * (*size)) : 4;
+               *array = realloc (*array, (*size) * sizeof (SimpleFunc));
+       }
+       (*array)[(*length)++] = value;
+}
+
+static bool
+_vala_simple_func_array_contains (SimpleFunc * stack,
+                                  ssize_t stack_length,
+                                  const SimpleFunc needle)
+{
+       ssize_t i;
+       for (i = 0; i < stack_length; i++) {
+               if (needle == stack[i]) {
+                       return true;
+               }
+       }
+       return false;
+}
+
+void
+test_delegate_array (void)
+{
+       SimpleFunc* a = NULL;
+       SimpleFunc* _tmp0_;
+       int a_length1;
+       int _a_size_;
+       SimpleFunc* _tmp1_;
+       int _tmp1__length1;
+       SimpleFunc* _tmp2_;
+       int _tmp2__length1;
+       SimpleFunc* _tmp3_;
+       int _tmp3__length1;
+       _tmp0_ = calloc (0, sizeof (SimpleFunc));
+       a = _tmp0_;
+       a_length1 = 0;
+       _a_size_ = a_length1;
+       _tmp1_ = simple_delegates;
+       _tmp1__length1 = simple_delegates_length1;
+       simple_delegates = NULL;
+       simple_delegates_length1 = 0;
+       a = (free (a), NULL);
+       a = _tmp1_;
+       a_length1 = _tmp1__length1;
+       _a_size_ = a_length1;
+       _vala_array_add2 (&a, &a_length1, &_a_size_, (SimpleFunc) simple_func);
+       _tmp2_ = a;
+       _tmp2__length1 = a_length1;
+       assert (_tmp2__length1 == 1);
+       _tmp3_ = a;
+       _tmp3__length1 = a_length1;
+       assert (_vala_simple_func_array_contains (_tmp3_, _tmp3__length1, simple_func));
+       a = (free (a), NULL);
+}
+
+static void
+_vala_array_add3 (void** * array,
+                  int* length,
+                  int* size,
+                  void* value)
+{
+       if ((*length) == (*size)) {
+               *size = (*size) ? (2 * (*size)) : 4;
+               *array = realloc (*array, (*size) * sizeof (void*));
+       }
+       (*array)[(*length)++] = value;
+}
+
+static void
+_vala_array_add4 (void** * array,
+                  int* length,
+                  int* size,
+                  void* value)
+{
+       if ((*length) == (*size)) {
+               *size = (*size) ? (2 * (*size)) : 4;
+               *array = realloc (*array, (*size) * sizeof (void*));
+       }
+       (*array)[(*length)++] = value;
+}
+
+static bool
+_vala_valavoid_array_contains (void* * stack,
+                               ssize_t stack_length,
+                               const void* needle)
+{
+       ssize_t i;
+       for (i = 0; i < stack_length; i++) {
+               if (needle == stack[i]) {
+                       return true;
+               }
+       }
+       return false;
+}
+
+void
+test_void_array (void)
+{
+       void** a = NULL;
+       void** _tmp0_;
+       int a_length1;
+       int _a_size_;
+       void** _tmp1_;
+       int _tmp1__length1;
+       void** _tmp2_;
+       int _tmp2__length1;
+       _tmp0_ = calloc (0, sizeof (void*));
+       a = _tmp0_;
+       a_length1 = 0;
+       _a_size_ = a_length1;
+       _vala_array_add3 (&a, &a_length1, &_a_size_, (void*) NULL);
+       _vala_array_add4 (&a, &a_length1, &_a_size_, (void*) NULL);
+       _tmp1_ = a;
+       _tmp1__length1 = a_length1;
+       assert (_tmp1__length1 == 2);
+       _tmp2_ = a;
+       _tmp2__length1 = a_length1;
+       assert (_vala_valavoid_array_contains (_tmp2_, _tmp2__length1, (void*) NULL));
+       a = (free (a), NULL);
+}
+
+static int*
+_vala_array_dup11 (int* self,
+                   ssize_t length)
+{
+       if (length > 0) {
+               int* result;
+               result = calloc (length, sizeof (int));
+               memcpy (result, self, length * sizeof (int));
+               return result;
+       }
+       return NULL;
+}
+
+void
+test_explicit_copying (void)
+{
+       int* a0 = NULL;
+       int* _tmp0_;
+       int a0_length1;
+       int _a0_size_;
+       int* a1 = NULL;
+       int* _tmp1_;
+       int _tmp1__length1;
+       int a1_length1;
+       int _a1_size_;
+       int _tmp2_;
+       int _tmp3_;
+       _tmp0_ = calloc (3, sizeof (int));
+       _tmp0_[0] = 1;
+       _tmp0_[1] = 2;
+       _tmp0_[2] = 3;
+       a0 = _tmp0_;
+       a0_length1 = 3;
+       _a0_size_ = a0_length1;
+       _tmp1_ = (a0 != NULL) ? _vala_array_dup11 (a0, a0_length1) : a0;
+       _tmp1__length1 = a0_length1;
+       a1 = _tmp1_;
+       a1_length1 = _tmp1__length1;
+       _a1_size_ = a1_length1;
+       assert (a1_length1 == 3);
+       _tmp2_ = a0[1];
+       _tmp3_ = a1[1];
+       assert (_tmp2_ == _tmp3_);
+       a1 = (free (a1), NULL);
+       a0 = (free (a0), NULL);
+}
+
+void
+test_array_move (void)
+{
+       int* a = NULL;
+       int* _tmp0_;
+       int a_length1;
+       int _a_size_;
+       int _tmp1_;
+       int _tmp2_;
+       _tmp0_ = calloc (9, sizeof (int));
+       _tmp0_[0] = 1;
+       _tmp0_[1] = 2;
+       _tmp0_[2] = 3;
+       _tmp0_[3] = 4;
+       _tmp0_[4] = 5;
+       _tmp0_[5] = 6;
+       _tmp0_[6] = 7;
+       _tmp0_[7] = 8;
+       _tmp0_[8] = 9;
+       a = _tmp0_;
+       a_length1 = 9;
+       _a_size_ = a_length1;
+       _tmp1_ = a[4];
+       assert (_tmp1_ == 5);
+       _vala_array_move (a, sizeof (int), 4, 0, 5);
+       _tmp2_ = a[4];
+       assert (_tmp2_ == 9);
+       a = (free (a), NULL);
+}
+
+void
+test_array_resize (void)
+{
+       int* a = NULL;
+       int* _tmp0_;
+       int a_length1;
+       int _a_size_;
+       int _tmp1_;
+       int _tmp2_;
+       int _tmp3_;
+       _tmp0_ = calloc (9, sizeof (int));
+       _tmp0_[0] = 1;
+       _tmp0_[1] = 2;
+       _tmp0_[2] = 3;
+       _tmp0_[3] = 4;
+       _tmp0_[4] = 5;
+       _tmp0_[5] = 6;
+       _tmp0_[6] = 7;
+       _tmp0_[7] = 8;
+       _tmp0_[8] = 9;
+       a = _tmp0_;
+       a_length1 = 9;
+       _a_size_ = a_length1;
+       _tmp1_ = a[a_length1 - 1];
+       assert (_tmp1_ == 9);
+       _tmp2_ = 5;
+       a = realloc (a, sizeof (int) * 5);
+       (_tmp2_ > a_length1) ? memset (a + a_length1, 0, sizeof (int) * (_tmp2_ - a_length1)) : NULL;
+       a_length1 = _tmp2_;
+       _a_size_ = _tmp2_;
+       _tmp3_ = a[a_length1 - 1];
+       assert (_tmp3_ == 5);
+       a = (free (a), NULL);
+}
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = calloc (1, sizeof (Foo));
+       memcpy (dup, self, sizeof (Foo));
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       free (self);
+}
+
+Bar*
+bar_dup (const Bar* self)
+{
+       Bar* dup;
+       dup = calloc (1, sizeof (Bar));
+       memcpy (dup, self, sizeof (Bar));
+       return dup;
+}
+
+void
+bar_free (Bar* self)
+{
+       free (self);
+}
+
+Manam*
+manam_dup (const Manam* self)
+{
+       Manam* dup;
+       dup = calloc (1, sizeof (Manam));
+       memcpy (dup, self, sizeof (Manam));
+       return dup;
+}
+
+void
+manam_free (Manam* self)
+{
+       free (self);
+}
+
+static bool
+_bar_equal (const Bar * s1,
+            const Bar * s2)
+{
+       if (s1 == s2) {
+               return true;
+       }
+       if (s1 == NULL) {
+               return false;
+       }
+       if (s2 == NULL) {
+               return false;
+       }
+       if (s1->bar != s2->bar) {
+               return false;
+       }
+       return true;
+}
+
+static bool
+_vala_bar_array_contains (Bar * stack,
+                          ssize_t stack_length,
+                          const Bar * needle)
+{
+       ssize_t i;
+       for (i = 0; i < stack_length; i++) {
+               if (_bar_equal (&stack[i], needle) == true) {
+                       return true;
+               }
+       }
+       return false;
+}
+
+static void*
+_manam_dup0 (void* self)
+{
+       return self ? manam_dup (self) : NULL;
+}
+
+void
+test_struct_array (void)
+{
+       Foo _tmp0_;
+       Bar b = {0};
+       Bar _tmp1_ = {0};
+       Bar* bar = NULL;
+       Bar* _tmp2_;
+       int bar_length1;
+       int _bar_size_;
+       Bar _tmp3_;
+       Bar _tmp4_;
+       Manam* manam = NULL;
+       Manam _tmp5_ = {0};
+       Manam* _tmp6_;
+       Manam* manam_copy = NULL;
+       Manam* _tmp7_;
+       _tmp0_ = FOO_ARRAY_CONST[0];
+       assert (_tmp0_.bar == 42);
+       _tmp1_.bar = 4711;
+       b = _tmp1_;
+       _tmp2_ = calloc (23, sizeof (Bar));
+       bar = _tmp2_;
+       bar_length1 = 23;
+       _bar_size_ = bar_length1;
+       _tmp3_ = b;
+       bar[7] = _tmp3_;
+       _tmp4_ = b;
+       assert (_vala_bar_array_contains (bar, bar_length1, &_tmp4_));
+       _tmp6_ = _manam_dup0 (&_tmp5_);
+       manam = _tmp6_;
+       _tmp7_ = _manam_dup0 (manam);
+       manam_copy = _tmp7_;
+       _manam_free0 (manam_copy);
+       _manam_free0 (manam);
+       bar = (free (bar), NULL);
+}
+
+void
+give_fixed_array (int** i)
+{
+       int _vala_i[3] = {0};
+       int _tmp0_[3] = {0};
+       _tmp0_[0] = 3;
+       _tmp0_[1] = 4;
+       _tmp0_[2] = 5;
+       memcpy (_vala_i, _tmp0_, 3 * sizeof (int));
+       if (i) {
+               *i = _vala_i;
+       }
+}
+
+void
+take_fixed_array (int* i)
+{
+       int _tmp0_;
+       assert (3 == 3);
+       _tmp0_ = i[1];
+       assert (_tmp0_ == 2);
+}
+
+void
+change_fixed_array (int** i)
+{
+       assert (3 == 3);
+}
+
+void
+test_fixed_array (void)
+{
+       int i[3] = {0};
+       int _tmp0_[3] = {0};
+       int k[3] = {0};
+       int _tmp1_[3] = {0};
+       int j[3] = {0};
+       int _tmp2_[3] = {0};
+       _tmp0_[0] = 1;
+       _tmp0_[1] = 2;
+       _tmp0_[2] = 3;
+       memcpy (i, _tmp0_, 3 * sizeof (int));
+       assert (3 == 3);
+       take_fixed_array (i);
+       _tmp1_[0] = 6;
+       _tmp1_[1] = 7;
+       _tmp1_[2] = 8;
+       memcpy (k, _tmp1_, 3 * sizeof (int));
+       change_fixed_array (&k);
+       assert (3 == 3);
+       give_fixed_array (&_tmp2_);
+       memcpy (j, _tmp2_, 3 * sizeof (int));
+       assert (3 == 3);
+}
+
+static void
+_vala_main (void)
+{
+       test_integer_array ();
+       test_string_array ();
+       test_array_pass ();
+       test_static_array ();
+       test_reference_transfer ();
+       test_length_assignment ();
+       test_inline_array ();
+       test_nd_array ();
+       test_delegate_array ();
+       test_void_array ();
+       test_explicit_copying ();
+       test_array_move ();
+       test_array_resize ();
+       test_struct_array ();
+       test_fixed_array ();
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (void* array,
+                     ssize_t array_length,
+                     ValaDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               ssize_t i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((void**) array)[i] != NULL) {
+                               destroy_func (((void**) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (void* array,
+                  ssize_t array_length,
+                  ValaDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       free (array);
+}
+
+static void
+_vala_array_move (void* array,
+                  size_t element_size,
+                  ssize_t src,
+                  ssize_t dest,
+                  ssize_t length)
+{
+       memmove (((char*) array) + (dest * element_size), ((char*) array) + (src * element_size), length * 
element_size);
+       if ((src < dest) && ((src + length) > dest)) {
+               memset (((char*) array) + (src * element_size), 0, (dest - src) * element_size);
+       } else if ((src > dest) && (src < (dest + length))) {
+               memset (((char*) array) + ((dest + length) * element_size), 0, (src - dest) * element_size);
+       } else if (src != dest) {
+               memset (((char*) array) + (src * element_size), 0, length * element_size);
+       }
+}
+
+static ssize_t
+_vala_array_length (void* array)
+{
+       ssize_t length;
+       length = 0;
+       if (array) {
+               while (((void**) array)[length]) {
+                       length++;
+               }
+       }
+       return length;
+}
+
diff --git a/tests/posix/delegate_only.c-expected b/tests/posix/delegate_only.c-expected
new file mode 100644
index 000000000..e9df8bb8c
--- /dev/null
+++ b/tests/posix/delegate_only.c-expected
@@ -0,0 +1,20 @@
+/* posix_delegate_only.c generated by valac, the Vala compiler
+ * generated from posix_delegate_only.vala, do not modify */
+
+typedef void (*FooFunc) (void* user_data);
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/posix/empty-length-0.c-expected b/tests/posix/empty-length-0.c-expected
new file mode 100644
index 000000000..a18289fc2
--- /dev/null
+++ b/tests/posix/empty-length-0.c-expected
@@ -0,0 +1,389 @@
+/* posix_empty_length_0.c generated by valac, the Vala compiler
+ * generated from posix_empty_length_0.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <stddef.h>
+#include <sys/types.h>
+#include <assert.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef struct _Manam Manam;
+#define _free0(var) ((var == NULL) ? NULL : (var = (free (var), NULL)))
+typedef void (*ValaDestroyNotify) (void* data);
+
+struct _Manam {
+       char* s;
+};
+
+VALA_EXTERN char** foo;
+VALA_EXTERN int foo_length1;
+char** foo = NULL;
+int foo_length1 = 0;
+static int _foo_size_ = 0;
+VALA_EXTERN int* bar;
+VALA_EXTERN int bar_length1;
+int* bar = NULL;
+int bar_length1 = 0;
+static int _bar_size_ = 0;
+VALA_EXTERN Manam* manam;
+VALA_EXTERN int manam_length1;
+Manam* manam = NULL;
+int manam_length1 = 0;
+static int _manam_size_ = 0;
+
+VALA_EXTERN Manam* manam_dup (const Manam* self);
+VALA_EXTERN void manam_free (Manam* self);
+VALA_EXTERN void manam_copy (const Manam* self,
+                 Manam* dest);
+VALA_EXTERN void manam_destroy (Manam* self);
+VALA_EXTERN char** get_foo (int* result_length1);
+static char** _vala_array_dup1 (char** self,
+                         ssize_t length);
+VALA_EXTERN int* get_bar (int* result_length1);
+static int* _vala_array_dup2 (int* self,
+                       ssize_t length);
+VALA_EXTERN Manam* get_manam (int* result_length1);
+static Manam* _vala_array_dup3 (Manam* self,
+                         ssize_t length);
+static void _vala_main (void);
+static void _vala_Manam_array_free (Manam * array,
+                             ssize_t array_length);
+static void _vala_array_destroy (void* array,
+                          ssize_t array_length,
+                          ValaDestroyNotify destroy_func);
+static void _vala_array_free (void* array,
+                       ssize_t array_length,
+                       ValaDestroyNotify destroy_func);
+
+static void*
+_strdup0 (void* self)
+{
+       return self ? strdup (self) : NULL;
+}
+
+void
+manam_copy (const Manam* self,
+            Manam* dest)
+{
+       const char* _tmp0_;
+       char* _tmp1_;
+       _tmp0_ = (*self).s;
+       _tmp1_ = _strdup0 (_tmp0_);
+       _free0 ((*dest).s);
+       (*dest).s = _tmp1_;
+}
+
+void
+manam_destroy (Manam* self)
+{
+       _free0 ((*self).s);
+}
+
+Manam*
+manam_dup (const Manam* self)
+{
+       Manam* dup;
+       dup = calloc (1, sizeof (Manam));
+       manam_copy (self, dup);
+       return dup;
+}
+
+void
+manam_free (Manam* self)
+{
+       manam_destroy (self);
+       free (self);
+}
+
+static char**
+_vala_array_dup1 (char** self,
+                  ssize_t length)
+{
+       if (length >= 0) {
+               char** result;
+               ssize_t i;
+               result = calloc (length + 1, sizeof (char*));
+               for (i = 0; i < length; i++) {
+                       char* _tmp0_;
+                       _tmp0_ = _strdup0 (self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+char**
+get_foo (int* result_length1)
+{
+       char** _tmp0_;
+       int _tmp0__length1;
+       char** _tmp1_;
+       int _tmp1__length1;
+       char** _tmp2_;
+       int _tmp2__length1;
+       char** result = NULL;
+       _tmp0_ = foo;
+       _tmp0__length1 = foo_length1;
+       _tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup1 (_tmp0_, _tmp0__length1) : _tmp0_;
+       _tmp1__length1 = _tmp0__length1;
+       _tmp2_ = _tmp1_;
+       _tmp2__length1 = _tmp1__length1;
+       if (result_length1) {
+               *result_length1 = _tmp2__length1;
+       }
+       result = _tmp2_;
+       return result;
+}
+
+static int*
+_vala_array_dup2 (int* self,
+                  ssize_t length)
+{
+       if (length > 0) {
+               int* result;
+               result = calloc (length, sizeof (int));
+               memcpy (result, self, length * sizeof (int));
+               return result;
+       }
+       return NULL;
+}
+
+int*
+get_bar (int* result_length1)
+{
+       int* _tmp0_;
+       int _tmp0__length1;
+       int* _tmp1_;
+       int _tmp1__length1;
+       int* _tmp2_;
+       int _tmp2__length1;
+       int* result = NULL;
+       _tmp0_ = bar;
+       _tmp0__length1 = bar_length1;
+       _tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup2 (_tmp0_, _tmp0__length1) : _tmp0_;
+       _tmp1__length1 = _tmp0__length1;
+       _tmp2_ = _tmp1_;
+       _tmp2__length1 = _tmp1__length1;
+       if (result_length1) {
+               *result_length1 = _tmp2__length1;
+       }
+       result = _tmp2_;
+       return result;
+}
+
+static Manam*
+_vala_array_dup3 (Manam* self,
+                  ssize_t length)
+{
+       if (length > 0) {
+               Manam* result;
+               ssize_t i;
+               result = calloc (length, sizeof (Manam));
+               for (i = 0; i < length; i++) {
+                       Manam _tmp0_;
+                       Manam _tmp1_ = {0};
+                       _tmp0_ = self[i];
+                       manam_copy (&_tmp0_, &_tmp1_);
+                       result[i] = _tmp1_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+Manam*
+get_manam (int* result_length1)
+{
+       Manam* _tmp0_;
+       int _tmp0__length1;
+       Manam* _tmp1_;
+       int _tmp1__length1;
+       Manam* _tmp2_;
+       int _tmp2__length1;
+       Manam* result = NULL;
+       _tmp0_ = manam;
+       _tmp0__length1 = manam_length1;
+       _tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup3 (_tmp0_, _tmp0__length1) : _tmp0_;
+       _tmp1__length1 = _tmp0__length1;
+       _tmp2_ = _tmp1_;
+       _tmp2__length1 = _tmp1__length1;
+       if (result_length1) {
+               *result_length1 = _tmp2__length1;
+       }
+       result = _tmp2_;
+       return result;
+}
+
+static void
+_vala_Manam_array_free (Manam * array,
+                        ssize_t array_length)
+{
+       if (array != NULL) {
+               ssize_t i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       manam_destroy (&array[i]);
+               }
+       }
+       free (array);
+}
+
+static void
+_vala_main (void)
+{
+       {
+               char** _tmp0_;
+               char** _tmp1_;
+               int _tmp1__length1;
+               int _tmp2_ = 0;
+               char** _tmp3_;
+               char** _tmp4_;
+               int _tmp4__length1;
+               _tmp0_ = calloc (0 + 1, sizeof (char*));
+               foo = (_vala_array_free (foo, foo_length1, (ValaDestroyNotify) free), NULL);
+               foo = _tmp0_;
+               foo_length1 = 0;
+               _foo_size_ = foo_length1;
+               _tmp1_ = foo;
+               _tmp1__length1 = foo_length1;
+               assert (_tmp1_ != NULL);
+               _tmp3_ = get_foo (&_tmp2_);
+               _tmp4_ = _tmp3_;
+               _tmp4__length1 = _tmp2_;
+               assert (_tmp4_ != NULL);
+               _tmp4_ = (_vala_array_free (_tmp4_, _tmp4__length1, (ValaDestroyNotify) free), NULL);
+       }
+       {
+               char** _tmp5_;
+               char** _tmp6_;
+               int _tmp6__length1;
+               int _tmp7_ = 0;
+               char** _tmp8_;
+               char** _tmp9_;
+               int _tmp9__length1;
+               _tmp5_ = calloc (0 + 1, sizeof (char*));
+               foo = (_vala_array_free (foo, foo_length1, (ValaDestroyNotify) free), NULL);
+               foo = _tmp5_;
+               foo_length1 = 0;
+               _foo_size_ = foo_length1;
+               _tmp6_ = foo;
+               _tmp6__length1 = foo_length1;
+               assert (_tmp6_ != NULL);
+               _tmp8_ = get_foo (&_tmp7_);
+               _tmp9_ = _tmp8_;
+               _tmp9__length1 = _tmp7_;
+               assert (_tmp9_ != NULL);
+               _tmp9_ = (_vala_array_free (_tmp9_, _tmp9__length1, (ValaDestroyNotify) free), NULL);
+       }
+       {
+               int* _tmp10_;
+               int _tmp11_ = 0;
+               int* _tmp12_;
+               int* _tmp13_;
+               int _tmp13__length1;
+               _tmp10_ = calloc (0, sizeof (int));
+               bar = (free (bar), NULL);
+               bar = _tmp10_;
+               bar_length1 = 0;
+               _bar_size_ = bar_length1;
+               _tmp12_ = get_bar (&_tmp11_);
+               _tmp13_ = _tmp12_;
+               _tmp13__length1 = _tmp11_;
+               assert (_tmp13_ == NULL);
+               _tmp13_ = (free (_tmp13_), NULL);
+       }
+       {
+               int* _tmp14_;
+               int _tmp15_ = 0;
+               int* _tmp16_;
+               int* _tmp17_;
+               int _tmp17__length1;
+               _tmp14_ = calloc (0, sizeof (int));
+               bar = (free (bar), NULL);
+               bar = _tmp14_;
+               bar_length1 = 0;
+               _bar_size_ = bar_length1;
+               _tmp16_ = get_bar (&_tmp15_);
+               _tmp17_ = _tmp16_;
+               _tmp17__length1 = _tmp15_;
+               assert (_tmp17_ == NULL);
+               _tmp17_ = (free (_tmp17_), NULL);
+       }
+       {
+               Manam* _tmp18_;
+               int _tmp19_ = 0;
+               Manam* _tmp20_;
+               Manam* _tmp21_;
+               int _tmp21__length1;
+               _tmp18_ = calloc (0, sizeof (Manam));
+               manam = (_vala_Manam_array_free (manam, manam_length1), NULL);
+               manam = _tmp18_;
+               manam_length1 = 0;
+               _manam_size_ = manam_length1;
+               _tmp20_ = get_manam (&_tmp19_);
+               _tmp21_ = _tmp20_;
+               _tmp21__length1 = _tmp19_;
+               assert (_tmp21_ == NULL);
+               _tmp21_ = (_vala_Manam_array_free (_tmp21_, _tmp21__length1), NULL);
+       }
+       {
+               Manam* _tmp22_;
+               int _tmp23_ = 0;
+               Manam* _tmp24_;
+               Manam* _tmp25_;
+               int _tmp25__length1;
+               _tmp22_ = calloc (0, sizeof (Manam));
+               manam = (_vala_Manam_array_free (manam, manam_length1), NULL);
+               manam = _tmp22_;
+               manam_length1 = 0;
+               _manam_size_ = manam_length1;
+               _tmp24_ = get_manam (&_tmp23_);
+               _tmp25_ = _tmp24_;
+               _tmp25__length1 = _tmp23_;
+               assert (_tmp25_ == NULL);
+               _tmp25_ = (_vala_Manam_array_free (_tmp25_, _tmp25__length1), NULL);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (void* array,
+                     ssize_t array_length,
+                     ValaDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               ssize_t i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((void**) array)[i] != NULL) {
+                               destroy_func (((void**) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (void* array,
+                  ssize_t array_length,
+                  ValaDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       free (array);
+}
+
diff --git a/tests/posix/enum-to-string.c-expected b/tests/posix/enum-to-string.c-expected
new file mode 100644
index 000000000..ca84c862a
--- /dev/null
+++ b/tests/posix/enum-to-string.c-expected
@@ -0,0 +1,56 @@
+/* posix_enum_to_string.c generated by valac, the Vala compiler
+ * generated from posix_enum_to_string.vala, do not modify */
+
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+
+typedef enum  {
+       FOO_BAR,
+       FOO_BAZ
+} Foo;
+
+static void _vala_main (void);
+static const char* _foo_to_string (Foo value);
+
+static const char*
+_foo_to_string (Foo value)
+{
+       switch (value) {
+               case FOO_BAR:
+               return "FOO_BAR";
+               case FOO_BAZ:
+               return "FOO_BAZ";
+       }
+       return NULL;
+}
+
+static int
+_strcmp0 (const void * s1,
+          const void * s2)
+{
+       if (!s1) {
+               return -(s1 != s2);
+       }
+       if (!s2) {
+               return s1 != s2;
+       }
+       return strcmp (s1, s2);
+}
+
+static void
+_vala_main (void)
+{
+       const char* _tmp0_;
+       _tmp0_ = _foo_to_string (FOO_BAR);
+       assert (_strcmp0 (_tmp0_, "FOO_BAR") == 0);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/posix/enum_only.c-expected b/tests/posix/enum_only.c-expected
new file mode 100644
index 000000000..758278707
--- /dev/null
+++ b/tests/posix/enum_only.c-expected
@@ -0,0 +1,23 @@
+/* posix_enum_only.c generated by valac, the Vala compiler
+ * generated from posix_enum_only.vala, do not modify */
+
+typedef enum  {
+       FOO_BAR,
+       FOO_BAZ
+} Foo;
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/posix/string-concat.c-expected b/tests/posix/string-concat.c-expected
new file mode 100644
index 000000000..efb127088
--- /dev/null
+++ b/tests/posix/string-concat.c-expected
@@ -0,0 +1,72 @@
+/* posix_string_concat.c generated by valac, the Vala compiler
+ * generated from posix_string_concat.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <stddef.h>
+#include <assert.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _free0(var) ((var == NULL) ? NULL : (var = (free (var), NULL)))
+
+VALA_EXTERN const char* get_foo (void);
+static void _vala_main (void);
+
+const char*
+get_foo (void)
+{
+       const char* result = NULL;
+       result = "foo";
+       return result;
+}
+
+static int
+_strcmp0 (const void * s1,
+          const void * s2)
+{
+       if (!s1) {
+               return -(s1 != s2);
+       }
+       if (!s2) {
+               return s1 != s2;
+       }
+       return strcmp (s1, s2);
+}
+
+static void
+_vala_main (void)
+{
+       char* s = NULL;
+       const char* _tmp0_;
+       char* _tmp1_;
+       char* _tmp2_;
+       char* _tmp3_;
+       char* _tmp4_;
+       _tmp0_ = get_foo ();
+       _tmp1_ = strcat (strcpy (malloc (1 + (strlen (_tmp0_) + strlen ("bar"))), _tmp0_), "bar");
+       _tmp2_ = _tmp1_;
+       _tmp3_ = strcat (strcpy (malloc (1 + (strlen (_tmp2_) + strlen ("!"))), _tmp2_), "!");
+       _tmp4_ = _tmp3_;
+       _free0 (_tmp2_);
+       s = _tmp4_;
+       assert (_strcmp0 (s, "foobar!") == 0);
+       _free0 (s);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/posix/string-printf.c-expected b/tests/posix/string-printf.c-expected
new file mode 100644
index 000000000..c63c6e0fe
--- /dev/null
+++ b/tests/posix/string-printf.c-expected
@@ -0,0 +1,65 @@
+/* posix_string_printf.c generated by valac, the Vala compiler
+ * generated from posix_string_printf.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <assert.h>
+#include <stddef.h>
+
+#define _free0(var) ((var == NULL) ? NULL : (var = (free (var), NULL)))
+
+static void _vala_main (void);
+static char* string_printf (const char* format,
+                     ...) __attribute__((__format__ (__printf__, 1, 2))) ;
+
+static char*
+string_printf (const char* format,
+               ...)
+{
+       int length;
+       va_list ap;
+       char* result;
+       va_start (ap, format);
+       length = vsnprintf (NULL, 0, format, ap) + 1;
+       va_end (ap);
+       result = malloc (length);
+       va_start (ap, format);
+       vsnprintf (result, length, format, ap);
+       va_end (ap);
+       return result;
+}
+
+static int
+_strcmp0 (const void * s1,
+          const void * s2)
+{
+       if (!s1) {
+               return -(s1 != s2);
+       }
+       if (!s2) {
+               return s1 != s2;
+       }
+       return strcmp (s1, s2);
+}
+
+static void
+_vala_main (void)
+{
+       char* s = NULL;
+       char* _tmp0_;
+       _tmp0_ = string_printf ("%i %s %u %.4f", 42, "foo", 4711U, 3.1415);
+       s = _tmp0_;
+       assert (_strcmp0 (s, "42 foo 4711 3.1415") == 0);
+       _free0 (s);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/posix/struct_only.c-expected b/tests/posix/struct_only.c-expected
new file mode 100644
index 000000000..da17479a4
--- /dev/null
+++ b/tests/posix/struct_only.c-expected
@@ -0,0 +1,54 @@
+/* posix_struct_only.c generated by valac, the Vala compiler
+ * generated from posix_struct_only.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef struct _Foo Foo;
+
+struct _Foo {
+       int i;
+};
+
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+static void _vala_main (void);
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = calloc (1, sizeof (Foo));
+       memcpy (dup, self, sizeof (Foo));
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       free (self);
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/resolver/peek-inner-types.c-expected b/tests/resolver/peek-inner-types.c-expected
new file mode 100644
index 000000000..3b471d8e2
--- /dev/null
+++ b/tests/resolver/peek-inner-types.c-expected
@@ -0,0 +1,1088 @@
+/* resolver_peek_inner_types.c generated by valac, the Vala compiler
+ * generated from resolver_peek_inner_types.vala, do not modify */
+
+#include <glib-object.h>
+#include <gobject/gvaluecollector.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define BAZ_TYPE_FOO (baz_foo_get_type ())
+#define BAZ_FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BAZ_TYPE_FOO, BazFoo))
+#define BAZ_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BAZ_TYPE_FOO, BazFooClass))
+#define BAZ_IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BAZ_TYPE_FOO))
+#define BAZ_IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BAZ_TYPE_FOO))
+#define BAZ_FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BAZ_TYPE_FOO, BazFooClass))
+
+typedef struct _BazFoo BazFoo;
+typedef struct _BazFooClass BazFooClass;
+typedef struct _BazFooPrivate BazFooPrivate;
+
+#define BAZ_FOO_TYPE_BAR1 (baz_foo_bar1_get_type ())
+#define BAZ_FOO_BAR1(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BAZ_FOO_TYPE_BAR1, BazFooBar1))
+#define BAZ_FOO_BAR1_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BAZ_FOO_TYPE_BAR1, BazFooBar1Class))
+#define BAZ_FOO_IS_BAR1(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BAZ_FOO_TYPE_BAR1))
+#define BAZ_FOO_IS_BAR1_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BAZ_FOO_TYPE_BAR1))
+#define BAZ_FOO_BAR1_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BAZ_FOO_TYPE_BAR1, BazFooBar1Class))
+
+typedef struct _BazFooBar1 BazFooBar1;
+typedef struct _BazFooBar1Class BazFooBar1Class;
+typedef struct _BazFooBar1Private BazFooBar1Private;
+typedef struct _BazFooParamSpecBar1 BazFooParamSpecBar1;
+
+#define BAZ_FOO_TYPE_IBAR1 (baz_foo_ibar1_get_type ())
+#define BAZ_FOO_IBAR1(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BAZ_FOO_TYPE_IBAR1, BazFooIBar1))
+#define BAZ_FOO_IS_IBAR1(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BAZ_FOO_TYPE_IBAR1))
+#define BAZ_FOO_IBAR1_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), BAZ_FOO_TYPE_IBAR1, 
BazFooIBar1Iface))
+
+typedef struct _BazFooIBar1 BazFooIBar1;
+typedef struct _BazFooIBar1Iface BazFooIBar1Iface;
+typedef struct _BazParamSpecFoo BazParamSpecFoo;
+
+#define BAZ_TYPE_IFOO (baz_ifoo_get_type ())
+#define BAZ_IFOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BAZ_TYPE_IFOO, BazIFoo))
+#define BAZ_IS_IFOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BAZ_TYPE_IFOO))
+#define BAZ_IFOO_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), BAZ_TYPE_IFOO, BazIFooIface))
+
+typedef struct _BazIFoo BazIFoo;
+typedef struct _BazIFooIface BazIFooIface;
+
+#define BAZ_IFOO_TYPE_BAR2 (baz_ifoo_bar2_get_type ())
+#define BAZ_IFOO_BAR2(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BAZ_IFOO_TYPE_BAR2, BazIFooBar2))
+#define BAZ_IFOO_BAR2_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BAZ_IFOO_TYPE_BAR2, BazIFooBar2Class))
+#define BAZ_IFOO_IS_BAR2(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BAZ_IFOO_TYPE_BAR2))
+#define BAZ_IFOO_IS_BAR2_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BAZ_IFOO_TYPE_BAR2))
+#define BAZ_IFOO_BAR2_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BAZ_IFOO_TYPE_BAR2, 
BazIFooBar2Class))
+
+typedef struct _BazIFooBar2 BazIFooBar2;
+typedef struct _BazIFooBar2Class BazIFooBar2Class;
+typedef struct _BazIFooBar2Private BazIFooBar2Private;
+typedef struct _BazIFooParamSpecBar2 BazIFooParamSpecBar2;
+
+#define BAZ_IFOO_TYPE_IBAR2 (baz_ifoo_ibar2_get_type ())
+#define BAZ_IFOO_IBAR2(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BAZ_IFOO_TYPE_IBAR2, BazIFooIBar2))
+#define BAZ_IFOO_IS_IBAR2(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BAZ_IFOO_TYPE_IBAR2))
+#define BAZ_IFOO_IBAR2_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), BAZ_IFOO_TYPE_IBAR2, 
BazIFooIBar2Iface))
+
+typedef struct _BazIFooIBar2 BazIFooIBar2;
+typedef struct _BazIFooIBar2Iface BazIFooIBar2Iface;
+
+#define TYPE_MANAM (manam_get_type ())
+#define MANAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MANAM, Manam))
+#define MANAM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MANAM, ManamClass))
+#define IS_MANAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MANAM))
+#define IS_MANAM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MANAM))
+#define MANAM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MANAM, ManamClass))
+
+typedef struct _Manam Manam;
+typedef struct _ManamClass ManamClass;
+typedef struct _ManamPrivate ManamPrivate;
+#define _baz_foo_bar1_unref0(var) ((var == NULL) ? NULL : (var = (baz_foo_bar1_unref (var), NULL)))
+#define _baz_ifoo_bar2_unref0(var) ((var == NULL) ? NULL : (var = (baz_ifoo_bar2_unref (var), NULL)))
+#define _baz_foo_unref0(var) ((var == NULL) ? NULL : (var = (baz_foo_unref (var), NULL)))
+
+struct _BazFoo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       BazFooPrivate * priv;
+};
+
+struct _BazFooClass {
+       GTypeClass parent_class;
+       void (*finalize) (BazFoo *self);
+};
+
+struct _BazFooBar1 {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       BazFooBar1Private * priv;
+};
+
+struct _BazFooBar1Class {
+       GTypeClass parent_class;
+       void (*finalize) (BazFooBar1 *self);
+};
+
+struct _BazFooParamSpecBar1 {
+       GParamSpec parent_instance;
+};
+
+struct _BazFooIBar1Iface {
+       GTypeInterface parent_iface;
+};
+
+struct _BazParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+struct _BazIFooIface {
+       GTypeInterface parent_iface;
+};
+
+struct _BazIFooBar2 {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       BazIFooBar2Private * priv;
+};
+
+struct _BazIFooBar2Class {
+       GTypeClass parent_class;
+       void (*finalize) (BazIFooBar2 *self);
+};
+
+struct _BazIFooParamSpecBar2 {
+       GParamSpec parent_instance;
+};
+
+struct _BazIFooIBar2Iface {
+       GTypeInterface parent_iface;
+};
+
+struct _Manam {
+       BazFoo parent_instance;
+       ManamPrivate * priv;
+};
+
+struct _ManamClass {
+       BazFooClass parent_class;
+};
+
+static gpointer baz_foo_parent_class = NULL;
+static gpointer baz_foo_bar1_parent_class = NULL;
+static gpointer baz_ifoo_bar2_parent_class = NULL;
+static gpointer manam_parent_class = NULL;
+static BazIFooIface * manam_baz_ifoo_parent_iface = NULL;
+
+VALA_EXTERN gpointer baz_foo_ref (gpointer instance);
+VALA_EXTERN void baz_foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* baz_param_spec_foo (const gchar* name,
+                                const gchar* nick,
+                                const gchar* blurb,
+                                GType object_type,
+                                GParamFlags flags);
+VALA_EXTERN void baz_value_set_foo (GValue* value,
+                        gpointer v_object);
+VALA_EXTERN void baz_value_take_foo (GValue* value,
+                         gpointer v_object);
+VALA_EXTERN gpointer baz_value_get_foo (const GValue* value);
+VALA_EXTERN GType baz_foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (BazFoo, baz_foo_unref)
+VALA_EXTERN BazFoo* baz_foo_new (void);
+VALA_EXTERN BazFoo* baz_foo_construct (GType object_type);
+VALA_EXTERN gpointer baz_foo_bar1_ref (gpointer instance);
+VALA_EXTERN void baz_foo_bar1_unref (gpointer instance);
+VALA_EXTERN GParamSpec* baz_foo_param_spec_bar1 (const gchar* name,
+                                     const gchar* nick,
+                                     const gchar* blurb,
+                                     GType object_type,
+                                     GParamFlags flags);
+VALA_EXTERN void baz_foo_value_set_bar1 (GValue* value,
+                             gpointer v_object);
+VALA_EXTERN void baz_foo_value_take_bar1 (GValue* value,
+                              gpointer v_object);
+VALA_EXTERN gpointer baz_foo_value_get_bar1 (const GValue* value);
+VALA_EXTERN GType baz_foo_bar1_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (BazFooBar1, baz_foo_bar1_unref)
+VALA_EXTERN BazFooBar1* baz_foo_bar1_new (void);
+VALA_EXTERN BazFooBar1* baz_foo_bar1_construct (GType object_type);
+static void baz_foo_bar1_finalize (BazFooBar1 * obj);
+static GType baz_foo_bar1_get_type_once (void);
+VALA_EXTERN GType baz_foo_ibar1_get_type (void) G_GNUC_CONST ;
+static GType baz_foo_ibar1_get_type_once (void);
+static void baz_foo_finalize (BazFoo * obj);
+static GType baz_foo_get_type_once (void);
+VALA_EXTERN GType baz_ifoo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN gpointer baz_ifoo_bar2_ref (gpointer instance);
+VALA_EXTERN void baz_ifoo_bar2_unref (gpointer instance);
+VALA_EXTERN GParamSpec* baz_ifoo_param_spec_bar2 (const gchar* name,
+                                      const gchar* nick,
+                                      const gchar* blurb,
+                                      GType object_type,
+                                      GParamFlags flags);
+VALA_EXTERN void baz_ifoo_value_set_bar2 (GValue* value,
+                              gpointer v_object);
+VALA_EXTERN void baz_ifoo_value_take_bar2 (GValue* value,
+                               gpointer v_object);
+VALA_EXTERN gpointer baz_ifoo_value_get_bar2 (const GValue* value);
+VALA_EXTERN GType baz_ifoo_bar2_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (BazIFooBar2, baz_ifoo_bar2_unref)
+VALA_EXTERN BazIFooBar2* baz_ifoo_bar2_new (void);
+VALA_EXTERN BazIFooBar2* baz_ifoo_bar2_construct (GType object_type);
+static void baz_ifoo_bar2_finalize (BazIFooBar2 * obj);
+static GType baz_ifoo_bar2_get_type_once (void);
+VALA_EXTERN GType baz_ifoo_ibar2_get_type (void) G_GNUC_CONST ;
+static GType baz_ifoo_ibar2_get_type_once (void);
+static GType baz_ifoo_get_type_once (void);
+VALA_EXTERN GType manam_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Manam, baz_foo_unref)
+VALA_EXTERN BazFooBar1* manam_foo1 (Manam* self);
+VALA_EXTERN BazFooIBar1* manam_ifoo1 (Manam* self);
+VALA_EXTERN BazIFooBar2* manam_foo2 (Manam* self);
+VALA_EXTERN BazIFooIBar2* manam_ifoo2 (Manam* self);
+VALA_EXTERN Manam* manam_new (void);
+VALA_EXTERN Manam* manam_construct (GType object_type);
+static GType manam_get_type_once (void);
+static void _vala_main (void);
+
+BazFoo*
+baz_foo_construct (GType object_type)
+{
+       BazFoo* self = NULL;
+       self = (BazFoo*) g_type_create_instance (object_type);
+       return self;
+}
+
+BazFoo*
+baz_foo_new (void)
+{
+       return baz_foo_construct (BAZ_TYPE_FOO);
+}
+
+BazFooBar1*
+baz_foo_bar1_construct (GType object_type)
+{
+       BazFooBar1* self = NULL;
+       self = (BazFooBar1*) g_type_create_instance (object_type);
+       return self;
+}
+
+BazFooBar1*
+baz_foo_bar1_new (void)
+{
+       return baz_foo_bar1_construct (BAZ_FOO_TYPE_BAR1);
+}
+
+static void
+baz_foo_value_bar1_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+baz_foo_value_bar1_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               baz_foo_bar1_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+baz_foo_value_bar1_copy_value (const GValue* src_value,
+                               GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = baz_foo_bar1_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+baz_foo_value_bar1_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+baz_foo_value_bar1_collect_value (GValue* value,
+                                  guint n_collect_values,
+                                  GTypeCValue* collect_values,
+                                  guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               BazFooBar1 * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = baz_foo_bar1_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+baz_foo_value_bar1_lcopy_value (const GValue* value,
+                                guint n_collect_values,
+                                GTypeCValue* collect_values,
+                                guint collect_flags)
+{
+       BazFooBar1 ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = baz_foo_bar1_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+baz_foo_param_spec_bar1 (const gchar* name,
+                         const gchar* nick,
+                         const gchar* blurb,
+                         GType object_type,
+                         GParamFlags flags)
+{
+       BazFooParamSpecBar1* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, BAZ_FOO_TYPE_BAR1), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+baz_foo_value_get_bar1 (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, BAZ_FOO_TYPE_BAR1), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+baz_foo_value_set_bar1 (GValue* value,
+                        gpointer v_object)
+{
+       BazFooBar1 * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, BAZ_FOO_TYPE_BAR1));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, BAZ_FOO_TYPE_BAR1));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               baz_foo_bar1_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               baz_foo_bar1_unref (old);
+       }
+}
+
+void
+baz_foo_value_take_bar1 (GValue* value,
+                         gpointer v_object)
+{
+       BazFooBar1 * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, BAZ_FOO_TYPE_BAR1));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, BAZ_FOO_TYPE_BAR1));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               baz_foo_bar1_unref (old);
+       }
+}
+
+static void
+baz_foo_bar1_class_init (BazFooBar1Class * klass,
+                         gpointer klass_data)
+{
+       baz_foo_bar1_parent_class = g_type_class_peek_parent (klass);
+       ((BazFooBar1Class *) klass)->finalize = baz_foo_bar1_finalize;
+}
+
+static void
+baz_foo_bar1_instance_init (BazFooBar1 * self,
+                            gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+baz_foo_bar1_finalize (BazFooBar1 * obj)
+{
+       BazFooBar1 * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, BAZ_FOO_TYPE_BAR1, BazFooBar1);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+baz_foo_bar1_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { baz_foo_value_bar1_init, 
baz_foo_value_bar1_free_value, baz_foo_value_bar1_copy_value, baz_foo_value_bar1_peek_pointer, "p", 
baz_foo_value_bar1_collect_value, "p", baz_foo_value_bar1_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (BazFooBar1Class), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) baz_foo_bar1_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(BazFooBar1), 0, (GInstanceInitFunc) baz_foo_bar1_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType baz_foo_bar1_type_id;
+       baz_foo_bar1_type_id = g_type_register_fundamental (g_type_fundamental_next (), "BazFooBar1", 
&g_define_type_info, &g_define_type_fundamental_info, 0);
+       return baz_foo_bar1_type_id;
+}
+
+GType
+baz_foo_bar1_get_type (void)
+{
+       static volatile gsize baz_foo_bar1_type_id__volatile = 0;
+       if (g_once_init_enter (&baz_foo_bar1_type_id__volatile)) {
+               GType baz_foo_bar1_type_id;
+               baz_foo_bar1_type_id = baz_foo_bar1_get_type_once ();
+               g_once_init_leave (&baz_foo_bar1_type_id__volatile, baz_foo_bar1_type_id);
+       }
+       return baz_foo_bar1_type_id__volatile;
+}
+
+gpointer
+baz_foo_bar1_ref (gpointer instance)
+{
+       BazFooBar1 * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+baz_foo_bar1_unref (gpointer instance)
+{
+       BazFooBar1 * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               BAZ_FOO_BAR1_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+baz_foo_ibar1_default_init (BazFooIBar1Iface * iface,
+                            gpointer iface_data)
+{
+}
+
+static GType
+baz_foo_ibar1_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BazFooIBar1Iface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) baz_foo_ibar1_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType baz_foo_ibar1_type_id;
+       baz_foo_ibar1_type_id = g_type_register_static (G_TYPE_INTERFACE, "BazFooIBar1", &g_define_type_info, 
0);
+       g_type_interface_add_prerequisite (baz_foo_ibar1_type_id, BAZ_FOO_TYPE_BAR1);
+       return baz_foo_ibar1_type_id;
+}
+
+GType
+baz_foo_ibar1_get_type (void)
+{
+       static volatile gsize baz_foo_ibar1_type_id__volatile = 0;
+       if (g_once_init_enter (&baz_foo_ibar1_type_id__volatile)) {
+               GType baz_foo_ibar1_type_id;
+               baz_foo_ibar1_type_id = baz_foo_ibar1_get_type_once ();
+               g_once_init_leave (&baz_foo_ibar1_type_id__volatile, baz_foo_ibar1_type_id);
+       }
+       return baz_foo_ibar1_type_id__volatile;
+}
+
+static void
+baz_value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+baz_value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               baz_foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+baz_value_foo_copy_value (const GValue* src_value,
+                          GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = baz_foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+baz_value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+baz_value_foo_collect_value (GValue* value,
+                             guint n_collect_values,
+                             GTypeCValue* collect_values,
+                             guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               BazFoo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = baz_foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+baz_value_foo_lcopy_value (const GValue* value,
+                           guint n_collect_values,
+                           GTypeCValue* collect_values,
+                           guint collect_flags)
+{
+       BazFoo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = baz_foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+baz_param_spec_foo (const gchar* name,
+                    const gchar* nick,
+                    const gchar* blurb,
+                    GType object_type,
+                    GParamFlags flags)
+{
+       BazParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, BAZ_TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+baz_value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, BAZ_TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+baz_value_set_foo (GValue* value,
+                   gpointer v_object)
+{
+       BazFoo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, BAZ_TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, BAZ_TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               baz_foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               baz_foo_unref (old);
+       }
+}
+
+void
+baz_value_take_foo (GValue* value,
+                    gpointer v_object)
+{
+       BazFoo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, BAZ_TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, BAZ_TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               baz_foo_unref (old);
+       }
+}
+
+static void
+baz_foo_class_init (BazFooClass * klass,
+                    gpointer klass_data)
+{
+       baz_foo_parent_class = g_type_class_peek_parent (klass);
+       ((BazFooClass *) klass)->finalize = baz_foo_finalize;
+}
+
+static void
+baz_foo_instance_init (BazFoo * self,
+                       gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+baz_foo_finalize (BazFoo * obj)
+{
+       BazFoo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, BAZ_TYPE_FOO, BazFoo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+baz_foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { baz_value_foo_init, 
baz_value_foo_free_value, baz_value_foo_copy_value, baz_value_foo_peek_pointer, "p", 
baz_value_foo_collect_value, "p", baz_value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (BazFooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) baz_foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(BazFoo), 0, (GInstanceInitFunc) baz_foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType baz_foo_type_id;
+       baz_foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "BazFoo", 
&g_define_type_info, &g_define_type_fundamental_info, 0);
+       return baz_foo_type_id;
+}
+
+GType
+baz_foo_get_type (void)
+{
+       static volatile gsize baz_foo_type_id__volatile = 0;
+       if (g_once_init_enter (&baz_foo_type_id__volatile)) {
+               GType baz_foo_type_id;
+               baz_foo_type_id = baz_foo_get_type_once ();
+               g_once_init_leave (&baz_foo_type_id__volatile, baz_foo_type_id);
+       }
+       return baz_foo_type_id__volatile;
+}
+
+gpointer
+baz_foo_ref (gpointer instance)
+{
+       BazFoo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+baz_foo_unref (gpointer instance)
+{
+       BazFoo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               BAZ_FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+BazIFooBar2*
+baz_ifoo_bar2_construct (GType object_type)
+{
+       BazIFooBar2* self = NULL;
+       self = (BazIFooBar2*) g_type_create_instance (object_type);
+       return self;
+}
+
+BazIFooBar2*
+baz_ifoo_bar2_new (void)
+{
+       return baz_ifoo_bar2_construct (BAZ_IFOO_TYPE_BAR2);
+}
+
+static void
+baz_ifoo_value_bar2_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+baz_ifoo_value_bar2_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               baz_ifoo_bar2_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+baz_ifoo_value_bar2_copy_value (const GValue* src_value,
+                                GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = baz_ifoo_bar2_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+baz_ifoo_value_bar2_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+baz_ifoo_value_bar2_collect_value (GValue* value,
+                                   guint n_collect_values,
+                                   GTypeCValue* collect_values,
+                                   guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               BazIFooBar2 * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = baz_ifoo_bar2_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+baz_ifoo_value_bar2_lcopy_value (const GValue* value,
+                                 guint n_collect_values,
+                                 GTypeCValue* collect_values,
+                                 guint collect_flags)
+{
+       BazIFooBar2 ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = baz_ifoo_bar2_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+baz_ifoo_param_spec_bar2 (const gchar* name,
+                          const gchar* nick,
+                          const gchar* blurb,
+                          GType object_type,
+                          GParamFlags flags)
+{
+       BazIFooParamSpecBar2* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, BAZ_IFOO_TYPE_BAR2), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+baz_ifoo_value_get_bar2 (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, BAZ_IFOO_TYPE_BAR2), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+baz_ifoo_value_set_bar2 (GValue* value,
+                         gpointer v_object)
+{
+       BazIFooBar2 * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, BAZ_IFOO_TYPE_BAR2));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, BAZ_IFOO_TYPE_BAR2));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               baz_ifoo_bar2_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               baz_ifoo_bar2_unref (old);
+       }
+}
+
+void
+baz_ifoo_value_take_bar2 (GValue* value,
+                          gpointer v_object)
+{
+       BazIFooBar2 * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, BAZ_IFOO_TYPE_BAR2));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, BAZ_IFOO_TYPE_BAR2));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               baz_ifoo_bar2_unref (old);
+       }
+}
+
+static void
+baz_ifoo_bar2_class_init (BazIFooBar2Class * klass,
+                          gpointer klass_data)
+{
+       baz_ifoo_bar2_parent_class = g_type_class_peek_parent (klass);
+       ((BazIFooBar2Class *) klass)->finalize = baz_ifoo_bar2_finalize;
+}
+
+static void
+baz_ifoo_bar2_instance_init (BazIFooBar2 * self,
+                             gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+baz_ifoo_bar2_finalize (BazIFooBar2 * obj)
+{
+       BazIFooBar2 * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, BAZ_IFOO_TYPE_BAR2, BazIFooBar2);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+baz_ifoo_bar2_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { baz_ifoo_value_bar2_init, 
baz_ifoo_value_bar2_free_value, baz_ifoo_value_bar2_copy_value, baz_ifoo_value_bar2_peek_pointer, "p", 
baz_ifoo_value_bar2_collect_value, "p", baz_ifoo_value_bar2_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (BazIFooBar2Class), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) baz_ifoo_bar2_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(BazIFooBar2), 0, (GInstanceInitFunc) baz_ifoo_bar2_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType baz_ifoo_bar2_type_id;
+       baz_ifoo_bar2_type_id = g_type_register_fundamental (g_type_fundamental_next (), "BazIFooBar2", 
&g_define_type_info, &g_define_type_fundamental_info, 0);
+       return baz_ifoo_bar2_type_id;
+}
+
+GType
+baz_ifoo_bar2_get_type (void)
+{
+       static volatile gsize baz_ifoo_bar2_type_id__volatile = 0;
+       if (g_once_init_enter (&baz_ifoo_bar2_type_id__volatile)) {
+               GType baz_ifoo_bar2_type_id;
+               baz_ifoo_bar2_type_id = baz_ifoo_bar2_get_type_once ();
+               g_once_init_leave (&baz_ifoo_bar2_type_id__volatile, baz_ifoo_bar2_type_id);
+       }
+       return baz_ifoo_bar2_type_id__volatile;
+}
+
+gpointer
+baz_ifoo_bar2_ref (gpointer instance)
+{
+       BazIFooBar2 * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+baz_ifoo_bar2_unref (gpointer instance)
+{
+       BazIFooBar2 * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               BAZ_IFOO_BAR2_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+baz_ifoo_ibar2_default_init (BazIFooIBar2Iface * iface,
+                             gpointer iface_data)
+{
+}
+
+static GType
+baz_ifoo_ibar2_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BazIFooIBar2Iface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) baz_ifoo_ibar2_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 
0, (GInstanceInitFunc) NULL, NULL };
+       GType baz_ifoo_ibar2_type_id;
+       baz_ifoo_ibar2_type_id = g_type_register_static (G_TYPE_INTERFACE, "BazIFooIBar2", 
&g_define_type_info, 0);
+       g_type_interface_add_prerequisite (baz_ifoo_ibar2_type_id, BAZ_IFOO_TYPE_BAR2);
+       return baz_ifoo_ibar2_type_id;
+}
+
+GType
+baz_ifoo_ibar2_get_type (void)
+{
+       static volatile gsize baz_ifoo_ibar2_type_id__volatile = 0;
+       if (g_once_init_enter (&baz_ifoo_ibar2_type_id__volatile)) {
+               GType baz_ifoo_ibar2_type_id;
+               baz_ifoo_ibar2_type_id = baz_ifoo_ibar2_get_type_once ();
+               g_once_init_leave (&baz_ifoo_ibar2_type_id__volatile, baz_ifoo_ibar2_type_id);
+       }
+       return baz_ifoo_ibar2_type_id__volatile;
+}
+
+static void
+baz_ifoo_default_init (BazIFooIface * iface,
+                       gpointer iface_data)
+{
+}
+
+static GType
+baz_ifoo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BazIFooIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) baz_ifoo_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType baz_ifoo_type_id;
+       baz_ifoo_type_id = g_type_register_static (G_TYPE_INTERFACE, "BazIFoo", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (baz_ifoo_type_id, BAZ_TYPE_FOO);
+       return baz_ifoo_type_id;
+}
+
+GType
+baz_ifoo_get_type (void)
+{
+       static volatile gsize baz_ifoo_type_id__volatile = 0;
+       if (g_once_init_enter (&baz_ifoo_type_id__volatile)) {
+               GType baz_ifoo_type_id;
+               baz_ifoo_type_id = baz_ifoo_get_type_once ();
+               g_once_init_leave (&baz_ifoo_type_id__volatile, baz_ifoo_type_id);
+       }
+       return baz_ifoo_type_id__volatile;
+}
+
+BazFooBar1*
+manam_foo1 (Manam* self)
+{
+       BazFooBar1* result = NULL;
+       g_return_val_if_fail (IS_MANAM (self), NULL);
+       result = NULL;
+       return result;
+}
+
+BazFooIBar1*
+manam_ifoo1 (Manam* self)
+{
+       BazFooIBar1* result = NULL;
+       g_return_val_if_fail (IS_MANAM (self), NULL);
+       result = NULL;
+       return result;
+}
+
+BazIFooBar2*
+manam_foo2 (Manam* self)
+{
+       BazIFooBar2* result = NULL;
+       g_return_val_if_fail (IS_MANAM (self), NULL);
+       result = NULL;
+       return result;
+}
+
+BazIFooIBar2*
+manam_ifoo2 (Manam* self)
+{
+       BazIFooIBar2* result = NULL;
+       g_return_val_if_fail (IS_MANAM (self), NULL);
+       result = NULL;
+       return result;
+}
+
+Manam*
+manam_construct (GType object_type)
+{
+       Manam* self = NULL;
+       self = (Manam*) baz_foo_construct (object_type);
+       return self;
+}
+
+Manam*
+manam_new (void)
+{
+       return manam_construct (TYPE_MANAM);
+}
+
+static void
+manam_class_init (ManamClass * klass,
+                  gpointer klass_data)
+{
+       manam_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+manam_baz_ifoo_interface_init (BazIFooIface * iface,
+                               gpointer iface_data)
+{
+       manam_baz_ifoo_parent_iface = g_type_interface_peek_parent (iface);
+}
+
+static void
+manam_instance_init (Manam * self,
+                     gpointer klass)
+{
+}
+
+static GType
+manam_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (ManamClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) manam_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Manam), 
0, (GInstanceInitFunc) manam_instance_init, NULL };
+       static const GInterfaceInfo baz_ifoo_info = { (GInterfaceInitFunc) manam_baz_ifoo_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       GType manam_type_id;
+       manam_type_id = g_type_register_static (BAZ_TYPE_FOO, "Manam", &g_define_type_info, 0);
+       g_type_add_interface_static (manam_type_id, BAZ_TYPE_IFOO, &baz_ifoo_info);
+       return manam_type_id;
+}
+
+GType
+manam_get_type (void)
+{
+       static volatile gsize manam_type_id__volatile = 0;
+       if (g_once_init_enter (&manam_type_id__volatile)) {
+               GType manam_type_id;
+               manam_type_id = manam_get_type_once ();
+               g_once_init_leave (&manam_type_id__volatile, manam_type_id);
+       }
+       return manam_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Manam* manam = NULL;
+       Manam* _tmp0_;
+       BazFooBar1* _tmp1_;
+       BazFooBar1* _tmp2_;
+       BazFooIBar1* _tmp3_;
+       BazFooIBar1* _tmp4_;
+       BazIFooBar2* _tmp5_;
+       BazIFooBar2* _tmp6_;
+       BazIFooIBar2* _tmp7_;
+       BazIFooIBar2* _tmp8_;
+       _tmp0_ = manam_new ();
+       manam = _tmp0_;
+       _tmp1_ = manam_foo1 (manam);
+       _tmp2_ = _tmp1_;
+       _baz_foo_bar1_unref0 (_tmp2_);
+       _tmp3_ = manam_ifoo1 (manam);
+       _tmp4_ = _tmp3_;
+       _baz_foo_bar1_unref0 (_tmp4_);
+       _tmp5_ = manam_foo2 (manam);
+       _tmp6_ = _tmp5_;
+       _baz_ifoo_bar2_unref0 (_tmp6_);
+       _tmp7_ = manam_ifoo2 (manam);
+       _tmp8_ = _tmp7_;
+       _baz_ifoo_bar2_unref0 (_tmp8_);
+       _baz_foo_unref0 (manam);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/scanner/regex-escape-x.c-expected b/tests/scanner/regex-escape-x.c-expected
new file mode 100644
index 000000000..e330cc025
--- /dev/null
+++ b/tests/scanner/regex-escape-x.c-expected
@@ -0,0 +1,47 @@
+/* scanner_regex_escape_x.c generated by valac, the Vala compiler
+ * generated from scanner_regex_escape_x.vala, do not modify */
+
+#include <glib.h>
+
+#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
+
+static void _vala_main (void);
+
+static GRegex* _tmp_regex_0 = NULL;
+
+static inline GRegex*
+_thread_safe_regex_init (GRegex** re,
+                         const gchar * pattern,
+                         GRegexCompileFlags compile_flags)
+{
+       if (g_once_init_enter ((volatile gsize*) re)) {
+               GRegex* val = g_regex_new (pattern, compile_flags, 0, NULL);
+               g_once_init_leave ((volatile gsize*) re, (gsize) val);
+       }
+       return *re;
+}
+
+static gpointer
+_g_regex_ref0 (gpointer self)
+{
+       return self ? g_regex_ref (self) : NULL;
+}
+
+static void
+_vala_main (void)
+{
+       GRegex* foo = NULL;
+       GRegex* _tmp0_;
+       _tmp0_ = _g_regex_ref0 (_thread_safe_regex_init (&_tmp_regex_0, "\\x10\\x00\\x00aa", 0 | 
G_REGEX_DOTALL));
+       foo = _tmp0_;
+       _g_regex_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/scanner/string-escape-x.c-expected b/tests/scanner/string-escape-x.c-expected
new file mode 100644
index 000000000..06567f0b3
--- /dev/null
+++ b/tests/scanner/string-escape-x.c-expected
@@ -0,0 +1,29 @@
+/* scanner_string_escape_x.c generated by valac, the Vala compiler
+ * generated from scanner_string_escape_x.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+       gchar* foo = NULL;
+       gchar* _tmp0_;
+       _tmp0_ = g_strdup ("\x10\x00\x00aa");
+       foo = _tmp0_;
+       _g_free0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/semantic/assignment-same-variable.c-expected 
b/tests/semantic/assignment-same-variable.c-expected
new file mode 100644
index 000000000..e01ab167c
--- /dev/null
+++ b/tests/semantic/assignment-same-variable.c-expected
@@ -0,0 +1,313 @@
+/* semantic_assignment_same_variable.c generated by valac, the Vala compiler
+ * generated from semantic_assignment_same_variable.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+#define _g_free0(var) (var = (g_free (var), NULL))
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+       gint i;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gpointer foo_parent_class = NULL;
+VALA_EXTERN gint i;
+gint i = 0;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       self->i = self->i;
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->i = 23;
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       gchar* s = NULL;
+       gchar* _tmp0_;
+       const gchar* _tmp1_;
+       gchar* _tmp2_;
+       _tmp0_ = g_strdup ("foo");
+       s = _tmp0_;
+       _tmp1_ = s;
+       _tmp2_ = g_strdup (_tmp1_);
+       _g_free0 (s);
+       s = _tmp2_;
+       i = 42;
+       i = i;
+       _g_free0 (s);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/semantic/class-opaque-automatic-property.c-expected 
b/tests/semantic/class-opaque-automatic-property.c-expected
new file mode 100644
index 000000000..a60070aeb
--- /dev/null
+++ b/tests/semantic/class-opaque-automatic-property.c-expected
@@ -0,0 +1,96 @@
+/* semantic_class_opaque_automatic_property.c generated by valac, the Vala compiler
+ * generated from semantic_class_opaque_automatic_property.vala, do not modify */
+
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef struct _Foo Foo;
+#define _foo_free0(var) ((var == NULL) ? NULL : (var = (foo_free (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       gint _bar;
+};
+
+VALA_EXTERN void foo_free (Foo * self);
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_free)
+static void foo_instance_init (Foo * self);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN gint foo_get_bar (Foo* self);
+VALA_EXTERN void foo_set_bar (Foo* self,
+                  gint value);
+static void _vala_main (void);
+
+Foo*
+foo_new (void)
+{
+       Foo* self;
+       self = g_slice_new0 (Foo);
+       foo_instance_init (self);
+       return self;
+}
+
+gint
+foo_get_bar (Foo* self)
+{
+       gint result;
+       g_return_val_if_fail (self != NULL, 0);
+       result = self->_bar;
+       return result;
+}
+
+void
+foo_set_bar (Foo* self,
+             gint value)
+{
+       g_return_if_fail (self != NULL);
+       self->_bar = value;
+}
+
+static void
+foo_instance_init (Foo * self)
+{
+}
+
+void
+foo_free (Foo * self)
+{
+       g_slice_free (Foo, self);
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       gint _tmp1_;
+       gint _tmp2_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       foo_set_bar (foo, 42);
+       _tmp1_ = foo_get_bar (foo);
+       _tmp2_ = _tmp1_;
+       _vala_assert (_tmp2_ == 42, "foo.bar == 42");
+       _foo_free0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/semantic/class-opaque.c-expected b/tests/semantic/class-opaque.c-expected
new file mode 100644
index 000000000..48718206e
--- /dev/null
+++ b/tests/semantic/class-opaque.c-expected
@@ -0,0 +1,85 @@
+/* semantic_class_opaque.c generated by valac, the Vala compiler
+ * generated from semantic_class_opaque.vala, do not modify */
+
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef struct _Foo Foo;
+#define _foo_free0(var) ((var == NULL) ? NULL : (var = (foo_free (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       gint i;
+       gint j;
+};
+
+VALA_EXTERN void foo_free (Foo * self);
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_free)
+static void foo_instance_init (Foo * self);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN gint foo_get_i (Foo* self);
+static void _vala_main (void);
+
+Foo*
+foo_new (void)
+{
+       Foo* self;
+       self = g_slice_new0 (Foo);
+       foo_instance_init (self);
+       self->i = 42;
+       return self;
+}
+
+gint
+foo_get_i (Foo* self)
+{
+       gint result = 0;
+       g_return_val_if_fail (self != NULL, 0);
+       result = self->i;
+       return result;
+}
+
+static void
+foo_instance_init (Foo * self)
+{
+}
+
+void
+foo_free (Foo * self)
+{
+       g_slice_free (Foo, self);
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       foo->j = 23;
+       _vala_assert (foo->j == 23, "foo.j == 23");
+       _vala_assert (foo_get_i (foo) == 42, "foo.get_i () == 42");
+       _foo_free0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/semantic/floating-reference-base-method.c-expected 
b/tests/semantic/floating-reference-base-method.c-expected
new file mode 100644
index 000000000..36f0b6a06
--- /dev/null
+++ b/tests/semantic/floating-reference-base-method.c-expected
@@ -0,0 +1,631 @@
+/* semantic_floating_reference_base_method.c generated by valac, the Vala compiler
+ * generated from semantic_floating_reference_base_method.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_IFOO (ifoo_get_type ())
+#define IFOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IFOO, IFoo))
+#define IS_IFOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IFOO))
+#define IFOO_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_IFOO, IFooIface))
+
+typedef struct _IFoo IFoo;
+typedef struct _IFooIface IFooIface;
+
+#define TYPE_IBAR (ibar_get_type ())
+#define IBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IBAR, IBar))
+#define IS_IBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IBAR))
+#define IBAR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_IBAR, IBarIface))
+
+typedef struct _IBar IBar;
+typedef struct _IBarIface IBarIface;
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+#define TYPE_MANAM (manam_get_type ())
+#define MANAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MANAM, Manam))
+#define MANAM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MANAM, ManamClass))
+#define IS_MANAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MANAM))
+#define IS_MANAM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MANAM))
+#define MANAM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MANAM, ManamClass))
+
+typedef struct _Manam Manam;
+typedef struct _ManamClass ManamClass;
+typedef struct _ManamPrivate ManamPrivate;
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+
+struct _IFooIface {
+       GTypeInterface parent_iface;
+       GInitiallyUnowned* (*foo) (IFoo* self);
+};
+
+struct _IBarIface {
+       GTypeInterface parent_iface;
+       GInitiallyUnowned* (*bar) (IBar* self);
+};
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+       GInitiallyUnowned* (*faz) (Foo* self);
+       GInitiallyUnowned* (*baz) (Foo* self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+struct _Manam {
+       Foo parent_instance;
+       ManamPrivate * priv;
+};
+
+struct _ManamClass {
+       FooClass parent_class;
+};
+
+static gpointer foo_parent_class = NULL;
+static IFooIface * foo_ifoo_parent_iface = NULL;
+static IBarIface * foo_ibar_parent_iface = NULL;
+static gpointer manam_parent_class = NULL;
+
+VALA_EXTERN GType ifoo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN GInitiallyUnowned* ifoo_foo (IFoo* self);
+static GType ifoo_get_type_once (void);
+VALA_EXTERN GType ibar_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN GInitiallyUnowned* ibar_bar (IBar* self);
+static GType ibar_get_type_once (void);
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN GInitiallyUnowned* foo_faz (Foo* self);
+VALA_EXTERN GInitiallyUnowned* foo_baz (Foo* self);
+static GInitiallyUnowned* foo_real_foo (IFoo* base);
+static GInitiallyUnowned* foo_real_bar (IBar* base);
+static GInitiallyUnowned* foo_real_faz (Foo* self);
+static GInitiallyUnowned* foo_real_baz (Foo* self);
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN GType manam_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Manam, foo_unref)
+static GInitiallyUnowned* manam_real_faz (Foo* base);
+static GInitiallyUnowned* manam_real_baz (Foo* base);
+VALA_EXTERN Manam* manam_new (void);
+VALA_EXTERN Manam* manam_construct (GType object_type);
+static GType manam_get_type_once (void);
+static void _vala_main (void);
+
+GInitiallyUnowned*
+ifoo_foo (IFoo* self)
+{
+       IFooIface* _iface_;
+       g_return_val_if_fail (IS_IFOO (self), NULL);
+       _iface_ = IFOO_GET_INTERFACE (self);
+       if (_iface_->foo) {
+               return _iface_->foo (self);
+       }
+       return NULL;
+}
+
+static void
+ifoo_default_init (IFooIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+ifoo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (IFooIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) ifoo_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType ifoo_type_id;
+       ifoo_type_id = g_type_register_static (G_TYPE_INTERFACE, "IFoo", &g_define_type_info, 0);
+       return ifoo_type_id;
+}
+
+GType
+ifoo_get_type (void)
+{
+       static volatile gsize ifoo_type_id__volatile = 0;
+       if (g_once_init_enter (&ifoo_type_id__volatile)) {
+               GType ifoo_type_id;
+               ifoo_type_id = ifoo_get_type_once ();
+               g_once_init_leave (&ifoo_type_id__volatile, ifoo_type_id);
+       }
+       return ifoo_type_id__volatile;
+}
+
+GInitiallyUnowned*
+ibar_bar (IBar* self)
+{
+       IBarIface* _iface_;
+       g_return_val_if_fail (IS_IBAR (self), NULL);
+       _iface_ = IBAR_GET_INTERFACE (self);
+       if (_iface_->bar) {
+               return _iface_->bar (self);
+       }
+       return NULL;
+}
+
+static void
+ibar_default_init (IBarIface * iface,
+                   gpointer iface_data)
+{
+}
+
+static GType
+ibar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (IBarIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) ibar_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType ibar_type_id;
+       ibar_type_id = g_type_register_static (G_TYPE_INTERFACE, "IBar", &g_define_type_info, 0);
+       return ibar_type_id;
+}
+
+GType
+ibar_get_type (void)
+{
+       static volatile gsize ibar_type_id__volatile = 0;
+       if (g_once_init_enter (&ibar_type_id__volatile)) {
+               GType ibar_type_id;
+               ibar_type_id = ibar_get_type_once ();
+               g_once_init_leave (&ibar_type_id__volatile, ibar_type_id);
+       }
+       return ibar_type_id__volatile;
+}
+
+static GInitiallyUnowned*
+foo_real_foo (IFoo* base)
+{
+       Foo * self;
+       GInitiallyUnowned* result = NULL;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_FOO, Foo);
+       result = NULL;
+       return result;
+}
+
+static GInitiallyUnowned*
+foo_real_bar (IBar* base)
+{
+       Foo * self;
+       GInitiallyUnowned* result = NULL;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_FOO, Foo);
+       result = NULL;
+       return result;
+}
+
+static GInitiallyUnowned*
+foo_real_faz (Foo* self)
+{
+       GInitiallyUnowned* result = NULL;
+       result = NULL;
+       return result;
+}
+
+GInitiallyUnowned*
+foo_faz (Foo* self)
+{
+       FooClass* _klass_;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->faz) {
+               return _klass_->faz (self);
+       }
+       return NULL;
+}
+
+static GInitiallyUnowned*
+foo_real_baz (Foo* self)
+{
+       GInitiallyUnowned* result = NULL;
+       result = NULL;
+       return result;
+}
+
+GInitiallyUnowned*
+foo_baz (Foo* self)
+{
+       FooClass* _klass_;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _klass_ = FOO_GET_CLASS (self);
+       if (_klass_->baz) {
+               return _klass_->baz (self);
+       }
+       return NULL;
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+       ((FooClass *) klass)->faz = (GInitiallyUnowned* (*) (Foo*)) foo_real_faz;
+       ((FooClass *) klass)->baz = (GInitiallyUnowned* (*) (Foo*)) foo_real_baz;
+}
+
+static void
+foo_ifoo_interface_init (IFooIface * iface,
+                         gpointer iface_data)
+{
+       foo_ifoo_parent_iface = g_type_interface_peek_parent (iface);
+       iface->foo = (GInitiallyUnowned* (*) (IFoo*)) foo_real_foo;
+}
+
+static void
+foo_ibar_interface_init (IBarIface * iface,
+                         gpointer iface_data)
+{
+       foo_ibar_parent_iface = g_type_interface_peek_parent (iface);
+       iface->bar = (GInitiallyUnowned* (*) (IBar*)) foo_real_bar;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       static const GInterfaceInfo ifoo_info = { (GInterfaceInitFunc) foo_ifoo_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       static const GInterfaceInfo ibar_info = { (GInterfaceInitFunc) foo_ibar_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       g_type_add_interface_static (foo_type_id, TYPE_IFOO, &ifoo_info);
+       g_type_add_interface_static (foo_type_id, TYPE_IBAR, &ibar_info);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static GInitiallyUnowned*
+manam_real_faz (Foo* base)
+{
+       Manam * self;
+       GInitiallyUnowned* result = NULL;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_MANAM, Manam);
+       result = NULL;
+       return result;
+}
+
+static GInitiallyUnowned*
+manam_real_baz (Foo* base)
+{
+       Manam * self;
+       GInitiallyUnowned* result = NULL;
+       self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_MANAM, Manam);
+       result = NULL;
+       return result;
+}
+
+Manam*
+manam_construct (GType object_type)
+{
+       Manam* self = NULL;
+       self = (Manam*) foo_construct (object_type);
+       return self;
+}
+
+Manam*
+manam_new (void)
+{
+       return manam_construct (TYPE_MANAM);
+}
+
+static void
+manam_class_init (ManamClass * klass,
+                  gpointer klass_data)
+{
+       manam_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->faz = (GInitiallyUnowned* (*) (Foo*)) manam_real_faz;
+       ((FooClass *) klass)->baz = (GInitiallyUnowned* (*) (Foo*)) manam_real_baz;
+}
+
+static void
+manam_instance_init (Manam * self,
+                     gpointer klass)
+{
+}
+
+static GType
+manam_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (ManamClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) manam_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Manam), 
0, (GInstanceInitFunc) manam_instance_init, NULL };
+       GType manam_type_id;
+       manam_type_id = g_type_register_static (TYPE_FOO, "Manam", &g_define_type_info, 0);
+       return manam_type_id;
+}
+
+GType
+manam_get_type (void)
+{
+       static volatile gsize manam_type_id__volatile = 0;
+       if (g_once_init_enter (&manam_type_id__volatile)) {
+               GType manam_type_id;
+               manam_type_id = manam_get_type_once ();
+               g_once_init_leave (&manam_type_id__volatile, manam_type_id);
+       }
+       return manam_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Manam* manam = NULL;
+       Manam* _tmp0_;
+       GInitiallyUnowned* _tmp1_;
+       GInitiallyUnowned* _tmp2_;
+       GInitiallyUnowned* _tmp3_;
+       GInitiallyUnowned* _tmp4_;
+       GInitiallyUnowned* _tmp5_;
+       GInitiallyUnowned* _tmp6_;
+       GInitiallyUnowned* _tmp7_;
+       GInitiallyUnowned* _tmp8_;
+       _tmp0_ = manam_new ();
+       manam = _tmp0_;
+       _tmp1_ = ifoo_foo (G_TYPE_CHECK_INSTANCE_CAST (manam, TYPE_IFOO, IFoo));
+       if (_tmp1_ != NULL) {
+               g_object_ref_sink (_tmp1_);
+       }
+       _tmp2_ = _tmp1_;
+       _g_object_unref0 (_tmp2_);
+       _tmp3_ = ibar_bar (G_TYPE_CHECK_INSTANCE_CAST (manam, TYPE_IBAR, IBar));
+       if (_tmp3_ != NULL) {
+               g_object_ref_sink (_tmp3_);
+       }
+       _tmp4_ = _tmp3_;
+       _g_object_unref0 (_tmp4_);
+       _tmp5_ = foo_faz (G_TYPE_CHECK_INSTANCE_CAST (manam, TYPE_FOO, Foo));
+       if (_tmp5_ != NULL) {
+               g_object_ref_sink (_tmp5_);
+       }
+       _tmp6_ = _tmp5_;
+       _g_object_unref0 (_tmp6_);
+       _tmp7_ = foo_baz (G_TYPE_CHECK_INSTANCE_CAST (manam, TYPE_FOO, Foo));
+       if (_tmp7_ != NULL) {
+               g_object_ref_sink (_tmp7_);
+       }
+       _tmp8_ = _tmp7_;
+       _g_object_unref0 (_tmp8_);
+       _foo_unref0 (manam);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/semantic/floating-reference-error.c-expected 
b/tests/semantic/floating-reference-error.c-expected
new file mode 100644
index 000000000..862e51930
--- /dev/null
+++ b/tests/semantic/floating-reference-error.c-expected
@@ -0,0 +1,107 @@
+/* semantic_floating_reference_error.c generated by valac, the Vala compiler
+ * generated from semantic_floating_reference_error.vala, do not modify */
+
+#include <glib.h>
+#include <stdarg.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN GVariant* get_floating_variant_with_error (GError** error);
+VALA_EXTERN void variant_args (gint first,
+                   ...);
+static void _vala_main (void);
+
+GVariant*
+get_floating_variant_with_error (GError** error)
+{
+       GVariant* _tmp0_;
+       GVariant* result = NULL;
+       _tmp0_ = g_variant_new_string ("bar");
+       result = _tmp0_;
+       return result;
+}
+
+void
+variant_args (gint first,
+              ...)
+{
+       va_list va = {0};
+       GVariant* _tmp0_;
+       va_start (va, first);
+       _tmp0_ = va_arg (va, GVariant*);
+       _vala_assert (!g_variant_is_floating (_tmp0_), "!va.arg<Variant> ().is_floating ()");
+       va_end (va);
+}
+
+static void
+_vala_main (void)
+{
+       GError* _inner_error0_ = NULL;
+       {
+               GVariant* _tmp0_ = NULL;
+               GVariant* _tmp1_;
+               _tmp1_ = get_floating_variant_with_error (&_inner_error0_);
+               if (_tmp1_ != NULL) {
+                       g_variant_ref_sink (_tmp1_);
+               }
+               _tmp0_ = _tmp1_;
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+               variant_args (23, _tmp0_, NULL);
+               _g_variant_unref0 (_tmp0_);
+       }
+       {
+               {
+                       GVariant* _tmp2_ = NULL;
+                       GVariant* _tmp3_;
+                       _tmp3_ = get_floating_variant_with_error (&_inner_error0_);
+                       if (_tmp3_ != NULL) {
+                               g_variant_ref_sink (_tmp3_);
+                       }
+                       _tmp2_ = _tmp3_;
+                       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                               goto __catch0_g_error;
+                       }
+                       variant_args (42, _tmp2_, NULL);
+                       _g_variant_unref0 (_tmp2_);
+               }
+               goto __finally0;
+               __catch0_g_error:
+               {
+                       g_clear_error (&_inner_error0_);
+                       g_assert_not_reached ();
+               }
+               __finally0:
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/semantic/floating-reference.c-expected b/tests/semantic/floating-reference.c-expected
new file mode 100644
index 000000000..f15e34da0
--- /dev/null
+++ b/tests/semantic/floating-reference.c-expected
@@ -0,0 +1,330 @@
+/* semantic_floating_reference.c generated by valac, the Vala compiler
+ * generated from semantic_floating_reference.vala, do not modify */
+
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _g_variant_type_free0(var) ((var == NULL) ? NULL : (var = (g_variant_type_free (var), NULL)))
+#define _g_variant_builder_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_builder_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN GVariant* get_floating_variant (void);
+VALA_EXTERN GVariant* get_floating_variant_with_error (GError** error);
+VALA_EXTERN void test_variant (void);
+static gchar* _variant_get1 (GVariant* value);
+VALA_EXTERN void test_variant_builder (void);
+static void _vala_main (void);
+
+GVariant*
+get_floating_variant (void)
+{
+       GVariant* _tmp0_;
+       GVariant* result = NULL;
+       _tmp0_ = g_variant_new_string ("foo");
+       result = _tmp0_;
+       return result;
+}
+
+GVariant*
+get_floating_variant_with_error (GError** error)
+{
+       GVariant* _tmp0_;
+       GVariant* result = NULL;
+       _tmp0_ = g_variant_new_string ("bar");
+       result = _tmp0_;
+       return result;
+}
+
+static gpointer
+_g_variant_ref0 (gpointer self)
+{
+       return self ? g_variant_ref (self) : NULL;
+}
+
+static gchar*
+_variant_get1 (GVariant* value)
+{
+       return g_variant_dup_string (value, NULL);
+}
+
+void
+test_variant (void)
+{
+       GError* _inner_error0_ = NULL;
+       {
+               gchar* value = NULL;
+               gchar* _tmp0_;
+               GVariant* _tmp1_ = NULL;
+               const gchar* _tmp2_;
+               GVariant* _tmp3_;
+               GVariant* variant = NULL;
+               GVariant* _tmp6_;
+               GVariant* _tmp7_;
+               const GVariantType* _tmp8_;
+               GVariant* _tmp9_;
+               _tmp0_ = g_strdup ("bar");
+               value = _tmp0_;
+               _tmp2_ = value;
+               _tmp3_ = g_variant_new_string (_tmp2_);
+               _tmp1_ = _tmp3_;
+               if (_tmp1_ == NULL) {
+                       const gchar* _tmp4_;
+                       GVariant* _tmp5_;
+                       _tmp4_ = value;
+                       _tmp5_ = g_variant_new_string (_tmp4_);
+                       _g_variant_unref0 (_tmp1_);
+                       _tmp1_ = _tmp5_;
+               }
+               _tmp6_ = _tmp1_;
+               _tmp1_ = NULL;
+               if (_tmp6_ != NULL) {
+                       g_variant_ref_sink (_tmp6_);
+               }
+               variant = _tmp6_;
+               _tmp7_ = variant;
+               _tmp8_ = G_VARIANT_TYPE_STRING;
+               _vala_assert (g_variant_is_of_type (_tmp7_, _tmp8_), "variant.is_of_type 
(VariantType.STRING)");
+               _tmp9_ = variant;
+               _vala_assert (!g_variant_is_floating (_tmp9_), "!variant.is_floating ()");
+               _g_variant_unref0 (variant);
+               _g_variant_unref0 (_tmp1_);
+               _g_free0 (value);
+       }
+       {
+               gchar* value = NULL;
+               gchar* _tmp10_;
+               GVariant* _tmp11_ = NULL;
+               const gchar* _tmp12_;
+               GVariant* variant = NULL;
+               GVariant* _tmp15_;
+               GVariant* _tmp16_;
+               const GVariantType* _tmp17_;
+               GVariant* _tmp18_;
+               _tmp10_ = g_strdup ("foo");
+               value = _tmp10_;
+               _tmp12_ = value;
+               if (_tmp12_ == NULL) {
+                       _g_variant_unref0 (_tmp11_);
+                       _tmp11_ = NULL;
+               } else {
+                       const gchar* _tmp13_;
+                       GVariant* _tmp14_;
+                       _tmp13_ = value;
+                       _tmp14_ = g_variant_new_string (_tmp13_);
+                       g_variant_ref_sink (_tmp14_);
+                       _g_variant_unref0 (_tmp11_);
+                       _tmp11_ = _tmp14_;
+               }
+               _tmp15_ = _g_variant_ref0 (_tmp11_);
+               variant = _tmp15_;
+               _tmp16_ = variant;
+               _tmp17_ = G_VARIANT_TYPE_STRING;
+               _vala_assert (g_variant_is_of_type (_tmp16_, _tmp17_), "variant.is_of_type 
(VariantType.STRING)");
+               _tmp18_ = variant;
+               _vala_assert (!g_variant_is_floating (_tmp18_), "!variant.is_floating ()");
+               _g_variant_unref0 (variant);
+               _g_variant_unref0 (_tmp11_);
+               _g_free0 (value);
+       }
+       {
+               gchar* value = NULL;
+               gchar* _tmp19_;
+               GVariant* variant = NULL;
+               const gchar* _tmp20_;
+               GVariant* _tmp23_;
+               const GVariantType* _tmp24_;
+               GVariant* _tmp25_;
+               _tmp19_ = g_strdup ("foo");
+               value = _tmp19_;
+               _tmp20_ = value;
+               if (_tmp20_ == NULL) {
+                       _g_variant_unref0 (variant);
+                       variant = NULL;
+               } else {
+                       const gchar* _tmp21_;
+                       GVariant* _tmp22_;
+                       _tmp21_ = value;
+                       _tmp22_ = g_variant_new_string (_tmp21_);
+                       g_variant_ref_sink (_tmp22_);
+                       _g_variant_unref0 (variant);
+                       variant = _tmp22_;
+               }
+               _tmp23_ = variant;
+               _tmp24_ = G_VARIANT_TYPE_STRING;
+               _vala_assert (g_variant_is_of_type (_tmp23_, _tmp24_), "variant.is_of_type 
(VariantType.STRING)");
+               _tmp25_ = variant;
+               _vala_assert (!g_variant_is_floating (_tmp25_), "!variant.is_floating ()");
+               _g_variant_unref0 (variant);
+               _g_free0 (value);
+       }
+       {
+               gboolean value = FALSE;
+               GVariant* variant = NULL;
+               GVariant* _tmp26_;
+               const GVariantType* _tmp27_;
+               value = TRUE;
+               _tmp26_ = g_variant_new_boolean (value);
+               g_variant_ref_sink (_tmp26_);
+               variant = _tmp26_;
+               _tmp27_ = G_VARIANT_TYPE_BOOLEAN;
+               _vala_assert (g_variant_is_of_type (variant, _tmp27_), "variant.is_of_type 
(VariantType.BOOLEAN)");
+               _vala_assert (!g_variant_is_floating (variant), "!variant.is_floating ()");
+               _g_variant_unref0 (variant);
+       }
+       {
+               gchar* value = NULL;
+               gchar* _tmp28_;
+               GVariant* variant = NULL;
+               GVariant* _tmp29_;
+               const GVariantType* _tmp30_;
+               gchar* s = NULL;
+               gchar* _tmp31_;
+               _tmp28_ = g_strdup ("manam");
+               value = _tmp28_;
+               _tmp29_ = g_variant_new_string (value);
+               g_variant_ref_sink (_tmp29_);
+               variant = _tmp29_;
+               _tmp30_ = G_VARIANT_TYPE_STRING;
+               _vala_assert (g_variant_is_of_type (variant, _tmp30_), "variant.is_of_type 
(VariantType.STRING)");
+               _vala_assert (!g_variant_is_floating (variant), "!variant.is_floating ()");
+               _tmp31_ = _variant_get1 (variant);
+               s = _tmp31_;
+               _vala_assert (g_strcmp0 (s, "manam") == 0, "s == \"manam\"");
+               _g_free0 (s);
+               _g_variant_unref0 (variant);
+               _g_free0 (value);
+       }
+       {
+               GVariant* variant = NULL;
+               GVariant* _tmp32_;
+               _tmp32_ = get_floating_variant ();
+               g_variant_ref_sink (_tmp32_);
+               variant = _tmp32_;
+               _vala_assert (!g_variant_is_floating (variant), "!variant.is_floating ()");
+               _g_variant_unref0 (variant);
+       }
+       {
+               GVariant* variant = NULL;
+               GVariant* _tmp33_;
+               _tmp33_ = get_floating_variant_with_error (&_inner_error0_);
+               if (_tmp33_ != NULL) {
+                       g_variant_ref_sink (_tmp33_);
+               }
+               variant = _tmp33_;
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+               _vala_assert (!g_variant_is_floating (variant), "!variant.is_floating ()");
+               _g_variant_unref0 (variant);
+       }
+       {
+               {
+                       GVariant* variant = NULL;
+                       GVariant* _tmp34_;
+                       GVariant* _tmp35_;
+                       _tmp34_ = get_floating_variant_with_error (&_inner_error0_);
+                       if (_tmp34_ != NULL) {
+                               g_variant_ref_sink (_tmp34_);
+                       }
+                       variant = _tmp34_;
+                       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                               goto __catch0_g_error;
+                       }
+                       _tmp35_ = variant;
+                       _vala_assert (!g_variant_is_floating (_tmp35_), "!variant.is_floating ()");
+                       _g_variant_unref0 (variant);
+               }
+               goto __finally0;
+               __catch0_g_error:
+               {
+                       g_clear_error (&_inner_error0_);
+                       g_assert_not_reached ();
+               }
+               __finally0:
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+                       g_clear_error (&_inner_error0_);
+                       return;
+               }
+       }
+}
+
+void
+test_variant_builder (void)
+{
+       gchar* name = NULL;
+       gchar* _tmp0_;
+       gchar* key = NULL;
+       gchar* _tmp1_;
+       GVariant* value = NULL;
+       GVariantBuilder* builder = NULL;
+       GVariantType* _tmp2_;
+       GVariantType* _tmp3_;
+       GVariantBuilder* _tmp4_;
+       GVariantBuilder* _tmp5_;
+       GVariant* variant = NULL;
+       GVariant* _tmp6_;
+       GVariant* _tmp7_;
+       GVariant* _tmp8_;
+       GVariant* _tmp9_;
+       _tmp0_ = g_strdup ("foo");
+       name = _tmp0_;
+       _tmp1_ = g_strdup ("bar");
+       key = _tmp1_;
+       value = NULL;
+       _tmp2_ = g_variant_type_new ("a{smv}");
+       _tmp3_ = _tmp2_;
+       _tmp4_ = g_variant_builder_new (_tmp3_);
+       _tmp5_ = _tmp4_;
+       _g_variant_type_free0 (_tmp3_);
+       builder = _tmp5_;
+       g_variant_builder_add (builder, "{smv}", key, value, NULL);
+       _tmp6_ = g_variant_builder_end (builder);
+       g_variant_ref_sink (_tmp6_);
+       _tmp7_ = _tmp6_;
+       _tmp8_ = g_variant_new ("(s@a{smv})", name, _tmp7_, NULL);
+       g_variant_ref_sink (_tmp8_);
+       _tmp9_ = _tmp8_;
+       _g_variant_unref0 (_tmp7_);
+       variant = _tmp9_;
+       _vala_assert (!g_variant_is_floating (variant), "!variant.is_floating ()");
+       _g_variant_unref0 (variant);
+       _g_variant_builder_unref0 (builder);
+       _g_variant_unref0 (value);
+       _g_free0 (key);
+       _g_free0 (name);
+}
+
+static void
+_vala_main (void)
+{
+       test_variant ();
+       test_variant_builder ();
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/semantic/localvariable-var-pointer-initializer.c-expected 
b/tests/semantic/localvariable-var-pointer-initializer.c-expected
new file mode 100644
index 000000000..b4bf0569a
--- /dev/null
+++ b/tests/semantic/localvariable-var-pointer-initializer.c-expected
@@ -0,0 +1,135 @@
+/* semantic_localvariable_var_pointer_initializer.c generated by valac, the Vala compiler
+ * generated from semantic_localvariable_var_pointer_initializer.vala, do not modify */
+
+#include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       gchar* s;
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN void foo_copy (const Foo* self,
+               Foo* dest);
+VALA_EXTERN void foo_destroy (Foo* self);
+static void _vala_main (void);
+
+void
+foo_copy (const Foo* self,
+          Foo* dest)
+{
+       const gchar* _tmp0_;
+       gchar* _tmp1_;
+       _tmp0_ = (*self).s;
+       _tmp1_ = g_strdup (_tmp0_);
+       _g_free0 ((*dest).s);
+       (*dest).s = _tmp1_;
+}
+
+void
+foo_destroy (Foo* self)
+{
+       _g_free0 ((*self).s);
+}
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       foo_copy (self, dup);
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       foo_destroy (self);
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       {
+               Foo foo = {0};
+               gchar* _tmp0_;
+               Foo _tmp1_ = {0};
+               Foo* foo_p = NULL;
+               const gchar* _tmp2_;
+               _tmp0_ = g_strdup ("foo");
+               _g_free0 (_tmp1_.s);
+               _tmp1_.s = _tmp0_;
+               foo = _tmp1_;
+               foo_p = &foo;
+               _tmp2_ = (*foo_p).s;
+               _vala_assert (g_strcmp0 (_tmp2_, "foo") == 0, "foo_p.s == \"foo\"");
+               foo_destroy (&foo);
+       }
+       {
+               Foo bar = {0};
+               gchar* _tmp3_;
+               Foo _tmp4_ = {0};
+               Foo* bar_p = NULL;
+               const gchar* _tmp5_;
+               _tmp3_ = g_strdup ("bar");
+               _g_free0 (_tmp4_.s);
+               _tmp4_.s = _tmp3_;
+               bar = _tmp4_;
+               bar_p = &bar;
+               _tmp5_ = (*bar_p).s;
+               _vala_assert (g_strcmp0 (_tmp5_, "bar") == 0, "bar_p.s == \"bar\"");
+               foo_destroy (&bar);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/semantic/member-access-static-transformed-qualified.c-expected 
b/tests/semantic/member-access-static-transformed-qualified.c-expected
new file mode 100644
index 000000000..825bb0c07
--- /dev/null
+++ b/tests/semantic/member-access-static-transformed-qualified.c-expected
@@ -0,0 +1,563 @@
+/* semantic_member_access_static_transformed_qualified.c generated by valac, the Vala compiler
+ * generated from semantic_member_access_static_transformed_qualified.vala, do not modify */
+
+#include <glib-object.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define MANAM_TYPE_MANAM (manam_manam_get_type ())
+#define MANAM_MANAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MANAM_TYPE_MANAM, ManamManam))
+#define MANAM_MANAM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MANAM_TYPE_MANAM, ManamManamClass))
+#define MANAM_IS_MANAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MANAM_TYPE_MANAM))
+#define MANAM_IS_MANAM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MANAM_TYPE_MANAM))
+#define MANAM_MANAM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MANAM_TYPE_MANAM, ManamManamClass))
+
+typedef struct _ManamManam ManamManam;
+typedef struct _ManamManamClass ManamManamClass;
+typedef struct _ManamManamPrivate ManamManamPrivate;
+typedef struct _ManamParamSpecManam ManamParamSpecManam;
+
+#define MANAM_TYPE_FOO (manam_foo_get_type ())
+#define MANAM_FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MANAM_TYPE_FOO, ManamFoo))
+#define MANAM_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MANAM_TYPE_FOO, ManamFooClass))
+#define MANAM_IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MANAM_TYPE_FOO))
+#define MANAM_IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MANAM_TYPE_FOO))
+#define MANAM_FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MANAM_TYPE_FOO, ManamFooClass))
+
+typedef struct _ManamFoo ManamFoo;
+typedef struct _ManamFooClass ManamFooClass;
+typedef struct _ManamFooPrivate ManamFooPrivate;
+typedef struct _ManamParamSpecFoo ManamParamSpecFoo;
+#define _manam_foo_unref0(var) ((var == NULL) ? NULL : (var = (manam_foo_unref (var), NULL)))
+
+struct _ManamManam {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       ManamManamPrivate * priv;
+};
+
+struct _ManamManamClass {
+       GTypeClass parent_class;
+       void (*finalize) (ManamManam *self);
+};
+
+struct _ManamParamSpecManam {
+       GParamSpec parent_instance;
+};
+
+struct _ManamFoo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       ManamFooPrivate * priv;
+};
+
+struct _ManamFooClass {
+       GTypeClass parent_class;
+       void (*finalize) (ManamFoo *self);
+};
+
+struct _ManamParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gpointer manam_manam_parent_class = NULL;
+static gpointer manam_foo_parent_class = NULL;
+
+VALA_EXTERN gpointer manam_manam_ref (gpointer instance);
+VALA_EXTERN void manam_manam_unref (gpointer instance);
+VALA_EXTERN GParamSpec* manam_param_spec_manam (const gchar* name,
+                                    const gchar* nick,
+                                    const gchar* blurb,
+                                    GType object_type,
+                                    GParamFlags flags);
+VALA_EXTERN void manam_value_set_manam (GValue* value,
+                            gpointer v_object);
+VALA_EXTERN void manam_value_take_manam (GValue* value,
+                             gpointer v_object);
+VALA_EXTERN gpointer manam_value_get_manam (const GValue* value);
+VALA_EXTERN GType manam_manam_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (ManamManam, manam_manam_unref)
+VALA_EXTERN ManamManam* manam_manam_new (void);
+VALA_EXTERN ManamManam* manam_manam_construct (GType object_type);
+static void manam_manam_finalize (ManamManam * obj);
+static GType manam_manam_get_type_once (void);
+VALA_EXTERN gpointer manam_foo_ref (gpointer instance);
+VALA_EXTERN void manam_foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* manam_param_spec_foo (const gchar* name,
+                                  const gchar* nick,
+                                  const gchar* blurb,
+                                  GType object_type,
+                                  GParamFlags flags);
+VALA_EXTERN void manam_value_set_foo (GValue* value,
+                          gpointer v_object);
+VALA_EXTERN void manam_value_take_foo (GValue* value,
+                           gpointer v_object);
+VALA_EXTERN gpointer manam_value_get_foo (const GValue* value);
+VALA_EXTERN GType manam_foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (ManamFoo, manam_foo_unref)
+VALA_EXTERN void manam_foo_bar (void);
+VALA_EXTERN ManamFoo* manam_foo_new (void);
+VALA_EXTERN ManamFoo* manam_foo_construct (GType object_type);
+static void manam_foo_finalize (ManamFoo * obj);
+static GType manam_foo_get_type_once (void);
+static void manam_main (void);
+
+ManamManam*
+manam_manam_construct (GType object_type)
+{
+       ManamManam* self = NULL;
+       self = (ManamManam*) g_type_create_instance (object_type);
+       return self;
+}
+
+ManamManam*
+manam_manam_new (void)
+{
+       return manam_manam_construct (MANAM_TYPE_MANAM);
+}
+
+static void
+manam_value_manam_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+manam_value_manam_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               manam_manam_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+manam_value_manam_copy_value (const GValue* src_value,
+                              GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = manam_manam_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+manam_value_manam_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+manam_value_manam_collect_value (GValue* value,
+                                 guint n_collect_values,
+                                 GTypeCValue* collect_values,
+                                 guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               ManamManam * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = manam_manam_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+manam_value_manam_lcopy_value (const GValue* value,
+                               guint n_collect_values,
+                               GTypeCValue* collect_values,
+                               guint collect_flags)
+{
+       ManamManam ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = manam_manam_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+manam_param_spec_manam (const gchar* name,
+                        const gchar* nick,
+                        const gchar* blurb,
+                        GType object_type,
+                        GParamFlags flags)
+{
+       ManamParamSpecManam* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, MANAM_TYPE_MANAM), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+manam_value_get_manam (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, MANAM_TYPE_MANAM), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+manam_value_set_manam (GValue* value,
+                       gpointer v_object)
+{
+       ManamManam * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, MANAM_TYPE_MANAM));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, MANAM_TYPE_MANAM));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               manam_manam_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               manam_manam_unref (old);
+       }
+}
+
+void
+manam_value_take_manam (GValue* value,
+                        gpointer v_object)
+{
+       ManamManam * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, MANAM_TYPE_MANAM));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, MANAM_TYPE_MANAM));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               manam_manam_unref (old);
+       }
+}
+
+static void
+manam_manam_class_init (ManamManamClass * klass,
+                        gpointer klass_data)
+{
+       manam_manam_parent_class = g_type_class_peek_parent (klass);
+       ((ManamManamClass *) klass)->finalize = manam_manam_finalize;
+}
+
+static void
+manam_manam_instance_init (ManamManam * self,
+                           gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+manam_manam_finalize (ManamManam * obj)
+{
+       ManamManam * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, MANAM_TYPE_MANAM, ManamManam);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+manam_manam_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { manam_value_manam_init, 
manam_value_manam_free_value, manam_value_manam_copy_value, manam_value_manam_peek_pointer, "p", 
manam_value_manam_collect_value, "p", manam_value_manam_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (ManamManamClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) manam_manam_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(ManamManam), 0, (GInstanceInitFunc) manam_manam_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType manam_manam_type_id;
+       manam_manam_type_id = g_type_register_fundamental (g_type_fundamental_next (), "ManamManam", 
&g_define_type_info, &g_define_type_fundamental_info, 0);
+       return manam_manam_type_id;
+}
+
+GType
+manam_manam_get_type (void)
+{
+       static volatile gsize manam_manam_type_id__volatile = 0;
+       if (g_once_init_enter (&manam_manam_type_id__volatile)) {
+               GType manam_manam_type_id;
+               manam_manam_type_id = manam_manam_get_type_once ();
+               g_once_init_leave (&manam_manam_type_id__volatile, manam_manam_type_id);
+       }
+       return manam_manam_type_id__volatile;
+}
+
+gpointer
+manam_manam_ref (gpointer instance)
+{
+       ManamManam * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+manam_manam_unref (gpointer instance)
+{
+       ManamManam * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               MANAM_MANAM_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+void
+manam_foo_bar (void)
+{
+}
+
+ManamFoo*
+manam_foo_construct (GType object_type)
+{
+       ManamFoo* self = NULL;
+       self = (ManamFoo*) g_type_create_instance (object_type);
+       return self;
+}
+
+ManamFoo*
+manam_foo_new (void)
+{
+       return manam_foo_construct (MANAM_TYPE_FOO);
+}
+
+static void
+manam_value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+manam_value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               manam_foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+manam_value_foo_copy_value (const GValue* src_value,
+                            GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = manam_foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+manam_value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+manam_value_foo_collect_value (GValue* value,
+                               guint n_collect_values,
+                               GTypeCValue* collect_values,
+                               guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               ManamFoo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = manam_foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+manam_value_foo_lcopy_value (const GValue* value,
+                             guint n_collect_values,
+                             GTypeCValue* collect_values,
+                             guint collect_flags)
+{
+       ManamFoo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = manam_foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+manam_param_spec_foo (const gchar* name,
+                      const gchar* nick,
+                      const gchar* blurb,
+                      GType object_type,
+                      GParamFlags flags)
+{
+       ManamParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, MANAM_TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+manam_value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, MANAM_TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+manam_value_set_foo (GValue* value,
+                     gpointer v_object)
+{
+       ManamFoo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, MANAM_TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, MANAM_TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               manam_foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               manam_foo_unref (old);
+       }
+}
+
+void
+manam_value_take_foo (GValue* value,
+                      gpointer v_object)
+{
+       ManamFoo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, MANAM_TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, MANAM_TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               manam_foo_unref (old);
+       }
+}
+
+static void
+manam_foo_class_init (ManamFooClass * klass,
+                      gpointer klass_data)
+{
+       manam_foo_parent_class = g_type_class_peek_parent (klass);
+       ((ManamFooClass *) klass)->finalize = manam_foo_finalize;
+}
+
+static void
+manam_foo_instance_init (ManamFoo * self,
+                         gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+manam_foo_finalize (ManamFoo * obj)
+{
+       ManamFoo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, MANAM_TYPE_FOO, ManamFoo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+manam_foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { manam_value_foo_init, 
manam_value_foo_free_value, manam_value_foo_copy_value, manam_value_foo_peek_pointer, "p", 
manam_value_foo_collect_value, "p", manam_value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (ManamFooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) manam_foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(ManamFoo), 0, (GInstanceInitFunc) manam_foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType manam_foo_type_id;
+       manam_foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "ManamFoo", 
&g_define_type_info, &g_define_type_fundamental_info, 0);
+       return manam_foo_type_id;
+}
+
+GType
+manam_foo_get_type (void)
+{
+       static volatile gsize manam_foo_type_id__volatile = 0;
+       if (g_once_init_enter (&manam_foo_type_id__volatile)) {
+               GType manam_foo_type_id;
+               manam_foo_type_id = manam_foo_get_type_once ();
+               g_once_init_leave (&manam_foo_type_id__volatile, manam_foo_type_id);
+       }
+       return manam_foo_type_id__volatile;
+}
+
+gpointer
+manam_foo_ref (gpointer instance)
+{
+       ManamFoo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+manam_foo_unref (gpointer instance)
+{
+       ManamFoo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               MANAM_FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+manam_main (void)
+{
+       ManamFoo* foo = NULL;
+       ManamFoo* _tmp0_;
+       _tmp0_ = manam_foo_new ();
+       foo = _tmp0_;
+       manam_foo_bar ();
+       _manam_foo_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       manam_main ();
+       return 0;
+}
+
diff --git a/tests/semantic/member-access-static-with-instance.c-expected 
b/tests/semantic/member-access-static-with-instance.c-expected
new file mode 100644
index 000000000..e73423aa5
--- /dev/null
+++ b/tests/semantic/member-access-static-with-instance.c-expected
@@ -0,0 +1,87 @@
+/* semantic_member_access_static_with_instance.c generated by valac, the Vala compiler
+ * generated from semantic_member_access_static_with_instance.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       gint i;
+};
+
+VALA_EXTERN Foo foo_static_field;
+Foo foo_static_field = {0};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+#define FOO_FOO 23
+#define BAR FOO_FOO
+static void _vala_main (void);
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       memcpy (dup, self, sizeof (Foo));
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       _vala_assert (BAR == 23, "BAR == 23");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/semantic/member-access-transformed-qualified.c-expected 
b/tests/semantic/member-access-transformed-qualified.c-expected
new file mode 100644
index 000000000..9433c599e
--- /dev/null
+++ b/tests/semantic/member-access-transformed-qualified.c-expected
@@ -0,0 +1,308 @@
+/* semantic_member_access_transformed_qualified.c generated by valac, the Vala compiler
+ * generated from semantic_member_access_transformed_qualified.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define FOO_MANAM_TYPE_FOO (foo_manam_foo_get_type ())
+#define FOO_MANAM_FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FOO_MANAM_TYPE_FOO, FooManamFoo))
+#define FOO_MANAM_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FOO_MANAM_TYPE_FOO, FooManamFooClass))
+#define FOO_MANAM_IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FOO_MANAM_TYPE_FOO))
+#define FOO_MANAM_IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FOO_MANAM_TYPE_FOO))
+#define FOO_MANAM_FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FOO_MANAM_TYPE_FOO, 
FooManamFooClass))
+
+typedef struct _FooManamFoo FooManamFoo;
+typedef struct _FooManamFooClass FooManamFooClass;
+typedef struct _FooManamFooPrivate FooManamFooPrivate;
+typedef struct _FooManamParamSpecFoo FooManamParamSpecFoo;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _FooManamFoo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooManamFooPrivate * priv;
+};
+
+struct _FooManamFooClass {
+       GTypeClass parent_class;
+       void (*finalize) (FooManamFoo *self);
+};
+
+struct _FooManamParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+VALA_EXTERN gint foo_bar_bar;
+gint foo_bar_bar = 23;
+static gpointer foo_manam_foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_manam_foo_ref (gpointer instance);
+VALA_EXTERN void foo_manam_foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* foo_manam_param_spec_foo (const gchar* name,
+                                      const gchar* nick,
+                                      const gchar* blurb,
+                                      GType object_type,
+                                      GParamFlags flags);
+VALA_EXTERN void foo_manam_value_set_foo (GValue* value,
+                              gpointer v_object);
+VALA_EXTERN void foo_manam_value_take_foo (GValue* value,
+                               gpointer v_object);
+VALA_EXTERN gpointer foo_manam_value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_manam_foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (FooManamFoo, foo_manam_foo_unref)
+VALA_EXTERN void foo_manam_foo_faz (void);
+VALA_EXTERN FooManamFoo* foo_manam_foo_new (void);
+VALA_EXTERN FooManamFoo* foo_manam_foo_construct (GType object_type);
+static void foo_manam_foo_finalize (FooManamFoo * obj);
+static GType foo_manam_foo_get_type_once (void);
+static void _vala_main (void);
+
+void
+foo_manam_foo_faz (void)
+{
+       foo_bar_bar = 42;
+}
+
+FooManamFoo*
+foo_manam_foo_construct (GType object_type)
+{
+       FooManamFoo* self = NULL;
+       self = (FooManamFoo*) g_type_create_instance (object_type);
+       return self;
+}
+
+FooManamFoo*
+foo_manam_foo_new (void)
+{
+       return foo_manam_foo_construct (FOO_MANAM_TYPE_FOO);
+}
+
+static void
+foo_manam_value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+foo_manam_value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_manam_foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+foo_manam_value_foo_copy_value (const GValue* src_value,
+                                GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_manam_foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+foo_manam_value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+foo_manam_value_foo_collect_value (GValue* value,
+                                   guint n_collect_values,
+                                   GTypeCValue* collect_values,
+                                   guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               FooManamFoo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_manam_foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+foo_manam_value_foo_lcopy_value (const GValue* value,
+                                 guint n_collect_values,
+                                 GTypeCValue* collect_values,
+                                 guint collect_flags)
+{
+       FooManamFoo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_manam_foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+foo_manam_param_spec_foo (const gchar* name,
+                          const gchar* nick,
+                          const gchar* blurb,
+                          GType object_type,
+                          GParamFlags flags)
+{
+       FooManamParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, FOO_MANAM_TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+foo_manam_value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, FOO_MANAM_TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+foo_manam_value_set_foo (GValue* value,
+                         gpointer v_object)
+{
+       FooManamFoo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, FOO_MANAM_TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, FOO_MANAM_TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_manam_foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_manam_foo_unref (old);
+       }
+}
+
+void
+foo_manam_value_take_foo (GValue* value,
+                          gpointer v_object)
+{
+       FooManamFoo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, FOO_MANAM_TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, FOO_MANAM_TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_manam_foo_unref (old);
+       }
+}
+
+static void
+foo_manam_foo_class_init (FooManamFooClass * klass,
+                          gpointer klass_data)
+{
+       foo_manam_foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooManamFooClass *) klass)->finalize = foo_manam_foo_finalize;
+}
+
+static void
+foo_manam_foo_instance_init (FooManamFoo * self,
+                             gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_manam_foo_finalize (FooManamFoo * obj)
+{
+       FooManamFoo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, FOO_MANAM_TYPE_FOO, FooManamFoo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_manam_foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { foo_manam_value_foo_init, 
foo_manam_value_foo_free_value, foo_manam_value_foo_copy_value, foo_manam_value_foo_peek_pointer, "p", 
foo_manam_value_foo_collect_value, "p", foo_manam_value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooManamFooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_manam_foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof 
(FooManamFoo), 0, (GInstanceInitFunc) foo_manam_foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_manam_foo_type_id;
+       foo_manam_foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "FooManamFoo", 
&g_define_type_info, &g_define_type_fundamental_info, 0);
+       return foo_manam_foo_type_id;
+}
+
+GType
+foo_manam_foo_get_type (void)
+{
+       static volatile gsize foo_manam_foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_manam_foo_type_id__volatile)) {
+               GType foo_manam_foo_type_id;
+               foo_manam_foo_type_id = foo_manam_foo_get_type_once ();
+               g_once_init_leave (&foo_manam_foo_type_id__volatile, foo_manam_foo_type_id);
+       }
+       return foo_manam_foo_type_id__volatile;
+}
+
+gpointer
+foo_manam_foo_ref (gpointer instance)
+{
+       FooManamFoo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_manam_foo_unref (gpointer instance)
+{
+       FooManamFoo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_MANAM_FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       _vala_assert (foo_bar_bar == 23, "bar == 23");
+       foo_manam_foo_faz ();
+       _vala_assert (foo_bar_bar == 42, "bar == 42");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/semantic/with-buildin.c-expected b/tests/semantic/with-buildin.c-expected
new file mode 100644
index 000000000..a0a15512d
--- /dev/null
+++ b/tests/semantic/with-buildin.c-expected
@@ -0,0 +1,33 @@
+/* semantic_with_buildin.c generated by valac, the Vala compiler
+ * generated from semantic_with_buildin.vala, do not modify */
+
+#include <stdio.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+       {
+               FILE* _tmp0_ = NULL;
+               FILE* _tmp1_;
+               _tmp1_ = stdout;
+               _tmp0_ = _tmp1_;
+               _vala_assert (!feof (_tmp0_), "!eof ()");
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/semantic/with-compact.c-expected b/tests/semantic/with-compact.c-expected
new file mode 100644
index 000000000..aa892e239
--- /dev/null
+++ b/tests/semantic/with-compact.c-expected
@@ -0,0 +1,74 @@
+/* semantic_with_compact.c generated by valac, the Vala compiler
+ * generated from semantic_with_compact.vala, do not modify */
+
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef struct _Foo Foo;
+#define _foo_free0(var) ((var == NULL) ? NULL : (var = (foo_free (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       gint i;
+};
+
+VALA_EXTERN void foo_free (Foo * self);
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_free)
+static void foo_instance_init (Foo * self);
+VALA_EXTERN Foo* foo_new (void);
+static void _vala_main (void);
+
+Foo*
+foo_new (void)
+{
+       Foo* self;
+       self = g_slice_new0 (Foo);
+       foo_instance_init (self);
+       return self;
+}
+
+static void
+foo_instance_init (Foo * self)
+{
+}
+
+void
+foo_free (Foo * self)
+{
+       g_slice_free (Foo, self);
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       {
+               foo->i = 13;
+       }
+       _vala_assert (foo->i == 13, "foo.i == 13");
+       _foo_free0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/semantic/with-declaration-cast-type.c-expected 
b/tests/semantic/with-declaration-cast-type.c-expected
new file mode 100644
index 000000000..95d83e04d
--- /dev/null
+++ b/tests/semantic/with-declaration-cast-type.c-expected
@@ -0,0 +1,373 @@
+/* semantic_with_declaration_cast_type.c generated by valac, the Vala compiler
+ * generated from semantic_with_declaration_cast_type.vala, do not modify */
+
+#include <glib-object.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+struct _Bar {
+       Foo parent_instance;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       FooClass parent_class;
+};
+
+static gpointer foo_parent_class = NULL;
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, foo_unref)
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static GType bar_get_type_once (void);
+static void _vala_main (void);
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar* self = NULL;
+       self = (Bar*) foo_construct (object_type);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (TYPE_FOO, "Bar", &g_define_type_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       {
+               Foo* f = NULL;
+               Bar* _tmp0_;
+               _tmp0_ = bar_new ();
+               f = G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, TYPE_FOO, Foo);
+               _foo_unref0 (f);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/semantic/with-declaration.c-expected b/tests/semantic/with-declaration.c-expected
new file mode 100644
index 000000000..3774c1bdc
--- /dev/null
+++ b/tests/semantic/with-declaration.c-expected
@@ -0,0 +1,356 @@
+/* semantic_with_declaration.c generated by valac, the Vala compiler
+ * generated from semantic_with_declaration.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+       gint i;
+       gint j;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static gpointer
+_foo_ref0 (gpointer self)
+{
+       return self ? foo_ref (self) : NULL;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo* _tmp0_;
+       Foo* f = NULL;
+       Foo* _tmp7_;
+       _tmp0_ = foo_new ();
+       foo = _tmp0_;
+       {
+               foo->i = 10;
+       }
+       _vala_assert (foo->i == 10, "foo.i == 10");
+       {
+               Foo* f = NULL;
+               Foo* _tmp1_;
+               _tmp1_ = _foo_ref0 (foo);
+               f = _tmp1_;
+               f->i = 100;
+               f->j = 200;
+               _foo_unref0 (f);
+       }
+       _vala_assert (foo->i == 100, "foo.i == 100");
+       _vala_assert (foo->j == 200, "foo.j == 200");
+       {
+               Foo* f = NULL;
+               Foo* _tmp2_;
+               _tmp2_ = _foo_ref0 (foo);
+               f = _tmp2_;
+               f->i = 1000;
+               f->j = 2000;
+               _foo_unref0 (f);
+       }
+       _vala_assert (foo->i == 1000, "foo.i == 1000");
+       _vala_assert (foo->j == 2000, "foo.j == 2000");
+       {
+               Foo* _tmp3_ = NULL;
+               Foo* _tmp4_;
+               Foo* _tmp5_;
+               Foo* _tmp6_;
+               _tmp4_ = _foo_ref0 (foo);
+               _foo_unref0 (f);
+               f = _tmp4_;
+               _tmp5_ = f;
+               _tmp3_ = _tmp5_;
+               _tmp3_->i = 10000;
+               _tmp6_ = f;
+               _tmp6_->j = 20000;
+       }
+       _tmp7_ = f;
+       _vala_assert (_tmp7_->i == 10000, "f.i == 10000");
+       _vala_assert (foo->j == 20000, "foo.j == 20000");
+       _foo_unref0 (f);
+       _foo_unref0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/semantic/with-dereferenced-pointer.c-expected 
b/tests/semantic/with-dereferenced-pointer.c-expected
new file mode 100644
index 000000000..616fc758d
--- /dev/null
+++ b/tests/semantic/with-dereferenced-pointer.c-expected
@@ -0,0 +1,311 @@
+/* semantic_with_dereferenced_pointer.c generated by valac, the Vala compiler
+ * generated from semantic_with_dereferenced_pointer.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+       gint i;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Foo* f = NULL;
+       Foo* _tmp0_;
+       Foo** p = NULL;
+       _tmp0_ = foo_new ();
+       f = _tmp0_;
+       p = &f;
+       {
+               Foo* _tmp1_ = NULL;
+               _tmp1_ = *p;
+               G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, TYPE_FOO, Foo)->i = 13;
+       }
+       _vala_assert (f->i == 13, "f.i == 13");
+       _foo_unref0 (f);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/semantic/with-enum-member.c-expected b/tests/semantic/with-enum-member.c-expected
new file mode 100644
index 000000000..a60d110d8
--- /dev/null
+++ b/tests/semantic/with-enum-member.c-expected
@@ -0,0 +1,62 @@
+/* semantic_with_enum_member.c generated by valac, the Vala compiler
+ * generated from semantic_with_enum_member.vala, do not modify */
+
+#include <glib-object.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef enum  {
+       FOO_ENUM_FIRST
+} FooEnum;
+
+#define TYPE_FOO_ENUM (foo_enum_get_type ())
+
+VALA_EXTERN GType foo_enum_get_type (void) G_GNUC_CONST ;
+static void _vala_main (void);
+
+static GType
+foo_enum_get_type_once (void)
+{
+       static const GEnumValue values[] = {{FOO_ENUM_FIRST, "FOO_ENUM_FIRST", "first"}, {0, NULL, NULL}};
+       GType foo_enum_type_id;
+       foo_enum_type_id = g_enum_register_static ("FooEnum", values);
+       return foo_enum_type_id;
+}
+
+GType
+foo_enum_get_type (void)
+{
+       static volatile gsize foo_enum_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_enum_type_id__volatile)) {
+               GType foo_enum_type_id;
+               foo_enum_type_id = foo_enum_get_type_once ();
+               g_once_init_leave (&foo_enum_type_id__volatile, foo_enum_type_id);
+       }
+       return foo_enum_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       {
+               FooEnum _tmp0_ = 0;
+               _tmp0_ = FOO_ENUM_FIRST;
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/semantic/with-null.c-expected b/tests/semantic/with-null.c-expected
new file mode 100644
index 000000000..452d2995c
--- /dev/null
+++ b/tests/semantic/with-null.c-expected
@@ -0,0 +1,300 @@
+/* semantic_with_null.c generated by valac, the Vala compiler
+ * generated from semantic_with_null.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+#include <stdlib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+typedef struct _ParamSpecFoo ParamSpecFoo;
+
+struct _Foo {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       FooPrivate * priv;
+       gint i;
+};
+
+struct _FooClass {
+       GTypeClass parent_class;
+       void (*finalize) (Foo *self);
+};
+
+struct _ParamSpecFoo {
+       GParamSpec parent_instance;
+};
+
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN gpointer foo_ref (gpointer instance);
+VALA_EXTERN void foo_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_foo (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_foo (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_foo (const GValue* value);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (Foo * obj);
+static GType foo_get_type_once (void);
+static void _vala_main (void);
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo* self = NULL;
+       self = (Foo*) g_type_create_instance (object_type);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+value_foo_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_foo_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               foo_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_foo_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_foo_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_foo_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Foo * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = foo_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_foo_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Foo ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = foo_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_foo (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecFoo* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_foo (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_foo (GValue* value,
+               gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               foo_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+void
+value_take_foo (GValue* value,
+                gpointer v_object)
+{
+       Foo * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               foo_unref (old);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       ((FooClass *) klass)->finalize = foo_finalize;
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+foo_finalize (Foo * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, 
value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType foo_type_id;
+       foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+gpointer
+foo_ref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+foo_unref (gpointer instance)
+{
+       Foo * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               FOO_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Foo* f = NULL;
+       f = NULL;
+       exit (0);
+       {
+               f->i = 7;
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/semantic/with-string.c-expected b/tests/semantic/with-string.c-expected
new file mode 100644
index 000000000..461a6966e
--- /dev/null
+++ b/tests/semantic/with-string.c-expected
@@ -0,0 +1,52 @@
+/* semantic_with_string.c generated by valac, the Vala compiler
+ * generated from semantic_with_string.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (void);
+
+static gchar*
+string_chomp (const gchar* self)
+{
+       gchar* _result_ = NULL;
+       gchar* _tmp0_;
+       gchar* result = NULL;
+       g_return_val_if_fail (self != NULL, NULL);
+       _tmp0_ = g_strdup (self);
+       _result_ = _tmp0_;
+       g_strchomp (_result_);
+       result = _result_;
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       {
+               const gchar* _tmp0_ = NULL;
+               gchar* _tmp1_;
+               gchar* _tmp2_;
+               _tmp0_ = "string ";
+               _tmp1_ = string_chomp (_tmp0_);
+               _tmp2_ = _tmp1_;
+               _vala_assert (g_strcmp0 (_tmp2_, "string") == 0, "chomp () == \"string\"");
+               _g_free0 (_tmp2_);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/semantic/with-value.c-expected b/tests/semantic/with-value.c-expected
new file mode 100644
index 000000000..1f09b3072
--- /dev/null
+++ b/tests/semantic/with-value.c-expected
@@ -0,0 +1,39 @@
+/* semantic_with_value.c generated by valac, the Vala compiler
+ * generated from semantic_with_value.vala, do not modify */
+
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+       gint i = 0;
+       gchar* s = NULL;
+       i = 0;
+       {
+               gchar* _tmp0_;
+               _tmp0_ = g_strdup_printf ("%i", i);
+               _g_free0 (s);
+               s = _tmp0_;
+       }
+       _vala_assert (g_strcmp0 (s, "0") == 0, "s == \"0\"");
+       _g_free0 (s);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/structs/bug530605.c-expected b/tests/structs/bug530605.c-expected
new file mode 100644
index 000000000..ea12f5aa2
--- /dev/null
+++ b/tests/structs/bug530605.c-expected
@@ -0,0 +1,197 @@
+/* structs_bug530605.c generated by valac, the Vala compiler
+ * generated from structs_bug530605.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _foo_free0(var) ((var == NULL) ? NULL : (var = (foo_free (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       gint bar;
+       gchar* baz;
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN void foo_copy (const Foo* self,
+               Foo* dest);
+VALA_EXTERN void foo_destroy (Foo* self);
+VALA_EXTERN void foo_init (Foo *self,
+               gint bar,
+               const gchar* baz);
+static void _vala_main (void);
+static gboolean _foo_equal (const Foo * s1,
+                     const Foo * s2);
+
+void
+foo_init (Foo *self,
+          gint bar,
+          const gchar* baz)
+{
+       gchar* _tmp0_;
+       g_return_if_fail (baz != NULL);
+       memset (self, 0, sizeof (Foo));
+       (*self).bar = bar;
+       _tmp0_ = g_strdup (baz);
+       _g_free0 ((*self).baz);
+       (*self).baz = _tmp0_;
+}
+
+void
+foo_copy (const Foo* self,
+          Foo* dest)
+{
+       const gchar* _tmp0_;
+       gchar* _tmp1_;
+       (*dest).bar = (*self).bar;
+       _tmp0_ = (*self).baz;
+       _tmp1_ = g_strdup (_tmp0_);
+       _g_free0 ((*dest).baz);
+       (*dest).baz = _tmp1_;
+}
+
+void
+foo_destroy (Foo* self)
+{
+       _g_free0 ((*self).baz);
+}
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       foo_copy (self, dup);
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       foo_destroy (self);
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static gpointer
+_foo_dup0 (gpointer self)
+{
+       return self ? foo_dup (self) : NULL;
+}
+
+static gboolean
+_foo_equal (const Foo * s1,
+            const Foo * s2)
+{
+       if (s1 == s2) {
+               return TRUE;
+       }
+       if (s1 == NULL) {
+               return FALSE;
+       }
+       if (s2 == NULL) {
+               return FALSE;
+       }
+       if (s1->bar != s2->bar) {
+               return FALSE;
+       }
+       if (g_strcmp0 (s1->baz, s2->baz)) {
+               return FALSE;
+       }
+       return TRUE;
+}
+
+static void
+_vala_main (void)
+{
+       Foo a = {0};
+       Foo b = {0};
+       Foo* c = NULL;
+       Foo _tmp0_ = {0};
+       Foo _tmp1_;
+       Foo* _tmp2_;
+       Foo* _tmp3_;
+       Foo d = {0};
+       Foo e = {0};
+       Foo _tmp4_;
+       Foo _tmp5_;
+       Foo _tmp6_;
+       Foo _tmp7_;
+       Foo _tmp8_;
+       Foo _tmp9_;
+       Foo _tmp10_;
+       foo_init (&a, 42, "hello");
+       foo_init (&b, 42, "hello");
+       foo_init (&_tmp0_, 42, "hello");
+       _tmp1_ = _tmp0_;
+       _tmp2_ = _foo_dup0 (&_tmp1_);
+       _tmp3_ = _tmp2_;
+       foo_destroy (&_tmp1_);
+       c = _tmp3_;
+       foo_init (&d, 42, "world");
+       foo_init (&e, 23, "hello");
+       _tmp4_ = a;
+       _tmp5_ = b;
+       _vala_assert (_foo_equal (&_tmp4_, &_tmp5_) == TRUE, "a == b");
+       _tmp6_ = a;
+       _vala_assert (_foo_equal (&_tmp6_, c) == TRUE, "a == c");
+       _tmp7_ = a;
+       _tmp8_ = d;
+       _vala_assert (_foo_equal (&_tmp7_, &_tmp8_) != TRUE, "a != d");
+       _tmp9_ = a;
+       _tmp10_ = e;
+       _vala_assert (_foo_equal (&_tmp9_, &_tmp10_) != TRUE, "a != e");
+       foo_destroy (&e);
+       foo_destroy (&d);
+       _foo_free0 (c);
+       foo_destroy (&b);
+       foo_destroy (&a);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/structs/bug572091.c-expected b/tests/structs/bug572091.c-expected
new file mode 100644
index 000000000..9c8216849
--- /dev/null
+++ b/tests/structs/bug572091.c-expected
@@ -0,0 +1,100 @@
+/* structs_bug572091.c generated by valac, the Vala compiler
+ * generated from structs_bug572091.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       gint bar;
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN void baz (Foo* foo);
+static void _vala_main (void);
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       memcpy (dup, self, sizeof (Foo));
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+void
+baz (Foo* foo)
+{
+       g_return_if_fail (foo != NULL);
+       (*foo).bar = 2;
+}
+
+static void
+_vala_main (void)
+{
+       Foo foo = {0};
+       Foo _tmp0_ = {0};
+       Foo _tmp1_;
+       Foo _tmp2_;
+       memset (&_tmp0_, 0, sizeof (Foo));
+       _tmp0_.bar = 1;
+       foo = _tmp0_;
+       _tmp1_ = foo;
+       baz (&_tmp1_);
+       _tmp2_ = foo;
+       _vala_assert (_tmp2_.bar == 1, "foo.bar == 1");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/structs/bug583603.c-expected b/tests/structs/bug583603.c-expected
new file mode 100644
index 000000000..5e013309f
--- /dev/null
+++ b/tests/structs/bug583603.c-expected
@@ -0,0 +1,90 @@
+/* structs_bug583603.c generated by valac, the Vala compiler
+ * generated from structs_bug583603.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       gint bar;
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+static void _vala_main (void);
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       memcpy (dup, self, sizeof (Foo));
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       gint i = 0;
+       Foo foo = {0};
+       Foo _tmp0_ = {0};
+       Foo _tmp1_;
+       i = 42;
+       _tmp0_.bar = i;
+       foo = _tmp0_;
+       _tmp1_ = foo;
+       _vala_assert (_tmp1_.bar == 42, "foo.bar == 42");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/structs/bug595587.c-expected b/tests/structs/bug595587.c-expected
new file mode 100644
index 000000000..c4de2eb1c
--- /dev/null
+++ b/tests/structs/bug595587.c-expected
@@ -0,0 +1,349 @@
+/* structs_bug595587.c generated by valac, the Vala compiler
+ * generated from structs_bug595587.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+typedef struct _ParamSpecBar ParamSpecBar;
+
+struct _Foo {
+       gint x;
+};
+
+struct _Bar {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       GTypeClass parent_class;
+       void (*finalize) (Bar *self);
+};
+
+struct _ParamSpecBar {
+       GParamSpec parent_instance;
+};
+
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN gpointer bar_ref (gpointer instance);
+VALA_EXTERN void bar_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_bar (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_bar (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_bar (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_bar (const GValue* value);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, bar_unref)
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+VALA_EXTERN void bar_set_foo (Bar* self,
+                  Foo* value);
+static void bar_finalize (Bar * obj);
+static GType bar_get_type_once (void);
+static void _vala_main (void);
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       memcpy (dup, self, sizeof (Foo));
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar* self = NULL;
+       self = (Bar*) g_type_create_instance (object_type);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+void
+bar_set_foo (Bar* self,
+             Foo* value)
+{
+       gboolean b = FALSE;
+       g_return_if_fail (IS_BAR (self));
+       b = value == NULL;
+}
+
+static void
+value_bar_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_bar_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               bar_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_bar_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = bar_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_bar_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_bar_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Bar * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = bar_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_bar_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Bar ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = bar_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_bar (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecBar* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_BAR), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_bar (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_bar (GValue* value,
+               gpointer v_object)
+{
+       Bar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               bar_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_unref (old);
+       }
+}
+
+void
+value_take_bar (GValue* value,
+                gpointer v_object)
+{
+       Bar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_unref (old);
+       }
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       ((BarClass *) klass)->finalize = bar_finalize;
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+bar_finalize (Bar * obj)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_bar_init, value_bar_free_value, 
value_bar_copy_value, value_bar_peek_pointer, "p", value_bar_collect_value, "p", value_bar_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType bar_type_id;
+       bar_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Bar", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+gpointer
+bar_ref (gpointer instance)
+{
+       Bar * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+bar_unref (gpointer instance)
+{
+       Bar * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               BAR_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/structs/bug596144.c-expected b/tests/structs/bug596144.c-expected
new file mode 100644
index 000000000..7ca28e236
--- /dev/null
+++ b/tests/structs/bug596144.c-expected
@@ -0,0 +1,140 @@
+/* structs_bug596144.c generated by valac, the Vala compiler
+ * generated from structs_bug596144.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GObject* o;
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN void foo_copy (const Foo* self,
+               Foo* dest);
+VALA_EXTERN void foo_destroy (Foo* self);
+static void _vala_main (void);
+
+static gpointer
+_g_object_ref0 (gpointer self)
+{
+       return self ? g_object_ref (self) : NULL;
+}
+
+void
+foo_copy (const Foo* self,
+          Foo* dest)
+{
+       GObject* _tmp0_;
+       GObject* _tmp1_;
+       _tmp0_ = (*self).o;
+       _tmp1_ = _g_object_ref0 (_tmp0_);
+       _g_object_unref0 ((*dest).o);
+       (*dest).o = _tmp1_;
+}
+
+void
+foo_destroy (Foo* self)
+{
+       _g_object_unref0 ((*self).o);
+}
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       foo_copy (self, dup);
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       foo_destroy (self);
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       GObject* o = NULL;
+       GObject* _tmp0_;
+       Foo foo = {0};
+       GObject* _tmp1_;
+       Foo _tmp2_ = {0};
+       Foo bar = {0};
+       Foo _tmp3_;
+       Foo _tmp4_;
+       GObject* _tmp5_;
+       Foo _tmp6_;
+       GObject* _tmp7_;
+       _tmp0_ = g_object_new (G_TYPE_OBJECT, NULL);
+       o = _tmp0_;
+       _tmp1_ = _g_object_ref0 (o);
+       memset (&_tmp2_, 0, sizeof (Foo));
+       _g_object_unref0 (_tmp2_.o);
+       _tmp2_.o = _tmp1_;
+       foo = _tmp2_;
+       _tmp3_ = foo;
+       memset (&foo, 0, sizeof (Foo));
+       bar = _tmp3_;
+       _tmp4_ = foo;
+       _tmp5_ = _tmp4_.o;
+       _vala_assert (_tmp5_ == NULL, "foo.o == null");
+       _tmp6_ = bar;
+       _tmp7_ = _tmp6_.o;
+       _vala_assert (_tmp7_ == o, "bar.o == o");
+       foo_destroy (&bar);
+       foo_destroy (&foo);
+       _g_object_unref0 (o);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/structs/bug603056.c-expected b/tests/structs/bug603056.c-expected
new file mode 100644
index 000000000..00a7ba3c4
--- /dev/null
+++ b/tests/structs/bug603056.c-expected
@@ -0,0 +1,97 @@
+/* structs_bug603056.c generated by valac, the Vala compiler
+ * generated from structs_bug603056.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       guint8 param;
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+static void _vala_main (void);
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       memcpy (dup, self, sizeof (Foo));
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       gboolean b = FALSE;
+       gint _tmp0_ = 0;
+       Foo foo = {0};
+       Foo _tmp1_ = {0};
+       Foo _tmp2_;
+       b = TRUE;
+       if (b) {
+               _tmp0_ = 10;
+       } else {
+               _tmp0_ = 20;
+       }
+       memset (&_tmp1_, 0, sizeof (Foo));
+       _tmp1_.param = (guint8) _tmp0_;
+       foo = _tmp1_;
+       _tmp2_ = foo;
+       _vala_assert (((gint) _tmp2_.param) == 10, "foo.param == 10");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/structs/bug606202.c-expected b/tests/structs/bug606202.c-expected
new file mode 100644
index 000000000..3087d4599
--- /dev/null
+++ b/tests/structs/bug606202.c-expected
@@ -0,0 +1,446 @@
+/* structs_bug606202.c generated by valac, the Vala compiler
+ * generated from structs_bug606202.vala, do not modify */
+
+#include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+#define _g_free0(var) (var = (g_free (var), NULL))
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+#define _foo_free0(var) ((var == NULL) ? NULL : (var = (foo_free (var), NULL)))
+typedef struct _ParamSpecBar ParamSpecBar;
+#define _bar_unref0(var) ((var == NULL) ? NULL : (var = (bar_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       gchar* s;
+};
+
+struct _Bar {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       BarPrivate * priv;
+};
+
+struct _BarClass {
+       GTypeClass parent_class;
+       void (*finalize) (Bar *self);
+};
+
+struct _BarPrivate {
+       Foo* _foo;
+};
+
+struct _ParamSpecBar {
+       GParamSpec parent_instance;
+};
+
+static gint Bar_private_offset;
+static gpointer bar_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN void foo_copy (const Foo* self,
+               Foo* dest);
+VALA_EXTERN void foo_destroy (Foo* self);
+VALA_EXTERN void foo_init (Foo *self,
+               const gchar* s);
+VALA_EXTERN gpointer bar_ref (gpointer instance);
+VALA_EXTERN void bar_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_bar (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_bar (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_bar (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_bar (const GValue* value);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, bar_unref)
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+VALA_EXTERN Foo* bar_get_foo (Bar* self);
+VALA_EXTERN void bar_set_foo (Bar* self,
+                  Foo* value);
+static void bar_finalize (Bar * obj);
+static GType bar_get_type_once (void);
+static void _vala_main (void);
+
+void
+foo_init (Foo *self,
+          const gchar* s)
+{
+       gchar* _tmp0_;
+       g_return_if_fail (s != NULL);
+       memset (self, 0, sizeof (Foo));
+       _tmp0_ = g_strdup (s);
+       _g_free0 ((*self).s);
+       (*self).s = _tmp0_;
+}
+
+void
+foo_copy (const Foo* self,
+          Foo* dest)
+{
+       const gchar* _tmp0_;
+       gchar* _tmp1_;
+       _tmp0_ = (*self).s;
+       _tmp1_ = g_strdup (_tmp0_);
+       _g_free0 ((*dest).s);
+       (*dest).s = _tmp1_;
+}
+
+void
+foo_destroy (Foo* self)
+{
+       _g_free0 ((*self).s);
+}
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       foo_copy (self, dup);
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       foo_destroy (self);
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static inline gpointer
+bar_get_instance_private (Bar* self)
+{
+       return G_STRUCT_MEMBER_P (self, Bar_private_offset);
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar* self = NULL;
+       self = (Bar*) g_type_create_instance (object_type);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+Foo*
+bar_get_foo (Bar* self)
+{
+       Foo* result;
+       Foo* _tmp0_;
+       g_return_val_if_fail (IS_BAR (self), NULL);
+       _tmp0_ = self->priv->_foo;
+       result = _tmp0_;
+       return result;
+}
+
+static gpointer
+_foo_dup0 (gpointer self)
+{
+       return self ? foo_dup (self) : NULL;
+}
+
+void
+bar_set_foo (Bar* self,
+             Foo* value)
+{
+       Foo* _tmp0_;
+       g_return_if_fail (IS_BAR (self));
+       _tmp0_ = _foo_dup0 (value);
+       _foo_free0 (self->priv->_foo);
+       self->priv->_foo = _tmp0_;
+}
+
+static void
+value_bar_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_bar_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               bar_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_bar_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = bar_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_bar_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_bar_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Bar * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = bar_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_bar_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Bar ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = bar_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_bar (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecBar* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_BAR), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_bar (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_bar (GValue* value,
+               gpointer v_object)
+{
+       Bar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               bar_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_unref (old);
+       }
+}
+
+void
+value_take_bar (GValue* value,
+                gpointer v_object)
+{
+       Bar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_unref (old);
+       }
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       ((BarClass *) klass)->finalize = bar_finalize;
+       g_type_class_adjust_private_offset (klass, &Bar_private_offset);
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+       self->priv = bar_get_instance_private (self);
+       self->ref_count = 1;
+}
+
+static void
+bar_finalize (Bar * obj)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       g_signal_handlers_destroy (self);
+       _foo_free0 (self->priv->_foo);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_bar_init, value_bar_free_value, 
value_bar_copy_value, value_bar_peek_pointer, "p", value_bar_collect_value, "p", value_bar_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType bar_type_id;
+       bar_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Bar", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       Bar_private_offset = g_type_add_instance_private (bar_type_id, sizeof (BarPrivate));
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+gpointer
+bar_ref (gpointer instance)
+{
+       Bar * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+bar_unref (gpointer instance)
+{
+       Bar * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               BAR_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       Bar* bar = NULL;
+       Bar* _tmp0_;
+       Foo foo = {0};
+       Foo _tmp1_;
+       Foo* _tmp2_;
+       Foo* _tmp3_;
+       const gchar* _tmp4_;
+       _tmp0_ = bar_new ();
+       bar = _tmp0_;
+       foo_init (&foo, "hello");
+       _tmp1_ = foo;
+       bar_set_foo (bar, &_tmp1_);
+       _tmp2_ = bar_get_foo (bar);
+       _tmp3_ = _tmp2_;
+       _tmp4_ = (*_tmp3_).s;
+       _vala_assert (g_strcmp0 (_tmp4_, "hello") == 0, "bar.foo.s == \"hello\"");
+       foo_destroy (&foo);
+       _bar_unref0 (bar);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/structs/bug609642.c-expected b/tests/structs/bug609642.c-expected
new file mode 100644
index 000000000..9f5e0a43a
--- /dev/null
+++ b/tests/structs/bug609642.c-expected
@@ -0,0 +1,63 @@
+/* structs_bug609642.c generated by valac, the Vala compiler
+ * generated from structs_bug609642.vala, do not modify */
+
+#include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN void foo (GValue* result);
+static void _vala_main (void);
+
+void
+foo (GValue* result)
+{
+       GValue _tmp0_ = {0};
+       g_value_init (&_tmp0_, G_TYPE_STRING);
+       g_value_set_string (&_tmp0_, "foo");
+       *result = _tmp0_;
+       return;
+}
+
+static void
+_vala_main (void)
+{
+       gchar* bar = NULL;
+       GValue _tmp0_ = {0};
+       GValue _tmp1_;
+       gchar* _tmp2_;
+       gchar* _tmp3_;
+       foo (&_tmp0_);
+       _tmp1_ = _tmp0_;
+       _tmp2_ = g_strdup (g_value_get_string (&_tmp0_));
+       _tmp3_ = _tmp2_;
+       G_IS_VALUE (&_tmp1_) ? (g_value_unset (&_tmp1_), NULL) : NULL;
+       bar = _tmp3_;
+       _vala_assert (g_strcmp0 (bar, "foo") == 0, "bar == \"foo\"");
+       _g_free0 (bar);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/structs/bug613513.c-expected b/tests/structs/bug613513.c-expected
new file mode 100644
index 000000000..820f33cfe
--- /dev/null
+++ b/tests/structs/bug613513.c-expected
@@ -0,0 +1,101 @@
+/* structs_bug613513.c generated by valac, the Vala compiler
+ * generated from structs_bug613513.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+#define _g_free0(var) (var = (g_free (var), NULL))
+
+struct _Foo {
+       gint i;
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN void foo_init (Foo *self,
+               const gchar* s);
+static void _vala_main (void);
+
+void
+foo_init (Foo *self,
+          const gchar* s)
+{
+       g_return_if_fail (s != NULL);
+       memset (self, 0, sizeof (Foo));
+}
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       memcpy (dup, self, sizeof (Foo));
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Foo foo = {0};
+       gchar* _tmp0_;
+       gchar* _tmp1_;
+       gchar* _tmp2_;
+       gchar* _tmp3_;
+       _tmp0_ = g_strdup_printf ("%i", 42);
+       _tmp1_ = _tmp0_;
+       _tmp2_ = g_strconcat ("hello", _tmp1_, NULL);
+       _tmp3_ = _tmp2_;
+       foo_init (&foo, _tmp3_);
+       _g_free0 (_tmp3_);
+       _g_free0 (_tmp1_);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/structs/bug613825.c-expected b/tests/structs/bug613825.c-expected
new file mode 100644
index 000000000..d70336d3e
--- /dev/null
+++ b/tests/structs/bug613825.c-expected
@@ -0,0 +1,89 @@
+/* structs_bug613825.c generated by valac, the Vala compiler
+ * generated from structs_bug613825.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       gint i;
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+static void _vala_main (void);
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       memcpy (dup, self, sizeof (Foo));
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Foo foo = {0};
+       Foo _tmp0_ = {0};
+       Foo _tmp1_;
+       memset (&_tmp0_, 0, sizeof (Foo));
+       _tmp0_.i = 42;
+       foo = _tmp0_;
+       _tmp1_ = foo;
+       _vala_assert (_tmp1_.i == 42, "foo.i == 42");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/structs/bug621176.c-expected b/tests/structs/bug621176.c-expected
new file mode 100644
index 000000000..696b206ac
--- /dev/null
+++ b/tests/structs/bug621176.c-expected
@@ -0,0 +1,90 @@
+/* structs_bug621176.c generated by valac, the Vala compiler
+ * generated from structs_bug621176.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       gint i;
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+static void _vala_main (void);
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       memcpy (dup, self, sizeof (Foo));
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       GValue v = {0};
+       Foo _tmp0_ = {0};
+       GValue _tmp1_ = {0};
+       memset (&_tmp0_, 0, sizeof (Foo));
+       g_value_init (&_tmp1_, TYPE_FOO);
+       g_value_set_boxed (&_tmp1_, &_tmp0_);
+       v = _tmp1_;
+       _vala_assert (G_VALUE_TYPE (&v) == TYPE_FOO, "v.type() == typeof (Foo)");
+       G_IS_VALUE (&v) ? (g_value_unset (&v), NULL) : NULL;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/structs/bug622422.c-expected b/tests/structs/bug622422.c-expected
new file mode 100644
index 000000000..dc6b2bf0e
--- /dev/null
+++ b/tests/structs/bug622422.c-expected
@@ -0,0 +1,174 @@
+/* structs_bug622422.c generated by valac, the Vala compiler
+ * generated from structs_bug622422.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+typedef void (*TestDelegate) (gpointer user_data);
+typedef struct _Block1Data Block1Data;
+
+struct _Foo {
+       gint i;
+};
+
+struct _Block1Data {
+       int _ref_count_;
+       Foo foo;
+       GValue value;
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN void do_foo (TestDelegate d,
+             gpointer d_target);
+VALA_EXTERN void do_foo_lambda (Foo* foo,
+                    GValue* value);
+static Block1Data* block1_data_ref (Block1Data* _data1_);
+static void block1_data_unref (void * _userdata_);
+static void __lambda4_ (Block1Data* _data1_);
+static void ___lambda4__test_delegate (gpointer self);
+static void _vala_main (void);
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       memcpy (dup, self, sizeof (Foo));
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+void
+do_foo (TestDelegate d,
+        gpointer d_target)
+{
+}
+
+static Block1Data*
+block1_data_ref (Block1Data* _data1_)
+{
+       g_atomic_int_inc (&_data1_->_ref_count_);
+       return _data1_;
+}
+
+static void
+block1_data_unref (void * _userdata_)
+{
+       Block1Data* _data1_;
+       _data1_ = (Block1Data*) _userdata_;
+       if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
+               G_IS_VALUE (&_data1_->value) ? (g_value_unset (&_data1_->value), NULL) : NULL;
+               g_slice_free (Block1Data, _data1_);
+       }
+}
+
+static void
+__lambda4_ (Block1Data* _data1_)
+{
+       GValue _tmp0_ = {0};
+       GValue _tmp1_;
+       GValue _tmp2_ = {0};
+       _data1_->foo.i = 1;
+       g_value_init (&_tmp0_, G_TYPE_INT);
+       g_value_set_int (&_tmp0_, (gint) 2);
+       _tmp1_ = _tmp0_;
+       if (G_IS_VALUE (&_tmp1_)) {
+               g_value_init (&_tmp2_, G_VALUE_TYPE (&_tmp1_));
+               g_value_copy (&_tmp1_, &_tmp2_);
+       } else {
+               _tmp2_ = _tmp1_;
+       }
+       G_IS_VALUE (&_data1_->value) ? (g_value_unset (&_data1_->value), NULL) : NULL;
+       _data1_->value = _tmp2_;
+       G_IS_VALUE (&_tmp0_) ? (g_value_unset (&_tmp0_), NULL) : NULL;
+}
+
+static void
+___lambda4__test_delegate (gpointer self)
+{
+       __lambda4_ (self);
+}
+
+void
+do_foo_lambda (Foo* foo,
+               GValue* value)
+{
+       Block1Data* _data1_;
+       Foo _tmp0_;
+       GValue _tmp1_;
+       GValue _tmp2_;
+       GValue _tmp3_ = {0};
+       g_return_if_fail (foo != NULL);
+       g_return_if_fail (value != NULL);
+       _data1_ = g_slice_new0 (Block1Data);
+       _data1_->_ref_count_ = 1;
+       _tmp0_ = *foo;
+       _data1_->foo = _tmp0_;
+       _tmp1_ = *value;
+       _tmp2_ = _tmp1_;
+       if (G_IS_VALUE (&_tmp2_)) {
+               g_value_init (&_tmp3_, G_VALUE_TYPE (&_tmp2_));
+               g_value_copy (&_tmp2_, &_tmp3_);
+       } else {
+               _tmp3_ = _tmp2_;
+       }
+       G_IS_VALUE (&_data1_->value) ? (g_value_unset (&_data1_->value), NULL) : NULL;
+       _data1_->value = _tmp3_;
+       do_foo (___lambda4__test_delegate, _data1_);
+       block1_data_unref (_data1_);
+       _data1_ = NULL;
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/structs/bug623092.c-expected b/tests/structs/bug623092.c-expected
new file mode 100644
index 000000000..02791555a
--- /dev/null
+++ b/tests/structs/bug623092.c-expected
@@ -0,0 +1,131 @@
+/* structs_bug623092.c generated by valac, the Vala compiler
+ * generated from structs_bug623092.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       gint bar;
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN void foo_init (Foo *self,
+               gint bar);
+VALA_EXTERN void make_foo (gint bar,
+               Foo* result);
+static void _vala_main (void);
+static gboolean _foo_equal (const Foo * s1,
+                     const Foo * s2);
+
+void
+foo_init (Foo *self,
+          gint bar)
+{
+       memset (self, 0, sizeof (Foo));
+       (*self).bar = bar;
+}
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       memcpy (dup, self, sizeof (Foo));
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+void
+make_foo (gint bar,
+          Foo* result)
+{
+       Foo _tmp0_ = {0};
+       foo_init (&_tmp0_, bar);
+       *result = _tmp0_;
+       return;
+}
+
+static gboolean
+_foo_equal (const Foo * s1,
+            const Foo * s2)
+{
+       if (s1 == s2) {
+               return TRUE;
+       }
+       if (s1 == NULL) {
+               return FALSE;
+       }
+       if (s2 == NULL) {
+               return FALSE;
+       }
+       if (s1->bar != s2->bar) {
+               return FALSE;
+       }
+       return TRUE;
+}
+
+static void
+_vala_main (void)
+{
+       Foo foo = {0};
+       Foo _tmp0_;
+       Foo _tmp1_ = {0};
+       foo_init (&foo, 10);
+       _tmp0_ = foo;
+       make_foo (10, &_tmp1_);
+       _vala_assert (_foo_equal (&_tmp0_, &_tmp1_) == TRUE, "foo == make_foo (10)");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/structs/bug651441.c-expected b/tests/structs/bug651441.c-expected
new file mode 100644
index 000000000..a11b15f0d
--- /dev/null
+++ b/tests/structs/bug651441.c-expected
@@ -0,0 +1,89 @@
+/* structs_bug651441.c generated by valac, the Vala compiler
+ * generated from structs_bug651441.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+
+struct _Foo {
+       gint i;
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN void test (gint n,
+           ...);
+static void _vala_main (void);
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       memcpy (dup, self, sizeof (Foo));
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+void
+test (gint n,
+      ...)
+{
+}
+
+static void
+_vala_main (void)
+{
+       Foo foo = {0};
+       Foo _tmp0_ = {0};
+       test (0, &_tmp0_, NULL);
+       foo = _tmp0_;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/structs/bug654646.c-expected b/tests/structs/bug654646.c-expected
new file mode 100644
index 000000000..ac2e178a4
--- /dev/null
+++ b/tests/structs/bug654646.c-expected
@@ -0,0 +1,49 @@
+/* structs_bug654646.c generated by valac, the Vala compiler
+ * generated from structs_bug654646.vala, do not modify */
+
+#include <glib.h>
+#include <stdarg.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+VALA_EXTERN void foo (gint i,
+          ...);
+VALA_EXTERN void bar (va_list v);
+static void _vala_main (void);
+
+void
+foo (gint i,
+     ...)
+{
+       va_list v = {0};
+       va_start (v, i);
+       bar (v);
+       va_end (v);
+}
+
+void
+bar (va_list v)
+{
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/structs/bug654753.c-expected b/tests/structs/bug654753.c-expected
new file mode 100644
index 000000000..91c69baba
--- /dev/null
+++ b/tests/structs/bug654753.c-expected
@@ -0,0 +1,110 @@
+/* structs_bug654753.c generated by valac, the Vala compiler
+ * generated from structs_bug654753.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       gint baz;
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN void foo_bar (Foo *self,
+              Foo* f);
+static void _vala_main (void);
+
+void
+foo_bar (Foo *self,
+         Foo* f)
+{
+       g_return_if_fail (f != NULL);
+       (*self).baz = 10;
+       (*f).baz = 20;
+}
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       memcpy (dup, self, sizeof (Foo));
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* array = NULL;
+       Foo* _tmp0_;
+       gint array_length1;
+       gint _array_size_;
+       Foo _tmp1_;
+       Foo _tmp2_;
+       Foo _tmp3_;
+       _tmp0_ = g_new0 (Foo, 2);
+       array = _tmp0_;
+       array_length1 = 2;
+       _array_size_ = array_length1;
+       _tmp1_ = array[1];
+       foo_bar (&array[0], &_tmp1_);
+       _tmp2_ = array[0];
+       _vala_assert (_tmp2_.baz == 10, "array[0].baz == 10");
+       _tmp3_ = array[1];
+       _vala_assert (_tmp3_.baz == 0, "array[1].baz == 0");
+       array = (g_free (array), NULL);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/structs/bug656693.c-expected b/tests/structs/bug656693.c-expected
new file mode 100644
index 000000000..838a0d53e
--- /dev/null
+++ b/tests/structs/bug656693.c-expected
@@ -0,0 +1,107 @@
+/* structs_bug656693.c generated by valac, the Vala compiler
+ * generated from structs_bug656693.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+#define _foo_free0(var) ((var == NULL) ? NULL : (var = (foo_free (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       gint bar;
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN void baz (Foo* foo);
+static void _vala_main (void);
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       memcpy (dup, self, sizeof (Foo));
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+void
+baz (Foo* foo)
+{
+       g_return_if_fail (foo != NULL);
+       (*foo).bar = 3;
+}
+
+static gpointer
+_foo_dup0 (gpointer self)
+{
+       return self ? foo_dup (self) : NULL;
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foo = NULL;
+       Foo _tmp0_ = {0};
+       Foo* _tmp1_;
+       Foo _tmp2_;
+       memset (&_tmp0_, 0, sizeof (Foo));
+       _tmp1_ = _foo_dup0 (&_tmp0_);
+       foo = _tmp1_;
+       _tmp2_ = *foo;
+       baz (&_tmp2_);
+       _vala_assert ((*foo).bar == 0, "foo.bar == 0");
+       _foo_free0 (foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/structs/bug657378.c-expected b/tests/structs/bug657378.c-expected
new file mode 100644
index 000000000..43d1af6f2
--- /dev/null
+++ b/tests/structs/bug657378.c-expected
@@ -0,0 +1,64 @@
+/* structs_bug657378.c generated by valac, the Vala compiler
+ * generated from structs_bug657378.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+#include <stdarg.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN gchar* foo (const gchar* format,
+            ...)  G_GNUC_PRINTF(1,2) ;
+static void _vala_main (void);
+
+gchar*
+foo (const gchar* format,
+     ...)
+{
+       va_list _tmp0_ = {0};
+       gchar* _tmp1_;
+       gchar* _tmp2_;
+       gchar* result = NULL;
+       g_return_val_if_fail (format != NULL, NULL);
+       va_start (_tmp0_, format);
+       _tmp1_ = g_strdup_vprintf (format, _tmp0_);
+       _tmp2_ = _tmp1_;
+       va_end (_tmp0_);
+       result = _tmp2_;
+       return result;
+}
+
+static void
+_vala_main (void)
+{
+       gchar* _tmp0_;
+       gchar* _tmp1_;
+       _tmp0_ = foo ("%s", "foo");
+       _tmp1_ = _tmp0_;
+       _vala_assert (g_strcmp0 (_tmp1_, "foo") == 0, "foo (\"%s\", \"foo\") == \"foo\"");
+       _g_free0 (_tmp1_);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/structs/bug658048.c-expected b/tests/structs/bug658048.c-expected
new file mode 100644
index 000000000..ad1b35855
--- /dev/null
+++ b/tests/structs/bug658048.c-expected
@@ -0,0 +1,51 @@
+/* structs_bug658048.c generated by valac, the Vala compiler
+ * generated from structs_bug658048.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+
+static void _vala_main (void);
+static gboolean _g_value_equal (const GValue * s1,
+                         const GValue * s2);
+
+static gboolean
+_g_value_equal (const GValue * s1,
+                const GValue * s2)
+{
+       if (s1 == s2) {
+               return TRUE;
+       }
+       if (s1 == NULL) {
+               return FALSE;
+       }
+       if (s2 == NULL) {
+               return FALSE;
+       }
+       return FALSE;
+}
+
+static void
+_vala_main (void)
+{
+       GValue a = {0};
+       GValue _tmp0_ = {0};
+       gboolean res = FALSE;
+       GValue _tmp1_;
+       GValue _tmp2_;
+       g_value_init (&_tmp0_, G_TYPE_INT);
+       g_value_set_int (&_tmp0_, 10);
+       a = _tmp0_;
+       _tmp1_ = a;
+       _tmp2_ = a;
+       res = _g_value_equal (&_tmp1_, &_tmp2_) == TRUE;
+       G_IS_VALUE (&a) ? (g_value_unset (&a), NULL) : NULL;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/structs/bug660426.c-expected b/tests/structs/bug660426.c-expected
new file mode 100644
index 000000000..3915de253
--- /dev/null
+++ b/tests/structs/bug660426.c-expected
@@ -0,0 +1,155 @@
+/* structs_bug660426.c generated by valac, the Vala compiler
+ * generated from structs_bug660426.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       gint* bar;
+       gint bar_length1;
+       gint _bar_size_;
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN void foo_copy (const Foo* self,
+               Foo* dest);
+VALA_EXTERN void foo_destroy (Foo* self);
+static gint* _vala_array_dup1 (gint* self,
+                        gssize length);
+static void _vala_main (void);
+static inline gpointer _vala_memdup2 (gconstpointer mem,
+                        gsize byte_size);
+
+static gint*
+_vala_array_dup1 (gint* self,
+                  gssize length)
+{
+       if (length > 0) {
+               return _vala_memdup2 (self, length * sizeof (gint));
+       }
+       return NULL;
+}
+
+void
+foo_copy (const Foo* self,
+          Foo* dest)
+{
+       gint* _tmp0_;
+       gint _tmp0__length1;
+       gint* _tmp1_;
+       gint _tmp1__length1;
+       _tmp0_ = (*self).bar;
+       _tmp0__length1 = (*self).bar_length1;
+       _tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup1 (_tmp0_, _tmp0__length1) : _tmp0_;
+       _tmp1__length1 = _tmp0__length1;
+       (*dest).bar = (g_free ((*dest).bar), NULL);
+       (*dest).bar = _tmp1_;
+       (*dest).bar_length1 = _tmp1__length1;
+       (*dest)._bar_size_ = (*dest).bar_length1;
+}
+
+void
+foo_destroy (Foo* self)
+{
+       (*self).bar = (g_free ((*self).bar), NULL);
+}
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       foo_copy (self, dup);
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       foo_destroy (self);
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Foo f = {0};
+       gint _tmp0_;
+       Foo _tmp1_;
+       gint* _tmp2_;
+       gint _tmp2__length1;
+       memset (&f, 0, sizeof (Foo));
+       _tmp0_ = 10;
+       f.bar = g_renew (gint, f.bar, 10);
+       (_tmp0_ > f.bar_length1) ? memset (f.bar + f.bar_length1, 0, sizeof (gint) * (_tmp0_ - 
f.bar_length1)) : NULL;
+       f.bar_length1 = _tmp0_;
+       f._bar_size_ = _tmp0_;
+       _tmp1_ = f;
+       _tmp2_ = _tmp1_.bar;
+       _tmp2__length1 = _tmp1_.bar_length1;
+       _vala_assert (_tmp2__length1 == 10, "f.bar.length == 10");
+       foo_destroy (&f);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static inline gpointer
+_vala_memdup2 (gconstpointer mem,
+               gsize byte_size)
+{
+       gpointer new_mem;
+       if (mem && byte_size != 0) {
+               new_mem = g_malloc (byte_size);
+               memcpy (new_mem, mem, byte_size);
+       } else {
+               new_mem = NULL;
+       }
+       return new_mem;
+}
+
diff --git a/tests/structs/bug661945.c-expected b/tests/structs/bug661945.c-expected
new file mode 100644
index 000000000..f4b3538a2
--- /dev/null
+++ b/tests/structs/bug661945.c-expected
@@ -0,0 +1,133 @@
+/* structs_bug661945.c generated by valac, the Vala compiler
+ * generated from structs_bug661945.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       gint a;
+       gint b;
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+static void _vala_main (void);
+static GVariant* _variant_new1 (Foo value);
+static void _variant_get1 (GVariant* value,
+                    Foo * result);
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       memcpy (dup, self, sizeof (Foo));
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static GVariant*
+_variant_new1 (Foo value)
+{
+       GVariantBuilder _tmp1_;
+       g_variant_builder_init (&_tmp1_, G_VARIANT_TYPE_TUPLE);
+       g_variant_builder_add_value (&_tmp1_, g_variant_new_int32 (value.a));
+       g_variant_builder_add_value (&_tmp1_, g_variant_new_int32 (value.b));
+       return g_variant_ref_sink (g_variant_builder_end (&_tmp1_));
+}
+
+static void
+_variant_get1 (GVariant* value,
+               Foo * result)
+{
+       Foo _tmp4_;
+       GVariantIter _tmp5_;
+       GVariant* _tmp6_;
+       GVariant* _tmp7_;
+       g_variant_iter_init (&_tmp5_, value);
+       _tmp6_ = g_variant_iter_next_value (&_tmp5_);
+       _tmp4_.a = g_variant_get_int32 (_tmp6_);
+       g_variant_unref (_tmp6_);
+       _tmp7_ = g_variant_iter_next_value (&_tmp5_);
+       _tmp4_.b = g_variant_get_int32 (_tmp7_);
+       g_variant_unref (_tmp7_);
+       *result = _tmp4_;
+}
+
+static void
+_vala_main (void)
+{
+       GVariant* a = NULL;
+       Foo _tmp0_ = {0};
+       GVariant* _tmp2_;
+       Foo b = {0};
+       Foo _tmp3_;
+       Foo _tmp8_;
+       Foo _tmp9_;
+       memset (&_tmp0_, 0, sizeof (Foo));
+       _tmp0_.a = 2;
+       _tmp0_.b = 3;
+       _tmp2_ = _variant_new1 (_tmp0_);
+       a = _tmp2_;
+       _variant_get1 (a, &_tmp3_);
+       b = _tmp3_;
+       _tmp8_ = b;
+       _vala_assert (_tmp8_.a == 2, "b.a == 2");
+       _tmp9_ = b;
+       _vala_assert (_tmp9_.b == 3, "b.b == 3");
+       _g_variant_unref0 (a);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/structs/bug667890.c-expected b/tests/structs/bug667890.c-expected
new file mode 100644
index 000000000..5ddc58ed0
--- /dev/null
+++ b/tests/structs/bug667890.c-expected
@@ -0,0 +1,93 @@
+/* structs_bug667890.c generated by valac, the Vala compiler
+ * generated from structs_bug667890.vala, do not modify */
+
+#include <glib.h>
+#include <glib-object.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef struct _Foo Foo;
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define BAR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_BAR, BarIface))
+
+typedef struct _Bar Bar;
+typedef struct _BarIface BarIface;
+
+struct _Foo {
+       gint foo;
+};
+
+struct _BarIface {
+       GTypeInterface parent_iface;
+       Foo (*bar) (Bar* self);
+};
+
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo bar_bar (Bar* self);
+static GType bar_get_type_once (void);
+static void _vala_main (void);
+
+Foo
+bar_bar (Bar* self)
+{
+       Foo result = {0};
+       BarIface* _iface_;
+       _iface_ = BAR_GET_INTERFACE (self);
+       if (_iface_->bar) {
+               return _iface_->bar (self);
+       }
+       return result;
+}
+
+static void
+bar_default_init (BarIface * iface,
+                  gpointer iface_data)
+{
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (BarIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType bar_type_id;
+       bar_type_id = g_type_register_static (G_TYPE_INTERFACE, "Bar", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (bar_type_id, G_TYPE_OBJECT);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/structs/bug669580.c-expected b/tests/structs/bug669580.c-expected
new file mode 100644
index 000000000..255621b6c
--- /dev/null
+++ b/tests/structs/bug669580.c-expected
@@ -0,0 +1,122 @@
+/* structs_bug669580.c generated by valac, the Vala compiler
+ * generated from structs_bug669580.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+
+#define TYPE_BAR (bar_get_type ())
+typedef Foo Bar;
+
+struct _Foo {
+       gint i;
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Bar* bar_dup (const Bar* self);
+VALA_EXTERN void bar_free (Bar* self);
+static void _vala_main (void);
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       memcpy (dup, self, sizeof (Foo));
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+Bar*
+bar_dup (const Bar* self)
+{
+       Bar* dup;
+       dup = g_new0 (Bar, 1);
+       memcpy (dup, self, sizeof (Bar));
+       return dup;
+}
+
+void
+bar_free (Bar* self)
+{
+       g_free (self);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       GType bar_type_id;
+       bar_type_id = g_boxed_type_register_static ("Bar", (GBoxedCopyFunc) bar_dup, (GBoxedFreeFunc) 
bar_free);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Bar bar = {0};
+       Bar _tmp0_ = {0};
+       _tmp0_.i = 0;
+       bar = _tmp0_;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/structs/bug685177.c-expected b/tests/structs/bug685177.c-expected
new file mode 100644
index 000000000..501cf7c0a
--- /dev/null
+++ b/tests/structs/bug685177.c-expected
@@ -0,0 +1,230 @@
+/* structs_bug685177.c generated by valac, the Vala compiler
+ * generated from structs_bug685177.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define __vala_GValue_free0(var) ((var == NULL) ? NULL : (var = (_vala_GValue_free (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN void non_nullable (GValue* v1,
+                   GValue* v2,
+                   GValue* v3);
+VALA_EXTERN void nullable (GValue* v1,
+               GValue** v2,
+               GValue** v3);
+static GValue* _g_value_dup (GValue* self);
+static void _vala_GValue_free (GValue* self);
+static void _vala_main (void);
+
+void
+non_nullable (GValue* v1,
+              GValue* v2,
+              GValue* v3)
+{
+       GValue _vala_v3 = {0};
+       GValue _tmp0_;
+       GValue _tmp1_;
+       GValue _tmp2_ = {0};
+       GValue _tmp3_;
+       GValue _tmp4_;
+       GValue _tmp5_ = {0};
+       g_return_if_fail (v1 != NULL);
+       g_return_if_fail (v2 != NULL);
+       _tmp0_ = *v2;
+       _tmp1_ = _tmp0_;
+       if (G_IS_VALUE (&_tmp1_)) {
+               g_value_init (&_tmp2_, G_VALUE_TYPE (&_tmp1_));
+               g_value_copy (&_tmp1_, &_tmp2_);
+       } else {
+               _tmp2_ = _tmp1_;
+       }
+       G_IS_VALUE (&_vala_v3) ? (g_value_unset (&_vala_v3), NULL) : NULL;
+       _vala_v3 = _tmp2_;
+       _tmp3_ = *v1;
+       _tmp4_ = _tmp3_;
+       if (G_IS_VALUE (&_tmp4_)) {
+               g_value_init (&_tmp5_, G_VALUE_TYPE (&_tmp4_));
+               g_value_copy (&_tmp4_, &_tmp5_);
+       } else {
+               _tmp5_ = _tmp4_;
+       }
+       G_IS_VALUE (v2) ? (g_value_unset (v2), NULL) : NULL;
+       *v2 = _tmp5_;
+       if (v3) {
+               *v3 = _vala_v3;
+       } else {
+               G_IS_VALUE (&_vala_v3) ? (g_value_unset (&_vala_v3), NULL) : NULL;
+       }
+}
+
+static GValue*
+_g_value_dup (GValue* self)
+{
+       return g_boxed_copy (G_TYPE_VALUE, self);
+}
+
+static gpointer
+__g_value_dup0 (gpointer self)
+{
+       return self ? _g_value_dup (self) : NULL;
+}
+
+static void
+_vala_GValue_free (GValue* self)
+{
+       g_boxed_free (G_TYPE_VALUE, self);
+}
+
+void
+nullable (GValue* v1,
+          GValue** v2,
+          GValue** v3)
+{
+       GValue* _vala_v3 = NULL;
+       GValue* _tmp0_;
+       _tmp0_ = __g_value_dup0 (*v2);
+       __vala_GValue_free0 (_vala_v3);
+       _vala_v3 = _tmp0_;
+       __vala_GValue_free0 (*v2);
+       *v2 = NULL;
+       if (v3) {
+               *v3 = _vala_v3;
+       } else {
+               __vala_GValue_free0 (_vala_v3);
+       }
+}
+
+static void
+_vala_main (void)
+{
+       GValue v1 = {0};
+       GValue _tmp0_ = {0};
+       GValue v2 = {0};
+       GValue _tmp1_ = {0};
+       GValue v3 = {0};
+       GValue _tmp2_;
+       GValue _tmp3_ = {0};
+       GValue _tmp4_;
+       GValue _tmp5_;
+       GValue _tmp6_;
+       GValue* v4 = NULL;
+       GValue* _tmp7_ = NULL;
+       GValue* v5 = NULL;
+       GValue* _tmp8_ = NULL;
+       GValue* v6 = NULL;
+       GValue* _tmp9_ = NULL;
+       GValue* _tmp10_;
+       GValue _tmp11_;
+       GValue _tmp12_ = {0};
+       GValue _tmp13_;
+       GValue _tmp14_;
+       GValue* _tmp15_;
+       GValue* _tmp16_;
+       GValue* _tmp17_;
+       GValue* _tmp18_;
+       GValue* _tmp19_ = NULL;
+       GValue* _tmp20_ = NULL;
+       GValue* _tmp21_ = NULL;
+       GValue* _tmp22_;
+       GValue* _tmp23_ = NULL;
+       GValue* _tmp24_;
+       GValue* _tmp25_;
+       GValue* _tmp26_;
+       g_value_init (&_tmp0_, G_TYPE_INT);
+       g_value_set_int (&_tmp0_, 1);
+       v1 = _tmp0_;
+       g_value_init (&_tmp1_, G_TYPE_INT);
+       g_value_set_int (&_tmp1_, 2);
+       v2 = _tmp1_;
+       _tmp2_ = v1;
+       non_nullable (&_tmp2_, &v2, &_tmp3_);
+       G_IS_VALUE (&v3) ? (g_value_unset (&v3), NULL) : NULL;
+       v3 = _tmp3_;
+       _tmp4_ = v1;
+       _vala_assert (g_value_get_int (&_tmp4_) == 1, "(int)v1 == 1");
+       _tmp5_ = v2;
+       _vala_assert (g_value_get_int (&_tmp5_) == 1, "(int)v2 == 1");
+       _tmp6_ = v3;
+       _vala_assert (g_value_get_int (&_tmp6_) == 2, "(int)v3 == 2");
+       _tmp7_ = g_new0 (GValue, 1);
+       g_value_init (_tmp7_, G_TYPE_INT);
+       g_value_set_int (_tmp7_, 4);
+       v4 = _tmp7_;
+       _tmp8_ = g_new0 (GValue, 1);
+       g_value_init (_tmp8_, G_TYPE_INT);
+       g_value_set_int (_tmp8_, 5);
+       v5 = _tmp8_;
+       _tmp9_ = g_new0 (GValue, 1);
+       g_value_init (_tmp9_, G_TYPE_INT);
+       g_value_set_int (_tmp9_, 6);
+       v6 = _tmp9_;
+       _tmp10_ = v4;
+       _tmp11_ = *_tmp10_;
+       non_nullable (&_tmp11_, v5, &_tmp12_);
+       __vala_GValue_free0 (v6);
+       _tmp13_ = _tmp12_;
+       _tmp14_ = _tmp13_;
+       _tmp15_ = __g_value_dup0 (&_tmp14_);
+       v6 = _tmp15_;
+       G_IS_VALUE (&_tmp13_) ? (g_value_unset (&_tmp13_), NULL) : NULL;
+       _tmp16_ = v4;
+       _vala_assert (g_value_get_int (_tmp16_) == 4, "(int)v4 == 4");
+       _tmp17_ = v5;
+       _vala_assert (g_value_get_int (_tmp17_) == 4, "(int)v5 == 4");
+       _tmp18_ = v6;
+       _vala_assert (g_value_get_int (_tmp18_) == 5, "(int)v6 == 5");
+       _tmp19_ = g_new0 (GValue, 1);
+       g_value_init (_tmp19_, G_TYPE_INT);
+       g_value_set_int (_tmp19_, 4);
+       __vala_GValue_free0 (v4);
+       v4 = _tmp19_;
+       _tmp20_ = g_new0 (GValue, 1);
+       g_value_init (_tmp20_, G_TYPE_INT);
+       g_value_set_int (_tmp20_, 5);
+       __vala_GValue_free0 (v5);
+       v5 = _tmp20_;
+       _tmp21_ = g_new0 (GValue, 1);
+       g_value_init (_tmp21_, G_TYPE_INT);
+       g_value_set_int (_tmp21_, 6);
+       __vala_GValue_free0 (v6);
+       v6 = _tmp21_;
+       _tmp22_ = v4;
+       nullable (_tmp22_, &v5, &_tmp23_);
+       __vala_GValue_free0 (v6);
+       v6 = _tmp23_;
+       _tmp24_ = v4;
+       _vala_assert (g_value_get_int (_tmp24_) == 4, "(int)v4 == 4");
+       _tmp25_ = v5;
+       _vala_assert (((gpointer) _tmp25_) == NULL, "v5 == null");
+       _tmp26_ = v6;
+       _vala_assert (g_value_get_int (_tmp26_) == 5, "(int)v6 == 5");
+       __vala_GValue_free0 (v6);
+       __vala_GValue_free0 (v5);
+       __vala_GValue_free0 (v4);
+       G_IS_VALUE (&v3) ? (g_value_unset (&v3), NULL) : NULL;
+       G_IS_VALUE (&v2) ? (g_value_unset (&v2), NULL) : NULL;
+       G_IS_VALUE (&v1) ? (g_value_unset (&v1), NULL) : NULL;
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/structs/bug686190.c-expected b/tests/structs/bug686190.c-expected
new file mode 100644
index 000000000..3e05e5e45
--- /dev/null
+++ b/tests/structs/bug686190.c-expected
@@ -0,0 +1,96 @@
+/* structs_bug686190.c generated by valac, the Vala compiler
+ * generated from structs_bug686190.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       gint x;
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN void foo_meth (Foo *self);
+static void _vala_main (void);
+
+void
+foo_meth (Foo *self)
+{
+       (*self).x = 10;
+}
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       memcpy (dup, self, sizeof (Foo));
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Foo foo = {0};
+       Foo* bar = NULL;
+       Foo _tmp0_;
+       memset (&foo, 0, sizeof (Foo));
+       bar = &foo;
+       foo_meth (bar);
+       _tmp0_ = foo;
+       _vala_assert (_tmp0_.x == 10, "foo.x == 10");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/structs/bug688732.c-expected b/tests/structs/bug688732.c-expected
new file mode 100644
index 000000000..d0717e990
--- /dev/null
+++ b/tests/structs/bug688732.c-expected
@@ -0,0 +1,155 @@
+/* structs_bug688732.c generated by valac, the Vala compiler
+ * generated from structs_bug688732.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+
+#define TYPE_BAR (bar_get_type ())
+typedef Foo Bar;
+
+struct _Foo {
+       gpointer t;
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN void foo_copy (const Foo* self,
+               Foo* dest);
+VALA_EXTERN void foo_destroy (Foo* self);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Bar* bar_dup (const Bar* self);
+VALA_EXTERN void bar_free (Bar* self);
+VALA_EXTERN void bar_copy (const Bar* self,
+               Bar* dest);
+VALA_EXTERN void bar_destroy (Bar* self);
+static void _vala_main (void);
+
+void
+foo_copy (const Foo* self,
+          Foo* dest)
+{
+       gconstpointer _tmp0_;
+       _tmp0_ = (*self).t;
+       (*dest).t = _tmp0_;
+}
+
+void
+foo_destroy (Foo* self)
+{
+}
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       foo_copy (self, dup);
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       foo_destroy (self);
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+void
+bar_copy (const Bar* self,
+          Bar* dest)
+{
+       gconstpointer _tmp0_;
+       _tmp0_ = (*self).t;
+       bar_destroy (&(*dest).t);
+       (*dest).t = _tmp0_;
+}
+
+void
+bar_destroy (Bar* self)
+{
+       foo_destroy (self);
+}
+
+Bar*
+bar_dup (const Bar* self)
+{
+       Bar* dup;
+       dup = g_new0 (Bar, 1);
+       bar_copy (self, dup);
+       return dup;
+}
+
+void
+bar_free (Bar* self)
+{
+       bar_destroy (self);
+       g_free (self);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       GType bar_type_id;
+       bar_type_id = g_boxed_type_register_static ("Bar", (GBoxedCopyFunc) bar_dup, (GBoxedFreeFunc) 
bar_free);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/structs/bug690380.c-expected b/tests/structs/bug690380.c-expected
new file mode 100644
index 000000000..8179531e6
--- /dev/null
+++ b/tests/structs/bug690380.c-expected
@@ -0,0 +1,173 @@
+/* structs_bug690380.c generated by valac, the Vala compiler
+ * generated from structs_bug690380.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+
+#define TYPE_BAR (bar_get_type ())
+typedef Foo Bar;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       gint i;
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Bar* bar_dup (const Bar* self);
+VALA_EXTERN void bar_free (Bar* self);
+static void _vala_main (void);
+static gboolean _foo_equal (const Foo * s1,
+                     const Foo * s2);
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       memcpy (dup, self, sizeof (Foo));
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+Bar*
+bar_dup (const Bar* self)
+{
+       Bar* dup;
+       dup = g_new0 (Bar, 1);
+       memcpy (dup, self, sizeof (Bar));
+       return dup;
+}
+
+void
+bar_free (Bar* self)
+{
+       g_free (self);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       GType bar_type_id;
+       bar_type_id = g_boxed_type_register_static ("Bar", (GBoxedCopyFunc) bar_dup, (GBoxedFreeFunc) 
bar_free);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static gboolean
+_foo_equal (const Foo * s1,
+            const Foo * s2)
+{
+       if (s1 == s2) {
+               return TRUE;
+       }
+       if (s1 == NULL) {
+               return FALSE;
+       }
+       if (s2 == NULL) {
+               return FALSE;
+       }
+       if (s1->i != s2->i) {
+               return FALSE;
+       }
+       return TRUE;
+}
+
+static void
+_vala_main (void)
+{
+       Foo f1 = {0};
+       Foo _tmp0_ = {0};
+       Foo f2 = {0};
+       Foo _tmp1_ = {0};
+       Foo _tmp2_;
+       Foo _tmp3_;
+       Bar b1 = {0};
+       Bar _tmp4_ = {0};
+       Bar b2 = {0};
+       Bar _tmp5_ = {0};
+       Bar _tmp6_;
+       Bar _tmp7_;
+       memset (&_tmp0_, 0, sizeof (Foo));
+       _tmp0_.i = 42;
+       f1 = _tmp0_;
+       memset (&_tmp1_, 0, sizeof (Foo));
+       _tmp1_.i = 42;
+       f2 = _tmp1_;
+       _tmp2_ = f1;
+       _tmp3_ = f2;
+       _vala_assert (_foo_equal (&_tmp2_, &_tmp3_) == TRUE, "f1 == f2");
+       memset (&_tmp4_, 0, sizeof (Bar));
+       _tmp4_.i = 42;
+       b1 = _tmp4_;
+       memset (&_tmp5_, 0, sizeof (Bar));
+       _tmp5_.i = 42;
+       b2 = _tmp5_;
+       _tmp6_ = b1;
+       _tmp7_ = b2;
+       _vala_assert (_foo_equal (&_tmp6_, &_tmp7_) == TRUE, "b1 == b2");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/structs/bug694140.c-expected b/tests/structs/bug694140.c-expected
new file mode 100644
index 000000000..e00332124
--- /dev/null
+++ b/tests/structs/bug694140.c-expected
@@ -0,0 +1,137 @@
+/* structs_bug694140.c generated by valac, the Vala compiler
+ * generated from structs_bug694140.vala, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef gint Foo;
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN gchar** colors;
+VALA_EXTERN gint colors_length1;
+gchar** colors = NULL;
+gint colors_length1 = 0;
+static gint _colors_size_ = 0;
+
+VALA_EXTERN const gchar* foo_get_bar (Foo self);
+VALA_EXTERN void foo_set_bar (Foo self,
+                  const gchar* value);
+static void _vala_main (void);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+const gchar*
+foo_get_bar (Foo self)
+{
+       const gchar* result;
+       gchar** _tmp0_;
+       gint _tmp0__length1;
+       const gchar* _tmp1_;
+       _tmp0_ = colors;
+       _tmp0__length1 = colors_length1;
+       _tmp1_ = _tmp0_[(gint) self];
+       result = _tmp1_;
+       return result;
+}
+
+void
+foo_set_bar (Foo self,
+             const gchar* value)
+{
+       gchar** _tmp0_;
+       gint _tmp0__length1;
+       gchar* _tmp1_;
+       _tmp0_ = colors;
+       _tmp0__length1 = colors_length1;
+       _tmp1_ = g_strdup (value);
+       _g_free0 (_tmp0_[(gint) self]);
+       _tmp0_[(gint) self] = _tmp1_;
+}
+
+static void
+_vala_main (void)
+{
+       gchar* _tmp0_;
+       gchar* _tmp1_;
+       gchar* _tmp2_;
+       gchar* _tmp3_;
+       gchar** _tmp4_;
+       Foo foo = 0;
+       const gchar* _tmp5_;
+       const gchar* _tmp6_;
+       const gchar* _tmp7_;
+       const gchar* _tmp8_;
+       _tmp0_ = g_strdup ("black");
+       _tmp1_ = g_strdup ("red");
+       _tmp2_ = g_strdup ("green");
+       _tmp3_ = g_strdup ("blue");
+       _tmp4_ = g_new0 (gchar*, 4 + 1);
+       _tmp4_[0] = _tmp0_;
+       _tmp4_[1] = _tmp1_;
+       _tmp4_[2] = _tmp2_;
+       _tmp4_[3] = _tmp3_;
+       colors = (_vala_array_free (colors, colors_length1, (GDestroyNotify) g_free), NULL);
+       colors = _tmp4_;
+       colors_length1 = 4;
+       _colors_size_ = colors_length1;
+       foo = (Foo) 1;
+       _tmp5_ = foo_get_bar (foo);
+       _tmp6_ = _tmp5_;
+       _vala_assert (g_strcmp0 (_tmp6_, "red") == 0, "foo.bar == \"red\"");
+       foo_set_bar (foo, "white");
+       _tmp7_ = foo_get_bar (foo);
+       _tmp8_ = _tmp7_;
+       _vala_assert (g_strcmp0 (_tmp8_, "white") == 0, "foo.bar == \"white\"");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/structs/bug749952.c-expected b/tests/structs/bug749952.c-expected
new file mode 100644
index 000000000..f2f605568
--- /dev/null
+++ b/tests/structs/bug749952.c-expected
@@ -0,0 +1,159 @@
+/* structs_bug749952.c generated by valac, the Vala compiler
+ * generated from structs_bug749952.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+
+#define TYPE_BAR (bar_get_type ())
+typedef Foo Bar;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       gint i;
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Bar* bar_dup (const Bar* self);
+VALA_EXTERN void bar_free (Bar* self);
+static void _vala_main (void);
+static gboolean _foo_equal (const Foo * s1,
+                     const Foo * s2);
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       memcpy (dup, self, sizeof (Foo));
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+Bar*
+bar_dup (const Bar* self)
+{
+       Bar* dup;
+       dup = g_new0 (Bar, 1);
+       memcpy (dup, self, sizeof (Bar));
+       return dup;
+}
+
+void
+bar_free (Bar* self)
+{
+       g_free (self);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       GType bar_type_id;
+       bar_type_id = g_boxed_type_register_static ("Bar", (GBoxedCopyFunc) bar_dup, (GBoxedFreeFunc) 
bar_free);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static gboolean
+_foo_equal (const Foo * s1,
+            const Foo * s2)
+{
+       if (s1 == s2) {
+               return TRUE;
+       }
+       if (s1 == NULL) {
+               return FALSE;
+       }
+       if (s2 == NULL) {
+               return FALSE;
+       }
+       if (s1->i != s2->i) {
+               return FALSE;
+       }
+       return TRUE;
+}
+
+static void
+_vala_main (void)
+{
+       Bar b1 = {0};
+       Bar _tmp0_ = {0};
+       Bar b2 = {0};
+       Bar _tmp1_ = {0};
+       Bar _tmp2_;
+       Bar _tmp3_;
+       Bar _tmp4_;
+       Bar _tmp5_;
+       b1 = _tmp0_;
+       b2 = _tmp1_;
+       _tmp2_ = b1;
+       _tmp3_ = b2;
+       _vala_assert (_foo_equal (&_tmp2_, &_tmp3_) == TRUE, "b1 == b2");
+       _tmp4_ = b2;
+       _tmp5_ = b1;
+       _vala_assert (_foo_equal (&_tmp4_, &_tmp5_) == TRUE, "b2 == b1");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/structs/bug775761.c-expected b/tests/structs/bug775761.c-expected
new file mode 100644
index 000000000..7edb24f09
--- /dev/null
+++ b/tests/structs/bug775761.c-expected
@@ -0,0 +1,182 @@
+/* structs_bug775761.c generated by valac, the Vala compiler
+ * generated from structs_bug775761.vala, do not modify */
+
+#include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       gchar* foo;
+       gint bar;
+       gchar** baz;
+       gint baz_length1;
+       gint _baz_size_;
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN void foo_copy (const Foo* self,
+               Foo* dest);
+VALA_EXTERN void foo_destroy (Foo* self);
+static void _vala_main (void);
+static gboolean _foo_equal (const Foo * s1,
+                     const Foo * s2);
+
+const gchar* FOO_ARRAY[2] = {"manam", "minimi"};
+
+void
+foo_copy (const Foo* self,
+          Foo* dest)
+{
+       const gchar* _tmp0_;
+       gchar* _tmp1_;
+       gchar** _tmp2_;
+       gint _tmp2__length1;
+       _tmp0_ = (*self).foo;
+       _tmp1_ = g_strdup (_tmp0_);
+       _g_free0 ((*dest).foo);
+       (*dest).foo = _tmp1_;
+       (*dest).bar = (*self).bar;
+       _tmp2_ = (*self).baz;
+       _tmp2__length1 = (*self).baz_length1;
+       (*dest).baz = _tmp2_;
+       (*dest).baz_length1 = _tmp2__length1;
+       (*dest)._baz_size_ = (*dest).baz_length1;
+}
+
+void
+foo_destroy (Foo* self)
+{
+       _g_free0 ((*self).foo);
+}
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       foo_copy (self, dup);
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       foo_destroy (self);
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static gboolean
+_foo_equal (const Foo * s1,
+            const Foo * s2)
+{
+       if (s1 == s2) {
+               return TRUE;
+       }
+       if (s1 == NULL) {
+               return FALSE;
+       }
+       if (s2 == NULL) {
+               return FALSE;
+       }
+       if (g_strcmp0 (s1->foo, s2->foo)) {
+               return FALSE;
+       }
+       if (s1->bar != s2->bar) {
+               return FALSE;
+       }
+       if (s1->baz != s2->baz) {
+               return FALSE;
+       }
+       return TRUE;
+}
+
+static void
+_vala_main (void)
+{
+       Foo a = {0};
+       gchar* _tmp0_;
+       Foo _tmp1_ = {0};
+       Foo b = {0};
+       gchar* _tmp2_;
+       Foo _tmp3_ = {0};
+       Foo _tmp4_;
+       Foo _tmp5_;
+       Foo _tmp6_;
+       gchar** _tmp7_;
+       gint _tmp7__length1;
+       _tmp0_ = g_strdup ("42");
+       _g_free0 (_tmp1_.foo);
+       _tmp1_.foo = _tmp0_;
+       _tmp1_.bar = 42;
+       _tmp1_.baz = FOO_ARRAY;
+       _tmp1_.baz_length1 = G_N_ELEMENTS (FOO_ARRAY);
+       _tmp1_._baz_size_ = _tmp1_.baz_length1;
+       a = _tmp1_;
+       _tmp2_ = g_strdup ("42");
+       _g_free0 (_tmp3_.foo);
+       _tmp3_.foo = _tmp2_;
+       _tmp3_.bar = 42;
+       _tmp3_.baz = FOO_ARRAY;
+       _tmp3_.baz_length1 = G_N_ELEMENTS (FOO_ARRAY);
+       _tmp3_._baz_size_ = _tmp3_.baz_length1;
+       b = _tmp3_;
+       _tmp4_ = a;
+       _tmp5_ = b;
+       _vala_assert (_foo_equal (&_tmp4_, &_tmp5_) == TRUE, "a == b");
+       _tmp6_ = a;
+       _tmp7_ = _tmp6_.baz;
+       _tmp7__length1 = _tmp6_.baz_length1;
+       _vala_assert (_tmp7__length1 == 2, "a.f3.length == 2");
+       foo_destroy (&b);
+       foo_destroy (&a);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/structs/bug777194-2.c-expected b/tests/structs/bug777194-2.c-expected
new file mode 100644
index 000000000..101c5d55a
--- /dev/null
+++ b/tests/structs/bug777194-2.c-expected
@@ -0,0 +1,44 @@
+/* structs_bug777194_2.c generated by valac, the Vala compiler
+ * generated from structs_bug777194_2.vala, do not modify */
+
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN gint* foo;
+gint* foo = NULL;
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+       gint* _tmp0_;
+       gint _tmp0__length1;
+       foo = (gint*) 0;
+       _tmp0_ = foo;
+       _tmp0__length1 = -1;
+       _vala_assert (_tmp0_ == NULL, "foo == null");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/structs/bug777194.c-expected b/tests/structs/bug777194.c-expected
new file mode 100644
index 000000000..22a22e517
--- /dev/null
+++ b/tests/structs/bug777194.c-expected
@@ -0,0 +1,369 @@
+/* structs_bug777194.c generated by valac, the Vala compiler
+ * generated from structs_bug777194.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+#define _foo_free0(var) ((var == NULL) ? NULL : (var = (foo_free (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       gint64 foo;
+       gint64 bar;
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN void bar (guint8* a,
+          gint a_length1);
+static void _vala_main (void);
+static guint8* _vala_array_dup1 (guint8* self,
+                          gssize length);
+static guint8* _vala_array_dup2 (guint8* self,
+                          gssize length);
+static guint8* _vala_array_dup3 (guint8* self,
+                          gssize length);
+static guint8* _vala_array_dup4 (guint8* self,
+                          gssize length);
+static guint8* _vala_array_dup5 (guint8* self,
+                          gssize length);
+static inline gpointer _vala_memdup2 (gconstpointer mem,
+                        gsize byte_size);
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       memcpy (dup, self, sizeof (Foo));
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+void
+bar (guint8* a,
+     gint a_length1)
+{
+       Foo* f = NULL;
+       gint f_length1;
+       gint _f_size_;
+       Foo _tmp0_;
+       Foo _tmp1_;
+       f = (Foo*) a;
+       f_length1 = (a_length1 * sizeof (guint8)) / sizeof (Foo);
+       _f_size_ = f_length1;
+       _tmp0_ = f[0];
+       _vala_assert (_tmp0_.foo == (2LL << 62), "f[0].foo == 2LL << 62");
+       _tmp1_ = f[0];
+       _vala_assert (_tmp1_.bar == (2LL << 31), "f[0].bar == 2LL << 31");
+}
+
+static gpointer
+_foo_dup0 (gpointer self)
+{
+       return self ? foo_dup (self) : NULL;
+}
+
+static guint8*
+_vala_array_dup1 (guint8* self,
+                  gssize length)
+{
+       if (length > 0) {
+               return _vala_memdup2 (self, length * sizeof (guint8));
+       }
+       return NULL;
+}
+
+static guint8*
+_vala_array_dup2 (guint8* self,
+                  gssize length)
+{
+       if (length > 0) {
+               return _vala_memdup2 (self, length * sizeof (guint8));
+       }
+       return NULL;
+}
+
+static guint8*
+_vala_array_dup3 (guint8* self,
+                  gssize length)
+{
+       if (length > 0) {
+               return _vala_memdup2 (self, length * sizeof (guint8));
+       }
+       return NULL;
+}
+
+static guint8*
+_vala_array_dup4 (guint8* self,
+                  gssize length)
+{
+       if (length > 0) {
+               return _vala_memdup2 (self, length * sizeof (guint8));
+       }
+       return NULL;
+}
+
+static guint8*
+_vala_array_dup5 (guint8* self,
+                  gssize length)
+{
+       if (length > 0) {
+               return _vala_memdup2 (self, length * sizeof (guint8));
+       }
+       return NULL;
+}
+
+static void
+_vala_main (void)
+{
+       guint8* tu = NULL;
+       gint tu_length1 = 0;
+       gint _tu_size_ = 0;
+       guint8* to = NULL;
+       gint to_length1 = 0;
+       gint _to_size_ = 0;
+       Foo fstack = {0};
+       Foo _tmp0_ = {0};
+       Foo* fheap = NULL;
+       Foo _tmp1_ = {0};
+       Foo* _tmp2_;
+       guint8* _tmp3_;
+       gint _tmp3__length1;
+       guint8* _tmp4_;
+       gint _tmp4__length1;
+       guint8* _tmp5_;
+       gint _tmp5__length1;
+       guint8* _tmp6_;
+       gint _tmp6__length1;
+       guint8* _tmp7_;
+       gint _tmp7__length1;
+       Foo _tmp8_;
+       Foo _tmp9_;
+       guint8* _tmp10_;
+       gint _tmp10__length1;
+       guint8* _tmp11_;
+       gint _tmp11__length1;
+       Foo _tmp12_;
+       guint8* _tmp13_;
+       gint _tmp13__length1;
+       guint8* _tmp14_;
+       gint _tmp14__length1;
+       guint8* _tmp15_;
+       gint _tmp15__length1;
+       guint8* _tmp16_;
+       gint _tmp16__length1;
+       guint8* _tmp17_;
+       gint _tmp17__length1;
+       guint8* _tmp18_;
+       gint _tmp18__length1;
+       guint8* _tmp19_;
+       gint _tmp19__length1;
+       guint8* _tmp20_;
+       gint _tmp20__length1;
+       gint32 i32 = 0;
+       guint8* _tmp21_;
+       gint _tmp21__length1;
+       guint8* _tmp22_;
+       gint _tmp22__length1;
+       guint8* _tmp23_;
+       gint _tmp23__length1;
+       guint8* _tmp24_;
+       gint _tmp24__length1;
+       guint64 u64 = 0ULL;
+       guint8* _tmp25_;
+       gint _tmp25__length1;
+       guint8* _tmp26_;
+       gint _tmp26__length1;
+       guint8* _tmp27_;
+       gint _tmp27__length1;
+       guint8* _tmp28_;
+       gint _tmp28__length1;
+       _tmp0_.foo = 2LL << 62;
+       _tmp0_.bar = 2LL << 31;
+       fstack = _tmp0_;
+       _tmp1_.foo = 2LL << 62;
+       _tmp1_.bar = 2LL << 31;
+       _tmp2_ = _foo_dup0 (&_tmp1_);
+       fheap = _tmp2_;
+       bar ((guint8*) (&fstack), (gint) (sizeof (Foo) / sizeof (guint8)));
+       tu = (guint8*) (&fstack);
+       tu_length1 = sizeof (Foo) / sizeof (guint8);
+       _tu_size_ = tu_length1;
+       _tmp3_ = tu;
+       _tmp3__length1 = tu_length1;
+       _vala_assert (_tmp3__length1 == 16, "tu.length == 16");
+       _tmp4_ = tu;
+       _tmp4__length1 = tu_length1;
+       bar (_tmp4_, (gint) _tmp4__length1);
+       _tmp5_ = (((guint8*) (&fstack)) != NULL) ? _vala_array_dup1 ((guint8*) (&fstack), sizeof (Foo) / 
sizeof (guint8)) : ((guint8*) (&fstack));
+       _tmp5__length1 = sizeof (Foo) / sizeof (guint8);
+       to = (g_free (to), NULL);
+       to = _tmp5_;
+       to_length1 = _tmp5__length1;
+       _to_size_ = to_length1;
+       _tmp6_ = to;
+       _tmp6__length1 = to_length1;
+       _vala_assert (_tmp6__length1 == 16, "to.length == 16");
+       _tmp7_ = to;
+       _tmp7__length1 = to_length1;
+       bar (_tmp7_, (gint) _tmp7__length1);
+       _tmp8_ = fstack;
+       bar ((guint8*) (&_tmp8_), (gint) (sizeof (Foo) / sizeof (guint8)));
+       _tmp9_ = fstack;
+       tu = (guint8*) (&_tmp9_);
+       tu_length1 = sizeof (Foo) / sizeof (guint8);
+       _tu_size_ = tu_length1;
+       _tmp10_ = tu;
+       _tmp10__length1 = tu_length1;
+       _vala_assert (_tmp10__length1 == 16, "tu.length == 16");
+       _tmp11_ = tu;
+       _tmp11__length1 = tu_length1;
+       bar (_tmp11_, (gint) _tmp11__length1);
+       _tmp12_ = fstack;
+       _tmp13_ = (((guint8*) (&_tmp12_)) != NULL) ? _vala_array_dup2 ((guint8*) (&_tmp12_), sizeof (Foo) / 
sizeof (guint8)) : ((guint8*) (&_tmp12_));
+       _tmp13__length1 = sizeof (Foo) / sizeof (guint8);
+       to = (g_free (to), NULL);
+       to = _tmp13_;
+       to_length1 = _tmp13__length1;
+       _to_size_ = to_length1;
+       _tmp14_ = to;
+       _tmp14__length1 = to_length1;
+       _vala_assert (_tmp14__length1 == 16, "to.length == 16");
+       _tmp15_ = to;
+       _tmp15__length1 = to_length1;
+       bar (_tmp15_, (gint) _tmp15__length1);
+       bar ((guint8*) fheap, (gint) (sizeof (Foo) / sizeof (guint8)));
+       tu = (guint8*) fheap;
+       tu_length1 = sizeof (Foo) / sizeof (guint8);
+       _tu_size_ = tu_length1;
+       _tmp16_ = tu;
+       _tmp16__length1 = tu_length1;
+       _vala_assert (_tmp16__length1 == 16, "tu.length == 16");
+       _tmp17_ = tu;
+       _tmp17__length1 = tu_length1;
+       bar (_tmp17_, (gint) _tmp17__length1);
+       _tmp18_ = (((guint8*) fheap) != NULL) ? _vala_array_dup3 ((guint8*) fheap, sizeof (Foo) / sizeof 
(guint8)) : ((guint8*) fheap);
+       _tmp18__length1 = sizeof (Foo) / sizeof (guint8);
+       to = (g_free (to), NULL);
+       to = _tmp18_;
+       to_length1 = _tmp18__length1;
+       _to_size_ = to_length1;
+       _tmp19_ = to;
+       _tmp19__length1 = to_length1;
+       _vala_assert (_tmp19__length1 == 16, "to.length == 16");
+       _tmp20_ = to;
+       _tmp20__length1 = to_length1;
+       bar (_tmp20_, (gint) _tmp20__length1);
+       i32 = (gint32) (2 << 28);
+       tu = (guint8*) (&i32);
+       tu_length1 = sizeof (gint32) / sizeof (guint8);
+       _tu_size_ = tu_length1;
+       _tmp21_ = tu;
+       _tmp21__length1 = tu_length1;
+       _vala_assert (_tmp21__length1 == 4, "tu.length == 4");
+       tu = (guint8*) (&i32);
+       tu_length1 = sizeof (gint32) / sizeof (guint8);
+       _tu_size_ = tu_length1;
+       _tmp22_ = tu;
+       _tmp22__length1 = tu_length1;
+       _vala_assert (_tmp22__length1 == 4, "tu.length == 4");
+       _tmp23_ = (((guint8*) (&i32)) != NULL) ? _vala_array_dup4 ((guint8*) (&i32), sizeof (gint32) / sizeof 
(guint8)) : ((guint8*) (&i32));
+       _tmp23__length1 = sizeof (gint32) / sizeof (guint8);
+       to = (g_free (to), NULL);
+       to = _tmp23_;
+       to_length1 = _tmp23__length1;
+       _to_size_ = to_length1;
+       _tmp24_ = to;
+       _tmp24__length1 = to_length1;
+       _vala_assert (_tmp24__length1 == 4, "to.length == 4");
+       u64 = (guint64) (2UL << 30);
+       tu = (guint8*) (&u64);
+       tu_length1 = sizeof (guint64) / sizeof (guint8);
+       _tu_size_ = tu_length1;
+       _tmp25_ = tu;
+       _tmp25__length1 = tu_length1;
+       _vala_assert (_tmp25__length1 == 8, "tu.length == 8");
+       tu = (guint8*) (&u64);
+       tu_length1 = sizeof (guint64) / sizeof (guint8);
+       _tu_size_ = tu_length1;
+       _tmp26_ = tu;
+       _tmp26__length1 = tu_length1;
+       _vala_assert (_tmp26__length1 == 8, "tu.length == 8");
+       _tmp27_ = (((guint8*) (&u64)) != NULL) ? _vala_array_dup5 ((guint8*) (&u64), sizeof (guint64) / 
sizeof (guint8)) : ((guint8*) (&u64));
+       _tmp27__length1 = sizeof (guint64) / sizeof (guint8);
+       to = (g_free (to), NULL);
+       to = _tmp27_;
+       to_length1 = _tmp27__length1;
+       _to_size_ = to_length1;
+       _tmp28_ = to;
+       _tmp28__length1 = to_length1;
+       _vala_assert (_tmp28__length1 == 8, "to.length == 8");
+       _foo_free0 (fheap);
+       to = (g_free (to), NULL);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static inline gpointer
+_vala_memdup2 (gconstpointer mem,
+               gsize byte_size)
+{
+       gpointer new_mem;
+       if (mem && byte_size != 0) {
+               new_mem = g_malloc (byte_size);
+               memcpy (new_mem, mem, byte_size);
+       } else {
+               new_mem = NULL;
+       }
+       return new_mem;
+}
+
diff --git a/tests/structs/cast-struct-boxed.c-expected b/tests/structs/cast-struct-boxed.c-expected
new file mode 100644
index 000000000..049ad5bba
--- /dev/null
+++ b/tests/structs/cast-struct-boxed.c-expected
@@ -0,0 +1,446 @@
+/* structs_cast_struct_boxed.c generated by valac, the Vala compiler
+ * generated from structs_cast_struct_boxed.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+#include <stdlib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+#define _foo_free0(var) ((var == NULL) ? NULL : (var = (foo_free (var), NULL)))
+#define _g_free0(var) ((var == NULL) ? NULL : (var = (g_free (var), NULL)))
+
+#define TYPE_BAR (bar_get_type ())
+typedef struct _Bar Bar;
+#define _bar_free0(var) ((var == NULL) ? NULL : (var = (bar_free (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       gint i;
+};
+
+struct _Bar {
+       gchar* s;
+};
+
+VALA_EXTERN Foo* foo;
+Foo* foo = NULL;
+VALA_EXTERN Bar* bar;
+Bar* bar = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN Foo* foo_heap_owned (void);
+VALA_EXTERN Foo* foo_heap_unowned (void);
+VALA_EXTERN void test_without_destroy (void);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Bar* bar_dup (const Bar* self);
+VALA_EXTERN void bar_free (Bar* self);
+VALA_EXTERN void bar_copy (const Bar* self,
+               Bar* dest);
+VALA_EXTERN void bar_destroy (Bar* self);
+VALA_EXTERN Bar* bar_heap_owned (void);
+VALA_EXTERN Bar* bar_heap_unowned (void);
+VALA_EXTERN void test_with_destroy (void);
+static void _vala_main (void);
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       memcpy (dup, self, sizeof (Foo));
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static gpointer
+_foo_dup0 (gpointer self)
+{
+       return self ? foo_dup (self) : NULL;
+}
+
+Foo*
+foo_heap_owned (void)
+{
+       Foo _tmp0_ = {0};
+       Foo* _tmp1_;
+       Foo* _tmp2_;
+       Foo* _tmp3_;
+       Foo* result = NULL;
+       _tmp0_.i = 23;
+       _tmp1_ = _foo_dup0 (&_tmp0_);
+       _foo_free0 (foo);
+       foo = _tmp1_;
+       _tmp2_ = foo;
+       _tmp3_ = _foo_dup0 (_tmp2_);
+       result = _tmp3_;
+       return result;
+}
+
+Foo*
+foo_heap_unowned (void)
+{
+       Foo _tmp0_ = {0};
+       Foo* _tmp1_;
+       Foo* _tmp2_;
+       Foo* result = NULL;
+       _tmp0_.i = 42;
+       _tmp1_ = _foo_dup0 (&_tmp0_);
+       _foo_free0 (foo);
+       foo = _tmp1_;
+       _tmp2_ = foo;
+       result = _tmp2_;
+       return result;
+}
+
+void
+test_without_destroy (void)
+{
+       {
+               Foo f = {0};
+               Foo* _tmp0_;
+               Foo* _tmp1_;
+               Foo _tmp2_;
+               Foo _tmp3_;
+               _tmp0_ = foo_heap_owned ();
+               _tmp1_ = _tmp0_;
+               _tmp2_ = *_tmp1_;
+               _foo_free0 (_tmp1_);
+               f = _tmp2_;
+               _tmp3_ = f;
+               _vala_assert (_tmp3_.i == 23, "f.i == 23");
+       }
+       {
+               Foo f = {0};
+               Foo* _tmp4_;
+               Foo _tmp5_;
+               Foo _tmp6_;
+               _tmp4_ = foo_heap_owned ();
+               _tmp5_ = (Foo) (*_tmp4_);
+               _g_free0 (_tmp4_);
+               f = _tmp5_;
+               _tmp6_ = f;
+               _vala_assert (_tmp6_.i == 23, "f.i == 23");
+       }
+       {
+               Foo f = {0};
+               Foo* _tmp7_;
+               Foo _tmp8_;
+               Foo _tmp9_;
+               _tmp7_ = foo_heap_owned ();
+               _tmp8_ = (Foo) (*_tmp7_);
+               _g_free0 (_tmp7_);
+               f = _tmp8_;
+               _tmp9_ = f;
+               _vala_assert (_tmp9_.i == 23, "f.i == 23");
+       }
+       {
+               Foo f = {0};
+               Foo _tmp10_;
+               f = *foo_heap_unowned ();
+               _tmp10_ = f;
+               _vala_assert (_tmp10_.i == 42, "f.i == 42");
+       }
+       {
+               Foo f = {0};
+               Foo _tmp11_;
+               f = (Foo) (*foo_heap_unowned ());
+               _tmp11_ = f;
+               _vala_assert (_tmp11_.i == 42, "f.i == 42");
+       }
+       {
+               Foo f = {0};
+               Foo _tmp12_;
+               f = (Foo) (*foo_heap_unowned ());
+               _tmp12_ = f;
+               _vala_assert (_tmp12_.i == 42, "f.i == 42");
+       }
+}
+
+void
+bar_copy (const Bar* self,
+          Bar* dest)
+{
+       const gchar* _tmp0_;
+       gchar* _tmp1_;
+       _tmp0_ = (*self).s;
+       _tmp1_ = g_strdup (_tmp0_);
+       _g_free0 ((*dest).s);
+       (*dest).s = _tmp1_;
+}
+
+void
+bar_destroy (Bar* self)
+{
+       _g_free0 ((*self).s);
+}
+
+Bar*
+bar_dup (const Bar* self)
+{
+       Bar* dup;
+       dup = g_new0 (Bar, 1);
+       bar_copy (self, dup);
+       return dup;
+}
+
+void
+bar_free (Bar* self)
+{
+       bar_destroy (self);
+       g_free (self);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       GType bar_type_id;
+       bar_type_id = g_boxed_type_register_static ("Bar", (GBoxedCopyFunc) bar_dup, (GBoxedFreeFunc) 
bar_free);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static gpointer
+_bar_dup0 (gpointer self)
+{
+       return self ? bar_dup (self) : NULL;
+}
+
+Bar*
+bar_heap_owned (void)
+{
+       gchar* _tmp0_;
+       Bar _tmp1_ = {0};
+       Bar _tmp2_;
+       Bar* _tmp3_;
+       Bar* _tmp4_;
+       Bar* _tmp5_;
+       Bar* result = NULL;
+       _tmp0_ = g_strdup ("bar");
+       _g_free0 (_tmp1_.s);
+       _tmp1_.s = _tmp0_;
+       _tmp2_ = _tmp1_;
+       _tmp3_ = _bar_dup0 (&_tmp2_);
+       _bar_free0 (bar);
+       bar = _tmp3_;
+       bar_destroy (&_tmp2_);
+       _tmp4_ = bar;
+       _tmp5_ = _bar_dup0 (_tmp4_);
+       result = _tmp5_;
+       return result;
+}
+
+Bar*
+bar_heap_unowned (void)
+{
+       gchar* _tmp0_;
+       Bar _tmp1_ = {0};
+       Bar _tmp2_;
+       Bar* _tmp3_;
+       Bar* _tmp4_;
+       Bar* result = NULL;
+       _tmp0_ = g_strdup ("manam");
+       _g_free0 (_tmp1_.s);
+       _tmp1_.s = _tmp0_;
+       _tmp2_ = _tmp1_;
+       _tmp3_ = _bar_dup0 (&_tmp2_);
+       _bar_free0 (bar);
+       bar = _tmp3_;
+       bar_destroy (&_tmp2_);
+       _tmp4_ = bar;
+       result = _tmp4_;
+       return result;
+}
+
+void
+test_with_destroy (void)
+{
+       {
+               Bar b = {0};
+               Bar* _tmp0_;
+               Bar* _tmp1_;
+               Bar _tmp2_;
+               Bar _tmp3_ = {0};
+               Bar _tmp4_;
+               Bar _tmp5_;
+               const gchar* _tmp6_;
+               _tmp0_ = bar_heap_owned ();
+               _tmp1_ = _tmp0_;
+               _tmp2_ = *_tmp1_;
+               bar_copy (&_tmp2_, &_tmp3_);
+               _tmp4_ = _tmp3_;
+               _bar_free0 (_tmp1_);
+               b = _tmp4_;
+               _tmp5_ = b;
+               _tmp6_ = _tmp5_.s;
+               _vala_assert (g_strcmp0 (_tmp6_, "bar") == 0, "b.s == \"bar\"");
+               bar_destroy (&b);
+       }
+       {
+               Bar b = {0};
+               Bar* _tmp7_;
+               Bar _tmp8_;
+               Bar _tmp9_;
+               const gchar* _tmp10_;
+               _tmp7_ = bar_heap_owned ();
+               _tmp8_ = (Bar) (*_tmp7_);
+               _g_free0 (_tmp7_);
+               b = _tmp8_;
+               _tmp9_ = b;
+               _tmp10_ = _tmp9_.s;
+               _vala_assert (g_strcmp0 (_tmp10_, "bar") == 0, "b.s == \"bar\"");
+               bar_destroy (&b);
+       }
+       {
+               Bar b = {0};
+               Bar* _tmp11_;
+               Bar _tmp12_;
+               Bar _tmp13_;
+               const gchar* _tmp14_;
+               _tmp11_ = bar_heap_owned ();
+               _tmp12_ = (Bar) (*_tmp11_);
+               _g_free0 (_tmp11_);
+               b = _tmp12_;
+               _tmp13_ = b;
+               _tmp14_ = _tmp13_.s;
+               _vala_assert (g_strcmp0 (_tmp14_, "bar") == 0, "b.s == \"bar\"");
+               bar_destroy (&b);
+       }
+       {
+               Bar b = {0};
+               Bar _tmp15_;
+               Bar _tmp16_ = {0};
+               Bar _tmp17_;
+               const gchar* _tmp18_;
+               _tmp15_ = *bar_heap_unowned ();
+               bar_copy (&_tmp15_, &_tmp16_);
+               b = _tmp16_;
+               _tmp17_ = b;
+               _tmp18_ = _tmp17_.s;
+               _vala_assert (g_strcmp0 (_tmp18_, "manam") == 0, "b.s == \"manam\"");
+               bar_destroy (&b);
+       }
+       {
+               Bar b = {0};
+               Bar _tmp19_;
+               Bar _tmp20_ = {0};
+               Bar _tmp21_;
+               const gchar* _tmp22_;
+               _tmp19_ = (Bar) (*bar_heap_unowned ());
+               bar_copy (&_tmp19_, &_tmp20_);
+               b = _tmp20_;
+               _tmp21_ = b;
+               _tmp22_ = _tmp21_.s;
+               _vala_assert (g_strcmp0 (_tmp22_, "manam") == 0, "b.s == \"manam\"");
+               bar_destroy (&b);
+       }
+       {
+               Bar b = {0};
+               Bar _tmp23_;
+               Bar _tmp24_ = {0};
+               Bar _tmp25_;
+               const gchar* _tmp26_;
+               _tmp23_ = (Bar) (*bar_heap_unowned ());
+               bar_copy (&_tmp23_, &_tmp24_);
+               b = _tmp24_;
+               _tmp25_ = b;
+               _tmp26_ = _tmp25_.s;
+               _vala_assert (g_strcmp0 (_tmp26_, "manam") == 0, "b.s == \"manam\"");
+               bar_destroy (&b);
+       }
+       {
+               Bar b = {0};
+               Bar _tmp27_;
+               const gchar* _tmp28_;
+               b = *bar_heap_unowned ();
+               _tmp27_ = b;
+               _tmp28_ = _tmp27_.s;
+               _vala_assert (g_strcmp0 (_tmp28_, "manam") == 0, "b.s == \"manam\"");
+       }
+       {
+               Bar b = {0};
+               Bar _tmp29_;
+               const gchar* _tmp30_;
+               b = (Bar) (*bar_heap_unowned ());
+               _tmp29_ = b;
+               _tmp30_ = _tmp29_.s;
+               _vala_assert (g_strcmp0 (_tmp30_, "manam") == 0, "b.s == \"manam\"");
+       }
+       {
+               Bar b = {0};
+               Bar _tmp31_;
+               const gchar* _tmp32_;
+               b = (Bar) (*bar_heap_unowned ());
+               _tmp31_ = b;
+               _tmp32_ = _tmp31_.s;
+               _vala_assert (g_strcmp0 (_tmp32_, "manam") == 0, "b.s == \"manam\"");
+       }
+}
+
+static void
+_vala_main (void)
+{
+       test_without_destroy ();
+       test_with_destroy ();
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/structs/constructor-params-array.c-expected 
b/tests/structs/constructor-params-array.c-expected
new file mode 100644
index 000000000..b75fe4e0a
--- /dev/null
+++ b/tests/structs/constructor-params-array.c-expected
@@ -0,0 +1,255 @@
+/* structs_constructor_params_array.c generated by valac, the Vala compiler
+ * generated from structs_constructor_params_array.vala, do not modify */
+
+#include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       gchar** sa;
+       gint sa_length1;
+       gint _sa_size_;
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN void foo_copy (const Foo* self,
+               Foo* dest);
+VALA_EXTERN void foo_destroy (Foo* self);
+VALA_EXTERN void foo_init (Foo *self,
+               const gchar* _first_strv,
+               ...);
+static void _vala_array_add1 (const gchar** * array,
+                       gint* length,
+                       gint* size,
+                       const gchar* value);
+static gchar** _vala_array_dup1 (gchar** self,
+                          gssize length);
+static gchar** _vala_array_dup2 (gchar** self,
+                          gssize length);
+static void _vala_main (void);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static void
+_vala_array_add1 (const gchar** * array,
+                  gint* length,
+                  gint* size,
+                  const gchar* value)
+{
+       if ((*length) == (*size)) {
+               *size = (*size) ? (2 * (*size)) : 4;
+               *array = g_renew (const gchar*, *array, (*size) + 1);
+       }
+       (*array)[(*length)++] = value;
+       (*array)[*length] = NULL;
+}
+
+static gchar**
+_vala_array_dup1 (gchar** self,
+                  gssize length)
+{
+       if (length >= 0) {
+               gchar** result;
+               gssize i;
+               result = g_new0 (gchar*, length + 1);
+               for (i = 0; i < length; i++) {
+                       gchar* _tmp0_;
+                       _tmp0_ = g_strdup (self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+void
+foo_init (Foo *self,
+          const gchar* _first_strv,
+          ...)
+{
+       const gchar* _strv_element;
+       va_list _va_list_strv;
+       const gchar** strv = NULL;
+       gint strv_length1 = 0;
+       gint _strv_size_ = 0;
+       const gchar* _tmp0_;
+       const gchar* _tmp1_;
+       const gchar* _tmp2_;
+       gchar** _tmp3_;
+       gint _tmp3__length1;
+       strv = g_new0 (const gchar*, strv_length1 + 1);
+       va_start (_va_list_strv, _first_strv);
+       _strv_element = _first_strv;
+       while (_strv_element != NULL) {
+               _vala_array_add1 (&strv, &strv_length1, &_strv_size_, _strv_element);
+               _strv_element = va_arg (_va_list_strv, const gchar*);
+       }
+       va_end (_va_list_strv);
+       memset (self, 0, sizeof (Foo));
+       _vala_assert (strv_length1 == 3, "strv.length == 3");
+       _tmp0_ = strv[0];
+       _vala_assert (g_strcmp0 (_tmp0_, "foo") == 0, "strv[0] == \"foo\"");
+       _tmp1_ = strv[1];
+       _vala_assert (g_strcmp0 (_tmp1_, "bar") == 0, "strv[1] == \"bar\"");
+       _tmp2_ = strv[2];
+       _vala_assert (g_strcmp0 (_tmp2_, "manam") == 0, "strv[2] == \"manam\"");
+       _tmp3_ = (strv != NULL) ? _vala_array_dup1 (strv, strv_length1) : strv;
+       _tmp3__length1 = strv_length1;
+       (*self).sa = (_vala_array_free ((*self).sa, (*self).sa_length1, (GDestroyNotify) g_free), NULL);
+       (*self).sa = _tmp3_;
+       (*self).sa_length1 = _tmp3__length1;
+       (*self)._sa_size_ = (*self).sa_length1;
+       strv = (g_free (strv), NULL);
+}
+
+static gchar**
+_vala_array_dup2 (gchar** self,
+                  gssize length)
+{
+       if (length >= 0) {
+               gchar** result;
+               gssize i;
+               result = g_new0 (gchar*, length + 1);
+               for (i = 0; i < length; i++) {
+                       gchar* _tmp0_;
+                       _tmp0_ = g_strdup (self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+void
+foo_copy (const Foo* self,
+          Foo* dest)
+{
+       gchar** _tmp0_;
+       gint _tmp0__length1;
+       gchar** _tmp1_;
+       gint _tmp1__length1;
+       _tmp0_ = (*self).sa;
+       _tmp0__length1 = (*self).sa_length1;
+       _tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup2 (_tmp0_, _tmp0__length1) : _tmp0_;
+       _tmp1__length1 = _tmp0__length1;
+       (*dest).sa = (_vala_array_free ((*dest).sa, (*dest).sa_length1, (GDestroyNotify) g_free), NULL);
+       (*dest).sa = _tmp1_;
+       (*dest).sa_length1 = _tmp1__length1;
+       (*dest)._sa_size_ = (*dest).sa_length1;
+}
+
+void
+foo_destroy (Foo* self)
+{
+       (*self).sa = (_vala_array_free ((*self).sa, (*self).sa_length1, (GDestroyNotify) g_free), NULL);
+}
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       foo_copy (self, dup);
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       foo_destroy (self);
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       Foo foo = {0};
+       Foo _tmp0_;
+       gchar** _tmp1_;
+       gint _tmp1__length1;
+       const gchar* _tmp2_;
+       foo_init (&foo, "foo", "bar", "manam", NULL);
+       _tmp0_ = foo;
+       _tmp1_ = _tmp0_.sa;
+       _tmp1__length1 = _tmp0_.sa_length1;
+       _tmp2_ = _tmp1_[1];
+       _vala_assert (g_strcmp0 (_tmp2_, "bar") == 0, "foo.sa[1] == \"bar\"");
+       foo_destroy (&foo);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/structs/constructor-variadic.c-expected b/tests/structs/constructor-variadic.c-expected
new file mode 100644
index 000000000..a40d668ba
--- /dev/null
+++ b/tests/structs/constructor-variadic.c-expected
@@ -0,0 +1,144 @@
+/* structs_constructor_variadic.c generated by valac, the Vala compiler
+ * generated from structs_constructor_variadic.vala, do not modify */
+
+#include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+#include <stdarg.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       gchar* s;
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN void foo_copy (const Foo* self,
+               Foo* dest);
+VALA_EXTERN void foo_destroy (Foo* self);
+VALA_EXTERN void foo_init (Foo *self,
+               const gchar* first_arg,
+               ...);
+static void _vala_main (void);
+
+void
+foo_init (Foo *self,
+          const gchar* first_arg,
+          ...)
+{
+       va_list args = {0};
+       gchar* second_arg = NULL;
+       const gchar* _tmp0_;
+       gchar* _tmp1_;
+       gchar* _tmp2_;
+       g_return_if_fail (first_arg != NULL);
+       memset (self, 0, sizeof (Foo));
+       _vala_assert (g_strcmp0 (first_arg, "foo") == 0, "first_arg == \"foo\"");
+       va_start (args, first_arg);
+       _tmp0_ = va_arg (args, gchar*);
+       _tmp1_ = g_strdup (_tmp0_);
+       second_arg = _tmp1_;
+       _vala_assert (g_strcmp0 (second_arg, "bar") == 0, "second_arg == \"bar\"");
+       _tmp2_ = g_strconcat (first_arg, second_arg, NULL);
+       _g_free0 ((*self).s);
+       (*self).s = _tmp2_;
+       _g_free0 (second_arg);
+       va_end (args);
+}
+
+void
+foo_copy (const Foo* self,
+          Foo* dest)
+{
+       const gchar* _tmp0_;
+       gchar* _tmp1_;
+       _tmp0_ = (*self).s;
+       _tmp1_ = g_strdup (_tmp0_);
+       _g_free0 ((*dest).s);
+       (*dest).s = _tmp1_;
+}
+
+void
+foo_destroy (Foo* self)
+{
+       _g_free0 ((*self).s);
+}
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       foo_copy (self, dup);
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       foo_destroy (self);
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       {
+               Foo foo = {0};
+               Foo _tmp0_;
+               const gchar* _tmp1_;
+               foo_init (&foo, "foo", "bar", NULL);
+               _tmp0_ = foo;
+               _tmp1_ = _tmp0_.s;
+               _vala_assert (g_strcmp0 (_tmp1_, "foobar") == 0, "foo.s == \"foobar\"");
+               foo_destroy (&foo);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/structs/default-gtype.c-expected b/tests/structs/default-gtype.c-expected
new file mode 100644
index 000000000..554b4d1b6
--- /dev/null
+++ b/tests/structs/default-gtype.c-expected
@@ -0,0 +1,100 @@
+/* structs_default_gtype.c generated by valac, the Vala compiler
+ * generated from structs_default_gtype.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+typedef Foo Bar;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       gint field;
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN Bar* bar_dup (const Bar* self);
+VALA_EXTERN void bar_free (Bar* self);
+static void _vala_main (void);
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       memcpy (dup, self, sizeof (Foo));
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+Bar*
+bar_dup (const Bar* self)
+{
+       Bar* dup;
+       dup = g_new0 (Bar, 1);
+       memcpy (dup, self, sizeof (Bar));
+       return dup;
+}
+
+void
+bar_free (Bar* self)
+{
+       g_free (self);
+}
+
+static void
+_vala_main (void)
+{
+       _vala_assert (TYPE_FOO == TYPE_FOO, "typeof (Bar) == typeof (Foo)");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/structs/gmutex.c-expected b/tests/structs/gmutex.c-expected
new file mode 100644
index 000000000..740fc2168
--- /dev/null
+++ b/tests/structs/gmutex.c-expected
@@ -0,0 +1,87 @@
+/* structs_gmutex.c generated by valac, the Vala compiler
+ * generated from structs_gmutex.vala, do not modify */
+
+#include <glib.h>
+#include <string.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+static void _vala_main (void);
+static void _vala_clear_GMutex (GMutex * mutex);
+static void _vala_clear_GRecMutex (GRecMutex * mutex);
+static void _vala_clear_GRWLock (GRWLock * mutex);
+static void _vala_clear_GCond (GCond * mutex);
+
+static void
+_vala_main (void)
+{
+       {
+               GMutex mutex = {0};
+               g_mutex_init (&mutex);
+               g_mutex_lock (&mutex);
+               _vala_assert (!g_mutex_trylock (&mutex), "!mutex.trylock ()");
+               g_mutex_unlock (&mutex);
+               _vala_clear_GMutex (&mutex);
+       }
+       {
+               GRecMutex mutex = {0};
+               g_rec_mutex_init (&mutex);
+               g_rec_mutex_lock (&mutex);
+               _vala_assert (g_rec_mutex_trylock (&mutex), "mutex.trylock ()");
+               g_rec_mutex_unlock (&mutex);
+               g_rec_mutex_unlock (&mutex);
+               _vala_clear_GRecMutex (&mutex);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_clear_GMutex (GMutex * mutex)
+{
+       GMutex zero_mutex = { 0 };
+       if (memcmp (mutex, &zero_mutex, sizeof (GMutex))) {
+               g_mutex_clear (mutex);
+               memset (mutex, 0, sizeof (GMutex));
+       }
+}
+
+static void
+_vala_clear_GRecMutex (GRecMutex * mutex)
+{
+       GRecMutex zero_mutex = { 0 };
+       if (memcmp (mutex, &zero_mutex, sizeof (GRecMutex))) {
+               g_rec_mutex_clear (mutex);
+               memset (mutex, 0, sizeof (GRecMutex));
+       }
+}
+
+static void
+_vala_clear_GRWLock (GRWLock * mutex)
+{
+       GRWLock zero_mutex = { 0 };
+       if (memcmp (mutex, &zero_mutex, sizeof (GRWLock))) {
+               g_rw_lock_clear (mutex);
+               memset (mutex, 0, sizeof (GRWLock));
+       }
+}
+
+static void
+_vala_clear_GCond (GCond * mutex)
+{
+       GCond zero_mutex = { 0 };
+       if (memcmp (mutex, &zero_mutex, sizeof (GCond))) {
+               g_cond_clear (mutex);
+               memset (mutex, 0, sizeof (GCond));
+       }
+}
+
diff --git a/tests/structs/gtype-base-struct.c-expected b/tests/structs/gtype-base-struct.c-expected
new file mode 100644
index 000000000..e7179b09e
--- /dev/null
+++ b/tests/structs/gtype-base-struct.c-expected
@@ -0,0 +1,623 @@
+/* structs_gtype_base_struct.c generated by valac, the Vala compiler
+ * generated from structs_gtype_base_struct.vala, do not modify */
+
+#include <glib.h>
+#include <float.h>
+#include <math.h>
+#include <glib-object.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef gint foo_int;
+typedef guint foo_uint;
+typedef gint64 foo_int64;
+typedef guint64 foo_uint64;
+typedef glong foo_long;
+typedef gulong foo_ulong;
+typedef gboolean foo_bool;
+typedef gchar foo_char;
+typedef guchar foo_uchar;
+typedef gfloat foo_float;
+typedef gdouble foo_double;
+typedef GType foo_gtype;
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_PROP_INT_PROPERTY,
+       FOO_PROP_UINT_PROPERTY,
+       FOO_PROP_INT64_PROPERTY,
+       FOO_PROP_UINT64_PROPERTY,
+       FOO_PROP_LONG_PROPERTY,
+       FOO_PROP_ULONG_PROPERTY,
+       FOO_PROP_BOOL_PROPERTY,
+       FOO_PROP_CHAR_PROPERTY,
+       FOO_PROP_UCHAR_PROPERTY,
+       FOO_PROP_FLOAT_PROPERTY,
+       FOO_PROP_DOUBLE_PROPERTY,
+       FOO_PROP_GTYPE_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _FooPrivate {
+       foo_int _prop_int;
+       foo_uint _prop_uint;
+       foo_int64 _prop_int64;
+       foo_uint64 _prop_uint64;
+       foo_long _prop_long;
+       foo_ulong _prop_ulong;
+       foo_bool _prop_bool;
+       foo_char _prop_char;
+       foo_uchar _prop_uchar;
+       foo_float _prop_float;
+       foo_double _prop_double;
+       foo_gtype _prop_gtype;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+VALA_EXTERN foo_int foo_get_prop_int (Foo* self);
+VALA_EXTERN void foo_set_prop_int (Foo* self,
+                       foo_int value);
+VALA_EXTERN foo_uint foo_get_prop_uint (Foo* self);
+VALA_EXTERN void foo_set_prop_uint (Foo* self,
+                        foo_uint value);
+VALA_EXTERN foo_int64 foo_get_prop_int64 (Foo* self);
+VALA_EXTERN void foo_set_prop_int64 (Foo* self,
+                         foo_int64 value);
+VALA_EXTERN foo_uint64 foo_get_prop_uint64 (Foo* self);
+VALA_EXTERN void foo_set_prop_uint64 (Foo* self,
+                          foo_uint64 value);
+VALA_EXTERN foo_long foo_get_prop_long (Foo* self);
+VALA_EXTERN void foo_set_prop_long (Foo* self,
+                        foo_long value);
+VALA_EXTERN foo_ulong foo_get_prop_ulong (Foo* self);
+VALA_EXTERN void foo_set_prop_ulong (Foo* self,
+                         foo_ulong value);
+VALA_EXTERN foo_bool foo_get_prop_bool (Foo* self);
+VALA_EXTERN void foo_set_prop_bool (Foo* self,
+                        foo_bool value);
+VALA_EXTERN foo_char foo_get_prop_char (Foo* self);
+VALA_EXTERN void foo_set_prop_char (Foo* self,
+                        foo_char value);
+VALA_EXTERN foo_uchar foo_get_prop_uchar (Foo* self);
+VALA_EXTERN void foo_set_prop_uchar (Foo* self,
+                         foo_uchar value);
+VALA_EXTERN foo_float foo_get_prop_float (Foo* self);
+VALA_EXTERN void foo_set_prop_float (Foo* self,
+                         foo_float value);
+VALA_EXTERN foo_double foo_get_prop_double (Foo* self);
+VALA_EXTERN void foo_set_prop_double (Foo* self,
+                          foo_double value);
+VALA_EXTERN foo_gtype foo_get_prop_gtype (Foo* self);
+VALA_EXTERN void foo_set_prop_gtype (Foo* self,
+                         foo_gtype value);
+static void foo_finalize (GObject * obj);
+static GType foo_get_type_once (void);
+static void _vala_foo_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_foo_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec);
+static void _vala_main (void);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+foo_int
+foo_get_prop_int (Foo* self)
+{
+       foo_int result;
+       g_return_val_if_fail (IS_FOO (self), 0);
+       result = self->priv->_prop_int;
+       return result;
+}
+
+void
+foo_set_prop_int (Foo* self,
+                  foo_int value)
+{
+       foo_int old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_prop_int (self);
+       if (old_value != value) {
+               self->priv->_prop_int = value;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_PROP_INT_PROPERTY]);
+       }
+}
+
+foo_uint
+foo_get_prop_uint (Foo* self)
+{
+       foo_uint result;
+       g_return_val_if_fail (IS_FOO (self), 0U);
+       result = self->priv->_prop_uint;
+       return result;
+}
+
+void
+foo_set_prop_uint (Foo* self,
+                   foo_uint value)
+{
+       foo_uint old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_prop_uint (self);
+       if (old_value != value) {
+               self->priv->_prop_uint = value;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_PROP_UINT_PROPERTY]);
+       }
+}
+
+foo_int64
+foo_get_prop_int64 (Foo* self)
+{
+       foo_int64 result;
+       g_return_val_if_fail (IS_FOO (self), 0LL);
+       result = self->priv->_prop_int64;
+       return result;
+}
+
+void
+foo_set_prop_int64 (Foo* self,
+                    foo_int64 value)
+{
+       foo_int64 old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_prop_int64 (self);
+       if (old_value != value) {
+               self->priv->_prop_int64 = value;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_PROP_INT64_PROPERTY]);
+       }
+}
+
+foo_uint64
+foo_get_prop_uint64 (Foo* self)
+{
+       foo_uint64 result;
+       g_return_val_if_fail (IS_FOO (self), 0ULL);
+       result = self->priv->_prop_uint64;
+       return result;
+}
+
+void
+foo_set_prop_uint64 (Foo* self,
+                     foo_uint64 value)
+{
+       foo_uint64 old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_prop_uint64 (self);
+       if (old_value != value) {
+               self->priv->_prop_uint64 = value;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_PROP_UINT64_PROPERTY]);
+       }
+}
+
+foo_long
+foo_get_prop_long (Foo* self)
+{
+       foo_long result;
+       g_return_val_if_fail (IS_FOO (self), 0L);
+       result = self->priv->_prop_long;
+       return result;
+}
+
+void
+foo_set_prop_long (Foo* self,
+                   foo_long value)
+{
+       foo_long old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_prop_long (self);
+       if (old_value != value) {
+               self->priv->_prop_long = value;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_PROP_LONG_PROPERTY]);
+       }
+}
+
+foo_ulong
+foo_get_prop_ulong (Foo* self)
+{
+       foo_ulong result;
+       g_return_val_if_fail (IS_FOO (self), 0UL);
+       result = self->priv->_prop_ulong;
+       return result;
+}
+
+void
+foo_set_prop_ulong (Foo* self,
+                    foo_ulong value)
+{
+       foo_ulong old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_prop_ulong (self);
+       if (old_value != value) {
+               self->priv->_prop_ulong = value;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_PROP_ULONG_PROPERTY]);
+       }
+}
+
+foo_bool
+foo_get_prop_bool (Foo* self)
+{
+       foo_bool result;
+       g_return_val_if_fail (IS_FOO (self), FALSE);
+       result = self->priv->_prop_bool;
+       return result;
+}
+
+void
+foo_set_prop_bool (Foo* self,
+                   foo_bool value)
+{
+       foo_bool old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_prop_bool (self);
+       if (old_value != value) {
+               self->priv->_prop_bool = value;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_PROP_BOOL_PROPERTY]);
+       }
+}
+
+foo_char
+foo_get_prop_char (Foo* self)
+{
+       foo_char result;
+       g_return_val_if_fail (IS_FOO (self), '\0');
+       result = self->priv->_prop_char;
+       return result;
+}
+
+void
+foo_set_prop_char (Foo* self,
+                   foo_char value)
+{
+       foo_char old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_prop_char (self);
+       if (old_value != value) {
+               self->priv->_prop_char = value;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_PROP_CHAR_PROPERTY]);
+       }
+}
+
+foo_uchar
+foo_get_prop_uchar (Foo* self)
+{
+       foo_uchar result;
+       g_return_val_if_fail (IS_FOO (self), '\0');
+       result = self->priv->_prop_uchar;
+       return result;
+}
+
+void
+foo_set_prop_uchar (Foo* self,
+                    foo_uchar value)
+{
+       foo_uchar old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_prop_uchar (self);
+       if (old_value != value) {
+               self->priv->_prop_uchar = value;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_PROP_UCHAR_PROPERTY]);
+       }
+}
+
+foo_float
+foo_get_prop_float (Foo* self)
+{
+       foo_float result;
+       g_return_val_if_fail (IS_FOO (self), 0.0F);
+       result = self->priv->_prop_float;
+       return result;
+}
+
+void
+foo_set_prop_float (Foo* self,
+                    foo_float value)
+{
+       foo_float old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_prop_float (self);
+       if (old_value != value) {
+               self->priv->_prop_float = value;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_PROP_FLOAT_PROPERTY]);
+       }
+}
+
+foo_double
+foo_get_prop_double (Foo* self)
+{
+       foo_double result;
+       g_return_val_if_fail (IS_FOO (self), 0.0);
+       result = self->priv->_prop_double;
+       return result;
+}
+
+void
+foo_set_prop_double (Foo* self,
+                     foo_double value)
+{
+       foo_double old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_prop_double (self);
+       if (old_value != value) {
+               self->priv->_prop_double = value;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_PROP_DOUBLE_PROPERTY]);
+       }
+}
+
+foo_gtype
+foo_get_prop_gtype (Foo* self)
+{
+       foo_gtype result;
+       g_return_val_if_fail (IS_FOO (self), 0UL);
+       result = self->priv->_prop_gtype;
+       return result;
+}
+
+void
+foo_set_prop_gtype (Foo* self,
+                    foo_gtype value)
+{
+       foo_gtype old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_prop_gtype (self);
+       if (old_value != value) {
+               self->priv->_prop_gtype = value;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_PROP_GTYPE_PROPERTY]);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_foo_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_foo_set_property;
+       G_OBJECT_CLASS (klass)->finalize = foo_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_PROP_INT_PROPERTY, 
foo_properties[FOO_PROP_INT_PROPERTY] = g_param_spec_int ("prop-int", "prop-int", "prop-int", G_MININT, 
G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_PROP_UINT_PROPERTY, 
foo_properties[FOO_PROP_UINT_PROPERTY] = g_param_spec_uint ("prop-uint", "prop-uint", "prop-uint", 0, 
G_MAXUINT, 0U, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_PROP_INT64_PROPERTY, 
foo_properties[FOO_PROP_INT64_PROPERTY] = g_param_spec_int64 ("prop-int64", "prop-int64", "prop-int64", 
G_MININT64, G_MAXINT64, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_PROP_UINT64_PROPERTY, 
foo_properties[FOO_PROP_UINT64_PROPERTY] = g_param_spec_uint64 ("prop-uint64", "prop-uint64", "prop-uint64", 
0, G_MAXUINT64, 0U, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_PROP_LONG_PROPERTY, 
foo_properties[FOO_PROP_LONG_PROPERTY] = g_param_spec_long ("prop-long", "prop-long", "prop-long", G_MINLONG, 
G_MAXLONG, 0L, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_PROP_ULONG_PROPERTY, 
foo_properties[FOO_PROP_ULONG_PROPERTY] = g_param_spec_ulong ("prop-ulong", "prop-ulong", "prop-ulong", 0, 
G_MAXULONG, 0UL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_PROP_BOOL_PROPERTY, 
foo_properties[FOO_PROP_BOOL_PROPERTY] = g_param_spec_boolean ("prop-bool", "prop-bool", "prop-bool", FALSE, 
G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_PROP_CHAR_PROPERTY, 
foo_properties[FOO_PROP_CHAR_PROPERTY] = g_param_spec_char ("prop-char", "prop-char", "prop-char", G_MININT8, 
G_MAXINT8, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_PROP_UCHAR_PROPERTY, 
foo_properties[FOO_PROP_UCHAR_PROPERTY] = g_param_spec_uchar ("prop-uchar", "prop-uchar", "prop-uchar", 0, 
G_MAXUINT8, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_PROP_FLOAT_PROPERTY, 
foo_properties[FOO_PROP_FLOAT_PROPERTY] = g_param_spec_float ("prop-float", "prop-float", "prop-float", 
-G_MAXFLOAT, G_MAXFLOAT, 0.0F, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_PROP_DOUBLE_PROPERTY, 
foo_properties[FOO_PROP_DOUBLE_PROPERTY] = g_param_spec_double ("prop-double", "prop-double", "prop-double", 
-G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_PROP_GTYPE_PROPERTY, 
foo_properties[FOO_PROP_GTYPE_PROPERTY] = g_param_spec_gtype ("prop-gtype", "prop-gtype", "prop-gtype", 
G_TYPE_NONE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+}
+
+static void
+foo_finalize (GObject * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       G_OBJECT_CLASS (foo_parent_class)->finalize (obj);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_foo_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_PROP_INT_PROPERTY:
+               g_value_set_int (value, foo_get_prop_int (self));
+               break;
+               case FOO_PROP_UINT_PROPERTY:
+               g_value_set_uint (value, foo_get_prop_uint (self));
+               break;
+               case FOO_PROP_INT64_PROPERTY:
+               g_value_set_int64 (value, foo_get_prop_int64 (self));
+               break;
+               case FOO_PROP_UINT64_PROPERTY:
+               g_value_set_uint64 (value, foo_get_prop_uint64 (self));
+               break;
+               case FOO_PROP_LONG_PROPERTY:
+               g_value_set_long (value, foo_get_prop_long (self));
+               break;
+               case FOO_PROP_ULONG_PROPERTY:
+               g_value_set_ulong (value, foo_get_prop_ulong (self));
+               break;
+               case FOO_PROP_BOOL_PROPERTY:
+               g_value_set_boolean (value, foo_get_prop_bool (self));
+               break;
+               case FOO_PROP_CHAR_PROPERTY:
+               g_value_set_schar (value, foo_get_prop_char (self));
+               break;
+               case FOO_PROP_UCHAR_PROPERTY:
+               g_value_set_uchar (value, foo_get_prop_uchar (self));
+               break;
+               case FOO_PROP_FLOAT_PROPERTY:
+               g_value_set_float (value, foo_get_prop_float (self));
+               break;
+               case FOO_PROP_DOUBLE_PROPERTY:
+               g_value_set_double (value, foo_get_prop_double (self));
+               break;
+               case FOO_PROP_GTYPE_PROPERTY:
+               g_value_set_gtype (value, foo_get_prop_gtype (self));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_foo_set_property (GObject * object,
+                        guint property_id,
+                        const GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_PROP_INT_PROPERTY:
+               foo_set_prop_int (self, g_value_get_int (value));
+               break;
+               case FOO_PROP_UINT_PROPERTY:
+               foo_set_prop_uint (self, g_value_get_uint (value));
+               break;
+               case FOO_PROP_INT64_PROPERTY:
+               foo_set_prop_int64 (self, g_value_get_int64 (value));
+               break;
+               case FOO_PROP_UINT64_PROPERTY:
+               foo_set_prop_uint64 (self, g_value_get_uint64 (value));
+               break;
+               case FOO_PROP_LONG_PROPERTY:
+               foo_set_prop_long (self, g_value_get_long (value));
+               break;
+               case FOO_PROP_ULONG_PROPERTY:
+               foo_set_prop_ulong (self, g_value_get_ulong (value));
+               break;
+               case FOO_PROP_BOOL_PROPERTY:
+               foo_set_prop_bool (self, g_value_get_boolean (value));
+               break;
+               case FOO_PROP_CHAR_PROPERTY:
+               foo_set_prop_char (self, g_value_get_schar (value));
+               break;
+               case FOO_PROP_UCHAR_PROPERTY:
+               foo_set_prop_uchar (self, g_value_get_uchar (value));
+               break;
+               case FOO_PROP_FLOAT_PROPERTY:
+               foo_set_prop_float (self, g_value_get_float (value));
+               break;
+               case FOO_PROP_DOUBLE_PROPERTY:
+               foo_set_prop_double (self, g_value_get_double (value));
+               break;
+               case FOO_PROP_GTYPE_PROPERTY:
+               foo_set_prop_gtype (self, g_value_get_gtype (value));
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_main (void)
+{
+       {
+               _vala_assert (G_TYPE_INT == G_TYPE_INT, "typeof (foo_int) == GLib.Type.INT");
+               _vala_assert (G_TYPE_UINT == G_TYPE_UINT, "typeof (foo_uint) == GLib.Type.UINT");
+               _vala_assert (G_TYPE_INT64 == G_TYPE_INT64, "typeof (foo_int64) == GLib.Type.INT64");
+               _vala_assert (G_TYPE_UINT64 == G_TYPE_UINT64, "typeof (foo_uint64) == GLib.Type.UINT64");
+               _vala_assert (G_TYPE_LONG == G_TYPE_LONG, "typeof (foo_long) == GLib.Type.LONG");
+               _vala_assert (G_TYPE_ULONG == G_TYPE_ULONG, "typeof (foo_ulong) == GLib.Type.ULONG");
+               _vala_assert (G_TYPE_BOOLEAN == G_TYPE_BOOLEAN, "typeof (foo_bool) == GLib.Type.BOOLEAN");
+               _vala_assert (G_TYPE_CHAR == G_TYPE_CHAR, "typeof (foo_char) == GLib.Type.CHAR");
+               _vala_assert (G_TYPE_UCHAR == G_TYPE_UCHAR, "typeof (foo_uchar) == GLib.Type.UCHAR");
+               _vala_assert (G_TYPE_FLOAT == G_TYPE_FLOAT, "typeof (foo_float) == GLib.Type.FLOAT");
+               _vala_assert (G_TYPE_DOUBLE == G_TYPE_DOUBLE, "typeof (foo_double) == GLib.Type.DOUBLE");
+               _vala_assert (G_TYPE_GTYPE == G_TYPE_GTYPE, "typeof (foo_gtype) == typeof (GLib.Type)");
+       }
+       {
+               Foo* foo = NULL;
+               Foo* _tmp0_;
+               _tmp0_ = foo_new ();
+               foo = _tmp0_;
+               _g_object_unref0 (foo);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/structs/gvalue-implicit-comparison.c-expected 
b/tests/structs/gvalue-implicit-comparison.c-expected
new file mode 100644
index 000000000..2d8605953
--- /dev/null
+++ b/tests/structs/gvalue-implicit-comparison.c-expected
@@ -0,0 +1,308 @@
+/* structs_gvalue_implicit_comparison.c generated by valac, the Vala compiler
+ * generated from structs_gvalue_implicit_comparison.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define __vala_GValue_free0(var) ((var == NULL) ? NULL : (var = (_vala_GValue_free (var), NULL)))
+
+VALA_EXTERN void get_value (GValue* v,
+                GValue* result);
+VALA_EXTERN GValue* get_nullable_value (GValue* v);
+static GValue* _g_value_dup (GValue* self);
+static void _vala_main (void);
+static void _vala_GValue_free (GValue* self);
+
+void
+get_value (GValue* v,
+           GValue* result)
+{
+       GValue _tmp0_;
+       GValue _tmp1_;
+       GValue _tmp2_ = {0};
+       g_return_if_fail (v != NULL);
+       _tmp0_ = *v;
+       _tmp1_ = _tmp0_;
+       if (G_IS_VALUE (&_tmp1_)) {
+               g_value_init (&_tmp2_, G_VALUE_TYPE (&_tmp1_));
+               g_value_copy (&_tmp1_, &_tmp2_);
+       } else {
+               _tmp2_ = _tmp1_;
+       }
+       *result = _tmp2_;
+       return;
+}
+
+static GValue*
+_g_value_dup (GValue* self)
+{
+       return g_boxed_copy (G_TYPE_VALUE, self);
+}
+
+static gpointer
+__g_value_dup0 (gpointer self)
+{
+       return self ? _g_value_dup (self) : NULL;
+}
+
+GValue*
+get_nullable_value (GValue* v)
+{
+       GValue* _tmp0_;
+       GValue* result = NULL;
+       _tmp0_ = __g_value_dup0 (v);
+       result = _tmp0_;
+       return result;
+}
+
+static void
+_vala_GValue_free (GValue* self)
+{
+       g_boxed_free (G_TYPE_VALUE, self);
+}
+
+static void
+_vala_main (void)
+{
+       {
+               GValue v = {0};
+               GValue _tmp0_ = {0};
+               GValue _tmp1_;
+               GValue _tmp2_;
+               g_value_init (&_tmp0_, G_TYPE_INT);
+               v = _tmp0_;
+               g_value_set_int (&v, 42);
+               _tmp1_ = v;
+               if (g_value_get_int (&_tmp1_) == 42) {
+               } else {
+                       g_assert_not_reached ();
+               }
+               _tmp2_ = v;
+               if (42 == g_value_get_int (&_tmp2_)) {
+               } else {
+                       g_assert_not_reached ();
+               }
+               G_IS_VALUE (&v) ? (g_value_unset (&v), NULL) : NULL;
+       }
+       {
+               GValue* v = NULL;
+               GValue _tmp3_ = {0};
+               GValue _tmp4_;
+               GValue* _tmp5_;
+               GValue* _tmp6_;
+               g_value_init (&_tmp3_, G_TYPE_INT);
+               _tmp4_ = _tmp3_;
+               _tmp5_ = __g_value_dup0 (&_tmp4_);
+               _tmp6_ = _tmp5_;
+               G_IS_VALUE (&_tmp4_) ? (g_value_unset (&_tmp4_), NULL) : NULL;
+               v = _tmp6_;
+               g_value_set_int (v, 42);
+               if (g_value_get_int (v) == 42) {
+               } else {
+                       g_assert_not_reached ();
+               }
+               if (42 == g_value_get_int (v)) {
+               } else {
+                       g_assert_not_reached ();
+               }
+               __vala_GValue_free0 (v);
+       }
+       {
+               GValue v = {0};
+               GValue _tmp7_ = {0};
+               GValue _tmp8_;
+               GValue _tmp9_;
+               g_value_init (&_tmp7_, G_TYPE_STRING);
+               v = _tmp7_;
+               g_value_set_string (&v, "foo");
+               _tmp8_ = v;
+               if (g_strcmp0 (g_value_get_string (&_tmp8_), "foo") == 0) {
+               } else {
+                       g_assert_not_reached ();
+               }
+               _tmp9_ = v;
+               if (g_strcmp0 ("foo", g_value_get_string (&_tmp9_)) == 0) {
+               } else {
+                       g_assert_not_reached ();
+               }
+               G_IS_VALUE (&v) ? (g_value_unset (&v), NULL) : NULL;
+       }
+       {
+               GValue* v = NULL;
+               GValue _tmp10_ = {0};
+               GValue _tmp11_;
+               GValue* _tmp12_;
+               GValue* _tmp13_;
+               g_value_init (&_tmp10_, G_TYPE_STRING);
+               _tmp11_ = _tmp10_;
+               _tmp12_ = __g_value_dup0 (&_tmp11_);
+               _tmp13_ = _tmp12_;
+               G_IS_VALUE (&_tmp11_) ? (g_value_unset (&_tmp11_), NULL) : NULL;
+               v = _tmp13_;
+               g_value_set_string (v, "foo");
+               if (g_strcmp0 (g_value_get_string (v), "foo") == 0) {
+               } else {
+                       g_assert_not_reached ();
+               }
+               if (g_strcmp0 ("foo", g_value_get_string (v)) == 0) {
+               } else {
+                       g_assert_not_reached ();
+               }
+               __vala_GValue_free0 (v);
+       }
+       {
+               GValue v = {0};
+               GValue _tmp14_ = {0};
+               GValue _tmp15_;
+               GValue _tmp16_ = {0};
+               GValue _tmp17_;
+               gboolean _tmp18_;
+               GValue _tmp19_;
+               GValue _tmp20_ = {0};
+               GValue _tmp21_;
+               gboolean _tmp22_;
+               g_value_init (&_tmp14_, G_TYPE_INT);
+               v = _tmp14_;
+               g_value_set_int (&v, 23);
+               _tmp15_ = v;
+               get_value (&_tmp15_, &_tmp16_);
+               _tmp17_ = _tmp16_;
+               _tmp18_ = g_value_get_int (&_tmp16_) != 23;
+               G_IS_VALUE (&_tmp17_) ? (g_value_unset (&_tmp17_), NULL) : NULL;
+               if (_tmp18_) {
+                       g_assert_not_reached ();
+               }
+               _tmp19_ = v;
+               get_value (&_tmp19_, &_tmp20_);
+               _tmp21_ = _tmp20_;
+               _tmp22_ = 23 != g_value_get_int (&_tmp20_);
+               G_IS_VALUE (&_tmp21_) ? (g_value_unset (&_tmp21_), NULL) : NULL;
+               if (_tmp22_) {
+                       g_assert_not_reached ();
+               }
+               G_IS_VALUE (&v) ? (g_value_unset (&v), NULL) : NULL;
+       }
+       {
+               GValue* v = NULL;
+               GValue _tmp23_ = {0};
+               GValue _tmp24_;
+               GValue* _tmp25_;
+               GValue* _tmp26_;
+               GValue* _tmp27_;
+               GValue* _tmp28_;
+               gboolean _tmp29_;
+               GValue* _tmp30_;
+               GValue* _tmp31_;
+               gboolean _tmp32_;
+               g_value_init (&_tmp23_, G_TYPE_INT);
+               _tmp24_ = _tmp23_;
+               _tmp25_ = __g_value_dup0 (&_tmp24_);
+               _tmp26_ = _tmp25_;
+               G_IS_VALUE (&_tmp24_) ? (g_value_unset (&_tmp24_), NULL) : NULL;
+               v = _tmp26_;
+               g_value_set_int (v, 23);
+               _tmp27_ = get_nullable_value (v);
+               _tmp28_ = _tmp27_;
+               _tmp29_ = g_value_get_int (_tmp27_) != 23;
+               __vala_GValue_free0 (_tmp28_);
+               if (_tmp29_) {
+                       g_assert_not_reached ();
+               }
+               _tmp30_ = get_nullable_value (v);
+               _tmp31_ = _tmp30_;
+               _tmp32_ = 23 != g_value_get_int (_tmp30_);
+               __vala_GValue_free0 (_tmp31_);
+               if (_tmp32_) {
+                       g_assert_not_reached ();
+               }
+               __vala_GValue_free0 (v);
+       }
+       {
+               GValue v = {0};
+               GValue _tmp33_ = {0};
+               GValue _tmp34_;
+               GValue _tmp35_ = {0};
+               GValue _tmp36_;
+               gboolean _tmp37_;
+               GValue _tmp38_;
+               GValue _tmp39_ = {0};
+               GValue _tmp40_;
+               gboolean _tmp41_;
+               g_value_init (&_tmp33_, G_TYPE_STRING);
+               v = _tmp33_;
+               g_value_set_string (&v, "bar");
+               _tmp34_ = v;
+               get_value (&_tmp34_, &_tmp35_);
+               _tmp36_ = _tmp35_;
+               _tmp37_ = g_strcmp0 (g_value_get_string (&_tmp35_), "bar") != 0;
+               G_IS_VALUE (&_tmp36_) ? (g_value_unset (&_tmp36_), NULL) : NULL;
+               if (_tmp37_) {
+                       g_assert_not_reached ();
+               }
+               _tmp38_ = v;
+               get_value (&_tmp38_, &_tmp39_);
+               _tmp40_ = _tmp39_;
+               _tmp41_ = g_strcmp0 ("bar", g_value_get_string (&_tmp39_)) != 0;
+               G_IS_VALUE (&_tmp40_) ? (g_value_unset (&_tmp40_), NULL) : NULL;
+               if (_tmp41_) {
+                       g_assert_not_reached ();
+               }
+               G_IS_VALUE (&v) ? (g_value_unset (&v), NULL) : NULL;
+       }
+       {
+               GValue* v = NULL;
+               GValue _tmp42_ = {0};
+               GValue _tmp43_;
+               GValue* _tmp44_;
+               GValue* _tmp45_;
+               GValue* _tmp46_;
+               GValue* _tmp47_;
+               gboolean _tmp48_;
+               GValue* _tmp49_;
+               GValue* _tmp50_;
+               gboolean _tmp51_;
+               g_value_init (&_tmp42_, G_TYPE_STRING);
+               _tmp43_ = _tmp42_;
+               _tmp44_ = __g_value_dup0 (&_tmp43_);
+               _tmp45_ = _tmp44_;
+               G_IS_VALUE (&_tmp43_) ? (g_value_unset (&_tmp43_), NULL) : NULL;
+               v = _tmp45_;
+               g_value_set_string (v, "bar");
+               _tmp46_ = get_nullable_value (v);
+               _tmp47_ = _tmp46_;
+               _tmp48_ = g_strcmp0 (g_value_get_string (_tmp46_), "bar") != 0;
+               __vala_GValue_free0 (_tmp47_);
+               if (_tmp48_) {
+                       g_assert_not_reached ();
+               }
+               _tmp49_ = get_nullable_value (v);
+               _tmp50_ = _tmp49_;
+               _tmp51_ = g_strcmp0 ("bar", g_value_get_string (_tmp49_)) != 0;
+               __vala_GValue_free0 (_tmp50_);
+               if (_tmp51_) {
+                       g_assert_not_reached ();
+               }
+               __vala_GValue_free0 (v);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/structs/gvalue.c-expected b/tests/structs/gvalue.c-expected
new file mode 100644
index 000000000..0caf6e916
--- /dev/null
+++ b/tests/structs/gvalue.c-expected
@@ -0,0 +1,1208 @@
+/* structs_gvalue.c generated by valac, the Vala compiler
+ * generated from structs_gvalue.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+#include <gobject/gvaluecollector.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define __vala_GValue_free0(var) ((var == NULL) ? NULL : (var = (_vala_GValue_free (var), NULL)))
+
+#define TYPE_BAR (bar_get_type ())
+#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
+#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
+#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
+#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
+#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
+
+typedef struct _Bar Bar;
+typedef struct _BarClass BarClass;
+typedef struct _BarPrivate BarPrivate;
+typedef struct _ParamSpecBar ParamSpecBar;
+
+#define TYPE_MANAM (manam_get_type ())
+#define MANAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MANAM, Manam))
+#define IS_MANAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MANAM))
+#define MANAM_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_MANAM, ManamIface))
+
+typedef struct _Manam Manam;
+typedef struct _ManamIface ManamIface;
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _bar_unref0(var) ((var == NULL) ? NULL : (var = (bar_unref (var), NULL)))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+
+#define TYPE_FOO_STRUCT (foo_struct_get_type ())
+typedef struct _FooStruct FooStruct;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Bar {
+       GTypeInstance parent_instance;
+       volatile int ref_count;
+       BarPrivate * priv;
+       gint i;
+};
+
+struct _BarClass {
+       GTypeClass parent_class;
+       void (*finalize) (Bar *self);
+};
+
+struct _ParamSpecBar {
+       GParamSpec parent_instance;
+};
+
+struct _ManamIface {
+       GTypeInterface parent_iface;
+};
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+       gint i;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _FooStruct {
+       gint i;
+};
+
+static gpointer bar_parent_class = NULL;
+static gpointer foo_parent_class = NULL;
+static ManamIface * foo_manam_parent_iface = NULL;
+
+VALA_EXTERN void test_value (void);
+VALA_EXTERN void test_value_array (void);
+static void _vala_GValue_array_free (GValue * array,
+                              gssize array_length);
+VALA_EXTERN void test_nullable_value (void);
+static void _vala_GValue_free (GValue* self);
+VALA_EXTERN void test_nullable_value_array (void);
+VALA_EXTERN gpointer bar_ref (gpointer instance);
+VALA_EXTERN void bar_unref (gpointer instance);
+VALA_EXTERN GParamSpec* param_spec_bar (const gchar* name,
+                            const gchar* nick,
+                            const gchar* blurb,
+                            GType object_type,
+                            GParamFlags flags);
+VALA_EXTERN void value_set_bar (GValue* value,
+                    gpointer v_object);
+VALA_EXTERN void value_take_bar (GValue* value,
+                     gpointer v_object);
+VALA_EXTERN gpointer value_get_bar (const GValue* value);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, bar_unref)
+VALA_EXTERN Bar* bar_new (void);
+VALA_EXTERN Bar* bar_construct (GType object_type);
+static void bar_finalize (Bar * obj);
+static GType bar_get_type_once (void);
+VALA_EXTERN GType manam_get_type (void) G_GNUC_CONST ;
+static GType manam_get_type_once (void);
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (void);
+VALA_EXTERN Foo* foo_construct (GType object_type);
+static void foo_finalize (GObject * obj);
+static GType foo_get_type_once (void);
+VALA_EXTERN void test_gtype (void);
+VALA_EXTERN void test_gobject (void);
+VALA_EXTERN void test_ginterface (void);
+VALA_EXTERN void take_value (GValue* v);
+VALA_EXTERN gboolean make_bool (void);
+VALA_EXTERN GType foo_struct_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN FooStruct* foo_struct_dup (const FooStruct* self);
+VALA_EXTERN void foo_struct_free (FooStruct* self);
+VALA_EXTERN void test_try_cast_value (void);
+static gchar** _vala_array_dup1 (gchar** self,
+                          gssize length);
+static void _vala_main (void);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+void
+test_value (void)
+{
+       GValue v1 = {0};
+       GValue _tmp0_ = {0};
+       gchar* s = NULL;
+       gchar* _tmp1_;
+       GValue v2 = {0};
+       GValue _tmp2_ = {0};
+       const gchar* _tmp3_;
+       const gchar* s2 = NULL;
+       GValue v3 = {0};
+       GValue _tmp4_ = {0};
+       const gchar* _tmp5_;
+       g_value_init (&_tmp0_, G_TYPE_INT);
+       g_value_set_int (&_tmp0_, 1);
+       v1 = _tmp0_;
+       _vala_assert (g_value_get_int (&v1) == 1, "v1.get_int() == 1");
+       _tmp1_ = g_strdup ("hello");
+       s = _tmp1_;
+       g_value_init (&_tmp2_, G_TYPE_STRING);
+       g_value_set_string (&_tmp2_, s);
+       v2 = _tmp2_;
+       _tmp3_ = g_value_get_string (&v2);
+       _vala_assert (g_strcmp0 (_tmp3_, s) == 0, "v2.get_string () == s");
+       s2 = "world";
+       g_value_init (&_tmp4_, G_TYPE_STRING);
+       g_value_set_string (&_tmp4_, s2);
+       v3 = _tmp4_;
+       _tmp5_ = g_value_get_string (&v3);
+       _vala_assert (g_strcmp0 (_tmp5_, s2) == 0, "v3.get_string () == s2");
+       G_IS_VALUE (&v3) ? (g_value_unset (&v3), NULL) : NULL;
+       G_IS_VALUE (&v2) ? (g_value_unset (&v2), NULL) : NULL;
+       _g_free0 (s);
+       G_IS_VALUE (&v1) ? (g_value_unset (&v1), NULL) : NULL;
+}
+
+static void
+_vala_GValue_array_free (GValue * array,
+                         gssize array_length)
+{
+       if (array != NULL) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       g_value_unset (&array[i]);
+               }
+       }
+       g_free (array);
+}
+
+void
+test_value_array (void)
+{
+       gint* iarray = NULL;
+       gint* _tmp0_;
+       gint iarray_length1;
+       gint _iarray_size_;
+       GValue* viarray = NULL;
+       GValue _tmp1_ = {0};
+       GValue _tmp2_ = {0};
+       GValue _tmp3_ = {0};
+       GValue _tmp4_ = {0};
+       GValue _tmp5_ = {0};
+       GValue* _tmp6_;
+       gint viarray_length1;
+       gint _viarray_size_;
+       GValue* _tmp7_;
+       gint _tmp7__length1;
+       gint* _tmp8_;
+       gint _tmp8__length1;
+       gchar** sarray = NULL;
+       gchar* _tmp15_;
+       gchar* _tmp16_;
+       gchar* _tmp17_;
+       gchar** _tmp18_;
+       gint sarray_length1;
+       gint _sarray_size_;
+       GValue* vsarray = NULL;
+       GValue _tmp19_ = {0};
+       GValue _tmp20_ = {0};
+       GValue _tmp21_ = {0};
+       GValue* _tmp22_;
+       gint vsarray_length1;
+       gint _vsarray_size_;
+       GValue* _tmp23_;
+       gint _tmp23__length1;
+       gchar** _tmp24_;
+       gint _tmp24__length1;
+       _tmp0_ = g_new0 (gint, 5);
+       _tmp0_[0] = 1;
+       _tmp0_[1] = 2;
+       _tmp0_[2] = 3;
+       _tmp0_[3] = 4;
+       _tmp0_[4] = 5;
+       iarray = _tmp0_;
+       iarray_length1 = 5;
+       _iarray_size_ = iarray_length1;
+       g_value_init (&_tmp1_, G_TYPE_INT);
+       g_value_set_int (&_tmp1_, 1);
+       g_value_init (&_tmp2_, G_TYPE_INT);
+       g_value_set_int (&_tmp2_, 2);
+       g_value_init (&_tmp3_, G_TYPE_INT);
+       g_value_set_int (&_tmp3_, 3);
+       g_value_init (&_tmp4_, G_TYPE_INT);
+       g_value_set_int (&_tmp4_, 4);
+       g_value_init (&_tmp5_, G_TYPE_INT);
+       g_value_set_int (&_tmp5_, 5);
+       _tmp6_ = g_new0 (GValue, 5);
+       _tmp6_[0] = _tmp1_;
+       _tmp6_[1] = _tmp2_;
+       _tmp6_[2] = _tmp3_;
+       _tmp6_[3] = _tmp4_;
+       _tmp6_[4] = _tmp5_;
+       viarray = _tmp6_;
+       viarray_length1 = 5;
+       _viarray_size_ = viarray_length1;
+       _tmp7_ = viarray;
+       _tmp7__length1 = viarray_length1;
+       _tmp8_ = iarray;
+       _tmp8__length1 = iarray_length1;
+       _vala_assert (_tmp7__length1 == _tmp8__length1, "viarray.length == iarray.length");
+       {
+               gint i = 0;
+               i = 0;
+               {
+                       gboolean _tmp9_ = FALSE;
+                       _tmp9_ = TRUE;
+                       while (TRUE) {
+                               GValue* _tmp11_;
+                               gint _tmp11__length1;
+                               GValue* _tmp12_;
+                               gint _tmp12__length1;
+                               gint* _tmp13_;
+                               gint _tmp13__length1;
+                               gint _tmp14_;
+                               if (!_tmp9_) {
+                                       gint _tmp10_;
+                                       _tmp10_ = i;
+                                       i = _tmp10_ + 1;
+                               }
+                               _tmp9_ = FALSE;
+                               _tmp11_ = viarray;
+                               _tmp11__length1 = viarray_length1;
+                               if (!(i < _tmp11__length1)) {
+                                       break;
+                               }
+                               _tmp12_ = viarray;
+                               _tmp12__length1 = viarray_length1;
+                               _tmp13_ = iarray;
+                               _tmp13__length1 = iarray_length1;
+                               _tmp14_ = _tmp13_[i];
+                               _vala_assert (g_value_get_int (&_tmp12_[i]) == _tmp14_, "viarray[i].get_int 
() == iarray[i]");
+                       }
+               }
+       }
+       _tmp15_ = g_strdup ("hello");
+       _tmp16_ = g_strdup ("vala");
+       _tmp17_ = g_strdup ("world");
+       _tmp18_ = g_new0 (gchar*, 3 + 1);
+       _tmp18_[0] = _tmp15_;
+       _tmp18_[1] = _tmp16_;
+       _tmp18_[2] = _tmp17_;
+       sarray = _tmp18_;
+       sarray_length1 = 3;
+       _sarray_size_ = sarray_length1;
+       g_value_init (&_tmp19_, G_TYPE_STRING);
+       g_value_set_string (&_tmp19_, "hello");
+       g_value_init (&_tmp20_, G_TYPE_STRING);
+       g_value_set_string (&_tmp20_, "vala");
+       g_value_init (&_tmp21_, G_TYPE_STRING);
+       g_value_set_string (&_tmp21_, "world");
+       _tmp22_ = g_new0 (GValue, 3);
+       _tmp22_[0] = _tmp19_;
+       _tmp22_[1] = _tmp20_;
+       _tmp22_[2] = _tmp21_;
+       vsarray = _tmp22_;
+       vsarray_length1 = 3;
+       _vsarray_size_ = vsarray_length1;
+       _tmp23_ = vsarray;
+       _tmp23__length1 = vsarray_length1;
+       _tmp24_ = sarray;
+       _tmp24__length1 = sarray_length1;
+       _vala_assert (_tmp23__length1 == _tmp24__length1, "vsarray.length == sarray.length");
+       {
+               gint i = 0;
+               i = 0;
+               {
+                       gboolean _tmp25_ = FALSE;
+                       _tmp25_ = TRUE;
+                       while (TRUE) {
+                               GValue* _tmp27_;
+                               gint _tmp27__length1;
+                               GValue* _tmp28_;
+                               gint _tmp28__length1;
+                               const gchar* _tmp29_;
+                               gchar** _tmp30_;
+                               gint _tmp30__length1;
+                               const gchar* _tmp31_;
+                               if (!_tmp25_) {
+                                       gint _tmp26_;
+                                       _tmp26_ = i;
+                                       i = _tmp26_ + 1;
+                               }
+                               _tmp25_ = FALSE;
+                               _tmp27_ = vsarray;
+                               _tmp27__length1 = vsarray_length1;
+                               if (!(i < _tmp27__length1)) {
+                                       break;
+                               }
+                               _tmp28_ = vsarray;
+                               _tmp28__length1 = vsarray_length1;
+                               _tmp29_ = g_value_get_string (&_tmp28_[i]);
+                               _tmp30_ = sarray;
+                               _tmp30__length1 = sarray_length1;
+                               _tmp31_ = _tmp30_[i];
+                               _vala_assert (g_strcmp0 (_tmp29_, _tmp31_) == 0, "vsarray[i].get_string () == 
sarray[i]");
+                       }
+               }
+       }
+       vsarray = (_vala_GValue_array_free (vsarray, vsarray_length1), NULL);
+       sarray = (_vala_array_free (sarray, sarray_length1, (GDestroyNotify) g_free), NULL);
+       viarray = (_vala_GValue_array_free (viarray, viarray_length1), NULL);
+       iarray = (g_free (iarray), NULL);
+}
+
+static void
+_vala_GValue_free (GValue* self)
+{
+       g_boxed_free (G_TYPE_VALUE, self);
+}
+
+void
+test_nullable_value (void)
+{
+       GValue* v1 = NULL;
+       GValue* _tmp0_ = NULL;
+       gchar* s = NULL;
+       gchar* _tmp1_;
+       GValue* v2 = NULL;
+       GValue* _tmp2_ = NULL;
+       const gchar* _tmp3_;
+       const gchar* s2 = NULL;
+       GValue* v3 = NULL;
+       GValue* _tmp4_ = NULL;
+       const gchar* _tmp5_;
+       _tmp0_ = g_new0 (GValue, 1);
+       g_value_init (_tmp0_, G_TYPE_INT);
+       g_value_set_int (_tmp0_, 1);
+       v1 = _tmp0_;
+       _vala_assert (g_value_get_int (v1) == 1, "v1.get_int() == 1");
+       _tmp1_ = g_strdup ("hello");
+       s = _tmp1_;
+       _tmp2_ = g_new0 (GValue, 1);
+       g_value_init (_tmp2_, G_TYPE_STRING);
+       g_value_set_string (_tmp2_, s);
+       v2 = _tmp2_;
+       _tmp3_ = g_value_get_string (v2);
+       _vala_assert (g_strcmp0 (_tmp3_, s) == 0, "v2.get_string () == s");
+       s2 = "world";
+       _tmp4_ = g_new0 (GValue, 1);
+       g_value_init (_tmp4_, G_TYPE_STRING);
+       g_value_set_string (_tmp4_, s2);
+       v3 = _tmp4_;
+       _tmp5_ = g_value_get_string (v3);
+       _vala_assert (g_strcmp0 (_tmp5_, s2) == 0, "v3.get_string () == s2");
+       __vala_GValue_free0 (v3);
+       __vala_GValue_free0 (v2);
+       _g_free0 (s);
+       __vala_GValue_free0 (v1);
+}
+
+void
+test_nullable_value_array (void)
+{
+       gint* iarray = NULL;
+       gint* _tmp0_;
+       gint iarray_length1;
+       gint _iarray_size_;
+       GValue** viarray = NULL;
+       GValue* _tmp1_ = NULL;
+       GValue* _tmp2_ = NULL;
+       GValue* _tmp3_ = NULL;
+       GValue* _tmp4_ = NULL;
+       GValue* _tmp5_ = NULL;
+       GValue** _tmp6_;
+       gint viarray_length1;
+       gint _viarray_size_;
+       GValue** _tmp7_;
+       gint _tmp7__length1;
+       gint* _tmp8_;
+       gint _tmp8__length1;
+       gchar** sarray = NULL;
+       gchar* _tmp16_;
+       gchar* _tmp17_;
+       gchar* _tmp18_;
+       gchar** _tmp19_;
+       gint sarray_length1;
+       gint _sarray_size_;
+       GValue** vsarray = NULL;
+       GValue* _tmp20_ = NULL;
+       GValue* _tmp21_ = NULL;
+       GValue* _tmp22_ = NULL;
+       GValue** _tmp23_;
+       gint vsarray_length1;
+       gint _vsarray_size_;
+       GValue** _tmp24_;
+       gint _tmp24__length1;
+       gchar** _tmp25_;
+       gint _tmp25__length1;
+       _tmp0_ = g_new0 (gint, 5);
+       _tmp0_[0] = 1;
+       _tmp0_[1] = 2;
+       _tmp0_[2] = 3;
+       _tmp0_[3] = 4;
+       _tmp0_[4] = 5;
+       iarray = _tmp0_;
+       iarray_length1 = 5;
+       _iarray_size_ = iarray_length1;
+       _tmp1_ = g_new0 (GValue, 1);
+       g_value_init (_tmp1_, G_TYPE_INT);
+       g_value_set_int (_tmp1_, 1);
+       _tmp2_ = g_new0 (GValue, 1);
+       g_value_init (_tmp2_, G_TYPE_INT);
+       g_value_set_int (_tmp2_, 2);
+       _tmp3_ = g_new0 (GValue, 1);
+       g_value_init (_tmp3_, G_TYPE_INT);
+       g_value_set_int (_tmp3_, 3);
+       _tmp4_ = g_new0 (GValue, 1);
+       g_value_init (_tmp4_, G_TYPE_INT);
+       g_value_set_int (_tmp4_, 4);
+       _tmp5_ = g_new0 (GValue, 1);
+       g_value_init (_tmp5_, G_TYPE_INT);
+       g_value_set_int (_tmp5_, 5);
+       _tmp6_ = g_new0 (GValue*, 5);
+       _tmp6_[0] = _tmp1_;
+       _tmp6_[1] = _tmp2_;
+       _tmp6_[2] = _tmp3_;
+       _tmp6_[3] = _tmp4_;
+       _tmp6_[4] = _tmp5_;
+       viarray = _tmp6_;
+       viarray_length1 = 5;
+       _viarray_size_ = viarray_length1;
+       _tmp7_ = viarray;
+       _tmp7__length1 = viarray_length1;
+       _tmp8_ = iarray;
+       _tmp8__length1 = iarray_length1;
+       _vala_assert (_tmp7__length1 == _tmp8__length1, "viarray.length == iarray.length");
+       {
+               gint i = 0;
+               i = 0;
+               {
+                       gboolean _tmp9_ = FALSE;
+                       _tmp9_ = TRUE;
+                       while (TRUE) {
+                               GValue** _tmp11_;
+                               gint _tmp11__length1;
+                               GValue** _tmp12_;
+                               gint _tmp12__length1;
+                               GValue* _tmp13_;
+                               gint* _tmp14_;
+                               gint _tmp14__length1;
+                               gint _tmp15_;
+                               if (!_tmp9_) {
+                                       gint _tmp10_;
+                                       _tmp10_ = i;
+                                       i = _tmp10_ + 1;
+                               }
+                               _tmp9_ = FALSE;
+                               _tmp11_ = viarray;
+                               _tmp11__length1 = viarray_length1;
+                               if (!(i < _tmp11__length1)) {
+                                       break;
+                               }
+                               _tmp12_ = viarray;
+                               _tmp12__length1 = viarray_length1;
+                               _tmp13_ = _tmp12_[i];
+                               _tmp14_ = iarray;
+                               _tmp14__length1 = iarray_length1;
+                               _tmp15_ = _tmp14_[i];
+                               _vala_assert (g_value_get_int (_tmp13_) == _tmp15_, "viarray[i].get_int () == 
iarray[i]");
+                       }
+               }
+       }
+       _tmp16_ = g_strdup ("hello");
+       _tmp17_ = g_strdup ("vala");
+       _tmp18_ = g_strdup ("world");
+       _tmp19_ = g_new0 (gchar*, 3 + 1);
+       _tmp19_[0] = _tmp16_;
+       _tmp19_[1] = _tmp17_;
+       _tmp19_[2] = _tmp18_;
+       sarray = _tmp19_;
+       sarray_length1 = 3;
+       _sarray_size_ = sarray_length1;
+       _tmp20_ = g_new0 (GValue, 1);
+       g_value_init (_tmp20_, G_TYPE_STRING);
+       g_value_set_string (_tmp20_, "hello");
+       _tmp21_ = g_new0 (GValue, 1);
+       g_value_init (_tmp21_, G_TYPE_STRING);
+       g_value_set_string (_tmp21_, "vala");
+       _tmp22_ = g_new0 (GValue, 1);
+       g_value_init (_tmp22_, G_TYPE_STRING);
+       g_value_set_string (_tmp22_, "world");
+       _tmp23_ = g_new0 (GValue*, 3);
+       _tmp23_[0] = _tmp20_;
+       _tmp23_[1] = _tmp21_;
+       _tmp23_[2] = _tmp22_;
+       vsarray = _tmp23_;
+       vsarray_length1 = 3;
+       _vsarray_size_ = vsarray_length1;
+       _tmp24_ = vsarray;
+       _tmp24__length1 = vsarray_length1;
+       _tmp25_ = sarray;
+       _tmp25__length1 = sarray_length1;
+       _vala_assert (_tmp24__length1 == _tmp25__length1, "vsarray.length == sarray.length");
+       {
+               gint i = 0;
+               i = 0;
+               {
+                       gboolean _tmp26_ = FALSE;
+                       _tmp26_ = TRUE;
+                       while (TRUE) {
+                               GValue** _tmp28_;
+                               gint _tmp28__length1;
+                               GValue** _tmp29_;
+                               gint _tmp29__length1;
+                               GValue* _tmp30_;
+                               const gchar* _tmp31_;
+                               gchar** _tmp32_;
+                               gint _tmp32__length1;
+                               const gchar* _tmp33_;
+                               if (!_tmp26_) {
+                                       gint _tmp27_;
+                                       _tmp27_ = i;
+                                       i = _tmp27_ + 1;
+                               }
+                               _tmp26_ = FALSE;
+                               _tmp28_ = vsarray;
+                               _tmp28__length1 = vsarray_length1;
+                               if (!(i < _tmp28__length1)) {
+                                       break;
+                               }
+                               _tmp29_ = vsarray;
+                               _tmp29__length1 = vsarray_length1;
+                               _tmp30_ = _tmp29_[i];
+                               _tmp31_ = g_value_get_string (_tmp30_);
+                               _tmp32_ = sarray;
+                               _tmp32__length1 = sarray_length1;
+                               _tmp33_ = _tmp32_[i];
+                               _vala_assert (g_strcmp0 (_tmp31_, _tmp33_) == 0, "vsarray[i].get_string () == 
sarray[i]");
+                       }
+               }
+       }
+       vsarray = (_vala_array_free (vsarray, vsarray_length1, (GDestroyNotify) _vala_GValue_free), NULL);
+       sarray = (_vala_array_free (sarray, sarray_length1, (GDestroyNotify) g_free), NULL);
+       viarray = (_vala_array_free (viarray, viarray_length1, (GDestroyNotify) _vala_GValue_free), NULL);
+       iarray = (g_free (iarray), NULL);
+}
+
+Bar*
+bar_construct (GType object_type)
+{
+       Bar* self = NULL;
+       self = (Bar*) g_type_create_instance (object_type);
+       return self;
+}
+
+Bar*
+bar_new (void)
+{
+       return bar_construct (TYPE_BAR);
+}
+
+static void
+value_bar_init (GValue* value)
+{
+       value->data[0].v_pointer = NULL;
+}
+
+static void
+value_bar_free_value (GValue* value)
+{
+       if (value->data[0].v_pointer) {
+               bar_unref (value->data[0].v_pointer);
+       }
+}
+
+static void
+value_bar_copy_value (const GValue* src_value,
+                      GValue* dest_value)
+{
+       if (src_value->data[0].v_pointer) {
+               dest_value->data[0].v_pointer = bar_ref (src_value->data[0].v_pointer);
+       } else {
+               dest_value->data[0].v_pointer = NULL;
+       }
+}
+
+static gpointer
+value_bar_peek_pointer (const GValue* value)
+{
+       return value->data[0].v_pointer;
+}
+
+static gchar*
+value_bar_collect_value (GValue* value,
+                         guint n_collect_values,
+                         GTypeCValue* collect_values,
+                         guint collect_flags)
+{
+       if (collect_values[0].v_pointer) {
+               Bar * object;
+               object = collect_values[0].v_pointer;
+               if (object->parent_instance.g_class == NULL) {
+                       return g_strconcat ("invalid unclassed object pointer for value type `", 
G_VALUE_TYPE_NAME (value), "'", NULL);
+               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
+                       return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE 
(object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
+               }
+               value->data[0].v_pointer = bar_ref (object);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       return NULL;
+}
+
+static gchar*
+value_bar_lcopy_value (const GValue* value,
+                       guint n_collect_values,
+                       GTypeCValue* collect_values,
+                       guint collect_flags)
+{
+       Bar ** object_p;
+       object_p = collect_values[0].v_pointer;
+       if (!object_p) {
+               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
+       }
+       if (!value->data[0].v_pointer) {
+               *object_p = NULL;
+       } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
+               *object_p = value->data[0].v_pointer;
+       } else {
+               *object_p = bar_ref (value->data[0].v_pointer);
+       }
+       return NULL;
+}
+
+GParamSpec*
+param_spec_bar (const gchar* name,
+                const gchar* nick,
+                const gchar* blurb,
+                GType object_type,
+                GParamFlags flags)
+{
+       ParamSpecBar* spec;
+       g_return_val_if_fail (g_type_is_a (object_type, TYPE_BAR), NULL);
+       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       G_PARAM_SPEC (spec)->value_type = object_type;
+       return G_PARAM_SPEC (spec);
+}
+
+gpointer
+value_get_bar (const GValue* value)
+{
+       g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR), NULL);
+       return value->data[0].v_pointer;
+}
+
+void
+value_set_bar (GValue* value,
+               gpointer v_object)
+{
+       Bar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+               bar_ref (value->data[0].v_pointer);
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_unref (old);
+       }
+}
+
+void
+value_take_bar (GValue* value,
+                gpointer v_object)
+{
+       Bar * old;
+       g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_BAR));
+       old = value->data[0].v_pointer;
+       if (v_object) {
+               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_BAR));
+               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE 
(value)));
+               value->data[0].v_pointer = v_object;
+       } else {
+               value->data[0].v_pointer = NULL;
+       }
+       if (old) {
+               bar_unref (old);
+       }
+}
+
+static void
+bar_class_init (BarClass * klass,
+                gpointer klass_data)
+{
+       bar_parent_class = g_type_class_peek_parent (klass);
+       ((BarClass *) klass)->finalize = bar_finalize;
+}
+
+static void
+bar_instance_init (Bar * self,
+                   gpointer klass)
+{
+       self->ref_count = 1;
+}
+
+static void
+bar_finalize (Bar * obj)
+{
+       Bar * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
+       g_signal_handlers_destroy (self);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       static const GTypeValueTable g_define_type_value_table = { value_bar_init, value_bar_free_value, 
value_bar_copy_value, value_bar_peek_pointer, "p", value_bar_collect_value, "p", value_bar_lcopy_value };
+       static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, 
(GInstanceInitFunc) bar_instance_init, &g_define_type_value_table };
+       static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | 
G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+       GType bar_type_id;
+       bar_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Bar", &g_define_type_info, 
&g_define_type_fundamental_info, 0);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+gpointer
+bar_ref (gpointer instance)
+{
+       Bar * self;
+       self = instance;
+       g_atomic_int_inc (&self->ref_count);
+       return instance;
+}
+
+void
+bar_unref (gpointer instance)
+{
+       Bar * self;
+       self = instance;
+       if (g_atomic_int_dec_and_test (&self->ref_count)) {
+               BAR_GET_CLASS (self)->finalize (self);
+               g_type_free_instance ((GTypeInstance *) self);
+       }
+}
+
+static void
+manam_default_init (ManamIface * iface,
+                    gpointer iface_data)
+{
+}
+
+static GType
+manam_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (ManamIface), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) manam_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, 
(GInstanceInitFunc) NULL, NULL };
+       GType manam_type_id;
+       manam_type_id = g_type_register_static (G_TYPE_INTERFACE, "Manam", &g_define_type_info, 0);
+       g_type_interface_add_prerequisite (manam_type_id, G_TYPE_OBJECT);
+       return manam_type_id;
+}
+
+GType
+manam_get_type (void)
+{
+       static volatile gsize manam_type_id__volatile = 0;
+       if (g_once_init_enter (&manam_type_id__volatile)) {
+               GType manam_type_id;
+               manam_type_id = manam_get_type_once ();
+               g_once_init_leave (&manam_type_id__volatile, manam_type_id);
+       }
+       return manam_type_id__volatile;
+}
+
+Foo*
+foo_construct (GType object_type)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, NULL);
+       return self;
+}
+
+Foo*
+foo_new (void)
+{
+       return foo_construct (TYPE_FOO);
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       G_OBJECT_CLASS (klass)->finalize = foo_finalize;
+}
+
+static void
+foo_manam_interface_init (ManamIface * iface,
+                          gpointer iface_data)
+{
+       foo_manam_parent_iface = g_type_interface_peek_parent (iface);
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+}
+
+static void
+foo_finalize (GObject * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       G_OBJECT_CLASS (foo_parent_class)->finalize (obj);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       static const GInterfaceInfo manam_info = { (GInterfaceInitFunc) foo_manam_interface_init, 
(GInterfaceFinalizeFunc) NULL, NULL};
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       g_type_add_interface_static (foo_type_id, TYPE_MANAM, &manam_info);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static gpointer
+_bar_ref0 (gpointer self)
+{
+       return self ? bar_ref (self) : NULL;
+}
+
+void
+test_gtype (void)
+{
+       Bar* o = NULL;
+       Bar* _tmp0_;
+       GValue vo = {0};
+       GValue _tmp1_ = {0};
+       Bar* o2 = NULL;
+       GValue _tmp2_;
+       Bar* _tmp3_;
+       _tmp0_ = bar_new ();
+       o = _tmp0_;
+       o->i = 42;
+       g_value_init (&_tmp1_, TYPE_BAR);
+       value_set_bar (&_tmp1_, o);
+       vo = _tmp1_;
+       _tmp2_ = vo;
+       _tmp3_ = _bar_ref0 (value_get_bar (&_tmp2_));
+       o2 = _tmp3_;
+       _vala_assert (o2->i == 42, "o2.i == 42");
+       _bar_unref0 (o2);
+       G_IS_VALUE (&vo) ? (g_value_unset (&vo), NULL) : NULL;
+       _bar_unref0 (o);
+}
+
+static gpointer
+_g_object_ref0 (gpointer self)
+{
+       return self ? g_object_ref (self) : NULL;
+}
+
+void
+test_gobject (void)
+{
+       Foo* o = NULL;
+       Foo* _tmp0_;
+       GValue vo = {0};
+       GValue _tmp1_ = {0};
+       Foo* o2 = NULL;
+       GValue _tmp2_;
+       Foo* _tmp3_;
+       _tmp0_ = foo_new ();
+       o = _tmp0_;
+       o->i = 42;
+       g_value_init (&_tmp1_, TYPE_FOO);
+       g_value_set_object (&_tmp1_, o);
+       vo = _tmp1_;
+       _tmp2_ = vo;
+       _tmp3_ = _g_object_ref0 (g_value_get_object (&_tmp2_));
+       o2 = _tmp3_;
+       _vala_assert (o2->i == 42, "o2.i == 42");
+       _g_object_unref0 (o2);
+       G_IS_VALUE (&vo) ? (g_value_unset (&vo), NULL) : NULL;
+       _g_object_unref0 (o);
+}
+
+void
+test_ginterface (void)
+{
+       Manam* i = NULL;
+       Foo* _tmp0_;
+       GValue vi = {0};
+       GValue _tmp1_ = {0};
+       Manam* i2 = NULL;
+       GValue _tmp2_;
+       Manam* _tmp3_;
+       _tmp0_ = foo_new ();
+       i = G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, TYPE_MANAM, Manam);
+       G_TYPE_CHECK_INSTANCE_CAST (i, TYPE_FOO, Foo)->i = 42;
+       g_value_init (&_tmp1_, TYPE_MANAM);
+       g_value_set_object (&_tmp1_, i);
+       vi = _tmp1_;
+       _tmp2_ = vi;
+       _tmp3_ = _g_object_ref0 (g_value_get_object (&_tmp2_));
+       i2 = _tmp3_;
+       _vala_assert (G_TYPE_CHECK_INSTANCE_CAST (i2, TYPE_FOO, Foo)->i == 42, "((Foo) i2).i == 42");
+       _g_object_unref0 (i2);
+       G_IS_VALUE (&vi) ? (g_value_unset (&vi), NULL) : NULL;
+       _g_object_unref0 (i);
+}
+
+void
+take_value (GValue* v)
+{
+       g_return_if_fail (v != NULL);
+}
+
+gboolean
+make_bool (void)
+{
+       gboolean result = FALSE;
+       result = TRUE;
+       return result;
+}
+
+FooStruct*
+foo_struct_dup (const FooStruct* self)
+{
+       FooStruct* dup;
+       dup = g_new0 (FooStruct, 1);
+       memcpy (dup, self, sizeof (FooStruct));
+       return dup;
+}
+
+void
+foo_struct_free (FooStruct* self)
+{
+       g_free (self);
+}
+
+static GType
+foo_struct_get_type_once (void)
+{
+       GType foo_struct_type_id;
+       foo_struct_type_id = g_boxed_type_register_static ("FooStruct", (GBoxedCopyFunc) foo_struct_dup, 
(GBoxedFreeFunc) foo_struct_free);
+       return foo_struct_type_id;
+}
+
+GType
+foo_struct_get_type (void)
+{
+       static volatile gsize foo_struct_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_struct_type_id__volatile)) {
+               GType foo_struct_type_id;
+               foo_struct_type_id = foo_struct_get_type_once ();
+               g_once_init_leave (&foo_struct_type_id__volatile, foo_struct_type_id);
+       }
+       return foo_struct_type_id__volatile;
+}
+
+static gchar**
+_vala_array_dup1 (gchar** self,
+                  gssize length)
+{
+       if (length >= 0) {
+               gchar** result;
+               gssize i;
+               result = g_new0 (gchar*, length + 1);
+               for (i = 0; i < length; i++) {
+                       gchar* _tmp0_;
+                       _tmp0_ = g_strdup (self[i]);
+                       result[i] = _tmp0_;
+               }
+               return result;
+       }
+       return NULL;
+}
+
+void
+test_try_cast_value (void)
+{
+       FooStruct s = {0};
+       FooStruct _tmp0_ = {0};
+       GValue vs = {0};
+       FooStruct _tmp1_;
+       GValue _tmp2_ = {0};
+       FooStruct s2 = {0};
+       GValue _tmp3_;
+       FooStruct* _tmp4_;
+       FooStruct _tmp5_ = {0};
+       FooStruct _tmp6_;
+       gchar** sarray = NULL;
+       gchar* _tmp7_;
+       gchar* _tmp8_;
+       gchar* _tmp9_;
+       gchar** _tmp10_;
+       gint sarray_length1;
+       gint _sarray_size_;
+       GValue va = {0};
+       GValue _tmp11_ = {0};
+       gchar** sarray2 = NULL;
+       GValue _tmp12_;
+       gchar** _tmp13_;
+       gchar** _tmp14_;
+       gint _tmp14__length1;
+       gint sarray2_length1;
+       gint _sarray2_size_;
+       const gchar* _tmp15_;
+       gchar** sarray3 = NULL;
+       GValue _tmp16_;
+       gchar** _tmp17_;
+       gint sarray3_length1;
+       gint _sarray3_size_;
+       const gchar* _tmp18_;
+       _tmp0_.i = 42;
+       s = _tmp0_;
+       _tmp1_ = s;
+       g_value_init (&_tmp2_, TYPE_FOO_STRUCT);
+       g_value_set_boxed (&_tmp2_, &_tmp1_);
+       vs = _tmp2_;
+       _tmp3_ = vs;
+       _tmp4_ = g_value_get_boxed (&_tmp3_);
+       s2 = (G_VALUE_HOLDS (&_tmp3_, TYPE_FOO_STRUCT) && _tmp4_) ? (*_tmp4_) : (g_warning ("Invalid GValue 
unboxing (wrong type or NULL)"), _tmp5_);
+       _tmp6_ = s2;
+       _vala_assert (_tmp6_.i == 42, "s2.i == 42");
+       _tmp7_ = g_strdup ("hello");
+       _tmp8_ = g_strdup ("vala");
+       _tmp9_ = g_strdup ("world");
+       _tmp10_ = g_new0 (gchar*, 3 + 1);
+       _tmp10_[0] = _tmp7_;
+       _tmp10_[1] = _tmp8_;
+       _tmp10_[2] = _tmp9_;
+       sarray = _tmp10_;
+       sarray_length1 = 3;
+       _sarray_size_ = sarray_length1;
+       g_value_init (&_tmp11_, G_TYPE_STRV);
+       g_value_set_boxed (&_tmp11_, sarray);
+       va = _tmp11_;
+       _tmp12_ = va;
+       _tmp13_ = g_value_get_boxed (&_tmp12_);
+       _tmp14_ = (_tmp13_ != NULL) ? _vala_array_dup1 (_tmp13_, g_strv_length (_tmp13_)) : _tmp13_;
+       _tmp14__length1 = g_strv_length (_tmp13_);
+       sarray2 = _tmp14_;
+       sarray2_length1 = _tmp14__length1;
+       _sarray2_size_ = sarray2_length1;
+       _tmp15_ = sarray2[1];
+       _vala_assert (g_strcmp0 (_tmp15_, "vala") == 0, "sarray2[1] == \"vala\"");
+       _tmp16_ = va;
+       _tmp17_ = g_value_get_boxed (&_tmp16_);
+       sarray3 = _tmp17_;
+       sarray3_length1 = g_strv_length (_tmp17_);
+       _sarray3_size_ = sarray3_length1;
+       _tmp18_ = sarray3[2];
+       _vala_assert (g_strcmp0 (_tmp18_, "world") == 0, "sarray3[2] == \"world\"");
+       sarray2 = (_vala_array_free (sarray2, sarray2_length1, (GDestroyNotify) g_free), NULL);
+       G_IS_VALUE (&va) ? (g_value_unset (&va), NULL) : NULL;
+       sarray = (_vala_array_free (sarray, sarray_length1, (GDestroyNotify) g_free), NULL);
+       G_IS_VALUE (&vs) ? (g_value_unset (&vs), NULL) : NULL;
+}
+
+static void
+_vala_main (void)
+{
+       GValue _tmp0_ = {0};
+       test_value ();
+       test_value_array ();
+       test_nullable_value ();
+       test_nullable_value_array ();
+       test_gtype ();
+       test_gobject ();
+       test_ginterface ();
+       g_value_init (&_tmp0_, G_TYPE_BOOLEAN);
+       g_value_set_boolean (&_tmp0_, make_bool ());
+       take_value (&_tmp0_);
+       G_IS_VALUE (&_tmp0_) ? (g_value_unset (&_tmp0_), NULL) : NULL;
+       test_try_cast_value ();
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/structs/properties.c-expected b/tests/structs/properties.c-expected
new file mode 100644
index 000000000..5826926d7
--- /dev/null
+++ b/tests/structs/properties.c-expected
@@ -0,0 +1,292 @@
+/* structs_properties.c generated by valac, the Vala compiler
+ * generated from structs_properties.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       gint _i;
+       gchar* _s;
+       gchar* _os;
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN void foo_copy (const Foo* self,
+               Foo* dest);
+VALA_EXTERN void foo_destroy (Foo* self);
+VALA_EXTERN gint foo_get_i (Foo* self);
+VALA_EXTERN void foo_set_i (Foo* self,
+                gint value);
+VALA_EXTERN const gchar* foo_get_s (Foo* self);
+VALA_EXTERN void foo_set_s (Foo* self,
+                const gchar* value);
+VALA_EXTERN gchar* foo_get_os (Foo* self);
+VALA_EXTERN void foo_set_os (Foo* self,
+                 const gchar* value);
+VALA_EXTERN const gchar* foo_get_s_get (Foo* self);
+VALA_EXTERN void foo_set_s_set (Foo* self,
+                    const gchar* value);
+static void _vala_main (void);
+
+gint
+foo_get_i (Foo* self)
+{
+       gint result;
+       g_return_val_if_fail (self != NULL, 0);
+       result = (*self)._i;
+       return result;
+}
+
+void
+foo_set_i (Foo* self,
+           gint value)
+{
+       g_return_if_fail (self != NULL);
+       (*self)._i = value;
+}
+
+const gchar*
+foo_get_s (Foo* self)
+{
+       const gchar* result;
+       const gchar* _tmp0_;
+       g_return_val_if_fail (self != NULL, NULL);
+       _tmp0_ = (*self)._s;
+       result = _tmp0_;
+       return result;
+}
+
+void
+foo_set_s (Foo* self,
+           const gchar* value)
+{
+       gchar* _tmp0_;
+       g_return_if_fail (self != NULL);
+       _tmp0_ = g_strdup (value);
+       _g_free0 ((*self)._s);
+       (*self)._s = _tmp0_;
+}
+
+gchar*
+foo_get_os (Foo* self)
+{
+       gchar* result;
+       const gchar* _tmp0_;
+       gchar* _tmp1_;
+       g_return_val_if_fail (self != NULL, NULL);
+       _tmp0_ = (*self)._os;
+       _tmp1_ = g_strdup (_tmp0_);
+       result = _tmp1_;
+       return result;
+}
+
+void
+foo_set_os (Foo* self,
+            const gchar* value)
+{
+       gchar* _tmp0_;
+       g_return_if_fail (self != NULL);
+       _tmp0_ = g_strdup (value);
+       _g_free0 ((*self)._os);
+       (*self)._os = _tmp0_;
+}
+
+const gchar*
+foo_get_s_get (Foo* self)
+{
+       const gchar* result;
+       const gchar* _tmp0_;
+       g_return_val_if_fail (self != NULL, NULL);
+       _tmp0_ = (*self)._s;
+       result = _tmp0_;
+       return result;
+}
+
+void
+foo_set_s_set (Foo* self,
+               const gchar* value)
+{
+       gchar* _tmp0_;
+       g_return_if_fail (self != NULL);
+       _tmp0_ = g_strdup (value);
+       _g_free0 ((*self)._s);
+       (*self)._s = _tmp0_;
+}
+
+void
+foo_copy (const Foo* self,
+          Foo* dest)
+{
+       const gchar* _tmp0_;
+       gchar* _tmp1_;
+       const gchar* _tmp2_;
+       gchar* _tmp3_;
+       (*dest)._i = (*self)._i;
+       _tmp0_ = (*self)._s;
+       _tmp1_ = g_strdup (_tmp0_);
+       _g_free0 ((*dest)._s);
+       (*dest)._s = _tmp1_;
+       _tmp2_ = (*self)._os;
+       _tmp3_ = g_strdup (_tmp2_);
+       _g_free0 ((*dest)._os);
+       (*dest)._os = _tmp3_;
+}
+
+void
+foo_destroy (Foo* self)
+{
+       _g_free0 ((*self)._s);
+       _g_free0 ((*self)._os);
+}
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       foo_copy (self, dup);
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       foo_destroy (self);
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       {
+               Foo foo = {0};
+               gchar* _tmp0_;
+               gchar* _tmp1_;
+               Foo _tmp2_ = {0};
+               Foo _tmp3_;
+               gint _tmp4_;
+               gint _tmp5_;
+               Foo _tmp6_;
+               const gchar* _tmp7_;
+               const gchar* _tmp8_;
+               Foo _tmp9_;
+               const gchar* _tmp10_;
+               const gchar* _tmp11_;
+               Foo _tmp12_;
+               gchar* _tmp13_;
+               gchar* _tmp14_;
+               gchar* _tmp15_;
+               Foo _tmp16_;
+               gint _tmp17_;
+               gint _tmp18_;
+               Foo _tmp19_;
+               const gchar* _tmp20_;
+               const gchar* _tmp21_;
+               Foo _tmp22_;
+               const gchar* _tmp23_;
+               const gchar* _tmp24_;
+               Foo _tmp25_;
+               gchar* _tmp26_;
+               gchar* _tmp27_;
+               gchar* _tmp28_;
+               _tmp0_ = g_strdup ("foo");
+               _tmp1_ = g_strdup ("bar");
+               _tmp2_._i = 23;
+               _g_free0 (_tmp2_._s);
+               _tmp2_._s = _tmp0_;
+               _g_free0 (_tmp2_._os);
+               _tmp2_._os = _tmp1_;
+               foo = _tmp2_;
+               _tmp3_ = foo;
+               _tmp4_ = foo_get_i (&_tmp3_);
+               _tmp5_ = _tmp4_;
+               _vala_assert (_tmp5_ == 23, "foo.i == 23");
+               _tmp6_ = foo;
+               _tmp7_ = foo_get_s (&_tmp6_);
+               _tmp8_ = _tmp7_;
+               _vala_assert (g_strcmp0 (_tmp8_, "foo") == 0, "foo.s == \"foo\"");
+               _tmp9_ = foo;
+               _tmp10_ = foo_get_s_get (&_tmp9_);
+               _tmp11_ = _tmp10_;
+               _vala_assert (g_strcmp0 (_tmp11_, "foo") == 0, "foo.s_get == \"foo\"");
+               _tmp12_ = foo;
+               _tmp13_ = foo_get_os (&_tmp12_);
+               _tmp14_ = _tmp13_;
+               _tmp15_ = _tmp14_;
+               _vala_assert (g_strcmp0 (_tmp15_, "bar") == 0, "foo.os == \"bar\"");
+               _g_free0 (_tmp15_);
+               foo_set_i (&foo, 42);
+               foo_set_s_set (&foo, "bar");
+               foo_set_os (&foo, "manam");
+               _tmp16_ = foo;
+               _tmp17_ = foo_get_i (&_tmp16_);
+               _tmp18_ = _tmp17_;
+               _vala_assert (_tmp18_ == 42, "foo.i == 42");
+               _tmp19_ = foo;
+               _tmp20_ = foo_get_s (&_tmp19_);
+               _tmp21_ = _tmp20_;
+               _vala_assert (g_strcmp0 (_tmp21_, "bar") == 0, "foo.s == \"bar\"");
+               _tmp22_ = foo;
+               _tmp23_ = foo_get_s_get (&_tmp22_);
+               _tmp24_ = _tmp23_;
+               _vala_assert (g_strcmp0 (_tmp24_, "bar") == 0, "foo.s_get == \"bar\"");
+               _tmp25_ = foo;
+               _tmp26_ = foo_get_os (&_tmp25_);
+               _tmp27_ = _tmp26_;
+               _tmp28_ = _tmp27_;
+               _vala_assert (g_strcmp0 (_tmp28_, "manam") == 0, "foo.os == \"manam\"");
+               _g_free0 (_tmp28_);
+               foo_destroy (&foo);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/structs/simple-type-constructor.c-expected 
b/tests/structs/simple-type-constructor.c-expected
new file mode 100644
index 000000000..00a17265c
--- /dev/null
+++ b/tests/structs/simple-type-constructor.c-expected
@@ -0,0 +1,57 @@
+/* structs_simple_type_constructor.c generated by valac, the Vala compiler
+ * generated from structs_simple_type_constructor.vala, do not modify */
+
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef struct _Foo Foo;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       gint i;
+       guint j;
+};
+
+VALA_EXTERN Foo foo_init (void);
+static void _vala_main (void);
+
+Foo
+foo_init (void)
+{
+       Foo self = {0};
+       self.i = 42;
+       self.j = 4711U;
+       return self;
+}
+
+static void
+_vala_main (void)
+{
+       Foo foo = {0};
+       Foo _tmp0_;
+       _tmp0_ = foo_init ();
+       foo = _tmp0_;
+       _vala_assert (foo.i == 42, "foo.i == 42");
+       _vala_assert (foo.j == 4711U, "foo.j == 4711U");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/structs/struct-base-types.c-expected b/tests/structs/struct-base-types.c-expected
new file mode 100644
index 000000000..81b8b4335
--- /dev/null
+++ b/tests/structs/struct-base-types.c-expected
@@ -0,0 +1,260 @@
+/* structs_struct_base_types.c generated by valac, the Vala compiler
+ * generated from structs_struct_base_types.vala, do not modify */
+
+#include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+#define _g_free0(var) (var = (g_free (var), NULL))
+
+#define TYPE_BAR (bar_get_type ())
+typedef Foo Bar;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       gchar* s;
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN void foo_copy (const Foo* self,
+               Foo* dest);
+VALA_EXTERN void foo_destroy (Foo* self);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Bar* bar_dup (const Bar* self);
+VALA_EXTERN void bar_free (Bar* self);
+VALA_EXTERN void bar_copy (const Bar* self,
+               Bar* dest);
+VALA_EXTERN void bar_destroy (Bar* self);
+static void _vala_main (void);
+
+void
+foo_copy (const Foo* self,
+          Foo* dest)
+{
+       const gchar* _tmp0_;
+       gchar* _tmp1_;
+       _tmp0_ = (*self).s;
+       _tmp1_ = g_strdup (_tmp0_);
+       _g_free0 ((*dest).s);
+       (*dest).s = _tmp1_;
+}
+
+void
+foo_destroy (Foo* self)
+{
+       _g_free0 ((*self).s);
+}
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       foo_copy (self, dup);
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       foo_destroy (self);
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+void
+bar_copy (const Bar* self,
+          Bar* dest)
+{
+       const gchar* _tmp0_;
+       gchar* _tmp1_;
+       _tmp0_ = (*self).s;
+       _tmp1_ = g_strdup (_tmp0_);
+       _g_free0 ((*dest).s);
+       (*dest).s = _tmp1_;
+}
+
+void
+bar_destroy (Bar* self)
+{
+       foo_destroy (self);
+}
+
+Bar*
+bar_dup (const Bar* self)
+{
+       Bar* dup;
+       dup = g_new0 (Bar, 1);
+       bar_copy (self, dup);
+       return dup;
+}
+
+void
+bar_free (Bar* self)
+{
+       bar_destroy (self);
+       g_free (self);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       GType bar_type_id;
+       bar_type_id = g_boxed_type_register_static ("Bar", (GBoxedCopyFunc) bar_dup, (GBoxedFreeFunc) 
bar_free);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+       {
+               Bar bar = {0};
+               gchar* _tmp0_;
+               Bar _tmp1_ = {0};
+               Foo foo = {0};
+               Bar _tmp2_;
+               Foo _tmp3_;
+               Foo _tmp4_ = {0};
+               Bar _tmp5_;
+               const gchar* _tmp6_;
+               Bar _tmp7_;
+               const gchar* _tmp8_;
+               Foo _tmp9_;
+               const gchar* _tmp10_;
+               void* s1 = NULL;
+               Foo _tmp11_;
+               const gchar* _tmp12_;
+               void* s2 = NULL;
+               Bar _tmp13_;
+               const gchar* _tmp14_;
+               _tmp0_ = g_strdup ("bar");
+               _g_free0 (_tmp1_.s);
+               _tmp1_.s = _tmp0_;
+               bar = _tmp1_;
+               _tmp2_ = bar;
+               _tmp3_ = _tmp2_;
+               foo_copy (&_tmp3_, &_tmp4_);
+               foo = _tmp4_;
+               _tmp5_ = bar;
+               _tmp6_ = _tmp5_.s;
+               _vala_assert (g_strcmp0 (_tmp6_, "bar") == 0, "bar.s == \"bar\"");
+               _tmp7_ = bar;
+               _tmp8_ = _tmp7_.s;
+               _tmp9_ = foo;
+               _tmp10_ = _tmp9_.s;
+               _vala_assert (g_strcmp0 (_tmp8_, _tmp10_) == 0, "bar.s == foo.s");
+               _tmp11_ = foo;
+               _tmp12_ = _tmp11_.s;
+               s1 = _tmp12_;
+               _tmp13_ = bar;
+               _tmp14_ = _tmp13_.s;
+               s2 = _tmp14_;
+               _vala_assert (s1 != s2, "s1 != s2");
+               foo_destroy (&foo);
+               bar_destroy (&bar);
+       }
+       {
+               Foo foo = {0};
+               gchar* _tmp15_;
+               Foo _tmp16_ = {0};
+               Bar bar = {0};
+               Foo _tmp17_;
+               Bar _tmp18_;
+               Bar _tmp19_ = {0};
+               Foo _tmp20_;
+               const gchar* _tmp21_;
+               Foo _tmp22_;
+               const gchar* _tmp23_;
+               Bar _tmp24_;
+               const gchar* _tmp25_;
+               void* s1 = NULL;
+               Foo _tmp26_;
+               const gchar* _tmp27_;
+               void* s2 = NULL;
+               Bar _tmp28_;
+               const gchar* _tmp29_;
+               _tmp15_ = g_strdup ("foo");
+               _g_free0 (_tmp16_.s);
+               _tmp16_.s = _tmp15_;
+               foo = _tmp16_;
+               _tmp17_ = foo;
+               _tmp18_ = _tmp17_;
+               bar_copy (&_tmp18_, &_tmp19_);
+               bar = _tmp19_;
+               _tmp20_ = foo;
+               _tmp21_ = _tmp20_.s;
+               _vala_assert (g_strcmp0 (_tmp21_, "foo") == 0, "foo.s == \"foo\"");
+               _tmp22_ = foo;
+               _tmp23_ = _tmp22_.s;
+               _tmp24_ = bar;
+               _tmp25_ = _tmp24_.s;
+               _vala_assert (g_strcmp0 (_tmp23_, _tmp25_) == 0, "foo.s == bar.s");
+               _tmp26_ = foo;
+               _tmp27_ = _tmp26_.s;
+               s1 = _tmp27_;
+               _tmp28_ = bar;
+               _tmp29_ = _tmp28_.s;
+               s2 = _tmp29_;
+               _vala_assert (s1 != s2, "s1 != s2");
+               bar_destroy (&bar);
+               foo_destroy (&foo);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/structs/struct-boxed-cast.c-expected b/tests/structs/struct-boxed-cast.c-expected
new file mode 100644
index 000000000..2b3784cb3
--- /dev/null
+++ b/tests/structs/struct-boxed-cast.c-expected
@@ -0,0 +1,168 @@
+/* structs_struct_boxed_cast.c generated by valac, the Vala compiler
+ * generated from structs_struct_boxed_cast.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_BAR (bar_get_type ())
+typedef struct _Bar Bar;
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _bar_free0(var) ((var == NULL) ? NULL : (var = (bar_free (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Bar {
+       gchar* s;
+       gint i;
+};
+
+VALA_EXTERN void foo (GType t_type,
+          GBoxedCopyFunc t_dup_func,
+          GDestroyNotify t_destroy_func,
+          gconstpointer t);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Bar* bar_dup (const Bar* self);
+VALA_EXTERN void bar_free (Bar* self);
+VALA_EXTERN void bar_copy (const Bar* self,
+               Bar* dest);
+VALA_EXTERN void bar_destroy (Bar* self);
+static void _vala_main (void);
+
+void
+foo (GType t_type,
+     GBoxedCopyFunc t_dup_func,
+     GDestroyNotify t_destroy_func,
+     gconstpointer t)
+{
+       const gchar* _tmp0_;
+       _tmp0_ = (*((Bar*) t)).s;
+       _vala_assert (g_strcmp0 (_tmp0_, "foo") == 0, "((Bar?) t).s == \"foo\"");
+       _vala_assert ((*((Bar*) t)).i == 23, "((Bar?) t).i == 23");
+}
+
+void
+bar_copy (const Bar* self,
+          Bar* dest)
+{
+       const gchar* _tmp0_;
+       gchar* _tmp1_;
+       _tmp0_ = (*self).s;
+       _tmp1_ = g_strdup (_tmp0_);
+       _g_free0 ((*dest).s);
+       (*dest).s = _tmp1_;
+       (*dest).i = (*self).i;
+}
+
+void
+bar_destroy (Bar* self)
+{
+       _g_free0 ((*self).s);
+}
+
+Bar*
+bar_dup (const Bar* self)
+{
+       Bar* dup;
+       dup = g_new0 (Bar, 1);
+       bar_copy (self, dup);
+       return dup;
+}
+
+void
+bar_free (Bar* self)
+{
+       bar_destroy (self);
+       g_free (self);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       GType bar_type_id;
+       bar_type_id = g_boxed_type_register_static ("Bar", (GBoxedCopyFunc) bar_dup, (GBoxedFreeFunc) 
bar_free);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static gpointer
+_bar_dup0 (gpointer self)
+{
+       return self ? bar_dup (self) : NULL;
+}
+
+static void
+_vala_main (void)
+{
+       Bar f = {0};
+       gchar* _tmp0_;
+       Bar _tmp1_ = {0};
+       Bar* cast = NULL;
+       Bar _tmp2_;
+       Bar* _tmp3_;
+       const gchar* _tmp4_;
+       Bar arg = {0};
+       gchar* _tmp5_;
+       Bar _tmp6_ = {0};
+       Bar _tmp7_;
+       Bar _tmp8_;
+       Bar _tmp9_;
+       _tmp0_ = g_strdup ("bar");
+       _g_free0 (_tmp1_.s);
+       _tmp1_.s = _tmp0_;
+       _tmp1_.i = 42;
+       f = _tmp1_;
+       _tmp2_ = f;
+       _tmp3_ = _bar_dup0 ((Bar*) (&_tmp2_));
+       cast = _tmp3_;
+       _tmp4_ = (*cast).s;
+       _vala_assert (g_strcmp0 (_tmp4_, "bar") == 0, "cast.s == \"bar\"");
+       _vala_assert ((*cast).i == 42, "cast.i == 42");
+       _tmp5_ = g_strdup ("foo");
+       _g_free0 (_tmp6_.s);
+       _tmp6_.s = _tmp5_;
+       _tmp6_.i = 23;
+       arg = _tmp6_;
+       _tmp7_ = arg;
+       foo (TYPE_BAR, (GBoxedCopyFunc) bar_dup, (GDestroyNotify) bar_free, (Bar*) (&_tmp7_));
+       _tmp8_ = arg;
+       foo (TYPE_BAR, (GBoxedCopyFunc) bar_dup, (GDestroyNotify) bar_free, &_tmp8_);
+       _tmp9_ = arg;
+       foo (TYPE_BAR, (GBoxedCopyFunc) bar_dup, (GDestroyNotify) bar_free, (Bar*) (&_tmp9_));
+       bar_destroy (&arg);
+       _bar_free0 (cast);
+       bar_destroy (&f);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/structs/struct-initializer-list-in-array.c-expected 
b/tests/structs/struct-initializer-list-in-array.c-expected
new file mode 100644
index 000000000..f740399d5
--- /dev/null
+++ b/tests/structs/struct-initializer-list-in-array.c-expected
@@ -0,0 +1,401 @@
+/* structs_struct_initializer_list_in_array.c generated by valac, the Vala compiler
+ * generated from structs_struct_initializer_list_in_array.vala, do not modify */
+
+#include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+
+#define TYPE_BAR (bar_get_type ())
+typedef struct _Bar Bar;
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Bar {
+       gchar* s;
+       gint i;
+};
+
+struct _Foo {
+       gchar* s;
+       Bar b;
+       gboolean* ba;
+       gint ba_length1;
+       gint _ba_size_;
+       gint i;
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Bar* bar_dup (const Bar* self);
+VALA_EXTERN void bar_free (Bar* self);
+VALA_EXTERN void bar_copy (const Bar* self,
+               Bar* dest);
+VALA_EXTERN void bar_destroy (Bar* self);
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN void foo_copy (const Foo* self,
+               Foo* dest);
+VALA_EXTERN void foo_destroy (Foo* self);
+static gboolean* _vala_array_dup1 (gboolean* self,
+                            gssize length);
+static void _vala_main (void);
+static void _vala_Foo_array_free (Foo * array,
+                           gssize array_length);
+static inline gpointer _vala_memdup2 (gconstpointer mem,
+                        gsize byte_size);
+
+static gboolean*
+_vala_array_dup1 (gboolean* self,
+                  gssize length)
+{
+       if (length > 0) {
+               return _vala_memdup2 (self, length * sizeof (gboolean));
+       }
+       return NULL;
+}
+
+void
+foo_copy (const Foo* self,
+          Foo* dest)
+{
+       const gchar* _tmp0_;
+       gchar* _tmp1_;
+       Bar _tmp2_;
+       Bar _tmp3_;
+       Bar _tmp4_ = {0};
+       gboolean* _tmp5_;
+       gint _tmp5__length1;
+       gboolean* _tmp6_;
+       gint _tmp6__length1;
+       _tmp0_ = (*self).s;
+       _tmp1_ = g_strdup (_tmp0_);
+       _g_free0 ((*dest).s);
+       (*dest).s = _tmp1_;
+       _tmp2_ = (*self).b;
+       _tmp3_ = _tmp2_;
+       bar_copy (&_tmp3_, &_tmp4_);
+       bar_destroy (&(*dest).b);
+       (*dest).b = _tmp4_;
+       _tmp5_ = (*self).ba;
+       _tmp5__length1 = (*self).ba_length1;
+       _tmp6_ = (_tmp5_ != NULL) ? _vala_array_dup1 (_tmp5_, _tmp5__length1) : _tmp5_;
+       _tmp6__length1 = _tmp5__length1;
+       (*dest).ba = (g_free ((*dest).ba), NULL);
+       (*dest).ba = _tmp6_;
+       (*dest).ba_length1 = _tmp6__length1;
+       (*dest)._ba_size_ = (*dest).ba_length1;
+       (*dest).i = (*self).i;
+}
+
+void
+foo_destroy (Foo* self)
+{
+       _g_free0 ((*self).s);
+       bar_destroy (&(*self).b);
+       (*self).ba = (g_free ((*self).ba), NULL);
+}
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       foo_copy (self, dup);
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       foo_destroy (self);
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+void
+bar_copy (const Bar* self,
+          Bar* dest)
+{
+       const gchar* _tmp0_;
+       gchar* _tmp1_;
+       _tmp0_ = (*self).s;
+       _tmp1_ = g_strdup (_tmp0_);
+       _g_free0 ((*dest).s);
+       (*dest).s = _tmp1_;
+       (*dest).i = (*self).i;
+}
+
+void
+bar_destroy (Bar* self)
+{
+       _g_free0 ((*self).s);
+}
+
+Bar*
+bar_dup (const Bar* self)
+{
+       Bar* dup;
+       dup = g_new0 (Bar, 1);
+       bar_copy (self, dup);
+       return dup;
+}
+
+void
+bar_free (Bar* self)
+{
+       bar_destroy (self);
+       g_free (self);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       GType bar_type_id;
+       bar_type_id = g_boxed_type_register_static ("Bar", (GBoxedCopyFunc) bar_dup, (GBoxedFreeFunc) 
bar_free);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+static void
+_vala_Foo_array_free (Foo * array,
+                      gssize array_length)
+{
+       if (array != NULL) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       foo_destroy (&array[i]);
+               }
+       }
+       g_free (array);
+}
+
+static void
+_vala_main (void)
+{
+       Foo* foos = NULL;
+       gchar* _tmp0_;
+       gchar* _tmp1_;
+       Bar _tmp2_ = {0};
+       gboolean* _tmp3_;
+       Foo _tmp4_ = {0};
+       gchar* _tmp5_;
+       gchar* _tmp6_;
+       Bar _tmp7_ = {0};
+       gboolean* _tmp8_;
+       Foo _tmp9_ = {0};
+       Foo* _tmp10_;
+       gint foos_length1;
+       gint _foos_size_;
+       Foo f = {0};
+       Foo* _tmp11_;
+       gint _tmp11__length1;
+       Foo _tmp12_;
+       Foo _tmp13_;
+       Foo _tmp14_ = {0};
+       gboolean _tmp15_ = FALSE;
+       gboolean _tmp16_ = FALSE;
+       gboolean _tmp17_ = FALSE;
+       Foo _tmp18_;
+       Foo* _tmp27_;
+       gint _tmp27__length1;
+       Foo _tmp28_;
+       Foo _tmp29_;
+       Foo _tmp30_ = {0};
+       gboolean _tmp31_ = FALSE;
+       gboolean _tmp32_ = FALSE;
+       gboolean _tmp33_ = FALSE;
+       Foo _tmp34_;
+       _tmp0_ = g_strdup ("foo");
+       _tmp1_ = g_strdup ("foo");
+       _g_free0 (_tmp2_.s);
+       _tmp2_.s = _tmp1_;
+       _tmp2_.i = 42;
+       _tmp3_ = g_new0 (gboolean, 1);
+       _tmp3_[0] = TRUE;
+       memset (&_tmp4_, 0, sizeof (Foo));
+       _g_free0 (_tmp4_.s);
+       _tmp4_.s = _tmp0_;
+       bar_destroy (&_tmp4_.b);
+       _tmp4_.b = _tmp2_;
+       _tmp4_.ba = (g_free (_tmp4_.ba), NULL);
+       _tmp4_.ba = _tmp3_;
+       _tmp4_.ba_length1 = 1;
+       _tmp4_._ba_size_ = _tmp4_.ba_length1;
+       _tmp4_.i = 23;
+       _tmp5_ = g_strdup ("bar");
+       _tmp6_ = g_strdup ("bar");
+       _g_free0 (_tmp7_.s);
+       _tmp7_.s = _tmp6_;
+       _tmp7_.i = 4711;
+       _tmp8_ = g_new0 (gboolean, 1);
+       _tmp8_[0] = FALSE;
+       memset (&_tmp9_, 0, sizeof (Foo));
+       _g_free0 (_tmp9_.s);
+       _tmp9_.s = _tmp5_;
+       bar_destroy (&_tmp9_.b);
+       _tmp9_.b = _tmp7_;
+       _tmp9_.ba = (g_free (_tmp9_.ba), NULL);
+       _tmp9_.ba = _tmp8_;
+       _tmp9_.ba_length1 = 1;
+       _tmp9_._ba_size_ = _tmp9_.ba_length1;
+       _tmp9_.i = 42;
+       _tmp10_ = g_new0 (Foo, 2);
+       _tmp10_[0] = _tmp4_;
+       _tmp10_[1] = _tmp9_;
+       foos = _tmp10_;
+       foos_length1 = 2;
+       _foos_size_ = foos_length1;
+       _tmp11_ = foos;
+       _tmp11__length1 = foos_length1;
+       _tmp12_ = _tmp11_[0];
+       _tmp13_ = _tmp12_;
+       foo_copy (&_tmp13_, &_tmp14_);
+       f = _tmp14_;
+       _tmp18_ = f;
+       if (_tmp18_.i == 23) {
+               Foo _tmp19_;
+               const gchar* _tmp20_;
+               _tmp19_ = f;
+               _tmp20_ = _tmp19_.s;
+               _tmp17_ = g_strcmp0 (_tmp20_, "foo") == 0;
+       } else {
+               _tmp17_ = FALSE;
+       }
+       if (_tmp17_) {
+               Foo _tmp21_;
+               Bar _tmp22_;
+               const gchar* _tmp23_;
+               _tmp21_ = f;
+               _tmp22_ = _tmp21_.b;
+               _tmp23_ = _tmp22_.s;
+               _tmp16_ = g_strcmp0 (_tmp23_, "foo") == 0;
+       } else {
+               _tmp16_ = FALSE;
+       }
+       if (_tmp16_) {
+               Foo _tmp24_;
+               gboolean* _tmp25_;
+               gint _tmp25__length1;
+               gboolean _tmp26_;
+               _tmp24_ = f;
+               _tmp25_ = _tmp24_.ba;
+               _tmp25__length1 = _tmp24_.ba_length1;
+               _tmp26_ = _tmp25_[0];
+               _tmp15_ = _tmp26_;
+       } else {
+               _tmp15_ = FALSE;
+       }
+       _vala_assert (_tmp15_, "f.i == 23 && f.s == \"foo\" && f.b.s == \"foo\" && f.ba[0]");
+       _tmp27_ = foos;
+       _tmp27__length1 = foos_length1;
+       _tmp28_ = _tmp27_[1];
+       _tmp29_ = _tmp28_;
+       foo_copy (&_tmp29_, &_tmp30_);
+       foo_destroy (&f);
+       f = _tmp30_;
+       _tmp34_ = f;
+       if (_tmp34_.i == 42) {
+               Foo _tmp35_;
+               const gchar* _tmp36_;
+               _tmp35_ = f;
+               _tmp36_ = _tmp35_.s;
+               _tmp33_ = g_strcmp0 (_tmp36_, "bar") == 0;
+       } else {
+               _tmp33_ = FALSE;
+       }
+       if (_tmp33_) {
+               Foo _tmp37_;
+               Bar _tmp38_;
+               _tmp37_ = f;
+               _tmp38_ = _tmp37_.b;
+               _tmp32_ = _tmp38_.i == 4711;
+       } else {
+               _tmp32_ = FALSE;
+       }
+       if (_tmp32_) {
+               Foo _tmp39_;
+               gboolean* _tmp40_;
+               gint _tmp40__length1;
+               gboolean _tmp41_;
+               _tmp39_ = f;
+               _tmp40_ = _tmp39_.ba;
+               _tmp40__length1 = _tmp39_.ba_length1;
+               _tmp41_ = _tmp40_[0];
+               _tmp31_ = !_tmp41_;
+       } else {
+               _tmp31_ = FALSE;
+       }
+       _vala_assert (_tmp31_, "f.i == 42 && f.s == \"bar\" && f.b.i == 4711 && !f.ba[0]");
+       foo_destroy (&f);
+       foos = (_vala_Foo_array_free (foos, foos_length1), NULL);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
+static inline gpointer
+_vala_memdup2 (gconstpointer mem,
+               gsize byte_size)
+{
+       gpointer new_mem;
+       if (mem && byte_size != 0) {
+               new_mem = g_malloc (byte_size);
+               memcpy (new_mem, mem, byte_size);
+       } else {
+               new_mem = NULL;
+       }
+       return new_mem;
+}
+
diff --git a/tests/structs/struct-initializer-list-nested.c-expected 
b/tests/structs/struct-initializer-list-nested.c-expected
new file mode 100644
index 000000000..8f8b83e5c
--- /dev/null
+++ b/tests/structs/struct-initializer-list-nested.c-expected
@@ -0,0 +1,457 @@
+/* structs_struct_initializer_list_nested.c generated by valac, the Vala compiler
+ * generated from structs_struct_initializer_list_nested.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+
+#define TYPE_BAR (bar_get_type ())
+typedef struct _Bar Bar;
+#define _foo_free0(var) ((var == NULL) ? NULL : (var = (foo_free (var), NULL)))
+
+#define TYPE_MANAM (manam_get_type ())
+typedef struct _Manam Manam;
+
+#define TYPE_BAZ (baz_get_type ())
+typedef struct _Baz Baz;
+#define _bar_free0(var) ((var == NULL) ? NULL : (var = (bar_free (var), NULL)))
+#define _manam_free0(var) ((var == NULL) ? NULL : (var = (manam_free (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       gint i;
+       gint j;
+};
+
+struct _Bar {
+       Foo a;
+       Foo* b;
+};
+
+struct _Manam {
+       Foo a;
+       Bar b;
+};
+
+struct _Baz {
+       Foo f;
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Bar* bar_dup (const Bar* self);
+VALA_EXTERN void bar_free (Bar* self);
+VALA_EXTERN void bar_copy (const Bar* self,
+               Bar* dest);
+VALA_EXTERN void bar_destroy (Bar* self);
+VALA_EXTERN GType manam_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Manam* manam_dup (const Manam* self);
+VALA_EXTERN void manam_free (Manam* self);
+VALA_EXTERN void manam_copy (const Manam* self,
+                 Manam* dest);
+VALA_EXTERN void manam_destroy (Manam* self);
+VALA_EXTERN GType baz_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Baz* baz_dup (const Baz* self);
+VALA_EXTERN void baz_free (Baz* self);
+static void _vala_main (void);
+
+const Baz BAZ = {(Foo) {23, 42}};
+const Baz BAZ_A[2] = {{(Foo) {23, 42}}, {(Foo) {47, 11}}};
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       memcpy (dup, self, sizeof (Foo));
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static gpointer
+_foo_dup0 (gpointer self)
+{
+       return self ? foo_dup (self) : NULL;
+}
+
+void
+bar_copy (const Bar* self,
+          Bar* dest)
+{
+       Foo _tmp0_;
+       Foo* _tmp1_;
+       Foo* _tmp2_;
+       _tmp0_ = (*self).a;
+       (*dest).a = _tmp0_;
+       _tmp1_ = (*self).b;
+       _tmp2_ = _foo_dup0 (_tmp1_);
+       _foo_free0 ((*dest).b);
+       (*dest).b = _tmp2_;
+}
+
+void
+bar_destroy (Bar* self)
+{
+       _foo_free0 ((*self).b);
+}
+
+Bar*
+bar_dup (const Bar* self)
+{
+       Bar* dup;
+       dup = g_new0 (Bar, 1);
+       bar_copy (self, dup);
+       return dup;
+}
+
+void
+bar_free (Bar* self)
+{
+       bar_destroy (self);
+       g_free (self);
+}
+
+static GType
+bar_get_type_once (void)
+{
+       GType bar_type_id;
+       bar_type_id = g_boxed_type_register_static ("Bar", (GBoxedCopyFunc) bar_dup, (GBoxedFreeFunc) 
bar_free);
+       return bar_type_id;
+}
+
+GType
+bar_get_type (void)
+{
+       static volatile gsize bar_type_id__volatile = 0;
+       if (g_once_init_enter (&bar_type_id__volatile)) {
+               GType bar_type_id;
+               bar_type_id = bar_get_type_once ();
+               g_once_init_leave (&bar_type_id__volatile, bar_type_id);
+       }
+       return bar_type_id__volatile;
+}
+
+void
+manam_copy (const Manam* self,
+            Manam* dest)
+{
+       Foo _tmp0_;
+       Bar _tmp1_;
+       Bar _tmp2_;
+       Bar _tmp3_ = {0};
+       _tmp0_ = (*self).a;
+       (*dest).a = _tmp0_;
+       _tmp1_ = (*self).b;
+       _tmp2_ = _tmp1_;
+       bar_copy (&_tmp2_, &_tmp3_);
+       bar_destroy (&(*dest).b);
+       (*dest).b = _tmp3_;
+}
+
+void
+manam_destroy (Manam* self)
+{
+       bar_destroy (&(*self).b);
+}
+
+Manam*
+manam_dup (const Manam* self)
+{
+       Manam* dup;
+       dup = g_new0 (Manam, 1);
+       manam_copy (self, dup);
+       return dup;
+}
+
+void
+manam_free (Manam* self)
+{
+       manam_destroy (self);
+       g_free (self);
+}
+
+static GType
+manam_get_type_once (void)
+{
+       GType manam_type_id;
+       manam_type_id = g_boxed_type_register_static ("Manam", (GBoxedCopyFunc) manam_dup, (GBoxedFreeFunc) 
manam_free);
+       return manam_type_id;
+}
+
+GType
+manam_get_type (void)
+{
+       static volatile gsize manam_type_id__volatile = 0;
+       if (g_once_init_enter (&manam_type_id__volatile)) {
+               GType manam_type_id;
+               manam_type_id = manam_get_type_once ();
+               g_once_init_leave (&manam_type_id__volatile, manam_type_id);
+       }
+       return manam_type_id__volatile;
+}
+
+Baz*
+baz_dup (const Baz* self)
+{
+       Baz* dup;
+       dup = g_new0 (Baz, 1);
+       memcpy (dup, self, sizeof (Baz));
+       return dup;
+}
+
+void
+baz_free (Baz* self)
+{
+       g_free (self);
+}
+
+static GType
+baz_get_type_once (void)
+{
+       GType baz_type_id;
+       baz_type_id = g_boxed_type_register_static ("Baz", (GBoxedCopyFunc) baz_dup, (GBoxedFreeFunc) 
baz_free);
+       return baz_type_id;
+}
+
+GType
+baz_get_type (void)
+{
+       static volatile gsize baz_type_id__volatile = 0;
+       if (g_once_init_enter (&baz_type_id__volatile)) {
+               GType baz_type_id;
+               baz_type_id = baz_get_type_once ();
+               g_once_init_leave (&baz_type_id__volatile, baz_type_id);
+       }
+       return baz_type_id__volatile;
+}
+
+static gpointer
+_bar_dup0 (gpointer self)
+{
+       return self ? bar_dup (self) : NULL;
+}
+
+static gpointer
+_manam_dup0 (gpointer self)
+{
+       return self ? manam_dup (self) : NULL;
+}
+
+static void
+_vala_main (void)
+{
+       {
+               static const Baz LOCAL_BAZ = {(Foo) {23, 42}};
+       }
+       {
+               static const Baz LOCAL_BAZ_A[2] = {{(Foo) {23, 42}}, {(Foo) {47, 11}}};
+       }
+       {
+               Bar bar = {0};
+               Foo _tmp0_;
+               Foo* _tmp1_;
+               Bar _tmp2_ = {0};
+               Bar _tmp3_;
+               Foo _tmp4_;
+               Bar _tmp5_;
+               Foo* _tmp6_;
+               _tmp0_ = (Foo) {42, 11};
+               _tmp1_ = _foo_dup0 (&_tmp0_);
+               _tmp2_.a = (Foo) {23, 47};
+               _foo_free0 (_tmp2_.b);
+               _tmp2_.b = _tmp1_;
+               bar = _tmp2_;
+               _tmp3_ = bar;
+               _tmp4_ = _tmp3_.a;
+               _vala_assert (_tmp4_.j == 47, "bar.a.j == 47");
+               _tmp5_ = bar;
+               _tmp6_ = _tmp5_.b;
+               _vala_assert ((*_tmp6_).i == 42, "bar.b.i == 42");
+               bar_destroy (&bar);
+       }
+       {
+               Bar* bar = NULL;
+               Foo _tmp7_;
+               Foo* _tmp8_;
+               Bar _tmp9_ = {0};
+               Bar _tmp10_;
+               Bar* _tmp11_;
+               Bar* _tmp12_;
+               Foo _tmp13_;
+               Foo* _tmp14_;
+               _tmp7_ = (Foo) {42, 11};
+               _tmp8_ = _foo_dup0 (&_tmp7_);
+               _tmp9_.a = (Foo) {23, 47};
+               _foo_free0 (_tmp9_.b);
+               _tmp9_.b = _tmp8_;
+               _tmp10_ = _tmp9_;
+               _tmp11_ = _bar_dup0 (&_tmp10_);
+               _tmp12_ = _tmp11_;
+               bar_destroy (&_tmp10_);
+               bar = _tmp12_;
+               _tmp13_ = (*bar).a;
+               _vala_assert (_tmp13_.i == 23, "bar.a.i == 23");
+               _tmp14_ = (*bar).b;
+               _vala_assert ((*_tmp14_).j == 11, "bar.b.j == 11");
+               _bar_free0 (bar);
+       }
+       {
+               Bar bar = {0};
+               Bar _tmp15_ = {0};
+               Foo _tmp16_;
+               Foo* _tmp17_;
+               Bar _tmp18_ = {0};
+               Bar _tmp19_;
+               Foo _tmp20_;
+               Bar _tmp21_;
+               Foo* _tmp22_;
+               bar = _tmp15_;
+               _tmp16_ = (Foo) {42, 11};
+               _tmp17_ = _foo_dup0 (&_tmp16_);
+               _tmp18_.a = (Foo) {23, 47};
+               _foo_free0 (_tmp18_.b);
+               _tmp18_.b = _tmp17_;
+               bar_destroy (&bar);
+               bar = _tmp18_;
+               _tmp19_ = bar;
+               _tmp20_ = _tmp19_.a;
+               _vala_assert (_tmp20_.j == 47, "bar.a.j == 47");
+               _tmp21_ = bar;
+               _tmp22_ = _tmp21_.b;
+               _vala_assert ((*_tmp22_).i == 42, "bar.b.i == 42");
+               bar_destroy (&bar);
+       }
+       {
+               Manam manam = {0};
+               Foo _tmp23_;
+               Foo* _tmp24_;
+               Manam _tmp25_ = {0};
+               Manam _tmp26_;
+               Foo _tmp27_;
+               Manam _tmp28_;
+               Bar _tmp29_;
+               Foo* _tmp30_;
+               _tmp23_ = (Foo) {42, 11};
+               _tmp24_ = _foo_dup0 (&_tmp23_);
+               _tmp25_.a = (Foo) {23, 42};
+               bar_destroy (&_tmp25_.b);
+               _tmp25_.b = (Bar) {(Foo) {23, 47}, _tmp24_};
+               manam = _tmp25_;
+               _tmp26_ = manam;
+               _tmp27_ = _tmp26_.a;
+               _vala_assert (_tmp27_.i == 23, "manam.a.i == 23");
+               _tmp28_ = manam;
+               _tmp29_ = _tmp28_.b;
+               _tmp30_ = _tmp29_.b;
+               _vala_assert ((*_tmp30_).j == 11, "manam.b.b.j == 11");
+               manam_destroy (&manam);
+       }
+       {
+               Manam manam = {0};
+               Manam _tmp31_ = {0};
+               Foo _tmp32_;
+               Foo* _tmp33_;
+               Manam _tmp34_ = {0};
+               Manam _tmp35_;
+               Foo _tmp36_;
+               Manam _tmp37_;
+               Bar _tmp38_;
+               Foo* _tmp39_;
+               manam = _tmp31_;
+               _tmp32_ = (Foo) {42, 11};
+               _tmp33_ = _foo_dup0 (&_tmp32_);
+               _tmp34_.a = (Foo) {23, 42};
+               bar_destroy (&_tmp34_.b);
+               _tmp34_.b = (Bar) {(Foo) {23, 47}, _tmp33_};
+               manam_destroy (&manam);
+               manam = _tmp34_;
+               _tmp35_ = manam;
+               _tmp36_ = _tmp35_.a;
+               _vala_assert (_tmp36_.i == 23, "manam.a.i == 23");
+               _tmp37_ = manam;
+               _tmp38_ = _tmp37_.b;
+               _tmp39_ = _tmp38_.b;
+               _vala_assert ((*_tmp39_).j == 11, "manam.b.b.j == 11");
+               manam_destroy (&manam);
+       }
+       {
+               Manam* manam = NULL;
+               Foo _tmp40_;
+               Foo* _tmp41_;
+               Manam _tmp42_ = {0};
+               Manam _tmp43_;
+               Manam* _tmp44_;
+               Manam* _tmp45_;
+               Foo _tmp46_;
+               Bar _tmp47_;
+               Foo _tmp48_;
+               _tmp40_ = (Foo) {42, 11};
+               _tmp41_ = _foo_dup0 (&_tmp40_);
+               _tmp42_.a = (Foo) {23, 42};
+               bar_destroy (&_tmp42_.b);
+               _tmp42_.b = (Bar) {(Foo) {23, 47}, _tmp41_};
+               _tmp43_ = _tmp42_;
+               _tmp44_ = _manam_dup0 (&_tmp43_);
+               _tmp45_ = _tmp44_;
+               manam_destroy (&_tmp43_);
+               manam = _tmp45_;
+               _tmp46_ = (*manam).a;
+               _vala_assert (_tmp46_.j == 42, "manam.a.j == 42");
+               _tmp47_ = (*manam).b;
+               _tmp48_ = _tmp47_.a;
+               _vala_assert (_tmp48_.i == 23, "manam.b.a.i == 23");
+               _manam_free0 (manam);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/structs/struct-no-gtype-inherit.c-expected 
b/tests/structs/struct-no-gtype-inherit.c-expected
new file mode 100644
index 000000000..99211b9f3
--- /dev/null
+++ b/tests/structs/struct-no-gtype-inherit.c-expected
@@ -0,0 +1,23 @@
+/* structs_struct_no_gtype_inherit.c generated by valac, the Vala compiler
+ * generated from structs_struct_no_gtype_inherit.vala, do not modify */
+
+#include <stdint.h>
+
+typedef int32_t foo_t;
+typedef foo_t bar_t;
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/structs/struct-no-gtype.c-expected b/tests/structs/struct-no-gtype.c-expected
new file mode 100644
index 000000000..b12fb74fc
--- /dev/null
+++ b/tests/structs/struct-no-gtype.c-expected
@@ -0,0 +1,54 @@
+/* structs_struct_no_gtype.c generated by valac, the Vala compiler
+ * generated from structs_struct_no_gtype.vala, do not modify */
+
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+typedef struct _Foo Foo;
+
+struct _Foo {
+       void* p;
+};
+
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+static void _vala_main (void);
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       memcpy (dup, self, sizeof (Foo));
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       g_free (self);
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/structs/struct_only.c-expected b/tests/structs/struct_only.c-expected
new file mode 100644
index 000000000..dba7370e0
--- /dev/null
+++ b/tests/structs/struct_only.c-expected
@@ -0,0 +1,77 @@
+/* structs_struct_only.c generated by valac, the Vala compiler
+ * generated from structs_struct_only.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+typedef struct _Foo Foo;
+
+struct _Foo {
+       gint i;
+};
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN Foo* foo_dup (const Foo* self);
+VALA_EXTERN void foo_free (Foo* self);
+static void _vala_main (void);
+
+Foo*
+foo_dup (const Foo* self)
+{
+       Foo* dup;
+       dup = g_new0 (Foo, 1);
+       memcpy (dup, self, sizeof (Foo));
+       return dup;
+}
+
+void
+foo_free (Foo* self)
+{
+       g_free (self);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       GType foo_type_id;
+       foo_type_id = g_boxed_type_register_static ("Foo", (GBoxedCopyFunc) foo_dup, (GBoxedFreeFunc) 
foo_free);
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_main (void)
+{
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/structs/structs.c-expected b/tests/structs/structs.c-expected
new file mode 100644
index 000000000..6d86fbf34
--- /dev/null
+++ b/tests/structs/structs.c-expected
@@ -0,0 +1,508 @@
+/* structs_structs.c generated by valac, the Vala compiler
+ * generated from structs_structs.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <string.h>
+#include <stdio.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_SIMPLE_STRUCT (simple_struct_get_type ())
+typedef struct _SimpleStruct SimpleStruct;
+
+#define TYPE_PUBLIC_STRUCT (public_struct_get_type ())
+typedef struct _PublicStruct PublicStruct;
+
+#define TYPE_STRUCT_WITH_CREATION_METHOD (struct_with_creation_method_get_type ())
+typedef struct _StructWithCreationMethod StructWithCreationMethod;
+
+#define TYPE_STRUCT_WITH_NAMED_CREATION_METHOD (struct_with_named_creation_method_get_type ())
+typedef struct _StructWithNamedCreationMethod StructWithNamedCreationMethod;
+typedef void (*Func) (gpointer user_data);
+
+#define TYPE_STRUCT_WITH_FUNC (struct_with_func_get_type ())
+typedef struct _StructWithFunc StructWithFunc;
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _SimpleStruct {
+       gint field;
+       gint array[10];
+};
+
+struct _PublicStruct {
+       gint field;
+};
+
+struct _StructWithCreationMethod {
+       gint field;
+};
+
+struct _StructWithNamedCreationMethod {
+       gint field;
+};
+
+struct _StructWithFunc {
+       Func foo;
+       gpointer foo_target;
+       GDestroyNotify foo_target_destroy_notify;
+};
+
+VALA_EXTERN GType simple_struct_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN SimpleStruct* simple_struct_dup (const SimpleStruct* self);
+VALA_EXTERN void simple_struct_free (SimpleStruct* self);
+VALA_EXTERN GType public_struct_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN PublicStruct* public_struct_dup (const PublicStruct* self);
+VALA_EXTERN void public_struct_free (PublicStruct* self);
+VALA_EXTERN GType struct_with_creation_method_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN StructWithCreationMethod* struct_with_creation_method_dup (const StructWithCreationMethod* self);
+VALA_EXTERN void struct_with_creation_method_free (StructWithCreationMethod* self);
+VALA_EXTERN void struct_with_creation_method_init (StructWithCreationMethod *self);
+VALA_EXTERN GType struct_with_named_creation_method_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN StructWithNamedCreationMethod* struct_with_named_creation_method_dup (const 
StructWithNamedCreationMethod* self);
+VALA_EXTERN void struct_with_named_creation_method_free (StructWithNamedCreationMethod* self);
+VALA_EXTERN void struct_with_named_creation_method_init_named (StructWithNamedCreationMethod *self);
+VALA_EXTERN GType struct_with_func_get_type (void) G_GNUC_CONST ;
+VALA_EXTERN StructWithFunc* struct_with_func_dup (const StructWithFunc* self);
+VALA_EXTERN void struct_with_func_free (StructWithFunc* self);
+VALA_EXTERN void struct_with_func_copy (const StructWithFunc* self,
+                            StructWithFunc* dest);
+VALA_EXTERN void struct_with_func_destroy (StructWithFunc* self);
+VALA_EXTERN void struct_with_func_init (StructWithFunc *self,
+                            Func f,
+                            gpointer f_target,
+                            GDestroyNotify f_target_destroy_notify);
+VALA_EXTERN void test_in_parameter (SimpleStruct* st);
+VALA_EXTERN void test_in_nullable_parameter (SimpleStruct* st);
+VALA_EXTERN void test_ref_parameter (SimpleStruct* st);
+VALA_EXTERN void test_out_parameter (SimpleStruct* st);
+VALA_EXTERN void test_struct_with_func (void);
+static void __lambda4_ (void);
+static void ___lambda4__func (gpointer self);
+static void _vala_StructWithFunc_array_free (StructWithFunc * array,
+                                      gssize array_length);
+static void _vala_main (void);
+
+SimpleStruct*
+simple_struct_dup (const SimpleStruct* self)
+{
+       SimpleStruct* dup;
+       dup = g_new0 (SimpleStruct, 1);
+       memcpy (dup, self, sizeof (SimpleStruct));
+       return dup;
+}
+
+void
+simple_struct_free (SimpleStruct* self)
+{
+       g_free (self);
+}
+
+static GType
+simple_struct_get_type_once (void)
+{
+       GType simple_struct_type_id;
+       simple_struct_type_id = g_boxed_type_register_static ("SimpleStruct", (GBoxedCopyFunc) 
simple_struct_dup, (GBoxedFreeFunc) simple_struct_free);
+       return simple_struct_type_id;
+}
+
+GType
+simple_struct_get_type (void)
+{
+       static volatile gsize simple_struct_type_id__volatile = 0;
+       if (g_once_init_enter (&simple_struct_type_id__volatile)) {
+               GType simple_struct_type_id;
+               simple_struct_type_id = simple_struct_get_type_once ();
+               g_once_init_leave (&simple_struct_type_id__volatile, simple_struct_type_id);
+       }
+       return simple_struct_type_id__volatile;
+}
+
+PublicStruct*
+public_struct_dup (const PublicStruct* self)
+{
+       PublicStruct* dup;
+       dup = g_new0 (PublicStruct, 1);
+       memcpy (dup, self, sizeof (PublicStruct));
+       return dup;
+}
+
+void
+public_struct_free (PublicStruct* self)
+{
+       g_free (self);
+}
+
+static GType
+public_struct_get_type_once (void)
+{
+       GType public_struct_type_id;
+       public_struct_type_id = g_boxed_type_register_static ("PublicStruct", (GBoxedCopyFunc) 
public_struct_dup, (GBoxedFreeFunc) public_struct_free);
+       return public_struct_type_id;
+}
+
+GType
+public_struct_get_type (void)
+{
+       static volatile gsize public_struct_type_id__volatile = 0;
+       if (g_once_init_enter (&public_struct_type_id__volatile)) {
+               GType public_struct_type_id;
+               public_struct_type_id = public_struct_get_type_once ();
+               g_once_init_leave (&public_struct_type_id__volatile, public_struct_type_id);
+       }
+       return public_struct_type_id__volatile;
+}
+
+void
+struct_with_creation_method_init (StructWithCreationMethod *self)
+{
+       FILE* _tmp0_;
+       memset (self, 0, sizeof (StructWithCreationMethod));
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, "StructWithCreationMethod\n");
+}
+
+StructWithCreationMethod*
+struct_with_creation_method_dup (const StructWithCreationMethod* self)
+{
+       StructWithCreationMethod* dup;
+       dup = g_new0 (StructWithCreationMethod, 1);
+       memcpy (dup, self, sizeof (StructWithCreationMethod));
+       return dup;
+}
+
+void
+struct_with_creation_method_free (StructWithCreationMethod* self)
+{
+       g_free (self);
+}
+
+static GType
+struct_with_creation_method_get_type_once (void)
+{
+       GType struct_with_creation_method_type_id;
+       struct_with_creation_method_type_id = g_boxed_type_register_static ("StructWithCreationMethod", 
(GBoxedCopyFunc) struct_with_creation_method_dup, (GBoxedFreeFunc) struct_with_creation_method_free);
+       return struct_with_creation_method_type_id;
+}
+
+GType
+struct_with_creation_method_get_type (void)
+{
+       static volatile gsize struct_with_creation_method_type_id__volatile = 0;
+       if (g_once_init_enter (&struct_with_creation_method_type_id__volatile)) {
+               GType struct_with_creation_method_type_id;
+               struct_with_creation_method_type_id = struct_with_creation_method_get_type_once ();
+               g_once_init_leave (&struct_with_creation_method_type_id__volatile, 
struct_with_creation_method_type_id);
+       }
+       return struct_with_creation_method_type_id__volatile;
+}
+
+void
+struct_with_named_creation_method_init_named (StructWithNamedCreationMethod *self)
+{
+       FILE* _tmp0_;
+       memset (self, 0, sizeof (StructWithNamedCreationMethod));
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, "StructWithNamedCreationMethod\n");
+}
+
+StructWithNamedCreationMethod*
+struct_with_named_creation_method_dup (const StructWithNamedCreationMethod* self)
+{
+       StructWithNamedCreationMethod* dup;
+       dup = g_new0 (StructWithNamedCreationMethod, 1);
+       memcpy (dup, self, sizeof (StructWithNamedCreationMethod));
+       return dup;
+}
+
+void
+struct_with_named_creation_method_free (StructWithNamedCreationMethod* self)
+{
+       g_free (self);
+}
+
+static GType
+struct_with_named_creation_method_get_type_once (void)
+{
+       GType struct_with_named_creation_method_type_id;
+       struct_with_named_creation_method_type_id = g_boxed_type_register_static 
("StructWithNamedCreationMethod", (GBoxedCopyFunc) struct_with_named_creation_method_dup, (GBoxedFreeFunc) 
struct_with_named_creation_method_free);
+       return struct_with_named_creation_method_type_id;
+}
+
+GType
+struct_with_named_creation_method_get_type (void)
+{
+       static volatile gsize struct_with_named_creation_method_type_id__volatile = 0;
+       if (g_once_init_enter (&struct_with_named_creation_method_type_id__volatile)) {
+               GType struct_with_named_creation_method_type_id;
+               struct_with_named_creation_method_type_id = struct_with_named_creation_method_get_type_once 
();
+               g_once_init_leave (&struct_with_named_creation_method_type_id__volatile, 
struct_with_named_creation_method_type_id);
+       }
+       return struct_with_named_creation_method_type_id__volatile;
+}
+
+void
+struct_with_func_init (StructWithFunc *self,
+                       Func f,
+                       gpointer f_target,
+                       GDestroyNotify f_target_destroy_notify)
+{
+       Func _tmp0_;
+       gpointer _tmp0__target;
+       GDestroyNotify _tmp0__target_destroy_notify;
+       memset (self, 0, sizeof (StructWithFunc));
+       _tmp0_ = f;
+       _tmp0__target = f_target;
+       _tmp0__target_destroy_notify = f_target_destroy_notify;
+       f = NULL;
+       f_target = NULL;
+       f_target_destroy_notify = NULL;
+       ((*self).foo_target_destroy_notify == NULL) ? NULL : ((*self).foo_target_destroy_notify 
((*self).foo_target), NULL);
+       (*self).foo = NULL;
+       (*self).foo_target = NULL;
+       (*self).foo_target_destroy_notify = NULL;
+       (*self).foo = _tmp0_;
+       (*self).foo_target = _tmp0__target;
+       (*self).foo_target_destroy_notify = _tmp0__target_destroy_notify;
+       (f_target_destroy_notify == NULL) ? NULL : (f_target_destroy_notify (f_target), NULL);
+       f = NULL;
+       f_target = NULL;
+       f_target_destroy_notify = NULL;
+}
+
+void
+struct_with_func_copy (const StructWithFunc* self,
+                       StructWithFunc* dest)
+{
+       Func _tmp0_;
+       gpointer _tmp0__target;
+       _tmp0_ = (*self).foo;
+       _tmp0__target = (*self).foo_target;
+       ((*dest).foo_target_destroy_notify == NULL) ? NULL : ((*dest).foo_target_destroy_notify 
((*dest).foo_target), NULL);
+       (*dest).foo = NULL;
+       (*dest).foo_target = NULL;
+       (*dest).foo_target_destroy_notify = NULL;
+       (*dest).foo = _tmp0_;
+       (*dest).foo_target = _tmp0__target;
+       (*dest).foo_target_destroy_notify = NULL;
+}
+
+void
+struct_with_func_destroy (StructWithFunc* self)
+{
+       ((*self).foo_target_destroy_notify == NULL) ? NULL : ((*self).foo_target_destroy_notify 
((*self).foo_target), NULL);
+       (*self).foo = NULL;
+       (*self).foo_target = NULL;
+       (*self).foo_target_destroy_notify = NULL;
+}
+
+StructWithFunc*
+struct_with_func_dup (const StructWithFunc* self)
+{
+       StructWithFunc* dup;
+       dup = g_new0 (StructWithFunc, 1);
+       struct_with_func_copy (self, dup);
+       return dup;
+}
+
+void
+struct_with_func_free (StructWithFunc* self)
+{
+       struct_with_func_destroy (self);
+       g_free (self);
+}
+
+static GType
+struct_with_func_get_type_once (void)
+{
+       GType struct_with_func_type_id;
+       struct_with_func_type_id = g_boxed_type_register_static ("StructWithFunc", (GBoxedCopyFunc) 
struct_with_func_dup, (GBoxedFreeFunc) struct_with_func_free);
+       return struct_with_func_type_id;
+}
+
+GType
+struct_with_func_get_type (void)
+{
+       static volatile gsize struct_with_func_type_id__volatile = 0;
+       if (g_once_init_enter (&struct_with_func_type_id__volatile)) {
+               GType struct_with_func_type_id;
+               struct_with_func_type_id = struct_with_func_get_type_once ();
+               g_once_init_leave (&struct_with_func_type_id__volatile, struct_with_func_type_id);
+       }
+       return struct_with_func_type_id__volatile;
+}
+
+void
+test_in_parameter (SimpleStruct* st)
+{
+       FILE* _tmp0_;
+       SimpleStruct _tmp1_;
+       g_return_if_fail (st != NULL);
+       _tmp0_ = stdout;
+       _tmp1_ = *st;
+       fprintf (_tmp0_, "test_in_parameter: st.field = %d\n", _tmp1_.field);
+}
+
+void
+test_in_nullable_parameter (SimpleStruct* st)
+{
+       _vala_assert ((*st).field == 1, "st.field == 1");
+}
+
+void
+test_ref_parameter (SimpleStruct* st)
+{
+       FILE* _tmp0_;
+       SimpleStruct _tmp1_;
+       gint _tmp2_;
+       g_return_if_fail (st != NULL);
+       _tmp0_ = stdout;
+       _tmp1_ = *st;
+       fprintf (_tmp0_, "test_ref_parameter: st.field = %d\n", _tmp1_.field);
+       _tmp2_ = (*st).field;
+       (*st).field = _tmp2_ + 1;
+       (*st).array[0] = 10;
+}
+
+void
+test_out_parameter (SimpleStruct* st)
+{
+       SimpleStruct _vala_st = {0};
+       memset (&_vala_st, 0, sizeof (SimpleStruct));
+       _vala_st.field = 3;
+       if (st) {
+               *st = _vala_st;
+       }
+}
+
+static void
+__lambda4_ (void)
+{
+}
+
+static void
+___lambda4__func (gpointer self)
+{
+       __lambda4_ ();
+}
+
+static void
+_vala_StructWithFunc_array_free (StructWithFunc * array,
+                                 gssize array_length)
+{
+       if (array != NULL) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       struct_with_func_destroy (&array[i]);
+               }
+       }
+       g_free (array);
+}
+
+void
+test_struct_with_func (void)
+{
+       StructWithFunc* foes = NULL;
+       StructWithFunc _tmp0_ = {0};
+       StructWithFunc* _tmp1_;
+       gint foes_length1;
+       gint _foes_size_;
+       struct_with_func_init (&_tmp0_, ___lambda4__func, NULL, NULL);
+       _tmp1_ = g_new0 (StructWithFunc, 1);
+       _tmp1_[0] = _tmp0_;
+       foes = _tmp1_;
+       foes_length1 = 1;
+       _foes_size_ = foes_length1;
+       foes = (_vala_StructWithFunc_array_free (foes, foes_length1), NULL);
+}
+
+static void
+_vala_main (void)
+{
+       FILE* _tmp0_;
+       FILE* _tmp1_;
+       SimpleStruct simple_struct = {0};
+       FILE* _tmp2_;
+       PublicStruct public_struct = {0};
+       FILE* _tmp3_;
+       StructWithCreationMethod struct_with_creation_method = {0};
+       FILE* _tmp4_;
+       StructWithNamedCreationMethod struct_with_named_creation_method = {0};
+       FILE* _tmp5_;
+       SimpleStruct _tmp6_ = {0};
+       FILE* _tmp7_;
+       SimpleStruct _tmp8_;
+       SimpleStruct _tmp9_;
+       SimpleStruct _tmp10_ = {0};
+       SimpleStruct _tmp11_;
+       FILE* _tmp12_;
+       SimpleStruct _tmp13_;
+       SimpleStruct _tmp14_;
+       gint _tmp15_;
+       SimpleStruct _tmp16_ = {0};
+       FILE* _tmp17_;
+       SimpleStruct _tmp18_;
+       FILE* _tmp19_;
+       _tmp0_ = stdout;
+       fprintf (_tmp0_, "Structs Test:\n");
+       _tmp1_ = stdout;
+       fprintf (_tmp1_, "new SimpleStruct ()\n");
+       memset (&simple_struct, 0, sizeof (SimpleStruct));
+       _tmp2_ = stdout;
+       fprintf (_tmp2_, "new PublicStruct ()\n");
+       memset (&public_struct, 0, sizeof (PublicStruct));
+       _tmp3_ = stdout;
+       fprintf (_tmp3_, "new StructWithCreationMethod ()\n");
+       struct_with_creation_method_init (&struct_with_creation_method);
+       _tmp4_ = stdout;
+       fprintf (_tmp4_, "new StructWithNamedCreationMethod ()\n");
+       struct_with_named_creation_method_init_named (&struct_with_named_creation_method);
+       _tmp5_ = stdout;
+       fprintf (_tmp5_, "new SimpleStruct () { field = 1 }\n");
+       memset (&_tmp6_, 0, sizeof (SimpleStruct));
+       _tmp6_.field = 1;
+       simple_struct = _tmp6_;
+       _tmp7_ = stdout;
+       _tmp8_ = simple_struct;
+       fprintf (_tmp7_, "simple_struct.field = %d\n", _tmp8_.field);
+       _tmp9_ = simple_struct;
+       test_in_parameter (&_tmp9_);
+       _tmp10_.field = 1;
+       test_in_parameter (&_tmp10_);
+       _tmp11_ = simple_struct;
+       test_in_nullable_parameter (&_tmp11_);
+       test_ref_parameter (&simple_struct);
+       _tmp12_ = stdout;
+       _tmp13_ = simple_struct;
+       fprintf (_tmp12_, "after test_ref_parameter: st.field = %d\n", _tmp13_.field);
+       _tmp14_ = simple_struct;
+       _tmp15_ = _tmp14_.array[0];
+       _vala_assert (_tmp15_ == 10, "simple_struct.array[0] == 10");
+       test_out_parameter (&_tmp16_);
+       simple_struct = _tmp16_;
+       _tmp17_ = stdout;
+       _tmp18_ = simple_struct;
+       fprintf (_tmp17_, "after test_out_parameter: st.field = %d\n", _tmp18_.field);
+       _tmp19_ = stdout;
+       fprintf (_tmp19_, ".\n");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/threads/threadpool.c-expected b/tests/threads/threadpool.c-expected
new file mode 100644
index 000000000..0ff74363f
--- /dev/null
+++ b/tests/threads/threadpool.c-expected
@@ -0,0 +1,109 @@
+/* threads_threadpool.c generated by valac, the Vala compiler
+ * generated from threads_threadpool.vala, do not modify */
+
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _g_thread_pool_free0(var) ((var == NULL) ? NULL : (var = (g_thread_pool_free (var, FALSE, TRUE), 
NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN gboolean success;
+gboolean success = FALSE;
+
+static void _vala_main (void);
+static void ___lambda4_ (gchar* s);
+static void ____lambda4__gfunc (gpointer data,
+                         gpointer self);
+
+static void
+___lambda4_ (gchar* s)
+{
+       gboolean _tmp0_ = FALSE;
+       g_return_if_fail (s != NULL);
+       if (g_strcmp0 (s, "foo") == 0) {
+               _tmp0_ = TRUE;
+       } else {
+               _tmp0_ = g_strcmp0 (s, "bar") == 0;
+       }
+       _vala_assert (_tmp0_, "s == \"foo\" || s == \"bar\"");
+       success = TRUE;
+       _g_free0 (s);
+}
+
+static void
+____lambda4__gfunc (gpointer data,
+                    gpointer self)
+{
+       ___lambda4_ ((gchar*) data);
+}
+
+static void
+_vala_main (void)
+{
+       GError* _inner_error0_ = NULL;
+       {
+               GThreadPool* pool = NULL;
+               GThreadPool* _tmp0_;
+               GThreadPool* _tmp1_;
+               gchar* _tmp2_;
+               GThreadPool* _tmp3_;
+               gchar* _tmp4_;
+               _tmp0_ = g_thread_pool_new (____lambda4__gfunc, NULL, 2, TRUE, &_inner_error0_);
+               pool = _tmp0_;
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       goto __catch0_g_error;
+               }
+               _tmp1_ = pool;
+               _tmp2_ = g_strdup ("foo");
+               g_thread_pool_push (_tmp1_, _tmp2_, &_inner_error0_);
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       _g_thread_pool_free0 (pool);
+                       goto __catch0_g_error;
+               }
+               _tmp3_ = pool;
+               _tmp4_ = g_strdup ("bar");
+               g_thread_pool_push (_tmp3_, _tmp4_, &_inner_error0_);
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       _g_thread_pool_free0 (pool);
+                       goto __catch0_g_error;
+               }
+               _g_thread_pool_free0 (pool);
+       }
+       goto __finally0;
+       __catch0_g_error:
+       {
+               g_clear_error (&_inner_error0_);
+               g_assert_not_reached ();
+       }
+       __finally0:
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, 
_inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _vala_assert (success, "success");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]